Repository: ajaxorg/ace Branch: master Commit: 7ce8db9fd6d5 Files: 1431 Total size: 9.3 MB Directory structure: gitextract_tcf14d4c/ ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── add-to-website.yml │ │ ├── bug-report.yml │ │ ├── config.yml │ │ ├── documentation.yml │ │ └── feature-request.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows/ │ ├── backwards-compatibility-commenter.yml │ ├── close-stale-issues.yml │ ├── issue-reprioritization.yml │ ├── link-comment.yml │ ├── nodejs.yml │ └── publish.yml ├── .gitignore ├── CHANGELOG.md ├── CNAME ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── Makefile.dryice.js ├── Readme.md ├── _config.yml ├── ace-internal.d.ts ├── ace-modes.d.ts ├── ace.d.ts ├── amplify.yml ├── build_support/ │ ├── editor.html │ └── mini_require.js ├── demo/ │ ├── autocompletion.html │ ├── autoresize.html │ ├── code_lens.html │ ├── csp.html │ ├── diff/ │ │ ├── examples/ │ │ │ ├── editor.16.js │ │ │ ├── editor.17.js │ │ │ └── editor.40.js │ │ └── index.html │ ├── emmet.html │ ├── i18n.html │ ├── inline_autocompletion.html │ ├── keyboard_shortcuts.html │ ├── kitchen-sink/ │ │ ├── demo.js │ │ ├── dev_util.js │ │ ├── doclist.js │ │ ├── docs/ │ │ │ ├── Dockerfile │ │ │ ├── Makefile │ │ │ ├── abap.abap │ │ │ ├── abc.abc │ │ │ ├── actionscript.as │ │ │ ├── ada.ada │ │ │ ├── alda.alda │ │ │ ├── apex.apex │ │ │ ├── aql.aql │ │ │ ├── asciidoc.asciidoc │ │ │ ├── asl.dsl │ │ │ ├── assembly_arm32.s │ │ │ ├── assembly_x86.asm │ │ │ ├── astro.astro │ │ │ ├── autohotkey.ahk │ │ │ ├── basic.bas │ │ │ ├── batchfile.bat │ │ │ ├── bibtex.bib │ │ │ ├── c9search.c9search_results │ │ │ ├── c_cpp.cpp │ │ │ ├── cirru.cirru │ │ │ ├── clojure.clj │ │ │ ├── clue.clue │ │ │ ├── cobol.CBL │ │ │ ├── coffee.coffee │ │ │ ├── coldfusion.cfm │ │ │ ├── crystal.cr │ │ │ ├── csharp.cs │ │ │ ├── csound_document.csd │ │ │ ├── csound_orchestra.orc │ │ │ ├── csound_score.sco │ │ │ ├── css.css │ │ │ ├── csv.csv │ │ │ ├── curly.curly │ │ │ ├── cuttlefish.conf │ │ │ ├── d.d │ │ │ ├── dart.dart │ │ │ ├── diff.diff │ │ │ ├── django.djt │ │ │ ├── dot.dot │ │ │ ├── drools.drl │ │ │ ├── edifact.edi │ │ │ ├── eiffel.e │ │ │ ├── ejs.ejs │ │ │ ├── elixir.ex │ │ │ ├── elm.elm │ │ │ ├── erlang.erl │ │ │ ├── flix.flix │ │ │ ├── forth.frt │ │ │ ├── fortran.f │ │ │ ├── fsharp.fsi │ │ │ ├── fsl.fsl │ │ │ ├── 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 │ │ │ ├── haxe.hx │ │ │ ├── hjson.hjson │ │ │ ├── htaccess │ │ │ ├── html.html │ │ │ ├── html_elixir.eex │ │ │ ├── html_ruby.erb │ │ │ ├── ini.ini │ │ │ ├── io.io │ │ │ ├── ion.ion │ │ │ ├── jack.jack │ │ │ ├── jade.jade │ │ │ ├── java.java │ │ │ ├── javascript.js │ │ │ ├── jexl.jexl │ │ │ ├── json.json │ │ │ ├── json5.json5 │ │ │ ├── jsoniq.jq │ │ │ ├── jsp.jsp │ │ │ ├── jssm.jssm │ │ │ ├── jsx.jsx │ │ │ ├── julia.jl │ │ │ ├── kotlin.kt │ │ │ ├── latex.tex │ │ │ ├── latte.latte │ │ │ ├── less.less │ │ │ ├── liquid.liquid │ │ │ ├── lisp.lisp │ │ │ ├── livescript.ls │ │ │ ├── logiql.logic │ │ │ ├── logtalk.lgt │ │ │ ├── lsl.lsl │ │ │ ├── lua.lua │ │ │ ├── luapage.lp │ │ │ ├── lucene.lucene │ │ │ ├── markdown.md │ │ │ ├── mask.mask │ │ │ ├── matlab.matlab │ │ │ ├── maze.mz │ │ │ ├── mediawiki.wiki │ │ │ ├── mel.mel │ │ │ ├── mips.s │ │ │ ├── mixal.mixal │ │ │ ├── mushcode.mc │ │ │ ├── mysql.mysql │ │ │ ├── nasal.nas │ │ │ ├── nginx.nginx │ │ │ ├── nim.nim │ │ │ ├── nix.nix │ │ │ ├── nsis.nsi │ │ │ ├── nunjucks.nunjucks │ │ │ ├── objectivec.m │ │ │ ├── ocaml.ml │ │ │ ├── odin.odin │ │ │ ├── partiql.partiql │ │ │ ├── pascal.pas │ │ │ ├── perl.pl │ │ │ ├── pgsql.pgsql │ │ │ ├── php.php │ │ │ ├── php_laravel_blade.blade.php │ │ │ ├── pig.pig │ │ │ ├── plaintext.txt │ │ │ ├── plsql.plsql │ │ │ ├── powershell.ps1 │ │ │ ├── praat.praat │ │ │ ├── prisma.prisma │ │ │ ├── prolog.plg │ │ │ ├── properties.properties │ │ │ ├── protobuf.proto │ │ │ ├── prql.prql │ │ │ ├── puppet.epp │ │ │ ├── python.py │ │ │ ├── qml.qml │ │ │ ├── r.r │ │ │ ├── raku.raku │ │ │ ├── razor.cshtml │ │ │ ├── rdoc.Rd │ │ │ ├── red.red │ │ │ ├── rhtml.Rhtml │ │ │ ├── robot.robot │ │ │ ├── rst.rst │ │ │ ├── ruby.rb │ │ │ ├── rust.rs │ │ │ ├── sac.sac │ │ │ ├── sass.sass │ │ │ ├── scad.scad │ │ │ ├── scala.scala │ │ │ ├── scheme.scm │ │ │ ├── scrypt.scrypt │ │ │ ├── scss.scss │ │ │ ├── sh.sh │ │ │ ├── sjs.sjs │ │ │ ├── slim.slim │ │ │ ├── smarty.smarty │ │ │ ├── smithy.smithy │ │ │ ├── snippets.snippets │ │ │ ├── soy_template.soy │ │ │ ├── space.space │ │ │ ├── sparql.rq │ │ │ ├── sql.sql │ │ │ ├── sqlserver.sqlserver │ │ │ ├── stylus.styl │ │ │ ├── swift.swift │ │ │ ├── tcl.tcl │ │ │ ├── terraform.tf │ │ │ ├── tex.tex │ │ │ ├── text.txt │ │ │ ├── textile.textile │ │ │ ├── toml.toml │ │ │ ├── tsv.tsv │ │ │ ├── tsx.tsx │ │ │ ├── turtle.ttl │ │ │ ├── twig.twig │ │ │ ├── typescript.ts │ │ │ ├── vala.vala │ │ │ ├── vbscript.vbs │ │ │ ├── velocity.vm │ │ │ ├── verilog.v │ │ │ ├── vhdl.vhd │ │ │ ├── visualforce.vfp │ │ │ ├── vue.vue │ │ │ ├── wollok.wlk │ │ │ ├── xml.xml │ │ │ ├── xquery.xq │ │ │ ├── yaml.yaml │ │ │ ├── zeek.zeek │ │ │ └── zig.zig │ │ ├── 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 │ ├── shadow-dom.html │ ├── show_own_source.js │ ├── static-highlighter/ │ │ ├── client.html │ │ └── server.js │ ├── static-highlighter.html │ ├── statusbar.html │ ├── test_ace_builds/ │ │ ├── index.ts │ │ ├── package.json │ │ └── tsconfig.json │ ├── test_package/ │ │ ├── index.ts │ │ ├── package.json │ │ └── tsconfig.json │ ├── toolbar.html │ ├── transform.html │ ├── webpack/ │ │ ├── demo.js │ │ ├── demo.ts │ │ ├── index.html │ │ ├── package.json │ │ └── webpack.config.js │ └── xml.xml ├── doc/ │ ├── README.md │ ├── additionalObjs.json │ ├── build.js │ ├── index.md │ ├── package.json │ ├── site/ │ │ ├── css/ │ │ │ └── font-awesome.css │ │ ├── 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 ├── package.json ├── src/ │ ├── ace.js │ ├── ace_test.js │ ├── anchor.js │ ├── anchor_test.js │ ├── apply_delta.js │ ├── autocomplete/ │ │ ├── inline.js │ │ ├── inline_screenreader.js │ │ ├── inline_test.js │ │ ├── popup.js │ │ ├── popup_test.js │ │ ├── text_completer.js │ │ └── util.js │ ├── autocomplete.js │ ├── autocomplete_test.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.js │ ├── 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_commands_test.js │ ├── editor_highlight_selected_word_test.js │ ├── editor_navigation_test.js │ ├── editor_options_test.js │ ├── editor_text_edit_test.js │ ├── ext/ │ │ ├── beautify.js │ │ ├── beautify_test.js │ │ ├── code_lens.js │ │ ├── code_lens_test.js │ │ ├── command_bar.js │ │ ├── command_bar_test.js │ │ ├── diff/ │ │ │ ├── base_diff_view.js │ │ │ ├── diff_test.js │ │ │ ├── gutter_decorator.js │ │ │ ├── inline_diff_view.js │ │ │ ├── providers/ │ │ │ │ └── default.js │ │ │ ├── scroll_diff_decorator.js │ │ │ ├── split_diff_view.js │ │ │ └── styles-css.js │ │ ├── diff.js │ │ ├── diff_test.js │ │ ├── elastic_tabstops_lite.js │ │ ├── emmet.js │ │ ├── emmet_test.js │ │ ├── error_marker.js │ │ ├── error_marker_test.js │ │ ├── hardwrap.js │ │ ├── hardwrap_test.js │ │ ├── inline_autocomplete.js │ │ ├── inline_autocomplete_test.js │ │ ├── keybinding_menu.js │ │ ├── language_tools.js │ │ ├── linking.js │ │ ├── menu_tools/ │ │ │ ├── get_editor_keyboard_shortcuts.js │ │ │ ├── overlay_page.js │ │ │ └── settings_menu.css.js │ │ ├── modelist.js │ │ ├── options.js │ │ ├── prompt.js │ │ ├── rtl.js │ │ ├── searchbox-css.js │ │ ├── searchbox.js │ │ ├── settings_menu.js │ │ ├── simple_tokenizer.js │ │ ├── simple_tokenizer_test.js │ │ ├── spellcheck.js │ │ ├── split.js │ │ ├── static-css.js │ │ ├── static_highlight.js │ │ ├── static_highlight_test.js │ │ ├── statusbar.js │ │ ├── textarea.js │ │ ├── themelist.js │ │ ├── whitespace.js │ │ ├── whitespace_test.js │ │ ├── whitespaces_in_selection.js │ │ └── whitespaces_in_selection_test.js │ ├── incremental_search.js │ ├── incremental_search_test.js │ ├── keyboard/ │ │ ├── emacs.js │ │ ├── emacs_test.js │ │ ├── gutter_handler.js │ │ ├── gutter_handler_test.js │ │ ├── hash_handler.js │ │ ├── keybinding.js │ │ ├── keybinding_test.js │ │ ├── sublime.js │ │ ├── sublime_test.js │ │ ├── textarea.js │ │ ├── textinput.js │ │ ├── textinput_test.js │ │ ├── vim.js │ │ ├── vim_ace_test.js │ │ ├── vim_test.js │ │ └── vscode.js │ ├── layer/ │ │ ├── cursor.js │ │ ├── decorators.js │ │ ├── font_metrics.js │ │ ├── gutter.js │ │ ├── gutter_test.js │ │ ├── lines.js │ │ ├── marker.js │ │ ├── text.js │ │ ├── text_markers.js │ │ ├── text_markers_test.js │ │ ├── text_test.js │ │ └── text_util.js │ ├── lib/ │ │ ├── app_config.js │ │ ├── bidiutil.js │ │ ├── deep_copy.js │ │ ├── default_english_messages.js │ │ ├── dom.js │ │ ├── es6-shim.js │ │ ├── event.js │ │ ├── event_emitter.js │ │ ├── event_emitter_test.js │ │ ├── fixoldbrowsers.js │ │ ├── keys.js │ │ ├── lang.js │ │ ├── net.js │ │ ├── oop.js │ │ ├── report_error.js │ │ ├── scroll.js │ │ └── useragent.js │ ├── line_widgets.js │ ├── marker_group.js │ ├── marker_group_test.js │ ├── mode/ │ │ ├── _test/ │ │ │ ├── Readme.md │ │ │ ├── highlight_rules_test.js │ │ │ ├── text_alda.txt │ │ │ ├── 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_prisma.txt │ │ │ ├── text_razor.txt │ │ │ ├── text_ruby.txt │ │ │ ├── text_rust.txt │ │ │ ├── text_verilog.txt │ │ │ ├── text_wollok.txt │ │ │ ├── text_xml.txt │ │ │ ├── text_yaml.txt │ │ │ ├── tokens_abap.json │ │ │ ├── tokens_abc.json │ │ │ ├── tokens_actionscript.json │ │ │ ├── tokens_ada.json │ │ │ ├── tokens_alda.json │ │ │ ├── tokens_apex.json │ │ │ ├── tokens_aql.json │ │ │ ├── tokens_asciidoc.json │ │ │ ├── tokens_asl.json │ │ │ ├── tokens_assembly_x86.json │ │ │ ├── tokens_autohotkey.json │ │ │ ├── tokens_basic.json │ │ │ ├── tokens_batchfile.json │ │ │ ├── tokens_bibtex.json │ │ │ ├── tokens_c9search.json │ │ │ ├── tokens_c_cpp.json │ │ │ ├── tokens_cirru.json │ │ │ ├── tokens_clojure.json │ │ │ ├── tokens_cobol.json │ │ │ ├── tokens_coffee.json │ │ │ ├── tokens_coldfusion.json │ │ │ ├── tokens_crystal.json │ │ │ ├── tokens_csharp.json │ │ │ ├── tokens_csound_document.json │ │ │ ├── tokens_csound_orchestra.json │ │ │ ├── tokens_csound_score.json │ │ │ ├── tokens_csp.json │ │ │ ├── tokens_css.json │ │ │ ├── tokens_csv.json │ │ │ ├── tokens_curly.json │ │ │ ├── tokens_d.json │ │ │ ├── tokens_dart.json │ │ │ ├── tokens_diff.json │ │ │ ├── tokens_django.json │ │ │ ├── tokens_dot.json │ │ │ ├── tokens_drools.json │ │ │ ├── tokens_edifact.json │ │ │ ├── tokens_eiffel.json │ │ │ ├── tokens_ejs.json │ │ │ ├── tokens_elixir.json │ │ │ ├── tokens_elm.json │ │ │ ├── tokens_erlang.json │ │ │ ├── tokens_flix.json │ │ │ ├── tokens_forth.json │ │ │ ├── tokens_fortran.json │ │ │ ├── tokens_fsharp.json │ │ │ ├── tokens_fsl.json │ │ │ ├── tokens_ftl.json │ │ │ ├── tokens_gcode.json │ │ │ ├── tokens_gherkin.json │ │ │ ├── tokens_gitignore.json │ │ │ ├── tokens_glsl.json │ │ │ ├── tokens_gobstones.json │ │ │ ├── tokens_golang.json │ │ │ ├── tokens_graphqlschema.json │ │ │ ├── tokens_groovy.json │ │ │ ├── tokens_haml.json │ │ │ ├── tokens_handlebars.json │ │ │ ├── tokens_haskell.json │ │ │ ├── tokens_haskell_cabal.json │ │ │ ├── tokens_haxe.json │ │ │ ├── tokens_hjson.json │ │ │ ├── tokens_html.json │ │ │ ├── tokens_html_elixir.json │ │ │ ├── tokens_html_ruby.json │ │ │ ├── tokens_ini.json │ │ │ ├── tokens_io.json │ │ │ ├── tokens_ion.json │ │ │ ├── tokens_jack.json │ │ │ ├── tokens_jade.json │ │ │ ├── tokens_java.json │ │ │ ├── tokens_javascript.json │ │ │ ├── tokens_jexl.json │ │ │ ├── tokens_json.json │ │ │ ├── tokens_json5.json │ │ │ ├── tokens_jsp.json │ │ │ ├── tokens_jssm.json │ │ │ ├── tokens_jsx.json │ │ │ ├── tokens_julia.json │ │ │ ├── tokens_kotlin.json │ │ │ ├── tokens_latex.json │ │ │ ├── tokens_latte.json │ │ │ ├── tokens_less.json │ │ │ ├── tokens_liquid.json │ │ │ ├── tokens_lisp.json │ │ │ ├── tokens_livescript.json │ │ │ ├── tokens_logiql.json │ │ │ ├── tokens_logtalk.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_mediawiki.json │ │ │ ├── tokens_mel.json │ │ │ ├── tokens_mips.json │ │ │ ├── tokens_mixal.json │ │ │ ├── tokens_mushcode.json │ │ │ ├── tokens_mysql.json │ │ │ ├── tokens_nasal.json │ │ │ ├── tokens_nginx.json │ │ │ ├── tokens_nim.json │ │ │ ├── tokens_nix.json │ │ │ ├── tokens_nsis.json │ │ │ ├── tokens_nunjucks.json │ │ │ ├── tokens_objectivec.json │ │ │ ├── tokens_ocaml.json │ │ │ ├── tokens_odin.json │ │ │ ├── tokens_partiql.json │ │ │ ├── tokens_pascal.json │ │ │ ├── tokens_perl.json │ │ │ ├── tokens_pgsql.json │ │ │ ├── tokens_php.json │ │ │ ├── tokens_php_laravel_blade.json │ │ │ ├── tokens_pig.json │ │ │ ├── tokens_plsql.json │ │ │ ├── tokens_powershell.json │ │ │ ├── tokens_praat.json │ │ │ ├── tokens_prisma.json │ │ │ ├── tokens_prolog.json │ │ │ ├── tokens_properties.json │ │ │ ├── tokens_protobuf.json │ │ │ ├── tokens_puppet.json │ │ │ ├── tokens_python.json │ │ │ ├── tokens_qml.json │ │ │ ├── tokens_r.json │ │ │ ├── tokens_raku.json │ │ │ ├── tokens_razor.json │ │ │ ├── tokens_rdoc.json │ │ │ ├── tokens_red.json │ │ │ ├── tokens_rhtml.json │ │ │ ├── tokens_robot.json │ │ │ ├── tokens_rst.json │ │ │ ├── tokens_ruby.json │ │ │ ├── tokens_rust.json │ │ │ ├── tokens_sac.json │ │ │ ├── tokens_sass.json │ │ │ ├── tokens_scad.json │ │ │ ├── tokens_scala.json │ │ │ ├── tokens_scheme.json │ │ │ ├── tokens_scrypt.json │ │ │ ├── tokens_scss.json │ │ │ ├── tokens_sh.json │ │ │ ├── tokens_sjs.json │ │ │ ├── tokens_slim.json │ │ │ ├── tokens_smarty.json │ │ │ ├── tokens_smithy.json │ │ │ ├── tokens_snippets.json │ │ │ ├── tokens_soy_template.json │ │ │ ├── tokens_space.json │ │ │ ├── tokens_sparql.json │ │ │ ├── tokens_sql.json │ │ │ ├── tokens_sqlserver.json │ │ │ ├── tokens_stylus.json │ │ │ ├── tokens_svg.json │ │ │ ├── tokens_swift.json │ │ │ ├── tokens_tcl.json │ │ │ ├── tokens_terraform.json │ │ │ ├── tokens_tex.json │ │ │ ├── tokens_text.json │ │ │ ├── tokens_textile.json │ │ │ ├── tokens_toml.json │ │ │ ├── tokens_tsv.json │ │ │ ├── tokens_tsx.json │ │ │ ├── tokens_turtle.json │ │ │ ├── tokens_twig.json │ │ │ ├── tokens_typescript.json │ │ │ ├── tokens_vala.json │ │ │ ├── tokens_vbscript.json │ │ │ ├── tokens_velocity.json │ │ │ ├── tokens_verilog.json │ │ │ ├── tokens_vhdl.json │ │ │ ├── tokens_visualforce.json │ │ │ ├── tokens_vue.json │ │ │ ├── tokens_wollok.json │ │ │ ├── tokens_xml.json │ │ │ ├── tokens_yaml.json │ │ │ └── tokens_zeek.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 │ │ ├── ada_test.js │ │ ├── alda.js │ │ ├── alda_highlight_rules.js │ │ ├── apache_conf.js │ │ ├── apache_conf_highlight_rules.js │ │ ├── apex.js │ │ ├── apex_highlight_rules.js │ │ ├── applescript.js │ │ ├── applescript_highlight_rules.js │ │ ├── aql.js │ │ ├── aql_highlight_rules.js │ │ ├── asciidoc.js │ │ ├── asciidoc_highlight_rules.js │ │ ├── asl.js │ │ ├── asl_highlight_rules.js │ │ ├── assembly_arm32.js │ │ ├── assembly_arm32_highlight_rules.js │ │ ├── assembly_x86.js │ │ ├── assembly_x86_highlight_rules.js │ │ ├── astro.js │ │ ├── astro_highlight_rules.js │ │ ├── autohotkey.js │ │ ├── autohotkey_highlight_rules.js │ │ ├── basic.js │ │ ├── basic_highlight_rules.js │ │ ├── batchfile.js │ │ ├── batchfile_highlight_rules.js │ │ ├── behaviour/ │ │ │ ├── behaviour_test.js │ │ │ ├── css.js │ │ │ ├── cstyle.js │ │ │ ├── html.js │ │ │ ├── javascript.js │ │ │ ├── liquid.js │ │ │ ├── xml.js │ │ │ └── xquery.js │ │ ├── behaviour.js │ │ ├── bibtex.js │ │ ├── bibtex_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 │ │ ├── clue.js │ │ ├── clue_highlight_rules.js │ │ ├── cobol.js │ │ ├── cobol_highlight_rules.js │ │ ├── coffee.js │ │ ├── coffee_highlight_rules.js │ │ ├── coldfusion.js │ │ ├── coldfusion_highlight_rules.js │ │ ├── coldfusion_test.js │ │ ├── crystal.js │ │ ├── crystal_highlight_rules.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 │ │ ├── csp.js │ │ ├── csp_highlight_rules.js │ │ ├── css.js │ │ ├── css_completions.js │ │ ├── css_highlight_rules.js │ │ ├── css_test.js │ │ ├── csv.js │ │ ├── csv_highlight_rules.js │ │ ├── curly.js │ │ ├── curly_highlight_rules.js │ │ ├── cuttlefish.js │ │ ├── cuttlefish_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 │ │ ├── edifact.js │ │ ├── edifact_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 │ │ ├── flix.js │ │ ├── flix_highlight_rules.js │ │ ├── folding/ │ │ │ ├── asciidoc.js │ │ │ ├── basic.js │ │ │ ├── basic_test.js │ │ │ ├── c9search.js │ │ │ ├── coffee.js │ │ │ ├── coffee_test.js │ │ │ ├── csharp.js │ │ │ ├── cstyle.js │ │ │ ├── cstyle_test.js │ │ │ ├── diff.js │ │ │ ├── drools.js │ │ │ ├── drools_test.js │ │ │ ├── fold_mode.js │ │ │ ├── fold_mode_test.js │ │ │ ├── haskell_cabal.js │ │ │ ├── html.js │ │ │ ├── html_test.js │ │ │ ├── ini.js │ │ │ ├── java.js │ │ │ ├── javascript.js │ │ │ ├── javascript_test.js │ │ │ ├── latex.js │ │ │ ├── latex_test.js │ │ │ ├── lua.js │ │ │ ├── lua_test.js │ │ │ ├── markdown.js │ │ │ ├── mixed.js │ │ │ ├── nunjucks.js │ │ │ ├── nunjucks_test.js │ │ │ ├── php.js │ │ │ ├── php_test.js │ │ │ ├── pythonic.js │ │ │ ├── pythonic_test.js │ │ │ ├── ruby.js │ │ │ ├── ruby_test.js │ │ │ ├── sql.js │ │ │ ├── sqlserver.js │ │ │ ├── vbscript.js │ │ │ ├── vbscript_test.js │ │ │ ├── velocity.js │ │ │ ├── xml.js │ │ │ ├── xml_test.js │ │ │ ├── yaml.js │ │ │ └── yaml_test.js │ │ ├── forth.js │ │ ├── forth_highlight_rules.js │ │ ├── fortran.js │ │ ├── fortran_highlight_rules.js │ │ ├── fsharp.js │ │ ├── fsharp_highlight_rules.js │ │ ├── fsl.js │ │ ├── fsl_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.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 │ │ ├── ini.js │ │ ├── ini_highlight_rules.js │ │ ├── io.js │ │ ├── io_highlight_rules.js │ │ ├── ion.js │ │ ├── ion_highlight_rules.js │ │ ├── jack.js │ │ ├── jack_highlight_rules.js │ │ ├── jade.js │ │ ├── jade_highlight_rules.js │ │ ├── java.js │ │ ├── java_highlight_rules.js │ │ ├── javascript.js │ │ ├── javascript_highlight_rules.js │ │ ├── javascript_test.js │ │ ├── jexl.js │ │ ├── jexl_highlight_rules.js │ │ ├── js_regex_highlight_rules.js │ │ ├── jsdoc_comment_highlight_rules.js │ │ ├── json.js │ │ ├── json5.js │ │ ├── json5_highlight_rules.js │ │ ├── json_highlight_rules.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 │ │ ├── latte.js │ │ ├── latte_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 │ │ ├── logtalk.js │ │ ├── logtalk_highlight_rules.js │ │ ├── lsl.js │ │ ├── lsl_highlight_rules.js │ │ ├── lua.js │ │ ├── lua_highlight_rules.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 │ │ ├── mediawiki.js │ │ ├── mediawiki_highlight_rules.js │ │ ├── mel.js │ │ ├── mel_highlight_rules.js │ │ ├── mips.js │ │ ├── mips_highlight_rules.js │ │ ├── mixal.js │ │ ├── mixal_highlight_rules.js │ │ ├── mushcode.js │ │ ├── mushcode_highlight_rules.js │ │ ├── mysql.js │ │ ├── mysql_highlight_rules.js │ │ ├── nasal.js │ │ ├── nasal_highlight_rules.js │ │ ├── nginx.js │ │ ├── nginx_highlight_rules.js │ │ ├── nim.js │ │ ├── nim_highlight_rules.js │ │ ├── nix.js │ │ ├── nix_highlight_rules.js │ │ ├── nsis.js │ │ ├── nsis_highlight_rules.js │ │ ├── nunjucks.js │ │ ├── nunjucks_highlight_rules.js │ │ ├── objectivec.js │ │ ├── objectivec_highlight_rules.js │ │ ├── ocaml.js │ │ ├── ocaml_highlight_rules.js │ │ ├── odin.js │ │ ├── odin_highlight_rules.js │ │ ├── odin_test.js │ │ ├── partiql.js │ │ ├── partiql_highlight_rules.js │ │ ├── pascal.js │ │ ├── pascal_highlight_rules.js │ │ ├── perl.js │ │ ├── perl_highlight_rules.js │ │ ├── pgsql.js │ │ ├── pgsql_highlight_rules.js │ │ ├── php.js │ │ ├── php_completions.js │ │ ├── php_highlight_rules.js │ │ ├── php_laravel_blade.js │ │ ├── php_laravel_blade_highlight_rules.js │ │ ├── php_test.js │ │ ├── pig.js │ │ ├── pig_highlight_rules.js │ │ ├── plain_text.js │ │ ├── plain_text_test.js │ │ ├── plsql.js │ │ ├── plsql_highlight_rules.js │ │ ├── powershell.js │ │ ├── powershell_highlight_rules.js │ │ ├── praat.js │ │ ├── praat_highlight_rules.js │ │ ├── prisma.js │ │ ├── prisma_highlight_rules.js │ │ ├── prolog.js │ │ ├── prolog_highlight_rules.js │ │ ├── properties.js │ │ ├── properties_highlight_rules.js │ │ ├── protobuf.js │ │ ├── protobuf_highlight_rules.js │ │ ├── prql.js │ │ ├── prql_highlight_rules.js │ │ ├── puppet.js │ │ ├── puppet_highlight_rules.js │ │ ├── python.js │ │ ├── python_highlight_rules.js │ │ ├── python_test.js │ │ ├── qml.js │ │ ├── qml_highlight_rules.js │ │ ├── r.js │ │ ├── r_highlight_rules.js │ │ ├── raku.js │ │ ├── raku_highlight_rules.js │ │ ├── razor.js │ │ ├── razor_completions.js │ │ ├── razor_highlight_rules.js │ │ ├── rdoc.js │ │ ├── rdoc_highlight_rules.js │ │ ├── red.js │ │ ├── red_highlight_rules.js │ │ ├── redshift.js │ │ ├── redshift_highlight_rules.js │ │ ├── rhtml.js │ │ ├── rhtml_highlight_rules.js │ │ ├── robot.js │ │ ├── robot_highlight_rules.js │ │ ├── rst.js │ │ ├── rst_highlight_rules.js │ │ ├── ruby.js │ │ ├── ruby_highlight_rules.js │ │ ├── ruby_test.js │ │ ├── rust.js │ │ ├── rust_highlight_rules.js │ │ ├── sac.js │ │ ├── sac_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 │ │ ├── scrypt.js │ │ ├── scrypt_highlight_rules.js │ │ ├── scss.js │ │ ├── scss_highlight_rules.js │ │ ├── sh.js │ │ ├── sh_highlight_rules.js │ │ ├── sjs.js │ │ ├── sjs_highlight_rules.js │ │ ├── slim.js │ │ ├── slim_highlight_rules.js │ │ ├── smarty.js │ │ ├── smarty_highlight_rules.js │ │ ├── smithy.js │ │ ├── smithy_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 │ │ ├── terraform.js │ │ ├── terraform_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 │ │ ├── tsv.js │ │ ├── tsv_highlight_rules.js │ │ ├── tsx.js │ │ ├── tsx_highlight_rules.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 │ │ ├── vbscript_test.js │ │ ├── velocity.js │ │ ├── velocity_highlight_rules.js │ │ ├── verilog.js │ │ ├── verilog_highlight_rules.js │ │ ├── vhdl.js │ │ ├── vhdl_highlight_rules.js │ │ ├── visualforce.js │ │ ├── visualforce_highlight_rules.js │ │ ├── vue.js │ │ ├── vue_highlight_rules.js │ │ ├── wollok.js │ │ ├── wollok_highlight_rules.js │ │ ├── xml.js │ │ ├── xml_highlight_rules.js │ │ ├── xml_test.js │ │ ├── yaml.js │ │ ├── yaml_highlight_rules.js │ │ ├── zeek.js │ │ ├── zeek_highlight_rules.js │ │ ├── zig.js │ │ └── zig_highlight_rules.js │ ├── mouse/ │ │ ├── default_gutter_handler.js │ │ ├── default_gutter_handler_test.js │ │ ├── default_handlers.js │ │ ├── dragdrop_handler.js │ │ ├── fold_handler.js │ │ ├── mouse_event.js │ │ ├── mouse_handler.js │ │ ├── mouse_handler_test.js │ │ ├── multi_select_handler.js │ │ └── touch_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 │ ├── scrollbar.js │ ├── scrollbar_custom.js │ ├── scrollbar_test.js │ ├── search.js │ ├── search_highlight.js │ ├── search_test.js │ ├── selection.js │ ├── selection_test.js │ ├── snippets/ │ │ ├── abc.js │ │ ├── abc.snippets.js │ │ ├── actionscript.js │ │ ├── actionscript.snippets.js │ │ ├── c_cpp.js │ │ ├── c_cpp.snippets.js │ │ ├── clojure.js │ │ ├── clojure.snippets.js │ │ ├── coffee.js │ │ ├── coffee.snippets.js │ │ ├── csound_document.js │ │ ├── csound_document.snippets.js │ │ ├── csound_orchestra.js │ │ ├── csound_orchestra.snippets.js │ │ ├── css.js │ │ ├── css.snippets.js │ │ ├── dart.js │ │ ├── dart.snippets.js │ │ ├── diff.js │ │ ├── diff.snippets.js │ │ ├── django.js │ │ ├── django.snippets.js │ │ ├── drools.js │ │ ├── drools.snippets.js │ │ ├── edifact.js │ │ ├── edifact.snippets.js │ │ ├── erlang.js │ │ ├── erlang.snippets.js │ │ ├── fsl.js │ │ ├── fsl.snippets.js │ │ ├── gobstones.js │ │ ├── gobstones.snippets.js │ │ ├── graphqlschema.js │ │ ├── graphqlschema.snippets.js │ │ ├── haml.js │ │ ├── haml.snippets.js │ │ ├── haskell.js │ │ ├── haskell.snippets.js │ │ ├── html.js │ │ ├── html.snippets.js │ │ ├── io.js │ │ ├── java.js │ │ ├── java.snippets.js │ │ ├── javascript.js │ │ ├── javascript.snippets.js │ │ ├── jsp.js │ │ ├── jsp.snippets.js │ │ ├── liquid.js │ │ ├── liquid.snippets.js │ │ ├── lsl.js │ │ ├── lsl.snippets.js │ │ ├── lua.js │ │ ├── lua.snippets.js │ │ ├── makefile.js │ │ ├── makefile.snippets.js │ │ ├── markdown.js │ │ ├── markdown.snippets.js │ │ ├── maze.js │ │ ├── maze.snippets.js │ │ ├── perl.js │ │ ├── perl.snippets.js │ │ ├── php.js │ │ ├── php.snippets.js │ │ ├── python.js │ │ ├── python.snippets.js │ │ ├── r.js │ │ ├── r.snippets.js │ │ ├── razor.js │ │ ├── razor.snippets.js │ │ ├── robot.js │ │ ├── robot.snippets.js │ │ ├── rst.js │ │ ├── rst.snippets.js │ │ ├── ruby.js │ │ ├── ruby.snippets.js │ │ ├── sh.js │ │ ├── sh.snippets.js │ │ ├── snippets.js │ │ ├── snippets.snippets.js │ │ ├── sql.js │ │ ├── sql.snippets.js │ │ ├── sqlserver.js │ │ ├── sqlserver.snippets.js │ │ ├── tcl.js │ │ ├── tcl.snippets.js │ │ ├── tex.js │ │ ├── tex.snippets.js │ │ ├── textile.js │ │ ├── textile.snippets.js │ │ ├── vala.js │ │ ├── velocity.js │ │ ├── velocity.snippets.js │ │ ├── wollok.js │ │ └── wollok.snippets.js │ ├── snippets.js │ ├── snippets_test.js │ ├── split.js │ ├── test/ │ │ ├── all.js │ │ ├── all_browser.js │ │ ├── assertions.js │ │ ├── asyncjs/ │ │ │ └── assert.js │ │ ├── benchmark.js │ │ ├── mockdom.js │ │ ├── mockdom_test.js │ │ ├── mockrenderer.js │ │ ├── run.js │ │ ├── test_list.js │ │ ├── tests.html │ │ ├── update_test_list.js │ │ └── user.js │ ├── theme/ │ │ ├── ambiance-css.js │ │ ├── ambiance.js │ │ ├── chaos-css.js │ │ ├── chaos.js │ │ ├── chrome-css.js │ │ ├── chrome.js │ │ ├── cloud9_day-css.js │ │ ├── cloud9_day.js │ │ ├── cloud9_night-css.js │ │ ├── cloud9_night.js │ │ ├── cloud9_night_low_color-css.js │ │ ├── cloud9_night_low_color.js │ │ ├── cloud_editor-css.js │ │ ├── cloud_editor.js │ │ ├── cloud_editor_dark-css.js │ │ ├── cloud_editor_dark.js │ │ ├── clouds-css.js │ │ ├── clouds.js │ │ ├── clouds_midnight-css.js │ │ ├── clouds_midnight.js │ │ ├── cobalt-css.js │ │ ├── cobalt.js │ │ ├── crimson_editor-css.js │ │ ├── crimson_editor.js │ │ ├── dawn-css.js │ │ ├── dawn.js │ │ ├── dracula-css.js │ │ ├── dracula.js │ │ ├── dreamweaver-css.js │ │ ├── dreamweaver.js │ │ ├── eclipse-css.js │ │ ├── eclipse.js │ │ ├── github-css.js │ │ ├── github.js │ │ ├── github_dark-css.js │ │ ├── github_dark.js │ │ ├── github_light_default-css.js │ │ ├── github_light_default.js │ │ ├── gob-css.js │ │ ├── gob.js │ │ ├── gruvbox-css.js │ │ ├── gruvbox.js │ │ ├── gruvbox_dark_hard-css.js │ │ ├── gruvbox_dark_hard.js │ │ ├── gruvbox_light_hard-css.js │ │ ├── gruvbox_light_hard.js │ │ ├── idle_fingers-css.js │ │ ├── idle_fingers.js │ │ ├── iplastic-css.js │ │ ├── iplastic.js │ │ ├── katzenmilch-css.js │ │ ├── katzenmilch.js │ │ ├── kr_theme-css.js │ │ ├── kr_theme.js │ │ ├── kuroir-css.js │ │ ├── kuroir.js │ │ ├── merbivore-css.js │ │ ├── merbivore.js │ │ ├── merbivore_soft-css.js │ │ ├── merbivore_soft.js │ │ ├── mono_industrial-css.js │ │ ├── mono_industrial.js │ │ ├── monokai-css.js │ │ ├── monokai.js │ │ ├── nord_dark-css.js │ │ ├── nord_dark.js │ │ ├── one_dark-css.js │ │ ├── one_dark.js │ │ ├── pastel_on_dark-css.js │ │ ├── pastel_on_dark.js │ │ ├── solarized_dark-css.js │ │ ├── solarized_dark.js │ │ ├── solarized_light-css.js │ │ ├── solarized_light.js │ │ ├── sqlserver-css.js │ │ ├── sqlserver.js │ │ ├── terminal-css.js │ │ ├── terminal.js │ │ ├── textmate-css.js │ │ ├── textmate.js │ │ ├── tomorrow-css.js │ │ ├── tomorrow.js │ │ ├── tomorrow_night-css.js │ │ ├── tomorrow_night.js │ │ ├── tomorrow_night_blue-css.js │ │ ├── tomorrow_night_blue.js │ │ ├── tomorrow_night_bright-css.js │ │ ├── tomorrow_night_bright.js │ │ ├── tomorrow_night_eighties-css.js │ │ ├── tomorrow_night_eighties.js │ │ ├── twilight-css.js │ │ ├── twilight.js │ │ ├── vibrant_ink-css.js │ │ ├── vibrant_ink.js │ │ ├── xcode-css.js │ │ └── xcode.js │ ├── token_iterator.js │ ├── token_iterator_test.js │ ├── tokenizer.js │ ├── tokenizer_dev.js │ ├── tokenizer_test.js │ ├── tooltip.js │ ├── tooltip_test.js │ ├── undomanager.js │ ├── undomanager_test.js │ ├── unicode.js │ ├── virtual_renderer.js │ ├── virtual_renderer_test.js │ └── worker/ │ └── worker_client.js ├── static.js ├── tool/ │ ├── Readme.md │ ├── ace_declaration_generator.js │ ├── add_mode.js │ ├── esm_resolver_generator.js │ ├── lib.js │ ├── mode_creator.html │ ├── mode_creator.js │ ├── modes-declaration-generator.js │ ├── package.json │ ├── perf-test.html │ ├── regexp_to_keywords.js │ ├── regexp_tokenizer.js │ ├── regexp_tokenizer_test.js │ ├── release-api-docs.sh │ ├── release.sh │ ├── templates/ │ │ ├── dummy.JSON-tmLanguage │ │ ├── highlight_rules.js │ │ ├── mode.js │ │ ├── snippets.js │ │ ├── theme.css │ │ └── theme.js │ ├── test-ace-builds-package.sh │ ├── test-npm-package.sh │ ├── 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 │ │ ├── gruvboxDarkHard.tmTheme │ │ ├── gruvboxLightHard.tmTheme │ │ ├── iPlastic.tmTheme │ │ ├── idleFingers.tmTheme │ │ ├── krTheme.tmTheme │ │ └── monoindustrial.tmTheme │ ├── unicode.js │ ├── update_deps.js │ └── wrap_keyword_regexp.js ├── translations/ │ ├── Readme.md │ ├── am.json │ ├── es.json │ └── ru.json ├── tsconfig.json ├── types/ │ ├── ace-ext.d.ts │ ├── ace-lib.d.ts │ ├── ace-modules.d.ts │ ├── ace-snippets.d.ts │ └── ace-theme.d.ts └── version.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/ISSUE_TEMPLATE/add-to-website.yml ================================================ --- name: "🌐 Add a project to the list of project using Ace on its website." description: Add a project to the list of projects using Ace, displayed on the website. title: "Add project (project name) to the list of projects using Ace on its website" labels: [website, needs-triage] assignees: [] body: - type: markdown attributes: value: | The fastest way to get your project to be displayed on the website is to create a PR. Examples: https://github.com/ajaxorg/ace/pull/5014, https://github.com/ajaxorg/ace/pull/5222. If for any reason creating a PR is not an option for you, please proceed with filling out this issue. Thanks! - type: input id: name attributes: label: Project name description: A name of the project to be used on Ace website. validations: required: true - type: input id: project-link attributes: label: Project link description: A link to the project's website. validations: required: true - type: input id: logo-link attributes: label: Logo link description: | A link to the logo image to be used on the website for the project. If not provided, only the name of the project will be displayed. By submitting this link, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. validations: required: false - type: textarea id: info attributes: label: Additional information description: Any additional information you would like to share. validations: required: false - type: checkboxes id: ack attributes: label: Acknowledgements options: - label: I may be able to implement this request. required: false ================================================ FILE: .github/ISSUE_TEMPLATE/bug-report.yml ================================================ --- name: "🐞 Bug Report" description: Report a bug title: "(module name): (short issue description)" labels: [bug, needs-triage] assignees: [] body: - type: textarea id: description attributes: label: Describe the bug description: What is the problem? A clear and concise description of the bug. validations: required: true - type: textarea id: expected attributes: label: Expected Behavior description: | What did you expect to happen? validations: required: true - type: textarea id: current attributes: label: Current Behavior description: | What actually happened? Please include full errors, uncaught exceptions, stack traces, and relevant logs. validations: required: true - type: textarea id: reproduction attributes: label: Reproduction Steps description: | Provide a self-contained, concise snippet of code that can be used to reproduce the issue. For more complex issues provide a repo with the smallest sample that reproduces the bug. Avoid including business logic or unrelated code, it makes diagnosis more difficult. validations: required: true - type: textarea id: solution attributes: label: Possible Solution description: | Suggest a fix/reason for the bug validations: required: false - type: textarea id: context attributes: label: Additional Information/Context description: | Anything else that might be relevant for troubleshooting this bug. Providing context helps us come up with a solution that is most useful in the real world. validations: required: false - type: input id: ace-version attributes: label: Ace Version / Browser / OS / Keyboard layout description: Information about software versions and keyboard configuration that can be relevant for reproducing the issue validations: required: true ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ --- blank_issues_enabled: false contact_links: - name: 🤔 General Question url: https://github.com/ajaxorg/ace/discussions/categories/q-a about: Please ask and answer questions as a discussion thread ================================================ FILE: .github/ISSUE_TEMPLATE/documentation.yml ================================================ --- name: "📕 Documentation Issue" description: Report an issue in the documentation title: "(short issue description)" labels: [documentation, needs-triage] assignees: [] body: - type: textarea id: description attributes: label: Describe the issue description: A clear and concise description of the issue. validations: required: true - type: textarea id: links attributes: label: Links description: | Include links to affected documentation page(s). validations: required: true ================================================ FILE: .github/ISSUE_TEMPLATE/feature-request.yml ================================================ --- name: 🚀 Feature Request description: Suggest an idea for this project title: "(short issue description)" labels: [feature-request, needs-triage] assignees: [] body: - type: textarea id: description attributes: label: Describe the feature description: A clear and concise description of the feature you are proposing. validations: required: true - type: textarea id: use-case attributes: label: Use Case description: | Why do you need this feature? For example: "I'm always frustrated when..." validations: required: true - type: textarea id: solution attributes: label: Proposed Solution description: | Suggest how to implement the addition or change. Please include prototype/workaround/sketch/reference implementation. validations: required: false - type: textarea id: other attributes: label: Other Information description: | Any alternative solutions or features you considered, a more detailed explanation, stack traces, related issues, links for context, etc. validations: required: false - type: checkboxes id: ack attributes: label: Acknowledgements options: - label: I may be able to implement this feature request required: false - label: This feature might incur a breaking change required: false - type: input id: ace-version attributes: label: ACE version used validations: required: true ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.md ================================================ *Issue #, if available:* *Description of changes:* By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. Pull Request Checklist: * [ ] No backwards incompatible changes were made to Ace's public interface which is defined through the main typings file (`ace.d.ts`) and its references: * https://github.com/ajaxorg/ace/blob/master/ace.d.ts * https://github.com/ajaxorg/ace/blob/master/ace-modes.d.ts * https://github.com/ajaxorg/ace/blob/master/ace-extensions.d.ts ================================================ FILE: .github/workflows/backwards-compatibility-commenter.yml ================================================ name: Comments for ensuring backward compatibility on: pull_request_target: paths: - 'ace.d.ts' - 'ace-modes.d.ts' - 'ace-extensions.d.ts' permissions: pull-requests: write jobs: comment: runs-on: ubuntu-latest steps: - name: Comment on PR uses: peter-evans/create-or-update-comment@v1 with: issue-number: ${{ github.event.pull_request.number }} body: | One of the public type files has been updated, plase make sure there are no backwards incompatible changes done in the PR. token: ${{ secrets.GITHUB_TOKEN }} ================================================ FILE: .github/workflows/close-stale-issues.yml ================================================ name: "Close Stale Issues" # Controls when the action will run. on: workflow_dispatch: schedule: - cron: "0 */4 * * *" jobs: cleanup: permissions: issues: write contents: read pull-requests: write runs-on: ubuntu-latest name: Stale issue job steps: - uses: aws-actions/stale-issue-cleanup@v5 with: issue-types: issues # Setting messages to an empty string will cause the automation to skip # that category ancient-issue-message: This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. stale-issue-message: This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. # These labels are required stale-issue-label: closing-soon exempt-issue-labels: no-autoclose, p1 response-requested-label: response-requested # Don't set closed-for-staleness label to skip closing very old issues # regardless of label closed-for-staleness-label: closed-for-staleness # Issue timing days-before-stale: 7 days-before-close: 2 days-before-ancient: 365 # If you don't want to mark a issue as being ancient based on a # threshold of "upvotes", you can set this here. An "upvote" is # the total number of +1, heart, hooray, and rocket reactions # on an issue. minimum-upvotes-to-exempt: 5 repo-token: ${{ secrets.GITHUB_TOKEN }} loglevel: DEBUG # Set dry-run to true to not perform label or close actions. dry-run: false ================================================ FILE: .github/workflows/issue-reprioritization.yml ================================================ name: issue-reprioritization on: schedule: - cron: "0 0 * * 0" jobs: issue-reprioritization: permissions: issues: write runs-on: ubuntu-latest steps: - uses: kaizencc/issue-reprioritization-manager@main id: reprioritization-manager with: github-token: ${{ secrets.GITHUB_TOKEN }} original-label: p2 new-label: p1 reprioritization-threshold: 5 - uses: kaizencc/pr-triage-manager@main with: github-token: ${{ secrets.GITHUB_TOKEN }} on-pulls: ${{ steps.reprioritization-manager.outputs.linked-pulls }} ================================================ FILE: .github/workflows/link-comment.yml ================================================ name: Update PR Description on: pull_request_target: # use this trigger to run on external pull requests too types: [opened, synchronize] jobs: update-description: runs-on: ubuntu-latest permissions: contents: read pull-requests: write steps: - name: Update PR description uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const prNumber = context.payload.pull_request.number; const owner = context.payload.pull_request.head.repo.owner.login; const repo = context.payload.pull_request.head.repo.name; const commit = context.payload.pull_request.head.sha; const link = `https://raw.githack.com/${owner}/${repo}/${commit}/kitchen-sink.html`; const { data: pullRequest } = await github.rest.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, pull_number: prNumber, }); if (!pullRequest.body.includes(link)) { const updatedBody = `${pullRequest.body}\n\n[Open kitchen-sink @ ${commit}](${link})`; await github.rest.pulls.update({ owner: context.repo.owner, repo: context.repo.repo, pull_number: prNumber, body: updatedBody, }); } ================================================ FILE: .github/workflows/nodejs.yml ================================================ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions name: CI on: push: branches: [ master ] pull_request: branches: [ master ] permissions: contents: read # to fetch code (actions/checkout) jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: [16.x] steps: - uses: actions/checkout@v2 - name: Fetch the master branch run: git fetch origin HEAD:refs/remotes/origin/HEAD --depth 1 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - run: npm i - run: npm run cover-json && mv ./coverage/coverage-final.json ./coverage/coverage.json - run: | # eslint set -x; git status; git checkout HEAD -- package.json; changes=$(git diff --name-only origin/HEAD --no-renames --diff-filter=ACMR); if [ "$changes" == "" ]; then echo "checking all files"; node node_modules/eslint/bin/eslint "lib/ace/**/*.js"; else jsChanges=$(echo "$changes" | grep -P '.js$' || :); if [ "$jsChanges" == "" ]; then echo "nothing to check"; else echo "checking $jsChanges"; node node_modules/eslint/bin/eslint $jsChanges; fi fi - run: | # check types set -x; npx tsc -v; npm run update-types; git diff --color --exit-code ./ace*d.ts; npm run typecheck; node_modules/.bin/tsc --noImplicitAny --strict --noUnusedLocals --noImplicitReturns --noUnusedParameters --noImplicitThis ace.d.ts; - run: | # test-npm-package set -x; ./tool/test-npm-package.sh # upload to codecov - uses: codecov/codecov-action@v3 with: token: d8edca4b-8e97-41e5-b54e-34c7cf3b2d47 file: ./coverage/coverage.json flags: unittests name: codecov-umbrella fail_ci_if_error: true ================================================ FILE: .github/workflows/publish.yml ================================================ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions name: Publish to NPM on: push: tags: - v* workflow_dispatch: permissions: id-token: write # Required for OIDC contents: read # to fetch code (actions/checkout) jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 # Setup .npmrc file to publish to npm - uses: actions/setup-node@v4 with: node-version: '24' registry-url: 'https://registry.npmjs.org' - run: npm install - run: npm run test - run: npm publish ================================================ FILE: .gitignore ================================================ # Junk that could exist anywhere: .DS_Store *.swp *.tmp *~ # Project files that should not be in the repo .* \#* !/.github !/.gitignore .*.gz *.tmTheme.js package-lock.json # A handy place to put stuff that git should ignore: /coverage /ignore/ node_modules/ jam/ * * .git-ref npm-debug.log deps/ dist lib/ace styles ================================================ FILE: CHANGELOG.md ================================================ # Changelog All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. ### [1.43.6](https://github.com/ajaxorg/ace/compare/v1.43.5...v1.43.6) (2026-01-23) ### Bug Fixes * the text completer didn't export its id ([#5847](https://github.com/ajaxorg/ace/issues/5847)) ([b256c10](https://github.com/ajaxorg/ace/commit/b256c10691e6ba9296d18dcdea15441189971d1e)) ### [1.43.5](https://github.com/ajaxorg/ace/compare/v1.43.4...v1.43.5) (2025-12-02) ### [1.43.4](https://github.com/ajaxorg/ace/compare/v1.43.3...v1.43.4) (2025-10-17) ### Bug Fixes * Update for compliance with typescript 5.9.2 ([#5855](https://github.com/ajaxorg/ace/issues/5855)) ([6e110b0](https://github.com/ajaxorg/ace/commit/6e110b0061b56b72db7478762036a1ba39251102)) ### [1.43.3](https://github.com/ajaxorg/ace/compare/v1.43.2...v1.43.3) (2025-09-02) ### Bug Fixes * firefox textarea autocomplete corruption ([#5860](https://github.com/ajaxorg/ace/issues/5860)) ([23ac02f](https://github.com/ajaxorg/ace/commit/23ac02f7602b84cc4ea30f6ed4f889d3802affde)) ### [1.43.2](https://github.com/ajaxorg/ace/compare/v1.43.1...v1.43.2) (2025-07-15) ### Features * Implement text markers ([#5835](https://github.com/ajaxorg/ace/issues/5835)) ([085730f](https://github.com/ajaxorg/ace/commit/085730fff987ec88c2350146f18b42b17532d47f)) ### [1.43.1](https://github.com/ajaxorg/ace/compare/v1.43.0...v1.43.1) (2025-07-02) ### Bug Fixes * **a11y:** aria-describedby to gutter elements ([#5838](https://github.com/ajaxorg/ace/issues/5838)) ([bf27c15](https://github.com/ajaxorg/ace/commit/bf27c151685ac486a991a61d67fa04adf8891c76)) ### [1.42.1](https://github.com/ajaxorg/ace/compare/v1.42.0...v1.42.1) (2025-06-20) ### Features * Add scroll diff decorators ([#5807](https://github.com/ajaxorg/ace/issues/5807)) ([b45e94c](https://github.com/ajaxorg/ace/commit/b45e94cb92d757b5f09ee0966a764ed0d245ed70)) ## [1.42.0](https://github.com/ajaxorg/ace/compare/v1.41.0...v1.42.0) (2025-06-03) ### Features * update mouse selection at user's refresh rate ([#5717](https://github.com/ajaxorg/ace/issues/5717)) ([90d72fc](https://github.com/ajaxorg/ace/commit/90d72fc95ed2a3e35725a39fa2b88c2fe6d0a44c)), closes [#5716](https://github.com/ajaxorg/ace/issues/5716) ### Bug Fixes * editor.completer would init on `enableBasicAutocompletion` option `true` ([#5756](https://github.com/ajaxorg/ace/issues/5756)) ([25a471a](https://github.com/ajaxorg/ace/commit/25a471a3ec0a7c657646a54d034709f0d3283f19)) * missing type aliases and MarkerGroup in `ace-builds` ([#5782](https://github.com/ajaxorg/ace/issues/5782)) ([b20be1a](https://github.com/ajaxorg/ace/commit/b20be1a4591e1c566fdb0e205a75fa580885e7c6)) ### [1.40.2](https://github.com/ajaxorg/ace/compare/v1.40.1...v1.40.2) (2025-05-02) ### [1.40.1](https://github.com/ajaxorg/ace/compare/v1.40.0...v1.40.1) (2025-04-23) ### Bug Fixes * **gutter:** add null check for session.foldWdigets ([#5801](https://github.com/ajaxorg/ace/issues/5801)) ([6ca40e9](https://github.com/ajaxorg/ace/commit/6ca40e93623ed1d4d04c8ce7ffb45186092c2198)) ## [1.40.0](https://github.com/ajaxorg/ace/compare/v1.39.1...v1.40.0) (2025-04-15) ### Features * **gutter:** added keyboard handling for experimental feature custom widgets ([#5796](https://github.com/ajaxorg/ace/issues/5796)) ([8037400](https://github.com/ajaxorg/ace/commit/803740045ca73555b01116b582791fce940cbe00)) ### [1.39.1](https://github.com/ajaxorg/ace/compare/v1.39.0...v1.39.1) (2025-03-20) ### Features * Editing is disabled tooltip in readonly mode ([#5771](https://github.com/ajaxorg/ace/issues/5771)) ([1098e53](https://github.com/ajaxorg/ace/commit/1098e5306fdc02e873cdadc85d2e13228abfe80c)) ### Bug Fixes * Fix is check in xml FoldMode ([#5752](https://github.com/ajaxorg/ace/issues/5752)) ([810c465](https://github.com/ajaxorg/ace/commit/810c4650288d32b119239f7731a3b3be0c25376c)) * replace NodeList.foreach with for loop ([#5769](https://github.com/ajaxorg/ace/issues/5769)) ([b3de3c1](https://github.com/ajaxorg/ace/commit/b3de3c1d99540bd94df122cedb7c5e3a792986a7)) * updateDocTooltip with undefined this.completions ([#5754](https://github.com/ajaxorg/ace/issues/5754)) ([adde072](https://github.com/ajaxorg/ace/commit/adde072dd4810aa8f99bb1e16a6ab7dfc81a6e9d)) * wrong java keywords ([#5759](https://github.com/ajaxorg/ace/issues/5759)) ([6b4c7a0](https://github.com/ajaxorg/ace/commit/6b4c7a09d844a2e16d664d3e9fbb384b543bcfcb)) ## [1.39.0](https://github.com/ajaxorg/ace/compare/v1.38.0...v1.39.0) (2025-02-21) ### Features * Multiline Search Support: line breaks `\n` ([#5675](https://github.com/ajaxorg/ace/issues/5675)) ([06d51b9](https://github.com/ajaxorg/ace/commit/06d51b9164dc9dc39fbd6df26b7132f4b9580a4c)) ### Bug Fixes * check if row is present when setting aria label of popup elements ([#5750](https://github.com/ajaxorg/ace/issues/5750)) ([ff16482](https://github.com/ajaxorg/ace/commit/ff16482101965fc4fce488a61a3cd0f9454d8e87)) * gutter hover tooltip a11y improvements ([#5747](https://github.com/ajaxorg/ace/issues/5747)) ([fbe3ddc](https://github.com/ajaxorg/ace/commit/fbe3ddccb1248c9f8f4a6524d2ded7235d225b41)) * narrowing platform to be either win or mac ([#5707](https://github.com/ajaxorg/ace/issues/5707)) ([18cc336](https://github.com/ajaxorg/ace/commit/18cc336187519107f47bb15e989008f48f0b1563)) * set score completion item when skipfilter true ([#5749](https://github.com/ajaxorg/ace/issues/5749)) ([a27e1e8](https://github.com/ajaxorg/ace/commit/a27e1e8a5d3d912b3b554cd2b5916b58750e8e71)) ## [1.38.0](https://github.com/ajaxorg/ace/compare/v1.37.5...v1.38.0) (2025-02-12) ### Features * **popup:** add supporting skipFilter flag for popup item ([#5740](https://github.com/ajaxorg/ace/issues/5740)) ([0db7585](https://github.com/ajaxorg/ace/commit/0db7585ae0ccbd353091426f60ac3d9e53e182c4)) ### Bug Fixes * **AcePopup:** fix aria-posinset issue on google chrome ([#5719](https://github.com/ajaxorg/ace/issues/5719)) ([09a0c5a](https://github.com/ajaxorg/ace/commit/09a0c5a11106754916a4fc324a35e8daf84055ba)) * calling setMode just before destroy causes error reading getLength ([#5727](https://github.com/ajaxorg/ace/issues/5727)) ([62b973e](https://github.com/ajaxorg/ace/commit/62b973ef2247debdd51cf6a41a3b24b97277efdb)) * highlight indent guides with wrapped lines ([#5621](https://github.com/ajaxorg/ace/issues/5621)) ([77b9fe1](https://github.com/ajaxorg/ace/commit/77b9fe1bc0b10b4c3fb2780d65f9d256d60634ce)) * improve aria attributes of popup elements ([#5739](https://github.com/ajaxorg/ace/issues/5739)) ([09fba2e](https://github.com/ajaxorg/ace/commit/09fba2e7347cd499c979e53ec7a8d8ee1fd48918)) * types for setTimeout/setInterval calls ([#5726](https://github.com/ajaxorg/ace/issues/5726)) ([9a76656](https://github.com/ajaxorg/ace/commit/9a76656acc9528a4a2e92a3b72c4d6598d3a0a8c)) * **VirtualRenderer:** fix scrollbar overlap on autocompletion ([#5713](https://github.com/ajaxorg/ace/issues/5713)) ([5acea6d](https://github.com/ajaxorg/ace/commit/5acea6d9200f4ca0c8495350cda6e41e8351913f)) * wrong type of paste event and missing types for themelist extension ([#5725](https://github.com/ajaxorg/ace/issues/5725)) ([a4b9d2d](https://github.com/ajaxorg/ace/commit/a4b9d2d91a2be841320030d93afde46ae723c8c3)) ### [1.37.5](https://github.com/ajaxorg/ace/compare/v1.37.4...v1.37.5) (2025-01-16) ### Bug Fixes * update aria-roledescription gutter ([#5718](https://github.com/ajaxorg/ace/issues/5718)) ([7ae3a4c](https://github.com/ajaxorg/ace/commit/7ae3a4c5f6f6e9bd31ae491f1fcef71fc5ae62fa)) ### [1.37.4](https://github.com/ajaxorg/ace/compare/v1.37.3...v1.37.4) (2025-01-09) ### Bug Fixes * Remove unnecesary `typeof` from type imports in declarations ([#5715](https://github.com/ajaxorg/ace/issues/5715)) ([2c8bf91](https://github.com/ajaxorg/ace/commit/2c8bf916d75b086b958c205896bc2adc1747d241)) ### [1.37.3](https://github.com/ajaxorg/ace/compare/v1.37.2...v1.37.3) (2025-01-07) ### [1.37.2](https://github.com/ajaxorg/ace/compare/v1.37.1...v1.37.2) (2025-01-06) ### Bug Fixes * fix return type of supportsFile modelist ([#5705](https://github.com/ajaxorg/ace/issues/5705)) ([de21d50](https://github.com/ajaxorg/ace/commit/de21d50656bd874e1626265b8853923cb8da7c8b)) ### [1.37.1](https://github.com/ajaxorg/ace/compare/v1.37.0...v1.37.1) (2024-12-20) ### Bug Fixes * hide gutter tooltip event missing from editor signal ([#5701](https://github.com/ajaxorg/ace/issues/5701)) ([66a6736](https://github.com/ajaxorg/ace/commit/66a673643d5d128eaf59d4fb6e5907fa6fa68773)) ### [1.36.6](https://github.com/ajaxorg/ace/compare/v1.36.5...v1.36.6) (2024-12-17) ### Bug Fixes * update contribuition guide to mandate test cases ([#5694](https://github.com/ajaxorg/ace/issues/5694)) ([e6533b3](https://github.com/ajaxorg/ace/commit/e6533b3972d5adbf5995646c44894466b3b7f40f)) * wrong behaviour rules in modes ([#5682](https://github.com/ajaxorg/ace/issues/5682)) ([442680c](https://github.com/ajaxorg/ace/commit/442680c68e66531c2d5ac80d80444ed600262ec1)) ### [1.36.5](https://github.com/ajaxorg/ace/compare/v1.36.4...v1.36.5) (2024-11-14) ### Features * exposing getter setter for widget manager created using line widgets ([#5673](https://github.com/ajaxorg/ace/issues/5673)) ([f5d0c19](https://github.com/ajaxorg/ace/commit/f5d0c196c69d06a9dda1bdeb379fa20ecbf75590)) ### Bug Fixes * vue-directives regex bug ([#5671](https://github.com/ajaxorg/ace/issues/5671)) ([5e1e524](https://github.com/ajaxorg/ace/commit/5e1e524d7ef04e13291b5a979fb4166e973e61f0)) ### [1.36.4](https://github.com/ajaxorg/ace/compare/v1.36.3...v1.36.4) (2024-11-04) ### Bug Fixes * **a11y:** update aria-label of textinput on cursor move ([#5665](https://github.com/ajaxorg/ace/issues/5665)) ([6ff93a8](https://github.com/ajaxorg/ace/commit/6ff93a86fe8c4855789ee7e7c156f7b376c0f935)) ### [1.36.3](https://github.com/ajaxorg/ace/compare/v1.36.2...v1.36.3) (2024-10-21) ### Bug Fixes * `readdirSync` options `recursive: true` was added only in NodeJs v20.1.0 ([#5645](https://github.com/ajaxorg/ace/issues/5645)) ([2953f72](https://github.com/ajaxorg/ace/commit/2953f72877a90691432373cfe9182e60ea9b2d8f)) ### [1.36.2](https://github.com/ajaxorg/ace/compare/v1.36.1...v1.36.2) (2024-08-30) ### Bug Fixes * apply padding to right side multi-line markers ([#5636](https://github.com/ajaxorg/ace/issues/5636)) ([c7549aa](https://github.com/ajaxorg/ace/commit/c7549aa5d53fb62f134b31a44d09029ceee3c800)) ### [1.36.1](https://github.com/ajaxorg/ace/compare/v1.36.0...v1.36.1) (2024-08-29) ### Bug Fixes * improve type getMarkerAtPosition markergroup ([#5631](https://github.com/ajaxorg/ace/issues/5631)) ([89bd40a](https://github.com/ajaxorg/ace/commit/89bd40a66a2f06fb8806f174e5559021540a5b1e)) * update cloudeditor light colours ([#5633](https://github.com/ajaxorg/ace/issues/5633)) ([0e2813e](https://github.com/ajaxorg/ace/commit/0e2813ed9e858d9359c2a79f2a9255d675308ad1)) ## [1.36.0](https://github.com/ajaxorg/ace/compare/v1.35.5...v1.36.0) (2024-08-21) ### Features * allow setting marker type for MarkerGroups ([#5630](https://github.com/ajaxorg/ace/issues/5630)) ([214df9c](https://github.com/ajaxorg/ace/commit/214df9cea8d729f3071f9c02889cba2b2e7051b3)) * **forced-color:** do not adjust the forced colors for the editor ([#5624](https://github.com/ajaxorg/ace/issues/5624)) ([c8f9df8](https://github.com/ajaxorg/ace/commit/c8f9df84e70ee29e8e989966985bcea95a9bef9b)) ### [1.35.5](https://github.com/ajaxorg/ace/compare/v1.35.4...v1.35.5) (2024-08-20) ### [1.35.4](https://github.com/ajaxorg/ace/compare/v1.35.3...v1.35.4) (2024-07-22) ### Bug Fixes * move right of cursor tokens to end of ghost text. ([#5616](https://github.com/ajaxorg/ace/issues/5616)) ([063ef9b](https://github.com/ajaxorg/ace/commit/063ef9bbe0934dfe75d9b447e8a92b69bfa41a3a)) ### [1.35.3](https://github.com/ajaxorg/ace/compare/v1.35.2...v1.35.3) (2024-07-18) ### Bug Fixes * ghost text rendering of empty lines ([#5615](https://github.com/ajaxorg/ace/issues/5615)) ([1ae0bdc](https://github.com/ajaxorg/ace/commit/1ae0bdcfb9da4078713d116e93a9c9a935a1258d)) ### [1.35.2](https://github.com/ajaxorg/ace/compare/v1.35.1...v1.35.2) (2024-07-01) ### [1.35.1](https://github.com/ajaxorg/ace/compare/v1.35.0...v1.35.1) (2024-06-27) ### Bug Fixes * explicitly construct Number from window zoom attribute ([#5600](https://github.com/ajaxorg/ace/issues/5600)) ([2591c36](https://github.com/ajaxorg/ace/commit/2591c36b9e768305a9f837bf74c828c2d8d76e05)) * use dom builder for gutter tooltip and inline widget ([#5601](https://github.com/ajaxorg/ace/issues/5601)) ([e81a299](https://github.com/ajaxorg/ace/commit/e81a299a8be39a7245a334ebc844eaeac6864bb3)) * workaround for safari rendering bug ([#5573](https://github.com/ajaxorg/ace/issues/5573)) ([f9a152f](https://github.com/ajaxorg/ace/commit/f9a152fd925a8a16b10c65c909201100486c71e8)) * wrong doc comment * insert behaviour ([#5571](https://github.com/ajaxorg/ace/issues/5571)) ([16c95b3](https://github.com/ajaxorg/ace/commit/16c95b32197c0ec952e52be85d21269005875940)) ## [1.35.0](https://github.com/ajaxorg/ace/compare/v1.34.2...v1.35.0) (2024-06-11) ### Features * allow '{n}' as placeholder for translated strings ([#5581](https://github.com/ajaxorg/ace/issues/5581)) ([2206024](https://github.com/ajaxorg/ace/commit/220602488b95748c74141d647e13114c7a4569fb)) ### Bug Fixes * allow setting the placeholder type for nls ([#5584](https://github.com/ajaxorg/ace/issues/5584)) ([3e2d50f](https://github.com/ajaxorg/ace/commit/3e2d50f5307e201c20825311585e1f612f1ff23c)) * not closed generic state in case of left-shift operator ([#5572](https://github.com/ajaxorg/ace/issues/5572)) ([e5bea6f](https://github.com/ajaxorg/ace/commit/e5bea6f63290003ff3270d56dbf9610e8a3091a8)) * wrong vue-directives regexp ([#5586](https://github.com/ajaxorg/ace/issues/5586)) ([5f89a33](https://github.com/ajaxorg/ace/commit/5f89a334e69640bb395e74ae86530217d08f141c)) ### [1.34.2](https://github.com/ajaxorg/ace/compare/v1.34.1...v1.34.2) (2024-05-27) ### [1.34.1](https://github.com/ajaxorg/ace/compare/v1.34.0...v1.34.1) (2024-05-24) ### Bug Fixes * always set aria-label to text input in a11y mode ([#5563](https://github.com/ajaxorg/ace/issues/5563)) ([00346fd](https://github.com/ajaxorg/ace/commit/00346fde824beabb69f677631ad52815665eaef4)) * Folding for comments and different modes ([#5533](https://github.com/ajaxorg/ace/issues/5533)) ([f4d0e33](https://github.com/ajaxorg/ace/commit/f4d0e33dac270ce21df09a96a39f50e16d6354db)) ## [1.34.0](https://github.com/ajaxorg/ace/compare/v1.33.3...v1.34.0) (2024-05-22) ### Features * allow users to add arialabel to text input ([#5560](https://github.com/ajaxorg/ace/issues/5560)) ([8d7dfb6](https://github.com/ajaxorg/ace/commit/8d7dfb69392960aba61def982f4bea8f3a5caa70)) ### [1.33.3](https://github.com/ajaxorg/ace/compare/v1.33.2...v1.33.3) (2024-05-21) ### Bug Fixes * contrast completion meta contrast cloud editor themes ([#5558](https://github.com/ajaxorg/ace/issues/5558)) ([b8877f0](https://github.com/ajaxorg/ace/commit/b8877f0f725b3973961cb639127402c9f56609de)) ### [1.33.2](https://github.com/ajaxorg/ace/compare/v1.33.1...v1.33.2) (2024-05-13) ### Bug Fixes * Add soft wrap for ghost text ([#5540](https://github.com/ajaxorg/ace/issues/5540)) ([6a26b27](https://github.com/ajaxorg/ace/commit/6a26b277d0050b38cd766e00f93be4b9f3170f68)) * generator function's determination; wrong parameter highlighting ([#5538](https://github.com/ajaxorg/ace/issues/5538)) ([ceca6f7](https://github.com/ajaxorg/ace/commit/ceca6f7b38f6b3347988f17579ae6a2e758137dd)) * incorrect spans style ([#5539](https://github.com/ajaxorg/ace/issues/5539)) ([65a7f38](https://github.com/ajaxorg/ace/commit/65a7f38713cffb729dab530711351c0a17c5801f)) * not determined folding widgets for html tags ([#5548](https://github.com/ajaxorg/ace/issues/5548)) ([7a51992](https://github.com/ajaxorg/ace/commit/7a5199292f55dfa1a8ea8830ea1a9d98be097161)) * wrong token type ([#5535](https://github.com/ajaxorg/ace/issues/5535)) ([4041489](https://github.com/ajaxorg/ace/commit/4041489bb38ffe609d5f9b43b4a7637e47fc4739)) ### [1.33.1](https://github.com/ajaxorg/ace/compare/v1.33.0...v1.33.1) (2024-04-23) ### Bug Fixes * account for `this.popup` being potentially undefined in completion mousewheel listener ([#5537](https://github.com/ajaxorg/ace/issues/5537)) ([6c3a9a6](https://github.com/ajaxorg/ace/commit/6c3a9a66a7a0ab0dd493ad2c281c9dd343d5301f)) ## [1.33.0](https://github.com/ajaxorg/ace/compare/v1.32.9...v1.33.0) (2024-04-12) ### Features * Make translation system key based and add annotation type to gutter icon aria labels ([#5524](https://github.com/ajaxorg/ace/issues/5524)) ([bb8256d](https://github.com/ajaxorg/ace/commit/bb8256d5a5b5e989e3fb1bb80f326b8564fbbc20)) ### Bug Fixes * Contrast is too low for searched items ([#5523](https://github.com/ajaxorg/ace/issues/5523)) ([507ae2f](https://github.com/ajaxorg/ace/commit/507ae2f872a2b2f1a14fdffbf6530f4046df44c0)) ### [1.32.9](https://github.com/ajaxorg/ace/compare/v1.32.8...v1.32.9) (2024-03-29) ### Bug Fixes * apply class to autocomplete popup for no suggestions state ([#5522](https://github.com/ajaxorg/ace/issues/5522)) ([a66f861](https://github.com/ajaxorg/ace/commit/a66f8619953eecd85833d97715e479d3b211c4cd)) ### [1.32.8](https://github.com/ajaxorg/ace/compare/v1.32.7...v1.32.8) (2024-03-22) ### Bug Fixes * allow completers to trigger on newline characters ([#5519](https://github.com/ajaxorg/ace/issues/5519)) ([6e870fd](https://github.com/ajaxorg/ace/commit/6e870fd08e06be47f9da971743d13b25c41f99c2)) * don't detach completion popup while typing when prefix is empty ([#5517](https://github.com/ajaxorg/ace/issues/5517)) ([7937e53](https://github.com/ajaxorg/ace/commit/7937e53babb9b327902e9dab4b18c04a907883be)) * scroll cursor line to top editor for long inline preview ([#5514](https://github.com/ajaxorg/ace/issues/5514)) ([529473b](https://github.com/ajaxorg/ace/commit/529473b6959d5f7a70ada1d20feb0c87b432f766)) * SwiftHighlightRules exports ([#5516](https://github.com/ajaxorg/ace/issues/5516)) ([f493ab0](https://github.com/ajaxorg/ace/commit/f493ab03bb50fe089c927b7a50a4a327c8dcec4c)) ### [1.32.7](https://github.com/ajaxorg/ace/compare/v1.32.6...v1.32.7) (2024-03-01) ### Bug Fixes * swap blue/red in cloudeditor themes to reduces usage of red ([#5492](https://github.com/ajaxorg/ace/issues/5492)) ([0e8f549](https://github.com/ajaxorg/ace/commit/0e8f549a16481f8bb7573ac9edaae377cb9e3972)) ### [1.32.6](https://github.com/ajaxorg/ace/compare/v1.32.5...v1.32.6) (2024-02-07) ### [1.32.5](https://github.com/ajaxorg/ace/compare/v1.32.4...v1.32.5) (2024-01-30) ### [1.32.4](https://github.com/ajaxorg/ace/compare/v1.32.3...v1.32.4) (2024-01-29) ### Bug Fixes * Improve contrast of completion popup in CloudEditor theme ([#5473](https://github.com/ajaxorg/ace/issues/5473)) ([273c7f1](https://github.com/ajaxorg/ace/commit/273c7f159ded7dc9403266c6501e16a35e4101c6)) * update JSX mode to reflect React JSX ([#5451](https://github.com/ajaxorg/ace/issues/5451)) ([66789a7](https://github.com/ajaxorg/ace/commit/66789a79ce1b7791c65886d8aecddd7efc0415e8)) ### [1.32.3](https://github.com/ajaxorg/ace/compare/v1.32.2...v1.32.3) (2023-12-29) ### Bug Fixes * improve prefixing for inline preview ([#5439](https://github.com/ajaxorg/ace/issues/5439)) ([51006bb](https://github.com/ajaxorg/ace/commit/51006bba9c60b97251ddb04ed74f68ba4e7f6b54)) * update ghost text if on same line popup ([12f4664](https://github.com/ajaxorg/ace/commit/12f466460d7187cfe37593dab1fbe275403fedd3)) * updated red color in cloud-editor dark theme ([#5432](https://github.com/ajaxorg/ace/issues/5432)) ([142b607](https://github.com/ajaxorg/ace/commit/142b607578f5d071a5026691ff6662c11e9f186b)) ### [1.32.2](https://github.com/ajaxorg/ace/compare/v1.32.1...v1.32.2) (2023-12-14) ### Bug Fixes * **themes:** changed the solarized theme primary color from `[#93](https://github.com/ajaxorg/ace/issues/93)A1A1` to `[#839496](https://github.com/ajaxorg/ace/issues/839496)`. ([#5422](https://github.com/ajaxorg/ace/issues/5422)) ([114a5c1](https://github.com/ajaxorg/ace/commit/114a5c163fd875b4fab332dadfadeeae41e4097a)), closes [#93A1A1](https://github.com/ajaxorg/ace/issues/93A1A1) ### [1.32.1](https://github.com/ajaxorg/ace/compare/v1.32.0...v1.32.1) (2023-12-11) ### Bug Fixes * don't show loading state when empty completer array is provided ([7a8a929](https://github.com/ajaxorg/ace/commit/7a8a92933b3fde75907612d106643d28efa2d776)) * prevent browser scroll while scrolling over the tooltip ([#5414](https://github.com/ajaxorg/ace/issues/5414)) ([c6475c0](https://github.com/ajaxorg/ace/commit/c6475c00bcfa49dde37ef9de06ebba82ba5ba15d)) * switch aria-selected to aria-current for webkit ([#5416](https://github.com/ajaxorg/ace/issues/5416)) ([bf1a4ea](https://github.com/ajaxorg/ace/commit/bf1a4ea607ed09b5a299390dd2daa5c1d0019e00)), closes [#5403](https://github.com/ajaxorg/ace/issues/5403) * yaml worker errors at undefined row/column ([06cc12a](https://github.com/ajaxorg/ace/commit/06cc12aad98176d931a1c1cf9a701f4ac0c33de5)) ## [1.32.0](https://github.com/ajaxorg/ace/compare/v1.31.2...v1.32.0) (2023-11-30) ### Features * adding CloudEditor theme ([#5404](https://github.com/ajaxorg/ace/issues/5404)) ([b0ee067](https://github.com/ajaxorg/ace/commit/b0ee067fadaf9593ed2207f363a402eb9ab8d57a)) ### Bug Fixes * autocomplete tests ([#5407](https://github.com/ajaxorg/ace/issues/5407)) ([cf6999d](https://github.com/ajaxorg/ace/commit/cf6999d9cb4103df16dc38a8cbfd40ab2a999e6d)) * set completion popup role to 'menu' for safari ([6845905](https://github.com/ajaxorg/ace/commit/684590546746fa2ef090c10c140e01e43974d8f4)) * stop rendering the completion popup disconnected from the editor for long ghost text ([#5401](https://github.com/ajaxorg/ace/issues/5401)) ([94d68a7](https://github.com/ajaxorg/ace/commit/94d68a73042c61a786d253fd0838e62cc5770a31)) * try to scroll inline preview into view ([#5400](https://github.com/ajaxorg/ace/issues/5400)) ([95af560](https://github.com/ajaxorg/ace/commit/95af5608b655259d12cdbc4ca28cf450f9e649c7)) ### [1.31.2](https://github.com/ajaxorg/ace/compare/v1.31.1...v1.31.2) (2023-11-15) ### Bug Fixes * inline preview with loading state ([05db94f](https://github.com/ajaxorg/ace/commit/05db94f53774f64318de757347f7217043744fe6)) ### [1.31.1](https://github.com/ajaxorg/ace/compare/v1.31.0...v1.31.1) (2023-10-30) ### Bug Fixes * improve yaml folding ([5c80e3c](https://github.com/ajaxorg/ace/commit/5c80e3cdd716b4ad26ee6958c9137278530b7816)) ## [1.31.0](https://github.com/ajaxorg/ace/compare/v1.30.0...v1.31.0) (2023-10-23) ### Features * add nasal language ([#5342](https://github.com/ajaxorg/ace/issues/5342)) ([4fff99e](https://github.com/ajaxorg/ace/commit/4fff99e320539a1472ce0512cd1fd3e5fc7f2ca6)) ### Bug Fixes * doc tooltip not filtering properly ([e5034c7](https://github.com/ajaxorg/ace/commit/e5034c7b58fb47fe57b28dbb001e72a567ef9abe)) ## [1.30.0](https://github.com/ajaxorg/ace/compare/v1.29.0...v1.30.0) (2023-10-13) ### Features * Add support for time units in PRQL ([#5324](https://github.com/ajaxorg/ace/issues/5324)) ([8b9175b](https://github.com/ajaxorg/ace/commit/8b9175bc780fade64bed1570fa1cd34d022b337b)) ## [1.29.0](https://github.com/ajaxorg/ace/compare/v1.28.0...v1.29.0) (2023-10-09) ### Features * allow setting completion.ignoreCaption ([5618046](https://github.com/ajaxorg/ace/commit/56180467e12c300850da89cc13c1c8648fb5e342)) ## [1.28.0](https://github.com/ajaxorg/ace/compare/v1.27.0...v1.28.0) (2023-09-22) ### Features * Keep focus on same item in completion popup when slow completer delivers results. ([#5322](https://github.com/ajaxorg/ace/issues/5322)) ([0983134](https://github.com/ajaxorg/ace/commit/09831343ccd450326cffb4b0f26ce3a8b830c7fb)) ## [1.27.0](https://github.com/ajaxorg/ace/compare/v1.26.0...v1.27.0) (2023-09-19) ### Features * Allow not showing inline preview for completers when `inlineEnabled` is set to `true`. ([#5315](https://github.com/ajaxorg/ace/issues/5315)) ([f3e3330](https://github.com/ajaxorg/ace/commit/f3e333041fc1a687b3ce35a44f1bf00bcc15a236)) ## [1.26.0](https://github.com/ajaxorg/ace/compare/v1.25.1...v1.26.0) (2023-09-15) ### Features * Allow to set setSelectOnHover for Autocomplete ([#5317](https://github.com/ajaxorg/ace/issues/5317)) ([dccbcc2](https://github.com/ajaxorg/ace/commit/dccbcc20288a48403f10aa29b6b9b6181dc8a66f)) ### Bug Fixes * Improve PRQL syntax highlightning ([#5313](https://github.com/ajaxorg/ace/issues/5313)) ([7d677f1](https://github.com/ajaxorg/ace/commit/7d677f1019ea5c81f3d9ae36ed1e71ac7a08fb30)) ### [1.25.1](https://github.com/ajaxorg/ace/compare/v1.25.0...v1.25.1) (2023-09-14) ## [1.25.0](https://github.com/ajaxorg/ace/compare/v1.24.2...v1.25.0) (2023-09-14) ### Features * Add syntax highlighting for PRQL ([#5307](https://github.com/ajaxorg/ace/issues/5307)) ([24862cd](https://github.com/ajaxorg/ace/commit/24862cdc83694bbe541c6f8be6fbaaff80d44bf7)) ### [1.24.2](https://github.com/ajaxorg/ace/compare/v1.24.1...v1.24.2) (2023-09-08) ### Bug Fixes * Added project details in index.html file ([#5300](https://github.com/ajaxorg/ace/issues/5300)) ([6e83505](https://github.com/ajaxorg/ace/commit/6e835059dd13e95178b15ce9b06a2f2444c2e731)) * autocompletion threshold doesn't apply to trigger characters ([84bbc88](https://github.com/ajaxorg/ace/commit/84bbc888e1c0304c0160bb19fc46cf5539d079cf)) * Update php_highlight_rules.js ([#5288](https://github.com/ajaxorg/ace/issues/5288)) ([caedd0c](https://github.com/ajaxorg/ace/commit/caedd0cf22d5a7644ceb418562ebcab801011c88)) ### [1.24.1](https://github.com/ajaxorg/ace/compare/v1.24.0...v1.24.1) (2023-08-15) ## [1.24.0](https://github.com/ajaxorg/ace/compare/v1.23.4...v1.24.0) (2023-08-09) ### Features * Add support for Unicode boundaries ([#5265](https://github.com/ajaxorg/ace/issues/5265)) ([1e6fcf3](https://github.com/ajaxorg/ace/commit/1e6fcf349d222715429ddc9fe6a38ec1f6d72ab1)) * Allow more lines in hidden textarea to improve screen reader experience on Windows ([#5225](https://github.com/ajaxorg/ace/issues/5225)) ([bccff5a](https://github.com/ajaxorg/ace/commit/bccff5ae21b86004c2a4ab4a86a989c61e728ebf)) * Cuttlefish mode ([#5278](https://github.com/ajaxorg/ace/issues/5278)) ([9cddf64](https://github.com/ajaxorg/ace/commit/9cddf64ac51fc5e7c5474e7aeaa2ef8f069220db)) ### Bug Fixes * add missing SQL keywords: IS and IN ([#5263](https://github.com/ajaxorg/ace/issues/5263)) ([c731164](https://github.com/ajaxorg/ace/commit/c731164315a757a5e0380f82eeef105a17b24b03)) * bug in lua.lua example file kitchen-sink ([#5258](https://github.com/ajaxorg/ace/issues/5258)) ([6549570](https://github.com/ajaxorg/ace/commit/6549570310983999a1fd3ce52bc5bf8b4004402f)) * support more environments ([#5266](https://github.com/ajaxorg/ace/issues/5266)) ([b196806](https://github.com/ajaxorg/ace/commit/b196806eb2937e7ee56e42b482b7b3bd5e3c9d79)) ### [1.23.4](https://github.com/ajaxorg/ace/compare/v1.23.3...v1.23.4) (2023-07-12) ### Bug Fixes * filterText triggered selection range removal when completions range was present ([#5249](https://github.com/ajaxorg/ace/issues/5249)) ([b586e4d](https://github.com/ajaxorg/ace/commit/b586e4d574bf780fc38f1ac0d034276272b36ad3)) ### [1.23.3](https://github.com/ajaxorg/ace/compare/v1.23.2...v1.23.3) (2023-07-10) ### Bug Fixes * android bug when deleting multiple lines ([#5248](https://github.com/ajaxorg/ace/issues/5248)) ([bd066ff](https://github.com/ajaxorg/ace/commit/bd066ffef88ca74f5ac32349d3e868cfa875a47b)), closes [#5087](https://github.com/ajaxorg/ace/issues/5087) * update jshint version to 2.13.6; change esversion to target ECMAScript 11 ([#5243](https://github.com/ajaxorg/ace/issues/5243)) ([301aee9](https://github.com/ajaxorg/ace/commit/301aee91b5974d9fb31d646466ed301c5c3b8249)) ### [1.23.2](https://github.com/ajaxorg/ace/compare/v1.23.1...v1.23.2) (2023-07-07) ### Bug Fixes * **autocomplete:** fix a11y violations ([#5241](https://github.com/ajaxorg/ace/issues/5241)) ([decb615](https://github.com/ajaxorg/ace/commit/decb6154198105289170303b7434c524eaf9fda8)) * bug in guttertooltip when `tooltipsFollowsMouse` set to false ([#5217](https://github.com/ajaxorg/ace/issues/5217)) ([67d318e](https://github.com/ajaxorg/ace/commit/67d318ed25d5b45789462850e6b96aac2931591f)) * typo in function name ([#5229](https://github.com/ajaxorg/ace/issues/5229)) ([6e99055](https://github.com/ajaxorg/ace/commit/6e99055c46f443271161e40fe15372d1d8ae9f42)) ### [1.23.1](https://github.com/ajaxorg/ace/compare/v1.23.0...v1.23.1) (2023-06-27) ## [1.23.0](https://github.com/ajaxorg/ace/compare/v1.22.1...v1.23.0) (2023-06-21) ### Features * **autocomplete:** ellipsis is shown when suggestions is longer than popover width ([#5204](https://github.com/ajaxorg/ace/issues/5204)) ([de4234b](https://github.com/ajaxorg/ace/commit/de4234be62be264b78bd4dd19b09cf20fb4d0f28)) * signal gutterkeydown in keyboard accessibility mode ([#5202](https://github.com/ajaxorg/ace/issues/5202)) ([538b18c](https://github.com/ajaxorg/ace/commit/538b18cf86e21c810910d286c820bac399927cd7)) ### Bug Fixes * Fix vite build and webpack warning ([#5192](https://github.com/ajaxorg/ace/issues/5192)) ([e14902e](https://github.com/ajaxorg/ace/commit/e14902e0c2b281346d062d6a5c84d05bd3590fe3)) * gutter tooltip class fix ([#5211](https://github.com/ajaxorg/ace/issues/5211)) ([5bdb944](https://github.com/ajaxorg/ace/commit/5bdb944714e7787632914aeef521e3e5024a1d1f)) * Improve ARIA labelling fold controls ([#5205](https://github.com/ajaxorg/ace/issues/5205)) ([dad5e6f](https://github.com/ajaxorg/ace/commit/dad5e6f6e445b805f7b470ef7892442a83d342e5)) * regression in setting breakpoints on folded lines ([51326eb](https://github.com/ajaxorg/ace/commit/51326ebfe9b3e97925ab1be05246e0f2646c8687)) ### [1.22.1](https://github.com/ajaxorg/ace/compare/v1.22.0...v1.22.1) (2023-06-11) ### Bug Fixes * don't throw unhandled errors in TabstopManager when EditSession becomes `undefined` ([#5193](https://github.com/ajaxorg/ace/issues/5193)) ([cd55932](https://github.com/ajaxorg/ace/commit/cd55932ac7161fcd45e2ee4f1ea8e22b5ff8c3c4)) * include ace-modes to the npm package ([a074fa4](https://github.com/ajaxorg/ace/commit/a074fa41334314169075b66cd77dd2d9a191c73f)) * jsdoc comment foldings ([#5197](https://github.com/ajaxorg/ace/issues/5197)) ([065af41](https://github.com/ajaxorg/ace/commit/065af4175f7c7426c9e8f798a0ec64c390a03259)) ## [1.22.0](https://github.com/ajaxorg/ace/compare/v1.21.1...v1.22.0) (2023-05-22) ### Features * add odin mode ([#5169](https://github.com/ajaxorg/ace/issues/5169)) ([d455e9b](https://github.com/ajaxorg/ace/commit/d455e9b16efb6030a8b0b6c1189b72516b205b40)) ### [1.21.1](https://github.com/ajaxorg/ace/compare/v1.21.0...v1.21.1) (2023-05-16) ### Bug Fixes * console error when hovering over empty gutter cell with tooltipFollowsMouse set to false ([#5173](https://github.com/ajaxorg/ace/issues/5173)) ([5ff8d4c](https://github.com/ajaxorg/ace/commit/5ff8d4cc064ac647a2f40bf977f88b2972ae17ef)) ## [1.21.0](https://github.com/ajaxorg/ace/compare/v1.20.0...v1.21.0) (2023-05-15) ### Features * Custom empty message when no completion found ([#5158](https://github.com/ajaxorg/ace/issues/5158)) ([204aafa](https://github.com/ajaxorg/ace/commit/204aafa04c268e98655fb83b4877302a0f82fa4d)) * Special trigger characters to start autocomplete ([#5147](https://github.com/ajaxorg/ace/issues/5147)) ([c2cfc5a](https://github.com/ajaxorg/ace/commit/c2cfc5a9f1448f64e62f7652c995a48c4ea31ab3)) ### Bug Fixes * command bar command type ([#5168](https://github.com/ajaxorg/ace/issues/5168)) ([64c8253](https://github.com/ajaxorg/ace/commit/64c8253e3cd4348b7ecd3684dae057c8fd5f79b9)) ## [1.20.0](https://github.com/ajaxorg/ace/compare/v1.19.0...v1.20.0) (2023-05-10) ### Features * Add gutter controls to keyboard accessibility mode ([#5146](https://github.com/ajaxorg/ace/issues/5146)) ([5f2face](https://github.com/ajaxorg/ace/commit/5f2face8febe7c260a42bc30c67195f6a5a46085)) * Inline autocomplete tooltip UX redesign ([#5149](https://github.com/ajaxorg/ace/issues/5149)) ([8d56c84](https://github.com/ajaxorg/ace/commit/8d56c841ef980527a1ebe4cf73442766f5f97208)) ## [1.19.0](https://github.com/ajaxorg/ace/compare/v1.18.1...v1.19.0) (2023-05-03) ### Features * publishing generated styling files to ace-code package ([1fa223e](https://github.com/ajaxorg/ace/commit/1fa223e4ca0df16c9a0e0a6df2996fa010189666)) ### [1.18.1](https://github.com/ajaxorg/ace/compare/v1.18.0...v1.18.1) (2023-05-03) ### Bug Fixes * add mode types, improve type definitions ([e22bd5c](https://github.com/ajaxorg/ace/commit/e22bd5c860451c000187941991c0047db4e701a2)) * hide `$getindent` from the SyntaxMode ([2b1c65b](https://github.com/ajaxorg/ace/commit/2b1c65bceb290db74f26a5c59158f93830bc6111)) * remove '$' fields for types that don't require exposing them ([2db9d4e](https://github.com/ajaxorg/ace/commit/2db9d4e88441f2932ce6c6f91e7f5ed36c590d2f)) * remove or update badly formatted declarations ([1e7b022](https://github.com/ajaxorg/ace/commit/1e7b022908cdf6fef0a28419c464874ce6433e6e)) * replaceRange could now be implemented as an instance of the Range interface, rather than being an instance of the Range class ([e1bdccc](https://github.com/ajaxorg/ace/commit/e1bdcccb4ed3179734aa534b37a9dade2e207f07)) * wrong next state in regex state ([c5ed709](https://github.com/ajaxorg/ace/commit/c5ed7092f0151d4aa00c7060ecf0111fc37bfebb)) ## [1.18.0](https://github.com/ajaxorg/ace/compare/v1.17.0...v1.18.0) (2023-04-21) ### Features * marker groups ([#5113](https://github.com/ajaxorg/ace/issues/5113)) ([01d4605](https://github.com/ajaxorg/ace/commit/01d4605c0dcf7bcbb4f1a09a243f7ef6d16d7d43)) * summary of annotations in folded lines ([#5117](https://github.com/ajaxorg/ace/issues/5117)) ([dc63ba9](https://github.com/ajaxorg/ace/commit/dc63ba900d3641284d7d11cbb5ccad7c3039f3a4)) ## [1.17.0](https://github.com/ajaxorg/ace/compare/v1.16.0...v1.17.0) (2023-04-12) ### Features * Add annotation level information to gutter tooltip ([#5101](https://github.com/ajaxorg/ace/issues/5101)) ([3cd28b8](https://github.com/ajaxorg/ace/commit/3cd28b88a51176c791e045f405cdf842916697ab)) * Add option to prevent keyboard focus trapping ([#5114](https://github.com/ajaxorg/ace/issues/5114)) ([fe5d1bf](https://github.com/ajaxorg/ace/commit/fe5d1bfbf0a3432b78a5e503d1db680181ef48b8)) * Add option to use SVG gutter icons ([#5107](https://github.com/ajaxorg/ace/issues/5107)) ([82eb439](https://github.com/ajaxorg/ace/commit/82eb439709773a71515fbe97c4e89890ea77e752)) * add ResizeObserver to make calling editor.resize optional ([51d5e4d](https://github.com/ajaxorg/ace/commit/51d5e4d4308ba98921b1d6ea8cf946d0e17d0a7a)) ### Bug Fixes * adds missing 'on' method for 'guttermousedown' ([7212042](https://github.com/ajaxorg/ace/commit/721204292907549fd4fd02d6672afd2b63d1e168)) * Fix bracket highlighting for brackets in open/close tags ([#5108](https://github.com/ajaxorg/ace/issues/5108)) ([3c149a9](https://github.com/ajaxorg/ace/commit/3c149a97acedd9c9ad52daebaf944aa26534d37f)) * Improves Liquid Support ([#5098](https://github.com/ajaxorg/ace/issues/5098)) ([0ae8dbb](https://github.com/ajaxorg/ace/commit/0ae8dbb0fe017cfb8321307e5bfe5959eb121754)) ## [1.16.0](https://github.com/ajaxorg/ace/compare/v1.14.0...v1.16.0) (2023-03-17) ### Features * Added Editor API to set the ghost text ([#5036](https://github.com/ajaxorg/ace/issues/5036)) ([958d573](https://github.com/ajaxorg/ace/commit/958d57383c4ebfacd414eb817aecc2e0982d1b36)) * Inline autocompletion ([#5084](https://github.com/ajaxorg/ace/issues/5084)) ([eb834a1](https://github.com/ajaxorg/ace/commit/eb834a1f1ca7f922437a90f2f14d935d75f31ac8)) ### Bug Fixes * add updated monospace font for Windows ([#5091](https://github.com/ajaxorg/ace/issues/5091)) ([a981972](https://github.com/ajaxorg/ace/commit/a9819722cec6ff60b028deaa7b70d7fefabac531)) * Added highlighting for TIES keyword introduced in PostgreSQL 13 ([#5033](https://github.com/ajaxorg/ace/issues/5033)) ([9588086](https://github.com/ajaxorg/ace/commit/95880868c2a9912f7c6a2c3942d67fc2a980094e)) * Added lateral keyword introduced in MySQL 8.0.14 ([#5053](https://github.com/ajaxorg/ace/issues/5053)) ([3250956](https://github.com/ajaxorg/ace/commit/32509568010d8b881cc9f1a6d6bd76e6f69360ea)) * editor shadow appears under the selected line background when horizontal scroll is active ([#5020](https://github.com/ajaxorg/ace/issues/5020)) ([ab4f788](https://github.com/ajaxorg/ace/commit/ab4f788455ae182ae133fa202d737efa5461ff79)) * Fix bug with missing token in latex folding ([#5093](https://github.com/ajaxorg/ace/issues/5093)) ([44b3a3e](https://github.com/ajaxorg/ace/commit/44b3a3ef2de40f5cc71c3dedc1ed8d596cfadeec)), closes [#5090](https://github.com/ajaxorg/ace/issues/5090) * Implement highlight mode for PL/SQL (Oracle) dialect ([#5037](https://github.com/ajaxorg/ace/issues/5037)) ([159aa70](https://github.com/ajaxorg/ace/commit/159aa70d551530f2866fb0006fad37bd75e60dda)) * Improve MySQL highlighting mode ([#5050](https://github.com/ajaxorg/ace/issues/5050)) ([00f6089](https://github.com/ajaxorg/ace/commit/00f60890a36121d7c705445514dcf79a81055f55)) * Option to determine specific prefixes for quote insertion ([#5067](https://github.com/ajaxorg/ace/issues/5067)) ([34e769c](https://github.com/ajaxorg/ace/commit/34e769c5b29a68a3c4201fecc75d1287c99f9d51)), closes [#5063](https://github.com/ajaxorg/ace/issues/5063) * Remove broken keybinding from vscode mode ([#5032](https://github.com/ajaxorg/ace/issues/5032)) ([68ff964](https://github.com/ajaxorg/ace/commit/68ff964a214cc2da66e4a35b313ff66dd4490e34)) ### [1.15.3](https://github.com/ajaxorg/ace/compare/v1.15.2...v1.15.3) (2023-03-02) ### [1.15.2](https://github.com/ajaxorg/ace/compare/v1.15.1...v1.15.2) (2023-02-16) ### [1.15.1](https://github.com/ajaxorg/ace/compare/v1.15.0...v1.15.1) (2023-02-13) ### Bug Fixes * Added lateral keyword introduced in MySQL 8.0.14 ([#5053](https://github.com/ajaxorg/ace/issues/5053)) ([3250956](https://github.com/ajaxorg/ace/commit/32509568010d8b881cc9f1a6d6bd76e6f69360ea)) * Implement highlight mode for PL/SQL (Oracle) dialect ([#5037](https://github.com/ajaxorg/ace/issues/5037)) ([159aa70](https://github.com/ajaxorg/ace/commit/159aa70d551530f2866fb0006fad37bd75e60dda)) * Improve MySQL highlighting mode ([#5050](https://github.com/ajaxorg/ace/issues/5050)) ([00f6089](https://github.com/ajaxorg/ace/commit/00f60890a36121d7c705445514dcf79a81055f55)) ## [1.15.0](https://github.com/ajaxorg/ace/compare/v1.14.0...v1.15.0) (2023-01-25) ### Features * Added Editor API to set the ghost text ([#5036](https://github.com/ajaxorg/ace/issues/5036)) ([958d573](https://github.com/ajaxorg/ace/commit/958d57383c4ebfacd414eb817aecc2e0982d1b36)) ### Bug Fixes * Added highlighting for TIES keyword introduced in PostgreSQL 13 ([#5033](https://github.com/ajaxorg/ace/issues/5033)) ([9588086](https://github.com/ajaxorg/ace/commit/95880868c2a9912f7c6a2c3942d67fc2a980094e)) * editor shadow appears under the selected line background when horizontal scroll is active ([#5020](https://github.com/ajaxorg/ace/issues/5020)) ([ab4f788](https://github.com/ajaxorg/ace/commit/ab4f788455ae182ae133fa202d737efa5461ff79)) * Remove broken keybinding from vscode mode ([#5032](https://github.com/ajaxorg/ace/issues/5032)) ([68ff964](https://github.com/ajaxorg/ace/commit/68ff964a214cc2da66e4a35b313ff66dd4490e34)) ## [1.14.0](https://github.com/ajaxorg/ace/compare/v1.13.1...v1.14.0) (2022-12-12) ### Features * Autocomplete accessibility features ([#5008](https://github.com/ajaxorg/ace/issues/5008)) ([3b7bb5e](https://github.com/ajaxorg/ace/commit/3b7bb5e4afbad0f2bdbc7f8487442a5cb78b8284)) ### Bug Fixes * Add missing options to `EditorOptions` ([#5003](https://github.com/ajaxorg/ace/issues/5003)) ([451b63f](https://github.com/ajaxorg/ace/commit/451b63f2243762d6de2fc5b9ee8c580c348b933c)) * added GREATEST|LEAST logical functions added in SQL Server 2022 ([#5009](https://github.com/ajaxorg/ace/issues/5009)) ([e3f3e7a](https://github.com/ajaxorg/ace/commit/e3f3e7ab3efe540ac345325f06278a8ab1871371)) * Better ES6 support for JavaScript Mode ([6fb39e3](https://github.com/ajaxorg/ace/commit/6fb39e38c79dd966233e48ed06be800c59c4c101)) * Fix vim keybindings scroll to the selected line ([#4980](https://github.com/ajaxorg/ace/issues/4980)) ([8562f94](https://github.com/ajaxorg/ace/commit/8562f9493e0ebef865064992f0526fdc6df8535a)) * show 2 context characters of a line when moving to it ([#4998](https://github.com/ajaxorg/ace/issues/4998)) ([743190e](https://github.com/ajaxorg/ace/commit/743190ea71841c0186b2f513b3d1e1a9e30d3de3)) * Update ace.d.ts typings for navigate ([#5011](https://github.com/ajaxorg/ace/issues/5011)) ([a302709](https://github.com/ajaxorg/ace/commit/a30270990cc0041edb6985059915f96524ebb154)) ### [1.13.2](https://github.com/ajaxorg/ace/compare/v1.13.1...v1.13.2) (2022-12-07) ### Bug Fixes * Add missing options to `EditorOptions` ([#5003](https://github.com/ajaxorg/ace/issues/5003)) ([451b63f](https://github.com/ajaxorg/ace/commit/451b63f2243762d6de2fc5b9ee8c580c348b933c)) * Better ES6 support for JavaScript Mode ([6fb39e3](https://github.com/ajaxorg/ace/commit/6fb39e38c79dd966233e48ed06be800c59c4c101)) * Fix vim keybindings scroll to the selected line ([#4980](https://github.com/ajaxorg/ace/issues/4980)) ([8562f94](https://github.com/ajaxorg/ace/commit/8562f9493e0ebef865064992f0526fdc6df8535a)) * show 2 context characters of a line when moving to it ([#4998](https://github.com/ajaxorg/ace/issues/4998)) ([743190e](https://github.com/ajaxorg/ace/commit/743190ea71841c0186b2f513b3d1e1a9e30d3de3)) ### [1.13.1](https://github.com/ajaxorg/ace/compare/v1.13.0...v1.13.1) (2022-11-16) ### Bug Fixes * Change curly braces insertion behavior for Markdown to act the same as for other braces ([#4994](https://github.com/ajaxorg/ace/issues/4994)) ([2760234](https://github.com/ajaxorg/ace/commit/2760234d3d8d1acba72a42df7763482655af5ebc)) * incorrect cursor position for very long lines ([#4996](https://github.com/ajaxorg/ace/issues/4996)) ([e57a9d9](https://github.com/ajaxorg/ace/commit/e57a9d9eef0c056cd38a07c77c460bea39cc9551)) ## [1.13.0](https://github.com/ajaxorg/ace/compare/v1.12.5...v1.13.0) (2022-11-11) ### Features * add highlight mode for Apache JEXL ([#4979](https://github.com/ajaxorg/ace/issues/4979)) ([4e8926e](https://github.com/ajaxorg/ace/commit/4e8926ef9f9207e57529e07cdbe2305b09e712e2)) ### Bug Fixes * Add missing options to `VirtualRendererOptions` and `EditorOptions` ([#4983](https://github.com/ajaxorg/ace/issues/4983)) ([19dd2ec](https://github.com/ajaxorg/ace/commit/19dd2ecc178bef2fedd6a53900f2db58ea7a3c23)) * Fix of scroll while interrupting animation ([#4993](https://github.com/ajaxorg/ace/issues/4993)) ([0092f3f](https://github.com/ajaxorg/ace/commit/0092f3f8c1f0d9c8a0b8bebe58cc3517931697b7)) * rare case when document passed to `dom.scrollbarWidth` doesn't have `documentElement` ([#4981](https://github.com/ajaxorg/ace/issues/4981)) ([df44158](https://github.com/ajaxorg/ace/commit/df441585ef44e17a027141e3ceed648e104e9cf9)) ### [1.12.5](https://github.com/ajaxorg/ace/compare/v1.12.4...v1.12.5) (2022-11-01) ### Bug Fixes * enableLiveAutocompletion documentation ([#4976](https://github.com/ajaxorg/ace/issues/4976)) ([987ab76](https://github.com/ajaxorg/ace/commit/987ab7602e06acc9b08c75914f5c1335d5cdc8cc)) * vim "normal" mode brackets highlighting ([0fbc54c](https://github.com/ajaxorg/ace/commit/0fbc54cc5130b0271928995660413ba0fab678cb)) ### [1.12.4](https://github.com/ajaxorg/ace/compare/v1.12.3...v1.12.4) (2022-10-31) ### Bug Fixes * Open valid url under cursor ([#4970](https://github.com/ajaxorg/ace/issues/4970)) ([bf2913a](https://github.com/ajaxorg/ace/commit/bf2913a71624e94d13727115b2aa0ef0c279c89f)) * Update for Csound 6.18.0 ([#4974](https://github.com/ajaxorg/ace/issues/4974)) ([6886b02](https://github.com/ajaxorg/ace/commit/6886b0233e9e1d8d6cce5d3ade7b27fe4527c940)) * update/add missing demo samples ([#4975](https://github.com/ajaxorg/ace/issues/4975)) ([2b8236e](https://github.com/ajaxorg/ace/commit/2b8236eaf1df10caa9ff45a06902df14947cd968)) ### [1.12.3](https://github.com/ajaxorg/ace/compare/v1.12.2...v1.12.3) (2022-10-18) ### Bug Fixes * Fix syntax error in the custom scroll CSS ([#4968](https://github.com/ajaxorg/ace/issues/4968)) ([f2a424a](https://github.com/ajaxorg/ace/commit/f2a424a649f655b9511b1bb6047097634edb0e3f)) ### [1.12.2](https://github.com/ajaxorg/ace/compare/v1.12.1...v1.12.2) (2022-10-18) ### Bug Fixes * custom scrollbar breaks csp mode ([#4967](https://github.com/ajaxorg/ace/issues/4967)) ([be8eb12](https://github.com/ajaxorg/ace/commit/be8eb1236fb7e1d27cedf033d301f094ec6764e5)) * find all in range bug ([13bd553](https://github.com/ajaxorg/ace/commit/13bd55348dc8de5c547c74ec0e48c52b6db96a26)) * Namespace-relative names for php ([#4963](https://github.com/ajaxorg/ace/issues/4963)) ([96e4066](https://github.com/ajaxorg/ace/commit/96e4066341fb7b82d02ad8272929711073d3bfc4)) ### [1.12.1](https://github.com/ajaxorg/ace/compare/v1.12.0...v1.12.1) (2022-10-17) ### Bug Fixes * php worker rules for T_NAME_FULLY_QUALIFIED ([#4960](https://github.com/ajaxorg/ace/issues/4960)) ([52dbb05](https://github.com/ajaxorg/ace/commit/52dbb0577693e29f124a1f16008b4e11e2ce7c02)) * recognisition of uppercase hex numbers for stylus mode ([#4962](https://github.com/ajaxorg/ace/issues/4962)) ([87e0dc7](https://github.com/ajaxorg/ace/commit/87e0dc7b868798300e874e39304aeda18d3d1a76)) ## [1.12.0](https://github.com/ajaxorg/ace/compare/v1.11.2...v1.12.0) (2022-10-15) ### Features * implement BibTeX mode highlighting ([ab9e191](https://github.com/ajaxorg/ace/commit/ab9e1916cb3363260de58b808bdc21fd6bc01618)) ### Bug Fixes * `MockDom's` `ClassList` `toggle` and `contains` methods return `boolean` instead of `void` ([e8c0a1f](https://github.com/ajaxorg/ace/commit/e8c0a1f35d302966626896aaf84b056e76a8e66e)) * change lua version to 5.3 ([#4954](https://github.com/ajaxorg/ace/issues/4954)) ([fc56af5](https://github.com/ajaxorg/ace/commit/fc56af5936a2ebfdfa0871ca6a68ccf7ecc7dbf0)) * documentation for TokenIterator methods ([#4955](https://github.com/ajaxorg/ace/issues/4955)) ([6bff7b4](https://github.com/ajaxorg/ace/commit/6bff7b43c7ad34dd5fafc81c5de773e9d709026d)) * Fixed comment folding bugs for html (xml like languages) ([#4910](https://github.com/ajaxorg/ace/issues/4910)) ([5279a8a](https://github.com/ajaxorg/ace/commit/5279a8a71719bf5c7099db1774a3d9669d9e5694)) * mode change for vim tests ([236a31e](https://github.com/ajaxorg/ace/commit/236a31e5d69fd4fd874b667b38dd1bf0685f75c5)) * php worker rules for `T_NAME_FULLY_QUALIFIED`, `T_NAME_QUALIFIED`, `T_NAME_RELATIVE` namespaced names tokens ([#4948](https://github.com/ajaxorg/ace/issues/4948)) ([059ff71](https://github.com/ajaxorg/ace/commit/059ff7186ac95d38fa11821488c847d3786d3486)) * tools to work with new ace project structure ([7894c4b](https://github.com/ajaxorg/ace/commit/7894c4bbc6da5eb3521efb3b89b1a189202c2497)) ### [1.11.2](https://github.com/ajaxorg/ace/compare/v1.11.1...v1.11.2) (2022-09-26) ### Bug Fixes * Fixed handling surrogare characters in insert, replace, delete mode in Vim ([72fd4b7](https://github.com/ajaxorg/ace/commit/72fd4b7b616f070be198dc8fc437d48a74637a53)) * Fixed handling surrogate characters in insert-after mode in Vim ([38f893a](https://github.com/ajaxorg/ace/commit/38f893a13b1f1dedea4407a8f3ef1d6098873269)) ### [1.11.1](https://github.com/ajaxorg/ace/compare/v1.11.0...v1.11.1) (2022-09-23) ### Bug Fixes * Discrepancy between keywords used by mode-aql.js in the current version and the version used by arangodb ([1503dd0](https://github.com/ajaxorg/ace/commit/1503dd06f2d651d16af964978fb8c62e0304b6d6)) * The editor can be crashed by passing in undefined into the setValue method ([56e6e56](https://github.com/ajaxorg/ace/commit/56e6e56137ea5717009e3687019f64dae7f88da2)) * Update vim mode ([#4933](https://github.com/ajaxorg/ace/issues/4933)) ([3b89ed0](https://github.com/ajaxorg/ace/commit/3b89ed06069cb45edb59b7442b5cc6c15b33cfa4)) ## [1.11.0](https://github.com/ajaxorg/ace/compare/v1.10.1...v1.11.0) (2022-09-20) ### Features * add gutter indicators for annotations; add custom scrollbar to display gutter indicators ([62fb0d8](https://github.com/ajaxorg/ace/commit/62fb0d8fba813241d01356962ed20ac868a29ede)) ### Bug Fixes * change scroll behaviour for `onmousedown` to immediate scroll to point ([392b224](https://github.com/ajaxorg/ace/commit/392b224ceb4e82b4d906c36aef2ea4953e3d440e)) * Do not try apply highlight indent guide if the file is empty ([#4928](https://github.com/ajaxorg/ace/issues/4928)) ([a90ef27](https://github.com/ajaxorg/ace/commit/a90ef275298b524c493076e47aae13036f6e6271)) * restrict annotation mark max height and optimise marks coords on canvas ([a6e2259](https://github.com/ajaxorg/ace/commit/a6e2259eb0a282c62fd9e6fde31d86b6c14ec06d)) ### [1.10.1](https://github.com/ajaxorg/ace/compare/v1.10.0...v1.10.1) (2022-09-06) ### Bug Fixes * prevent javascript snippets file confusing old packagers ([#4917](https://github.com/ajaxorg/ace/issues/4917)) ([5d7b65c](https://github.com/ajaxorg/ace/commit/5d7b65c30aff0106a7001f68ecdf13a23893eaad)) ## [1.10.0](https://github.com/ajaxorg/ace/compare/v1.9.6...v1.10.0) (2022-08-31) ### Features * editor option for indent guide highlighting ([f1f6517](https://github.com/ajaxorg/ace/commit/f1f6517a30d6819d1c8ca045744cdeb2925ccf0a)) ### Bug Fixes * add mock `getHighlightIndentGuides` and `setHighlightIndentGuides` for old tests to work ([4067512](https://github.com/ajaxorg/ace/commit/4067512a72934b23a0866eca33812425c37a7363)) * added "flex-start" and "flex-end" ([#4912](https://github.com/ajaxorg/ace/issues/4912)) ([3e14988](https://github.com/ajaxorg/ace/commit/3e14988209354f94483307f168705690e15adaf5)) * Fix problematic semicolon in CSS media queries ([#4849](https://github.com/ajaxorg/ace/issues/4849)) ([18a459a](https://github.com/ajaxorg/ace/commit/18a459a26430bfa58e0f798c4bacce6a799c77bd)) * more optimal way to accessing an element's list of classes; mark `highlightIndentGuide` as internal property ([855a874](https://github.com/ajaxorg/ace/commit/855a874ffde4824bb8de6e56cb44fad64d49725b)) * strictly equal instead of loosely ([d4c1ab8](https://github.com/ajaxorg/ace/commit/d4c1ab8ef6ee608e2570b7ca6d1d941c5a6628a9)) * Updated Jshint to 2.13.5 ([#4911](https://github.com/ajaxorg/ace/issues/4911)) ([2401fbd](https://github.com/ajaxorg/ace/commit/2401fbd93f0d61cc01150c1071145e974dd6693f)) ### [1.9.6](https://github.com/ajaxorg/ace/compare/v1.9.5...v1.9.6) (2022-08-17) ### Bug Fixes * better way to extract css for csp environments ([1b0612b](https://github.com/ajaxorg/ace/commit/1b0612b5a5ed33a2f1931e4aa08cb2d54ec8585c)) ### [1.9.5](https://github.com/ajaxorg/ace/compare/v1.9.4...v1.9.5) (2022-08-10) ### Bug Fixes * reverted fix build script CSS extract with `options.compress` ([#4894](https://github.com/ajaxorg/ace/issues/4894)) ([8fa4500](https://github.com/ajaxorg/ace/commit/8fa45008887c957bc9c78c65e805e73240f2b33f)) ### [1.9.4](https://github.com/ajaxorg/ace/compare/v1.9.2...v1.9.4) (2022-08-09) ### [1.9.3](https://github.com/ajaxorg/ace/compare/v1.9.2...v1.9.3) (2022-08-08) ### [1.9.2](https://github.com/ajaxorg/ace/compare/v1.9.1...v1.9.2) (2022-08-08) ### [1.9.1](https://github.com/ajaxorg/ace/compare/v1.9.0...v1.9.1) (2022-08-08) ## [1.9.0](https://github.com/ajaxorg/ace/compare/v1.8.1...v1.9.0) (2022-08-08) ### Features * added ability to limit amount of undos/redos ([#4872](https://github.com/ajaxorg/ace/issues/4872)) ([897ee0a](https://github.com/ajaxorg/ace/commit/897ee0a071ef4341338a285a1d9d8781fe5689de)) * publish Ace source code to ace-code NPM package ([#4881](https://github.com/ajaxorg/ace/issues/4881)) ([66cf041](https://github.com/ajaxorg/ace/commit/66cf0418bedf221a507d9a173583538c97885410)) ### Bug Fixes * Fix determination of anonymous code blocks in Postgres Mode (fixes [#4790](https://github.com/ajaxorg/ace/issues/4790)) ([06f7e22](https://github.com/ajaxorg/ace/commit/06f7e2290543ca6566aab56228a8fc8daddfcf55)) * Fixed Ace typings ([23208f2](https://github.com/ajaxorg/ace/commit/23208f2f19020d1f69b90bc3b02460bda8422072)) * Fixed jsDoc annotations ([e15abb4](https://github.com/ajaxorg/ace/commit/e15abb443abfad2de59c620ce49fc5498ce6d33e)), closes [#4879](https://github.com/ajaxorg/ace/issues/4879) * refactor of kotlin mode to simplify states and resolve incorrect highlights ([a30a99d](https://github.com/ajaxorg/ace/commit/a30a99df731c2f10c2006181ca58a96e7fc21155)) * returned precise highlight for functions params, generics and types ([967aa6b](https://github.com/ajaxorg/ace/commit/967aa6b05c4a69a5deac1b20c297648444ade7d6)) * Rust identifiers normally recognised now; generics highlight support; doc comments support ([#4868](https://github.com/ajaxorg/ace/issues/4868)) ([bbb5800](https://github.com/ajaxorg/ace/commit/bbb5800b4cf56d2996691edc63edc2783e19f427)) ### [1.8.1](https://github.com/ajaxorg/ace/compare/v1.8.0...v1.8.1) (2022-07-21) ### Bug Fixes * prevent race condition when creating css files in build ([1777bfb](https://github.com/ajaxorg/ace/commit/1777bfb7dca4dcaf575293ac9cacbc284f692351)) ## [1.8.0](https://github.com/ajaxorg/ace/compare/v1.7.1...v1.8.0) (2022-07-20) ### Features * Use mini require ([#4845](https://github.com/ajaxorg/ace/issues/4845)) ([b9fabd4](https://github.com/ajaxorg/ace/commit/b9fabd47c0765d40117809cd3978b95d593370fb)) ### Bug Fixes * add undocumented Target command ([62e8e9e](https://github.com/ajaxorg/ace/commit/62e8e9e4d3b21552dd83d454b7fd55d4981d096a)), closes [#4839](https://github.com/ajaxorg/ace/issues/4839) * added NSIS 3.08 commands ([acad68c](https://github.com/ajaxorg/ace/commit/acad68cf92f5372257b061e300e31f71df9c62e9)), closes [#4838](https://github.com/ajaxorg/ace/issues/4838) * **bidihandler:** check for undefined before access length property on `splits` variable ([457b657](https://github.com/ajaxorg/ace/commit/457b65748f331740ded529fd7bbd06b86819fa4e)) * correct highlight of php heredoc strings with one word on line ([ae4564c](https://github.com/ajaxorg/ace/commit/ae4564c2961b006ca849625a0dee1093061eba5a)) * Fixed typo in Nord Dark theme. ([#4843](https://github.com/ajaxorg/ace/issues/4843)) ([38bf666](https://github.com/ajaxorg/ace/commit/38bf6663f43be1c45bfba3dc68c4a4820fb2661d)) * Move session.onChange and placeholder.onChange handlers to be first in the change event handler queue ([bcb51f2](https://github.com/ajaxorg/ace/commit/bcb51f2b2a2ba2e1f30ebf543d97e7450574763f)) * reuse `getTargetDir` function ([b89c4db](https://github.com/ajaxorg/ace/commit/b89c4db3424687856ff9c9e732435c35438b0cb9)) * type declarations ([a8830fc](https://github.com/ajaxorg/ace/commit/a8830fc83708a7e51053038f1c6d7fde23e82e9d)) ### [1.7.1](https://github.com/ajaxorg/ace/compare/v1.7.0...v1.7.1) (2022-06-29) ### Bug Fixes * Fixed accessing properties when err is null in onerror handler ([3b62a07](https://github.com/ajaxorg/ace/commit/3b62a0713e68fd76bfa9c52fa2112b56888d2349)) * Uncaught TypeError: Cannot read properties of undefined in worker code ([ce068ac](https://github.com/ajaxorg/ace/commit/ce068ac29f0056f6a10d0fc99181b8ba3e274cfe)) ## [1.7.0](https://github.com/ajaxorg/ace/compare/v1.6.1...v1.7.0) (2022-06-28) ### Features * Add Robot Framework syntax highlighting ([773c0c5](https://github.com/ajaxorg/ace/commit/773c0c5d8b87fabb643d8c1e2053f536c53318e8)), closes [#4614](https://github.com/ajaxorg/ace/issues/4614) * Added YAML language linter ([451f915](https://github.com/ajaxorg/ace/commit/451f915e645f8a172098316196ae2e029fc26aed)), closes [#3979](https://github.com/ajaxorg/ace/issues/3979) ### Bug Fixes * Added two tmthemes gruvbox dark (hard) and light (hard) ([6b1e67f](https://github.com/ajaxorg/ace/commit/6b1e67f844056fd238a35094e8f4e4b197e0a9a4)), closes [#3673](https://github.com/ajaxorg/ace/issues/3673) * adds ignore browserified dir to eslintignore ([56b591b](https://github.com/ajaxorg/ace/commit/56b591b49673fcd062fd53325f74629d4cf45e3f)) * Allow setAnnotations to use custom className ([f505879](https://github.com/ajaxorg/ace/commit/f505879d0463a8b2781e0e7caaaa857444d51f85)), closes [#4362](https://github.com/ajaxorg/ace/issues/4362) * Avoid substitutions when Webpack was introduced ([a540323](https://github.com/ajaxorg/ace/commit/a540323e933c6bad164bdc9f103d8de744ee1546)), closes [#4476](https://github.com/ajaxorg/ace/issues/4476) * Highlighting DISTINCT keyword in SQL ([fb3820a](https://github.com/ajaxorg/ace/commit/fb3820a9c1624c49a149d388bf26aa3d504704bb)), closes [#4399](https://github.com/ajaxorg/ace/issues/4399) * Make sure completions aren't null or undefined ([a78e127](https://github.com/ajaxorg/ace/commit/a78e127e8fd7d724b96208447caa384783616323)), closes [#4608](https://github.com/ajaxorg/ace/issues/4608) ### [1.6.1](https://github.com/ajaxorg/ace/compare/v1.6.0...v1.6.1) (2022-06-24) ### Bug Fixes * Highlight unicode characters in Python function and class names ([be6f2d1](https://github.com/ajaxorg/ace/commit/be6f2d125a8ffe70ceb336051da6a161ce9cf1bc)) * Incorrect YAML syntax highlighting for version numbers with multiple periods ([049d761](https://github.com/ajaxorg/ace/commit/049d76131e6122f7397fb30cc341db34baaf2813)) * Incorrect YAML syntax highlighting for version numbers with multiple periods [#4827](https://github.com/ajaxorg/ace/issues/4827) ([915fcaf](https://github.com/ajaxorg/ace/commit/915fcaf542469a7dc0e3e7235f23a66a3abaadb9)) ## [1.6.0](https://github.com/ajaxorg/ace/compare/v1.5.3...v1.6.0) (2022-06-10) ### Bug Fixes * Add class to tooltip DOM element distinguish errors from warnings ([#4810](https://github.com/ajaxorg/ace/issues/4810)) ([d2446d6](https://github.com/ajaxorg/ace/commit/d2446d68e7ace4d1a860de6a5a3e5031f074161b)) * Autocomplete stopped working after upgrade to v1.5.2 ([48e6b60](https://github.com/ajaxorg/ace/commit/48e6b601ad5ae03a99a341843194c3854d2376c2)) * Fix css EOF duplicate errors [#4816](https://github.com/ajaxorg/ace/issues/4816) ([48176f6](https://github.com/ajaxorg/ace/commit/48176f66c8ca0dd239968329b471f55b548ee467)) * Fix overflow button for long lines with one token ([#4818](https://github.com/ajaxorg/ace/issues/4818)) ([3f93451](https://github.com/ajaxorg/ace/commit/3f934510514a25c53edf64bb80911a96b7133908)) ### [1.5.3](https://github.com/ajaxorg/ace/compare/v1.5.2...v1.5.3) (2022-05-31) ### Bug Fixes * Colors for variable, function and constant should be different ([#4802](https://github.com/ajaxorg/ace/issues/4802)) ([9e81bda](https://github.com/ajaxorg/ace/commit/9e81bdafc3d563421cae458259d4c4e1b449a237)) ### [1.5.2](https://github.com/ajaxorg/ace/compare/v1.5.1...v1.5.2) (2022-05-30) ### Bug Fixes * Added es6-shim library to fix old browsers ([#4720](https://github.com/ajaxorg/ace/issues/4720)) ([5ba71a0](https://github.com/ajaxorg/ace/commit/5ba71a0b8b0804d8cb385f7b2ee6b63e9bd1c3b8)) * Added mockdom.before method ([#4724](https://github.com/ajaxorg/ace/issues/4724)) ([ffedba3](https://github.com/ajaxorg/ace/commit/ffedba3e18138d7739285d1a9b945d01d384948e)) * Added support for cjs, mjs and log modes ([#4718](https://github.com/ajaxorg/ace/issues/4718)) ([375498a](https://github.com/ajaxorg/ace/commit/375498a12ff28cf955224baf60d242421817220d)) * Adds missed functions into `php_completions.js` ([#4726](https://github.com/ajaxorg/ace/issues/4726)) ([7d5f4b8](https://github.com/ajaxorg/ace/commit/7d5f4b83f3ecc854e70f1508e9247e39ca9de30a)) * Cannot read property of null for bgTokenizer after session is destroyed ([#4713](https://github.com/ajaxorg/ace/issues/4713)) ([d604f52](https://github.com/ajaxorg/ace/commit/d604f52d60e3ec2dced126337ad46a2cf71bf294)) * Do not render selected word markers for the same range multiple times ([#4727](https://github.com/ajaxorg/ace/issues/4727)) ([cd30f59](https://github.com/ajaxorg/ace/commit/cd30f591e40d5286fdabaa9f688f3c6066fbffff)) * Fixed popup CSS styling ([#4728](https://github.com/ajaxorg/ace/issues/4728)) ([045a3e6](https://github.com/ajaxorg/ace/commit/045a3e652ec37b1ab3b716cdf2bc24967a75eb77)) * Fixed scrolling code lenses into view ([#4717](https://github.com/ajaxorg/ace/issues/4717)) ([710b14a](https://github.com/ajaxorg/ace/commit/710b14a7709d7499a4d182ad707b3cbbb6e73a64)) * Multiple improvements for Ace themes ([#4715](https://github.com/ajaxorg/ace/issues/4715)) ([87ad55d](https://github.com/ajaxorg/ace/commit/87ad55daf243bdc619e15fbf220dc5ded235ed4c)) * Only send postMessage through worker if it's defined ([#4722](https://github.com/ajaxorg/ace/issues/4722)) ([2afa4bf](https://github.com/ajaxorg/ace/commit/2afa4bf91bbc99f29bd0a7c1f0adc600af2ceeae)) * Pass additional arguments for command.exec ([#4723](https://github.com/ajaxorg/ace/issues/4723)) ([3b36762](https://github.com/ajaxorg/ace/commit/3b36762c045246efbc2e11eaa08d20a90142d26f)) * Removed focussing after timeout in text input ([#4716](https://github.com/ajaxorg/ace/issues/4716)) ([f8ea48f](https://github.com/ajaxorg/ace/commit/f8ea48f1fe6362696ed30e01030e75c117ce4323)) * Throw invalid delta error if change is out of range and added V2 for worker and worker client ([#4721](https://github.com/ajaxorg/ace/issues/4721)) ([f269889](https://github.com/ajaxorg/ace/commit/f2698895d6617f1c7ebeed14b7ecbb1c5d71bb51)) * Updated ace typings ([#4714](https://github.com/ajaxorg/ace/issues/4714)) ([d5d6f9a](https://github.com/ajaxorg/ace/commit/d5d6f9a32ad443d02aa89d9f140917637f5f52ab)) ### [1.5.1](https://github.com/ajaxorg/ace/compare/v1.5.0...v1.5.1) (2022-05-23) ### Bug Fixes * Correctly tokenize YAML meta tags with non alphabetical characters after multiline string ([#4706](https://github.com/ajaxorg/ace/issues/4706)) ([0164811](https://github.com/ajaxorg/ace/commit/0164811fd95ecae9a46ce6fd7278e9c8b0b48eed)) * Made commas be tokenized as punctuation operator instead of text in JSON ([#4703](https://github.com/ajaxorg/ace/issues/4703)) ([4c4883a](https://github.com/ajaxorg/ace/commit/4c4883a854836b652dbb798b78f207ae4b1924b8)) * Multiple Partiql and Amazon Ion textual notation fixes ([#4686](https://github.com/ajaxorg/ace/issues/4686)) ([bffba8d](https://github.com/ajaxorg/ace/commit/bffba8d934773bc9236d741f1a1ce2237a971b3e)) * PHP syntax fix for AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG ([#4705](https://github.com/ajaxorg/ace/issues/4705)) ([d59c22b](https://github.com/ajaxorg/ace/commit/d59c22b603eaa9d688249a3cc11812e641f25426)) * Python functions should be highlighted as functions ([#4708](https://github.com/ajaxorg/ace/issues/4708)) ([b2aaf1f](https://github.com/ajaxorg/ace/commit/b2aaf1f5644397959bd8c94e9e705da176242edd)) * Updated PHP mode to support PHP8.1 syntax ([#4696](https://github.com/ajaxorg/ace/issues/4696)) ([33cf1c6](https://github.com/ajaxorg/ace/commit/33cf1c66af970edaf7eb0a468276fca249b8a5c8)) ## [1.5.0](https://github.com/ajaxorg/ace/compare/v1.4.14...v1.5.0) (2022-05-12) ### Features * Added ability to configure certain format options for beautify extension ([20275de](https://github.com/ajaxorg/ace/commit/20275de79c40636d27d5ce293cf528c915338fbd)) ### Bug Fixes * Modify syntax ([b78d772](https://github.com/ajaxorg/ace/commit/b78d77240e1909b9d91fcd2ac35a4c17af05f56b)) * Render bidirectional unicode characters as control characters ([#4693](https://github.com/ajaxorg/ace/issues/4693)) ([4d2ecf0](https://github.com/ajaxorg/ace/commit/4d2ecf08afeb1556f2511a1423729c2549802da8)) 2022.01.26 Version 1.4.14 - update vim mode - remove slow regex in beautify extension 2021.09.30 Version 1.4.13 - added useStrictCSP global option to use in environments where dynamic style creation is disabled see demo/csp.html for an example of a page which loads external css files instead of generating styles with javascript - updated vim mode, added support for gqq command 2020.07.06 Version 1.4.12 - removed unused es5-shim - imporved ruby and vbscript highlighting and folding - workaround for double space being converted to dot on mobile keyboards 2020.04.15 Version 1.4.10 - added workaround for chrome bug causing memory leak after calling editor.destroy - added code folding support for vbscript mode 2020.04.01 Version 1.4.9 - added option to disable autoindent - added new language modes - fixed backspace not working with some mobile keyboards 2020.01.14 Version 1.4.8 - highlight both matched braces, and highlight unmatched brace in red - improve snippet manager - compatibility with webpack file-loader v5 - improve vim mode 2019.10.17 Version 1.4.7 - add placeholder option 2019.09.08 Version 1.4.6 - restore native behavior of ctrl-p on mac (jumptomatching command is moved to cmd-\) - improve snippet manager - fix backspace handling on mobile 2019.06.17 Version 1.4.5 - improve scrolling and selection on mobile - improve type definitions 2019.04.24 Version 1.4.4 - add experimental command prompt - add chrystal, nim and nginx highlight rules - fix regression in vim mode on ios 2019.02.21 Version 1.4.3 - add sublime keybindings - add rtl option - implement ` and < textobjects in vim mode 2018.11.21 Version 1.4.2 - fix regression in vim mode - improve keyboard input handling on ipad and IE - add new syntax highlighters 2018.08.07 Version 1.4.1 - fix regression in autocomplete 2018.08.06 Version 1.4.0 - remove usage of innerHTML - improved handling of textinput for IME and mobile - add support for relative line numbers - improve autocompletion popup 2018.03.26 Version 1.3.3 - fix regession in static-highlight extension - use css animation for cursor blinking 2018.03.21 Version 1.3.2 - add experimental support for using ace-builds with webpack 2018.02.11 Version 1.3.1 - fixed regression with selectionChange event not firing some times - improved handling of non-ascii characters in vim normal mode 2018.01.31 Version 1.3.0 - added copy copyWithEmptySelection option - improved undoManager - improved settings_menu plugin - improved handling of files with very long lines - fixed bug with scrolling editor out of view in transformed elements 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: CNAME ================================================ ace.c9.io ================================================ FILE: CODE_OF_CONDUCT.md ================================================ ## Code of Conduct This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact opensource-codeofconduct@amazon.com with any additional questions or comments. ================================================ 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. Do make sure that your changes are covered by test cases to pass the pull request checks which exists inorder to keep ace robust. Happy coding, Cloud9 ================================================ 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 ***** */ /*global Buffer, setImmediate*/ var fs = require("fs"); var path = require("path"); var copy = require('architect-build/copy'); var build = require('architect-build/build'); var { updateDeclarationModuleNames, generateDeclaration, SEPARATE_MODULES } = require('./tool/ace_declaration_generator'); var ACE_HOME = __dirname; var BUILD_DIR = ACE_HOME + "/build"; var CACHE = {}; function generateAmdModules() { var root = ACE_HOME + "/"; function iterate(dir) { var filenames = fs.readdirSync(root + dir); filenames.forEach(function(name) { var path = dir + name; var stat = fs.statSync(root + path); var newPath = path.replace("src", "lib/ace"); if (stat.isDirectory()) { try { fs.mkdirSync(root + newPath); } catch(e) {} iterate(path + "/"); } else if (/\.js/.test(name) && !/worker_client\.js$/.test(name)) { transform(path, newPath); } }); } function transform(path, newPath) { var data = fs.readFileSync(root + path, "utf-8"); data = "define(function(require, exports, module){" + compileTypescript(data) +"\n});"; fs.writeFileSync(root + newPath, data, "utf-8"); } function compileTypescript(code) { var ts = require("typescript"); return ts.transpileModule(code, { compilerOptions: { newLine: "lf", downlevelIteration: true, suppressExcessPropertyErrors: true, module: ts.ModuleKind.CommonJS, removeComments: false, sourceMap: false, inlineSourceMap: false, target: "ES5" }, fileName: "" }).outputText; } iterate("src/"); } 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 || args.indexOf("-h") != -1 || args.indexOf("--help") != -1) { return showHelp(); } if (type == "css") { return extractCss(); } if (type == "nls") { return extractNls(); } if (args.indexOf("--reuse") === -1) { console.log("updating files in lib/ace"); generateAmdModules(); } 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(" css extract css files"); console.log(" nls extract nls messages"); 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.md", BUILD_DIR + "/CHANGELOG.md"); console.log('# ace ---------'); for (var i = 0; i < 4; i++) { buildAce({compress: i & 2, noconflict: i & 1, check: true}); } } function correctDeclarationsForBuild(path, additionalDeclarations) { var definitions = fs.readFileSync(path, 'utf8'); var newDefinitions = updateDeclarationModuleNames(definitions); if (additionalDeclarations) { newDefinitions = newDefinitions + '\n' + additionalDeclarations; } if (/ace\.d\.ts$/.test(path)) { var aceRequire = "$1\n export function require(name: string): any;"; newDefinitions = newDefinitions.replace(/(declare\smodule\s"ace\-builds"\s{)/, aceRequire); } fs.writeFileSync(path, newDefinitions); } function buildTypes() { // ace-builds package has different structure and can't use mode types defined for the ace-code. var paths = fs.readdirSync(BUILD_DIR + '/src-noconflict'); var typeDir = BUILD_DIR + "/types"; if (!fs.existsSync(typeDir)) { fs.mkdirSync(typeDir); } fs.readdirSync(BUILD_DIR + '/src-noconflict/snippets').forEach(function(path) { paths.push("snippets/" + path); }); var moduleNameRegex = /^(keybinding)-/; var pathModules = [ "declare module 'ace-builds/webpack-resolver';", "declare module 'ace-builds/esm-resolver';", "declare module 'ace-builds/src-noconflict/ace';" ].concat(paths.map(function(path) { if (moduleNameRegex.test(path)) { var moduleName = path.split('.')[0]; return "declare module 'ace-builds/src-noconflict/" + moduleName + "';"; } }).filter(Boolean)).join("\n") + "\n"; fs.copyFileSync(ACE_HOME + '/ace-internal.d.ts', BUILD_DIR + '/ace.d.ts'); generateDeclaration(BUILD_DIR + '/ace.d.ts'); fs.copyFileSync(ACE_HOME + '/ace-modes.d.ts', BUILD_DIR + '/ace-modes.d.ts'); correctDeclarationsForBuild(BUILD_DIR + '/ace.d.ts', pathModules); correctDeclarationsForBuild(BUILD_DIR + '/ace-modes.d.ts'); let allModules = SEPARATE_MODULES; allModules.push("modules"); // core modules allModules.forEach(function (key) { let fileName = '/ace-' + key + '.d.ts'; fs.copyFileSync(ACE_HOME + '/types' + fileName, BUILD_DIR + '/types' + fileName); correctDeclarationsForBuild(BUILD_DIR + '/types' + fileName); }); var esmUrls = []; var loader = paths.map(function(path) { if (/\.js$/.test(path) && !/^ace\.js$/.test(path)) { var moduleName = path.split('.')[0].replace(/-/, "/"); if (/^worker/.test(moduleName)) moduleName = "mode" + moduleName.slice(6) + "_worker"; moduleName = moduleName.replace(/keybinding/, "keyboard"); esmUrls.push("ace.config.setModuleLoader('ace/" + moduleName + "', () => import('./src-noconflict/" + path + "'));"); return "ace.config.setModuleUrl('ace/" + moduleName + "', require('file-loader?esModule=false!./src-noconflict/" + path + "'));"; } }).join('\n'); var esmLoader = esmUrls.join('\n'); fs.writeFileSync(BUILD_DIR + '/webpack-resolver.js', loader, "utf8"); fs.writeFileSync(BUILD_DIR + '/esm-resolver.js', esmLoader, "utf8"); } 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(" ``` *Exploring configuration options [Configuring-Ace](https://github.com/ajaxorg/ace/wiki/Configuring-Ace/)* 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 [https://ajaxorg.github.io/ace-api-docs/](https://ajaxorg.github.io/ace-api-docs/). 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 ask a question on our [discussions page](https://github.com/ajaxorg/ace/discussions). 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 npm run test ``` You can also run the tests in your browser by serving: http://localhost:8888/src/test/tests.html This makes debugging failing tests much 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). ================================================ FILE: _config.yml ================================================ # Config file for Jekyll, which is used by GH pages to build the Ace website. # Some files in the docs folder can cause Jekyll to trip up so we ignore those. # https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll exclude: - "demo/kitchen-sink/docs" ================================================ FILE: ace-internal.d.ts ================================================ export namespace Ace { type Anchor = import("./src/anchor").Anchor; type Editor = import("./src/editor").Editor; type EditSession = import("./src/edit_session").EditSession; type Document = import("./src/document").Document; type Fold = import("./src/edit_session/fold").Fold; type FoldLine = import("./src/edit_session/fold_line").FoldLine; type Range = import("./src/range").Range; type VirtualRenderer = import("./src/virtual_renderer").VirtualRenderer; type UndoManager = import("./src/undomanager").UndoManager; type Tokenizer = import("./src/tokenizer").Tokenizer; type TokenIterator = import("./src/token_iterator").TokenIterator; type Selection = import("./src/selection").Selection; type Autocomplete = import("./src/autocomplete").Autocomplete; type InlineAutocomplete = import("./src/ext/inline_autocomplete").InlineAutocomplete; type CompletionProvider = import("./src/autocomplete").CompletionProvider; type AcePopup = import("./src/autocomplete/popup").AcePopup; type AceInline = import("./src/autocomplete/inline").AceInline; type MouseEvent = import("./src/mouse/mouse_event").MouseEvent; type RangeList = import("./src/range_list").RangeList; type FilteredList = import("./src/autocomplete").FilteredList; type LineWidgets = import("./src/line_widgets").LineWidgets; type SearchBox = import("./src/ext/searchbox").SearchBox; type Occur = import("./src/occur").Occur; type DefaultHandlers = import("./src/mouse/default_handlers").DefaultHandlers; type GutterHandler = import("./src/mouse/default_gutter_handler").GutterHandler; type DragdropHandler = import("./src/mouse/dragdrop_handler").DragdropHandler; type AppConfig = import("./src/lib/app_config").AppConfig; type Config = typeof import("./src/config"); type GutterTooltip = import( "./src/mouse/default_gutter_handler").GutterTooltip; type GutterKeyboardEvent = import( "./src/keyboard/gutter_handler").GutterKeyboardEvent; type HoverTooltip = import("./src/tooltip").HoverTooltip; type Tooltip = import("./src/tooltip").Tooltip; type TextInput = import("./src/keyboard/textinput").TextInput; type DiffChunk = import("./src/ext/diff/base_diff_view").DiffChunk; type AfterLoadCallback = (err: Error | null, module: unknown) => void; type LoaderFunction = (moduleName: string, afterLoad: AfterLoadCallback) => void; export interface ConfigOptions { packaged: boolean, workerPath: string | null, modePath: string | null, themePath: string | null, basePath: string, suffix: string, $moduleUrls: { [url: string]: string }, loadWorkerFromBlob: boolean, sharedPopups: boolean, useStrictCSP: boolean | null } interface Theme { cssClass?: string; cssText?: string; $id?: string; padding?: number | string; isDark?: boolean; } interface ScrollBar { setVisible(visible: boolean): void; [key: string]: any; } interface HScrollbar extends ScrollBar { setWidth(width: number): void; } interface VScrollbar extends ScrollBar { setHeight(width: number): void; } interface LayerConfig { width: number, padding: number, firstRow: number, firstRowScreen: number, lastRow: number, lineHeight: number, characterWidth: number, minHeight: number, maxHeight: number, offset: number, height: number, gutterOffset: number } interface HardWrapOptions { /** First row of the range to process */ startRow: number; /** Last row of the range to process */ endRow: number; /** Whether to merge short adjacent lines that fit within the limit */ allowMerge?: boolean; /** Maximum column width for line wrapping (defaults to editor's print margin) */ column?: number; } interface CommandBarOptions { maxElementsOnTooltip: number; alwaysShow: boolean; showDelay: number; hideDelay: number; } interface ScreenCoordinates { row: number, column: number, side?: 1 | -1, offsetX?: number } interface Folding { $foldData: FoldLine[]; /** * 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 **/ getFoldAt(row: number, column: number, side?: number): Ace.Fold; /** * Returns all folds in the given range. Note, that this will return folds **/ getFoldsInRange(range: Ace.Range | Ace.Delta): Ace.Fold[]; getFoldsInRangeList(ranges: Ace.Range[] | Ace.Range): Ace.Fold[]; /** * Returns all folds in the document */ getAllFolds(): Ace.Fold[]; /** * 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" */ getFoldStringAt(row: number, column: number, trim?: number, foldLine?: Ace.FoldLine): string | null; getFoldLine(docRow: number, startFoldLine?: Ace.FoldLine): null | Ace.FoldLine; /** * Returns the fold which starts after or contains docRow */ getNextFoldLine(docRow: number, startFoldLine?: Ace.FoldLine): null | Ace.FoldLine; getFoldedRowCount(first: number, last: number): number; $addFoldLine(foldLine: FoldLine): Ace.FoldLine; /** * Adds a new fold. * @returns {Ace.Fold} * The new created Fold object or an existing fold object in case the * passed in range fits an existing fold exactly. */ addFold(placeholder: Ace.Fold | string, range?: Ace.Range): Ace.Fold; $modified: boolean; addFolds(folds: Ace.Fold[]): void; removeFold(fold: Ace.Fold): void; removeFolds(folds: Ace.Fold[]): void; expandFold(fold: Ace.Fold): void; expandFolds(folds: Ace.Fold[]): void; unfold(location?: number | null | Ace.Point | Ace.Range | Ace.Range[], expandInner?: boolean): Ace.Fold[] | undefined; /** * 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. **/ isRowFolded(docRow: number, startFoldRow?: Ace.FoldLine): boolean; getRowFoldEnd(docRow: number, startFoldRow?: Ace.FoldLine): number; getRowFoldStart(docRow: number, startFoldRow?: Ace.FoldLine): number; getFoldDisplayLine(foldLine: Ace.FoldLine, endRow?: number | null, endColumn?: number | null, startRow?: number | null, startColumn?: number | null): string; getDisplayLine(row: number, endColumn: number | null, startRow: number | null, startColumn: number | null): string; $cloneFoldData(): Ace.FoldLine[]; toggleFold(tryToUnfold?: boolean): void; getCommentFoldRange(row: number, column: number, dir?: number): Ace.Range | undefined; foldAll(startRow?: number | null, endRow?: number | null, depth?: number | null, test?: Function): void; foldToLevel(level: number): void; foldAllComments(): void; $foldStyles: { manual: number; markbegin: number; markbeginend: number; }; $foldStyle: string; setFoldStyle(style: string): void; $setFolding(foldMode: Ace.FoldMode): void; $foldMode: any; foldWidgets: any[]; getFoldWidget: any; getFoldWidgetRange: any; $updateFoldWidgets: any; $tokenizerUpdateFoldWidgets: any; getParentFoldRangeData(row: number, ignoreCurrent?: boolean): { range?: Ace.Range; firstRange?: Ace.Range; }; onFoldWidgetClick(row: number, e: any): void; $toggleFoldWidget(row: number, options: any): Fold | any; /** * * @param {boolean} [toggleParent] */ toggleFoldWidget(toggleParent?: boolean): void; updateFoldWidgets(delta: Ace.Delta): void; tokenizerUpdateFoldWidgets(e: any): void; } interface BracketMatch { findMatchingBracket: (position: Point, chr?: string) => Point; getBracketRange: (pos: Point) => null | Range; /** * Returns: * * null if there is no any bracket at `pos`; * * two Ranges if there is opening and closing brackets; * * one Range if there is only one bracket */ getMatchingBracketRanges: (pos: Point, isBackwards?: boolean) => null | Range[]; $brackets: { ")": string; "(": string; "]": string; "[": string; "{": string; "}": string; "<": string; ">": string; }; $findOpeningBracket: (bracket: string, position: Point, typeRe?: RegExp) => Point | null; $findClosingBracket: (bracket: string, position: Point, typeRe?: RegExp) => Point | null; /** * Returns [[Range]]'s for matching tags and tag names, if there are any */ getMatchingTags: (pos: Point) => { closeTag: Range; closeTagName: Range; openTag: Range; openTagName: Range; }; $findTagName: (iterator: any) => any; $findClosingTag: (iterator: any, token: any) => { openTag: Range; closeTag: Range; openTagName: Range; closeTagName: Range; }; $findOpeningTag: (iterator: any, token: any) => { openTag: Range; closeTag: Range; openTagName: Range; closeTagName: Range; }; } interface IRange { start: Point; end: Point; } interface LineWidget { editor?: Editor, el?: HTMLElement; rowCount?: number; hidden?: boolean; _inDocument?: boolean; column?: number; row: number; $oldWidget?: LineWidget, session?: EditSession, html?: string, text?: string, className?: string, coverGutter?: boolean, pixelHeight?: number, $fold?: Fold, type?: any, destroy?: () => void; coverLine?: boolean, fixedWidth?: boolean, fullWidth?: boolean, screenWidth?: number, rowsAbove?: number, lenses?: CodeLenseCommand[], } type NewLineMode = 'auto' | 'unix' | 'windows'; interface EditSessionOptions { wrap: "off" | "free" | "printmargin" | boolean | number; wrapMethod: 'code' | 'text' | 'auto'; indentedSoftWrap: boolean; firstLineNumber: number; useWorker: boolean; useSoftTabs: boolean; tabSize: number; navigateWithinSoftTabs: boolean; foldStyle: 'markbegin' | 'markbeginend' | 'manual'; overwrite: boolean; newLineMode: NewLineMode; mode: SyntaxMode | string; } interface VirtualRendererOptions { animatedScroll: boolean; showInvisibles: boolean; showPrintMargin: boolean; printMarginColumn: number; printMargin: boolean | number; showGutter: boolean; fadeFoldWidgets: boolean; showFoldWidgets: boolean; showLineNumbers: boolean; displayIndentGuides: boolean; highlightIndentGuides: boolean; highlightGutterLine: boolean; hScrollBarAlwaysVisible: boolean; vScrollBarAlwaysVisible: boolean; fontSize: string | number; fontFamily: string; maxLines: number; minLines: number; scrollPastEnd: number; fixedWidthGutter: boolean; customScrollbar: boolean; theme: string; hasCssTransforms: boolean; maxPixelHeight: number; useSvgGutterIcons: boolean; showFoldedAnnotations: boolean; useResizeObserver: boolean; } interface MouseHandlerOptions { scrollSpeed: number; dragDelay: number; dragEnabled: boolean; focusTimeout: number; } interface EditorOptions extends EditSessionOptions, MouseHandlerOptions, VirtualRendererOptions { selectionStyle: "fullLine" | "screenLine" | "text" | "line"; highlightActiveLine: boolean; highlightSelectedWord: boolean; readOnly: boolean; copyWithEmptySelection: boolean; cursorStyle: 'ace' | 'slim' | 'smooth' | 'wide'; mergeUndoDeltas: true | false | 'always'; behavioursEnabled: boolean; wrapBehavioursEnabled: boolean; enableAutoIndent: boolean; enableBasicAutocompletion: boolean | Completer[]; enableLiveAutocompletion: boolean | Completer[]; liveAutocompletionDelay: number; liveAutocompletionThreshold: number; enableSnippets: boolean; autoScrollEditorIntoView: boolean; keyboardHandler: string | null; placeholder: string; value: string; session: EditSession; relativeLineNumbers: boolean; enableMultiselect: boolean; enableKeyboardAccessibility: boolean; enableCodeLens: boolean; textInputAriaLabel: string; enableMobileMenu: boolean; } interface EventsBase { [key: string]: any; } interface EditSessionEvents { /** * Emitted when the document changes. * @param delta */ "change": (delta: Delta, emitter: EditSession) => void; /** * Emitted when the tab size changes, via [[EditSession.setTabSize]]. */ "changeTabSize": (e: undefined, emitter: EditSession) => void; /** * Emitted when the ability to overwrite text changes, via [[EditSession.setOverwrite]]. * @param overwrite */ "changeOverwrite": (overwrite: boolean, emitter: EditSession) => void; /** * Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change. * @param e */ "changeBreakpoint": (e: { row?: number, breakpoint?: boolean }, emitter: EditSession) => void; /** * Emitted when a front marker changes. */ "changeFrontMarker": (e: undefined, emitter: EditSession) => void; /** * Emitted when a back marker changes. */ "changeBackMarker": (e: undefined, emitter: EditSession) => void; /** * Emitted when an annotation changes, like through [[EditSession.setAnnotations]]. */ "changeAnnotation": (e: {}, emitter: EditSession) => void; /** * Emitted when a background tokenizer asynchronously processes new rows. */ "tokenizerUpdate": (e: { data: { first: number, last: number } }, emitter: EditSession) => void; /** * Emitted when the current mode changes. * @param e */ "changeMode": (e: any, emitter: EditSession) => void; /** * Emitted when the wrap mode changes. * @param e */ "changeWrapMode": (e: any, emitter: EditSession) => void; /** * Emitted when the wrapping limit changes. * @param e */ "changeWrapLimit": (e: any, emitter: EditSession) => void; /** * Emitted when a code fold is added or removed. * @param e */ "changeFold": (e: any, emitter: EditSession) => void; /** * Emitted when the scroll top changes. * @param scrollTop The new scroll top value **/ "changeScrollTop": (scrollTop: number, emitter: EditSession) => void; /** * Emitted when the scroll left changes. * @param scrollLeft The new scroll left value **/ "changeScrollLeft": (scrollLeft: number, emitter: EditSession) => void; "changeEditor": (e: { editor?: Editor, oldEditor?: Editor }, emitter: EditSession) => void; "changeSelection": (e: undefined, emitter: EditSession) => void; "startOperation": (op: { command?: { name?: string }, args?: any }, emitter: EditSession) => void; "endOperation": (op: any, emitter: EditSession) => void; "beforeEndOperation": (e: undefined, emitter: EditSession) => void; } interface EditorEvents { "change": (delta: Delta, emitter: Editor) => void; "changeSelection": (e: undefined, emitter: Editor) => void; "input": (e: undefined, emitter: Editor) => void; /** * Emitted whenever the [[EditSession]] changes. * @param e An object with two properties, `oldSession` and `session`, that represent the old and new [[EditSession]]s. **/ "changeSession": (e: { oldSession: EditSession, session: EditSession }, emitter: Editor) => void; "blur": (e: any, emitter: Editor) => void; "mousedown": (e: MouseEvent, emitter: Editor) => void; "mousemove": (e: MouseEvent & { scrollTop?: any }, emitter: Editor) => void; "changeStatus": (e: any, emitter: Editor) => void; "keyboardActivity": (e: any, emitter: Editor) => void; "mousewheel": (e: MouseEvent, emitter: Editor) => void; "mouseup": (e: MouseEvent, emitter: Editor) => void; "beforeEndOperation": (e: any, emitter: Editor) => void; "nativecontextmenu": (e: any, emitter: Editor) => void; "destroy": (e: any, emitter: Editor) => void; "focus": (e: any, emitter: Editor) => void; /** * Emitted when text is copied. * @param text The copied text **/ "copy": (e: { text: string }, emitter: Editor) => void; /** * Emitted when text is pasted. **/ "paste": (e: { text: string, event?: ClipboardEvent }, emitter: Editor) => void; /** * Emitted when the selection style changes, via [[Editor.setSelectionStyle]]. * @param data Contains one property, `data`, which indicates the new selection style **/ "changeSelectionStyle": (data: "fullLine" | "screenLine" | "text" | "line", emitter: Editor) => void; "changeMode": (e: { mode?: Ace.SyntaxMode, oldMode?: Ace.SyntaxMode }, emitter: Editor) => void; //from searchbox extension "findSearchBox": (e: { match: boolean }, emitter: Editor) => void; //from code_lens extension "codeLensClick": (e: any, emitter: Editor) => void; "select": (e: undefined, emitter: Editor) => void; "gutterkeydown": (e: GutterKeyboardEvent, emitter: Editor) => void; "gutterclick": (e: MouseEvent, emitter: Editor) => void; "showGutterTooltip": (e: GutterTooltip, emitter: Editor) => void; "hideGutterTooltip": (e: GutterTooltip, emitter: Editor) => void; "compositionStart": (e: undefined, emitter: Editor) => void; } interface AcePopupEvents { "click": (e: MouseEvent, emitter: AcePopup) => void; "dblclick": (e: MouseEvent, emitter: AcePopup) => void; "tripleclick": (e: MouseEvent, emitter: AcePopup) => void; "quadclick": (e: MouseEvent, emitter: AcePopup) => void; "show": (e: undefined, emitter: AcePopup) => void; "hide": (e: undefined, emitter: AcePopup) => void; "select": (hide: boolean, emitter: AcePopup) => void; "changeHoverMarker": (e: any, emitter: AcePopup) => void; } interface DocumentEvents { /** * 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 * **/ "change": (e: Delta, emitter: Document) => void; "changeNewLineMode": (e: undefined, emitter: Document) => void; } interface AnchorEvents { /** * 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()`]]. * @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 **/ "change": (e: { old: Point, value: Point }, emitter: Anchor) => void; } interface BackgroundTokenizerEvents { /** * Fires whenever the background tokeniziers between a range of rows are going to be updated. * @param e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated. **/ "update": (e: { data: { first: number, last: number } }, emitter: import("./src/background_tokenizer").BackgroundTokenizer) => void; } interface SelectionEvents { /** * Emitted when the cursor position changes. **/ "changeCursor": (e: undefined, emitter: Selection) => void; /** * Emitted when the cursor selection changes. **/ "changeSelection": (e: undefined, emitter: Selection) => void; } interface MultiSelectionEvents extends SelectionEvents { "multiSelect": (e: undefined, emitter: Selection) => void; "addRange": (e: { range: Range }, emitter: Selection) => void; "removeRange": (e: { ranges: Range[] }, emitter: Selection) => void; "singleSelect": (e: undefined, emitter: Selection) => void; } interface PlaceHolderEvents { "cursorEnter": (e: any, emitter: import("./src/placeholder").PlaceHolder) => void; "cursorLeave": (e: any, emitter: import("./src/placeholder").PlaceHolder) => void; } interface GutterEvents { "changeGutterWidth": (width: number, emitter: import("./src/layer/gutter").Gutter) => void; "afterRender": (e: undefined, emitter: import("./src/layer/gutter").Gutter) => void; } interface TextEvents { "changeCharacterSize": (e: any, emitter: import("./src/layer/text").Text) => void; } interface VirtualRendererEvents { "afterRender": (e: any, emitter: VirtualRenderer) => void; "beforeRender": (e: any, emitter: VirtualRenderer) => void; "themeLoaded": (e: { theme: string | Theme }, emitter: VirtualRenderer) => void; "themeChange": (e: { theme: string | Theme }, emitter: VirtualRenderer) => void; "scrollbarVisibilityChanged": (e: undefined, emitter: VirtualRenderer) => void; "changeCharacterSize": (e: any, emitter: VirtualRenderer) => void; "resize": (e: any, emitter: VirtualRenderer) => void; "autosize": (e: undefined, emitter: VirtualRenderer) => void; } type EmitParameters any> = T extends (first: infer First, ...rest: any[]) => any ? [First] : []; export class EventEmitter any }> { once(name: K, callback: T[K]): void; setDefaultHandler(name: string, callback: Function): void; removeDefaultHandler(name: string, callback: Function): void; on(name: K, callback: T[K], capturing?: boolean): T[K]; addEventListener(name: K, callback: T[K], capturing?: boolean): T[K]; off(name: K, callback: T[K]): void; removeListener(name: K, callback: T[K]): void; removeEventListener(name: K, callback: T[K]): void; removeAllListeners(name?: string): void; _signal(eventName: K, ...args: EmitParameters): void; _emit(eventName: K, ...args: EmitParameters): void; _dispatchEvent(eventName: K, ...args: EmitParameters): void; } interface SearchOptions { /**The string or regular expression you're looking for*/ needle: string | RegExp; preventScroll: boolean; /**Whether to search backwards from where cursor currently is*/ backwards: boolean; /**The starting [[Range]] or cursor position to begin the search*/ start: Range; /**Whether or not to include the current line in the search*/ skipCurrent: boolean; /**The [[Range]] to search within. Set this to `null` for the whole document*/ range: Range | null; preserveCase: boolean; /**Whether the search is a regular expression or not*/ regExp: boolean; /**Whether the search matches only on whole words*/ wholeWord: boolean; /**Whether the search ought to be case-sensitive*/ caseSensitive: boolean; /**Whether to wrap the search back to the beginning when it hits the end*/ wrap: boolean; re: any; /**true, if needle has \n or \r\n*/ $isMultiLine: boolean; /** * internal property, determine if browser supports unicode flag * @private * */ $supportsUnicodeFlag: boolean; } interface Point { row: number; column: number; } type Position = Point; interface Delta { action: 'insert' | 'remove'; start: Point; end: Point; lines: string[]; id?: number, folds?: Fold[] } interface Annotation { row: number; column: number; text: string; type: string; } export interface MarkerGroupItem { range: Range; className: string; } type MarkerGroup = import("./src/marker_group").MarkerGroup; export interface Command { name?: string; bindKey?: string | { mac?: string, win?: string }; readOnly?: boolean; exec?: (editor?: Editor | any, args?: any) => void; isAvailable?: (editor: Editor) => boolean; description?: string, multiSelectAction?: "forEach" | "forEachLine" | Function, scrollIntoView?: true | "cursor" | "center" | "selectionPart" | "animate" | "selection" | "none", aceCommandGroup?: string, passEvent?: boolean, level?: number, action?: string, } type CommandLike = Command | ((editor: Editor) => void) | ((sb: SearchBox) => void); type KeyboardHandler = Partial & { attach?: (editor: Editor) => void; detach?: (editor: Editor) => void; getStatusText?: (editor?: any, data?: any) => string; } export interface MarkerLike { range?: Range; type: string; renderer?: MarkerRenderer; clazz: string; inFront?: boolean; id?: number; update?: (html: string[], // TODO maybe define Marker class marker: any, session: EditSession, config: any) => void; [key: string]: any; } type MarkerRenderer = (html: string[], range: Range, left: number, top: number, config: any) => void; interface Token { type: string; value: string; index?: number; start?: number; } type BaseCompletion = import("./src/autocomplete").BaseCompletion; type SnippetCompletion = import("./src/autocomplete").SnippetCompletion; type ValueCompletion = import("./src/autocomplete").ValueCompletion; type Completion = import("./src/autocomplete").Completion; type HighlightRule = ({ defaultToken: string } | { include: string } | { todo: string } | { token: string | string[] | ((value: string) => string); regex: string | RegExp; next?: string | (() => void); push?: string; comment?: string; caseInsensitive?: boolean; nextState?: string; }) & { [key: string]: any }; type HighlightRulesMap = Record; type KeywordMapper = (keyword: string) => string; interface HighlightRules { $rules: HighlightRulesMap; $embeds: string[]; $keywords: any[]; $keywordList: string[]; addRules(rules: HighlightRulesMap, prefix?: string): void; getRules(): HighlightRulesMap; embedRules(rules: (new () => HighlightRules) | HighlightRulesMap, prefix: string, escapeRules?: boolean, append?: boolean): void; getEmbeds(): string[]; normalizeRules(): void; createKeywordMapper(map: Record, defaultToken?: string, ignoreCase?: boolean, splitChar?: string): KeywordMapper; } type FoldWidget = "start" | "end" | "" interface FoldMode { foldingStartMarker: RegExp; foldingStopMarker?: RegExp; getFoldWidget(session: EditSession, foldStyle: string, row: number): FoldWidget; getFoldWidgetRange(session: EditSession, foldStyle: string, row: number): Range | undefined; indentationBlock(session: EditSession, row: number, column?: number): Range | undefined; openingBracketBlock(session: EditSession, bracket: string, row: number, column: number, typeRe?: RegExp): Range | undefined; closingBracketBlock(session: EditSession, bracket: string, row: number, column: number, typeRe?: RegExp): Range | undefined; } type BehaviorAction = (state: string | string[], action: string, editor: Editor, session: EditSession, text: string | Range) => ({ text: string, selection: number[] } | Range) & { [key: string]: any } | undefined; type BehaviorMap = Record>; interface Behaviour { $behaviours: { [behaviour: string]: any } add(name: string, action: string, callback: BehaviorAction): void; addBehaviours(behaviours: BehaviorMap): void; remove(name: string): void; inherit(mode: SyntaxMode | (new () => SyntaxMode), filter: string[]): void; getBehaviours(filter?: string[]): BehaviorMap; } interface Outdent { checkOutdent(line: string, input: string): boolean; autoOutdent(doc: Document, row: number): number | undefined; } interface SyntaxMode { /** * quotes used by language mode */ $quotes: { [quote: string]: string }; HighlightRules: { new(config?: any): HighlightRules }; //TODO: fix this foldingRules?: FoldMode; $behaviour?: Behaviour; $defaultBehaviour?: Behaviour; /** * characters that indicate the start of a line comment */ lineCommentStart?: string; /** * characters that indicate the start and end of a block comment */ blockComment?: { start: string, end: string } tokenRe?: RegExp; nonTokenRe?: RegExp; /** * An object containing conditions to determine whether to apply matching quote or not. */ $pairQuotesAfter: { [quote: string]: RegExp } $tokenizer: Tokenizer; $highlightRules: HighlightRules; $embeds?: string[]; $modes?: SyntaxMode[]; $keywordList?: string[]; $highlightRuleConfig?: any; completionKeywords: string[]; transformAction: BehaviorAction; path?: string; getTokenizer(): Tokenizer; toggleCommentLines(state: string | string[], session: EditSession, startRow: number, endRow: number): void; toggleBlockComment(state: string | string[], session: EditSession, range: Range, cursor: Point): void; getNextLineIndent(state: string | string[], line: string, tab: string): string; checkOutdent(state: string | string[], line: string, input: string): boolean; autoOutdent(state: string | string[], doc: EditSession, row: number): void; // TODO implement WorkerClient types createWorker(session: EditSession): any; createModeDelegates(mapping: { [key: string]: string }): void; getKeywords(append?: boolean): Array; getCompletions(state: string | string[], session: EditSession, pos: Point, prefix: string): Completion[]; $getIndent(line: string): string; $createKeywordList(): string[]; $delegator(method: string, args: IArguments, defaultHandler: any): any; } interface OptionsBase { [key: string]: any; } class OptionsProvider { setOptions(optList: Partial): void; getOptions(optionNames?: Array | Partial): Partial; setOption(name: K, value: T[K]): void; getOption(name: K): T[K]; } type KeyBinding = import("./src/keyboard/keybinding").KeyBinding; interface CommandMap { [name: string]: Command; } type execEventHandler = (obj: { editor: Editor, command: Command, args: any[] }, emitter: CommandManager) => void; interface CommandManagerEvents { "exec": execEventHandler "afterExec": execEventHandler; "commandUnavailable": execEventHandler; } type CommandManager = import("./src/commands/command_manager").CommandManager; interface SavedSelection { start: Point; end: Point; isBackwards: boolean; } var Selection: { new(session: EditSession): Selection; } type CompleterCallback = (error: any, completions: Completion[]) => void; interface Completer { /** Regular expressions defining valid identifier characters for completion triggers */ identifierRegexps?: Array, /** Main completion method that provides suggestions for the given context */ getCompletions(editor: Editor, session: EditSession, position: Point, prefix: string, callback: CompleterCallback): void; /** Returns documentation tooltip for a completion item */ getDocTooltip?(item: Completion): void | string | Completion; /** Called when a completion item becomes visible */ onSeen?: (editor: Ace.Editor, completion: Completion) => void; /** Called when a completion item is inserted */ onInsert?: (editor: Ace.Editor, completion: Completion) => void; /** Cleanup method called when completion is cancelled */ cancel?(): void; /** Unique identifier for this completer */ id?: string; /** Characters that trigger autocompletion when typed */ triggerCharacters?: string[]; /** Whether to hide inline preview text */ hideInlinePreview?: boolean; /** Custom insertion handler for completion items */ insertMatch?: (editor: Editor, data: Completion) => void; } interface CompletionOptions { matches?: Completion[]; } type CompletionProviderOptions = { exactMatch?: boolean; ignoreCaption?: boolean; } type GatherCompletionRecord = { prefix: string; matches: Completion[]; finished: boolean; } type CompletionCallbackFunction = (err: Error | undefined, data: GatherCompletionRecord) => void; type CompletionProviderCallback = (this: import("./src/autocomplete").Autocomplete, err: Error | undefined, completions: import("./src/autocomplete").FilteredList, finished: boolean) => void; type AcePopupNavigation = "up" | "down" | "start" | "end"; interface EditorMultiSelectProperties { inMultiSelectMode?: boolean, /** * Updates the cursor and marker layers. **/ updateSelectionMarkers: () => void, /** * Adds the selection and cursor. * @param orientedRange A range containing a cursor **/ addSelectionMarker: (orientedRange: Ace.Range & { marker?: any }) => Ace.Range & { marker?: any }, /** * Removes the selection marker. * @param range The selection range added with [[Editor.addSelectionMarker `addSelectionMarker()`]]. **/ removeSelectionMarker: (range: Ace.Range & { marker?: any }) => void, removeSelectionMarkers: (ranges: (Ace.Range & { marker?: any })[]) => void, $onAddRange: (e: any) => void, $onRemoveRange: (e: any) => void, $onMultiSelect: (e: any) => void, $onSingleSelect: (e: any) => void, $onMultiSelectExec: (e: any) => void, /** * Executes a command for each selection range. * @param cmd The command to execute * @param [args] Any arguments for the command **/ forEachSelection: (cmd: Object, args?: string, options?: Object) => void, /** * Removes all the selections except the last added one. **/ exitMultiSelectMode: () => void, getSelectedText: () => string, $checkMultiselectChange: (e: any, anchor: Ace.Anchor) => void, /** * Finds and selects all the occurrences of `needle`. * @param needle The text to find * @param options The search options * @param additive keeps * @returns {Number} The cumulative count of all found matches **/ findAll: (needle?: string, options?: Partial, additive?: boolean) => number, /** * Adds a cursor above or below the active cursor. * @param dir The direction of lines to select: -1 for up, 1 for down * @param [skip] If `true`, removes the active selection range */ selectMoreLines: (dir: number, skip?: boolean) => void, /** * Transposes the selected ranges. * @param {Number} dir The direction to rotate selections **/ transposeSelections: (dir: number) => void, /** * Finds the next occurrence of text in an active selection and adds it to the selections. * @param {Number} dir The direction of lines to select: -1 for up, 1 for down * @param {Boolean} [skip] If `true`, removes the active selection range * @param {Boolean} [stopAtFirst] **/ selectMore: (dir: number, skip?: boolean, stopAtFirst?: boolean) => void, /** * Aligns the cursors or selected text. **/ alignCursors: () => void, $reAlignText: (lines: string[], forceLeft: boolean) => string[], multiSelect?: any, $multiselectOnSessionChange?: any, $blockSelectEnabled?: boolean, } /** * Provider interface for code lens functionality */ interface CodeLenseProvider { /** * Compute code lenses for the given edit session * @param session The edit session to provide code lenses for * @param callback Callback function that receives errors and code lenses */ provideCodeLenses: (session: EditSession, callback: (err: any, payload: CodeLense[]) => void) => void; } /** * Represents a command associated with a code lens */ interface CodeLenseCommand { /** * Command identifier that will be executed */ id?: string, /** * Display title for the code lens */ title: string, /** * Argument(s) to pass to the command when executed */ arguments?: any, } /** * Represents a code lens - an actionable UI element displayed above a code line */ interface CodeLense { /** * Starting position where the code lens should be displayed */ start: Point, /** * Command to execute when the code lens is activated */ command?: CodeLenseCommand } interface CodeLenseEditorExtension { codeLensProviders?: CodeLenseProvider[]; $codeLensClickHandler?: any; $updateLenses?: () => void; $updateLensesOnInput?: () => void; } interface ElasticTabstopsEditorExtension { elasticTabstops?: import("./src/ext/elastic_tabstops_lite").ElasticTabstopsLite; } interface TextareaEditorExtension { setDisplaySettings?: (settings: any) => void; } interface PromptEditorExtension { cmdLine?: Editor; } interface OptionsEditorExtension { $options?: any; } interface MultiSelectProperties { ranges: Ace.Range[] | null; rangeList: Ace.RangeList | null; /** * Adds a range to a selection by entering multiselect mode, if necessary. * @param {Ace.Range} range The new range to add * @param {Boolean} [$blockChangeEvents] Whether or not to block changing events **/ addRange(range: Ace.Range, $blockChangeEvents?: boolean): any; inMultiSelectMode: boolean; /** * @param {Ace.Range} [range] **/ toSingleRange(range?: Ace.Range): void; /** * Removes a Range containing pos (if it exists). * @param {Ace.Point} pos The position to remove, as a `{row, column}` object **/ substractPoint(pos: Ace.Point): any; /** * Merges overlapping ranges ensuring consistency after changes **/ mergeOverlappingRanges(): void; /** * @param {Ace.Range} range */ $onAddRange(range: Ace.Range): void; rangeCount: number; /** * * @param {Ace.Range[]} removed */ $onRemoveRange(removed: Ace.Range[]): void; /** * adds multicursor support to selection */ $initRangeList(): void; /** * Returns a concatenation of all the ranges. * @returns {Ace.Range[]} **/ getAllRanges(): Ace.Range[]; /** * Splits all the ranges into lines. **/ splitIntoLines(): void; /** */ joinSelections(): void; /** **/ toggleBlockSelection(): void; /** * * Gets list of ranges composing rectangular block on the screen * * @param {Ace.ScreenCoordinates} screenCursor The cursor to use * @param {Ace.ScreenCoordinates} screenAnchor The anchor to use * @param {Boolean} [includeEmptyLines] If true, this includes ranges inside the block which are empty due to clipping * @returns {Ace.Range[]} **/ rectangularRangeBlock(screenCursor: Ace.ScreenCoordinates, screenAnchor: Ace.ScreenCoordinates, includeEmptyLines?: boolean): Ace.Range[]; _eventRegistry?: any; index?: number; } type AcePopupEventsCombined = Ace.EditorEvents & Ace.AcePopupEvents; type AcePopupWithEditor = Ace.EventEmitter & Ace.Editor; type InlineAutocompleteAction = "prev" | "next" | "first" | "last"; type TooltipCommandFunction = (editor: Ace.Editor) => T; export interface TooltipCommand extends Ace.Command { enabled?: TooltipCommandFunction | boolean, getValue?: TooltipCommandFunction, type: "button" | "text" | "checkbox" iconCssClass?: string, cssClass?: string } export type CommandBarTooltip = import("./src/ext/command_bar").CommandBarTooltip; export type TokenizeResult = Array> export interface StaticHighlightOptions { /** Syntax mode (e.g., 'ace/mode/javascript'). Auto-detected from CSS class if not provided */ mode?: string | SyntaxMode, /** Color theme (e.g., 'ace/theme/textmate'). Defaults to 'ace/theme/textmate' */ theme?: string | Theme, /** Whether to trim whitespace from code content */ trim?: boolean, /** Starting line number for display */ firstLineNumber?: number, /** Whether to show line numbers gutter */ showGutter?: boolean } export interface Operation { command: { name?: string; }; args: any; selectionBefore?: Range | Range[]; selectionAfter?: Range | Range[]; docChanged?: boolean; selectionChanged?: boolean; } export interface CommandBarEvents { "hide": (e: undefined, emitter: import("./src/ext/command_bar").CommandBarTooltip) => void; "show": (e: undefined, emitter: import("./src/ext/command_bar").CommandBarTooltip) => void; "alwaysShow": (e: boolean, emitter: import("./src/ext/command_bar").CommandBarTooltip) => void; } export interface FontMetricsEvents { "changeCharacterSize": (e: { data: { height: number, width: number } }, emitter: import("./src/layer/font_metrics").FontMetrics) => void; } export interface OptionPanelEvents { "setOption": (e: { name: string, value: any }, emitter: import("./src/ext/options").OptionPanel) => void; } export interface ScrollbarEvents { "scroll": (e: { data: number }, emitter: ScrollBar) => void; } export interface TextInputAriaOptions { activeDescendant?: string; role?: string; setLabel?: boolean; inline?: boolean; } } export const version: string; export const config: Ace.Config; export function require(name: string): any; export function edit(el?: string | (Element & { env?: any; value?: any; }) | null, options?: Partial): Ace.Editor; export function createEditSession(text: Ace.Document | string, mode?: Ace.SyntaxMode | string): Ace.EditSession; export const VirtualRenderer: { new(container: HTMLElement, theme?: string): Ace.VirtualRenderer; }; export const EditSession: { new(text: string | Ace.Document, mode?: Ace.SyntaxMode): Ace.EditSession; }; export const UndoManager: { new(): Ace.UndoManager; }; export const Editor: { new(renderer: Ace.VirtualRenderer, session?: Ace.EditSession, options?: Partial): Ace.Editor; }; export const Range: { new(startRow: number, startColumn: number, endRow: number, endColumn: number): Ace.Range; fromPoints(start: Ace.Point, end: Ace.Point): Ace.Range; comparePoints(p1: Ace.Point, p2: Ace.Point): number; }; export type InlineAutocomplete = Ace.InlineAutocomplete; export type CommandBarTooltip = Ace.CommandBarTooltip; declare global { interface Element { setAttribute(name: string, value: boolean): void; setAttribute(name: string, value: number): void; } } declare module "./src/anchor" { export interface Anchor extends Ace.EventEmitter { markerId?: number; document: Ace.Document; } } declare module "./src/autocomplete" { export interface Autocomplete { popup: Ace.AcePopup; emptyMessage?: Function, } export interface CompletionProvider { completions: Ace.FilteredList; } } declare module "./src/background_tokenizer" { export interface BackgroundTokenizer extends Ace.EventEmitter { } } declare module "./src/document" { export interface Document extends Ace.EventEmitter { } } declare module "./src/editor" { export interface Editor extends Ace.EditorMultiSelectProperties, Ace.OptionsProvider, Ace.EventEmitter, Ace.CodeLenseEditorExtension, Ace.ElasticTabstopsEditorExtension, Ace.TextareaEditorExtension, Ace.PromptEditorExtension, Ace.OptionsEditorExtension { session: Ace.EditSession; $mergeUndoDeltas?: any, $highlightSelectedWord?: boolean, $updatePlaceholder?: Function, $cursorStyle?: string, $readOnly?: any, $highlightActiveLine?: any, $enableAutoIndent?: any, $copyWithEmptySelection?: any $selectionStyle?: string, env?: any; widgetManager?: Ace.LineWidgets, completer?: Ace.Autocomplete | Ace.InlineAutocomplete, completers: Ace.Completer[], $highlightTagPending?: boolean, showKeyboardShortcuts?: () => void, showSettingsMenu?: () => void, searchBox?: Ace.SearchBox, _eventRegistry?: any, $textInputAriaLabel?: string } } declare module "./src/edit_session" { type TextMarker = import("./src/layer/text_markers").TextMarker; type TextMarkers = typeof import("./src/layer/text_markers").editSessionTextMarkerMixin & { $textMarkers: TextMarker[]; $textMarkerId: number; $scheduleForRemove: Set; }; export interface EditSession extends Ace.EventEmitter, Ace.OptionsProvider, Ace.Folding, Ace.BracketMatch, TextMarkers { doc: Ace.Document, $highlightLineMarker?: { start: Ace.Point, end: Ace.Point, id?: number } $useSoftTabs?: boolean, $tabSize?: number, $useWorker?: boolean, $wrapAsCode?: boolean, $indentedSoftWrap?: boolean, $bracketHighlight?: any, $selectionMarker?: number, lineWidgetsWidth?: number, $getWidgetScreenLength?: () => number, _changedWidgets?: any, $options: any, $wrapMethod?: any, $enableVarChar?: any, $wrap?: any, $navigateWithinSoftTabs?: boolean, $selectionMarkers?: any[], gutterRenderer?: any, $firstLineNumber?: number, $emacsMark?: any, selectionMarkerCount?: number, multiSelect?: any, $occurHighlight?: any, $occur?: Ace.Occur, $occurMatchingLines?: any, $useEmacsStyleLineStart?: boolean, $selectLongWords?: boolean, curOp: Ace.Operation | null, getSelectionMarkers(): any[], } } declare module "./src/edit_session/fold" { export interface Fold { collapseChildren?: number; } } declare module "./src/placeholder" { export interface PlaceHolder extends Ace.EventEmitter { } } declare module "./src/scrollbar" { export interface VScrollBar extends Ace.EventEmitter { } export interface HScrollBar extends Ace.EventEmitter { } } declare module "./src/scrollbar_custom" { export interface VScrollBar extends Ace.EventEmitter { } export interface HScrollBar extends Ace.EventEmitter { } } declare module "./src/line_widgets" { export interface LineWidgets { lineWidgets: Ace.LineWidget[]; editor: Ace.Editor; } } declare module "./src/selection" { export interface Selection extends Ace.EventEmitter, Ace.MultiSelectProperties { } } declare module "./src/range" { export interface Range { id?: number; cursor?: Ace.Point; isBackwards?: boolean; } } declare module "./src/virtual_renderer" { export interface VirtualRenderer extends Ace.EventEmitter, Ace.OptionsProvider { $customScrollbar?: boolean, $extraHeight?: number, $showGutter?: boolean, $showPrintMargin?: boolean, $printMarginColumn?: number, $animatedScroll?: boolean, $isMousePressed?: boolean, textarea: HTMLTextAreaElement, $hScrollBarAlwaysVisible?: boolean, $vScrollBarAlwaysVisible?: boolean $maxLines?: number, $scrollPastEnd?: number, enableKeyboardAccessibility?: boolean, $highlightGutterLine?: boolean, $minLines?: number, $maxPixelHeight?: number, $gutterWidth?: number, showInvisibles?: boolean, $hasCssTransforms?: boolean, $blockCursor?: boolean, $useTextareaForIME?: boolean, theme?: any, $theme?: any, destroyed?: boolean, session: Ace.EditSession, keyboardFocusClassName?: string, } } declare module "./src/snippets" { interface SnippetManager extends Ace.EventEmitter { } } declare module "./src/ext/command_bar" { export interface CommandBarTooltip extends Ace.EventEmitter { $shouldHideMoreOptions?: boolean, } } declare module "./src/commands/command_manager" { export interface CommandManager extends Ace.EventEmitter { $checkCommandState?: boolean } } declare module "./src/autocomplete/popup" { export interface AcePopup extends Ace.AcePopupWithEditor { setSelectOnHover: (val: boolean) => void, setRow: (line: number) => void, getRow: () => number, getHoveredRow: () => number, filterText: string, isOpen: boolean, isTopdown: boolean, autoSelect: boolean, data: Ace.Completion[], setData: (data: Ace.Completion[], filterText?: string) => void, getData: (row: number) => Ace.Completion, hide: () => void, anchor: "top" | "bottom", anchorPosition: Ace.Point, tryShow: (pos: any, lineHeight: number, anchor: "top" | "bottom", forceShow?: boolean) => boolean, $borderSize: number, show: (pos: any, lineHeight: number, topdownOnly?: boolean) => void, goTo: (where: Ace.AcePopupNavigation) => void, getTextLeftOffset: () => number, $imageSize: number, anchorPos: any, isMouseOver?: boolean, selectedNode?: HTMLElement, } } declare module "./src/layer/cursor" { export interface Cursor { timeoutId?: number; } } declare module "./src/layer/gutter" { export interface Gutter extends Ace.EventEmitter { $useSvgGutterIcons?: boolean, $showFoldedAnnotations?: boolean, } } declare module "./src/layer/text" { type TextMarkersMixin = typeof import("./src/layer/text_markers").textMarkerMixin; export interface Text extends Ace.EventEmitter, TextMarkersMixin { config: Ace.LayerConfig } } declare module "./src/lib/app_config" { export interface AppConfig extends Ace.EventEmitter { } } declare module "./src/mouse/mouse_event" { export interface MouseEvent { time?: number; } } declare module "./src/mouse/mouse_handler" { export interface MouseHandler { cancelDrag?: boolean //from DefaultHandlers $clickSelection?: Ace.Range, mousedownEvent?: Ace.MouseEvent, startSelect?: (pos?: Ace.Point, waitForClickSelection?: boolean) => void, select?: () => void $lastScroll?: { t: number, vx: number, vy: number, allowed: number } selectEnd?: () => void $tooltip?: Ace.GutterTooltip } } declare module "./src/ext/options" { export interface OptionPanel extends Ace.EventEmitter { } } declare module "./src/layer/font_metrics" { export interface FontMetrics extends Ace.EventEmitter { } } declare module "./src/tooltip" { export interface HoverTooltip { row: number; } } declare module "./src/mouse/default_gutter_handler" { export interface GutterHandler { } } declare module "./src/ext/diff/base_diff_view" { export interface BaseDiffView extends Ace.OptionsProvider { } } ================================================ FILE: ace-modes.d.ts ================================================ declare module "ace-code/src/mode/abap_highlight_rules" { export const AbapHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/abap" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/abc_highlight_rules" { export const ABCHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/abc" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/actionscript_highlight_rules" { export const ActionScriptHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/actionscript" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/ada_highlight_rules" { export const AdaHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/ada" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/alda_highlight_rules" { export const AldaHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/alda" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/apache_conf_highlight_rules" { export const ApacheConfHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/apache_conf" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/apex_highlight_rules" { export const ApexHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/apex" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/applescript_highlight_rules" { export const AppleScriptHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/applescript" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/aql_highlight_rules" { export const AqlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/aql" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/asciidoc_highlight_rules" { export const AsciidocHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/asciidoc" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/asl_highlight_rules" { export const ASLHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/asl" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/assembly_arm32_highlight_rules" { export const AssemblyARM32HighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/assembly_arm32" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/assembly_x86_highlight_rules" { export const AssemblyX86HighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/assembly_x86" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/astro_highlight_rules" { export const AstroHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/astro" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/autohotkey_highlight_rules" { export const AutoHotKeyHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/autohotkey" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/basic_highlight_rules" { export const BasicHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/basic" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/batchfile_highlight_rules" { export const BatchFileHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/batchfile" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/behaviour" { export const Behaviour: new () => import("ace-code").Ace.Behaviour; } declare module "ace-code/src/mode/behaviour/css" { export const CssBehaviour: new () => import("ace-code").Ace.Behaviour; } declare module "ace-code/src/mode/behaviour/cstyle" { export const CstyleBehaviour: new () => import("ace-code").Ace.Behaviour; } declare module "ace-code/src/mode/behaviour/html" { export const HtmlBehaviour: new () => import("ace-code").Ace.Behaviour; } declare module "ace-code/src/mode/behaviour/javascript" { export const JavaScriptBehaviour: new () => import("ace-code").Ace.Behaviour; } declare module "ace-code/src/mode/behaviour/liquid" { export const LiquidBehaviour: new () => import("ace-code").Ace.Behaviour; } declare module "ace-code/src/mode/behaviour/xml" { export const XmlBehaviour: new () => import("ace-code").Ace.Behaviour; } declare module "ace-code/src/mode/behaviour/xquery" { export const XQueryBehaviour: new () => import("ace-code").Ace.Behaviour; } declare module "ace-code/src/mode/bibtex_highlight_rules" { export const BibTeXHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/bibtex" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/c_cpp_highlight_rules" { export const cFunctions: string; export const c_cppHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/c_cpp" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/c9search_highlight_rules" { export const C9SearchHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/c9search" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/cirru_highlight_rules" { export const CirruHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/cirru" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/clojure_highlight_rules" { export const ClojureHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/clojure" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/clue_highlight_rules" { export const ClueHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/clue" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/cobol_highlight_rules" { export const CobolHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/cobol" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/coffee_highlight_rules" { export const CoffeeHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/coffee" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/coldfusion_highlight_rules" { export const ColdfusionHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/coldfusion" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/crystal_highlight_rules" { export const CrystalHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/crystal" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/csharp_highlight_rules" { export const CSharpHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/csharp" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/csound_document_highlight_rules" { export const CsoundDocumentHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/csound_document" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/csound_orchestra_highlight_rules" { export const CsoundOrchestraHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/csound_orchestra" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/csound_preprocessor_highlight_rules" { export const CsoundPreprocessorHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/csound_score_highlight_rules" { export const CsoundScoreHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/csound_score" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/csp_highlight_rules" { export const CspHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/csp" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/css_completions" { export const CssCompletions: new () => import("ace-code").Ace.Completion; } declare module "ace-code/src/mode/css_highlight_rules" { export const supportType: string; export const supportFunction: string; export const supportConstant: string; export const supportConstantColor: string; export const supportConstantFonts: string; export const numRe: string; export const pseudoElements: string; export const pseudoClasses: string; export const CssHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/css" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/csv_highlight_rules" { export const CsvHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/csv" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/curly_highlight_rules" { export const CurlyHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/curly" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/cuttlefish_highlight_rules" { export const CuttlefishHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/cuttlefish" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/d_highlight_rules" { export const DHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/d" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/dart_highlight_rules" { export const DartHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/dart" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/diff_highlight_rules" { export const DiffHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/diff" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/django" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/doc_comment_highlight_rules" { export const DocCommentHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/dockerfile_highlight_rules" { export const DockerfileHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/dockerfile" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/dot_highlight_rules" { export const DotHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/dot" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/drools_highlight_rules" { export const DroolsHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/drools" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/edifact_highlight_rules" { export const EdifactHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/edifact" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/eiffel_highlight_rules" { export const EiffelHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/eiffel" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/ejs" { export const EjsHighlightRules: new () => import("ace-code").Ace.HighlightRules; export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/elixir_highlight_rules" { export const ElixirHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/elixir" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/elm_highlight_rules" { export const ElmHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/elm" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/erlang_highlight_rules" { export const ErlangHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/erlang" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/flix_highlight_rules" { export const FlixHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/flix" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/folding/asciidoc" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/basic" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/c9search" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/coffee" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/csharp" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/cstyle" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/diff" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/drools" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/fold_mode" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/haskell_cabal" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/html" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/ini" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/java" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/javascript" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/latex" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/lua" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/markdown" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/mixed" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/nunjucks" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/php" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/pythonic" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/ruby" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/sql" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/sqlserver" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/vbscript" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/velocity" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/xml" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/folding/yaml" { export const FoldMode: new () => import("ace-code").Ace.Folding; } declare module "ace-code/src/mode/forth_highlight_rules" { export const ForthHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/forth" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/fortran_highlight_rules" { export const FortranHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/fortran" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/fsharp_highlight_rules" { export const FSharpHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/fsharp" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/fsl_highlight_rules" { export const FSLHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/fsl" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/ftl_highlight_rules" { export const FtlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/ftl" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/gcode_highlight_rules" { export const GcodeHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/gcode" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/gherkin_highlight_rules" { export const GherkinHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/gherkin" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/gitignore_highlight_rules" { export const GitignoreHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/gitignore" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/glsl_highlight_rules" { export const glslHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/glsl" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/gobstones_highlight_rules" { export const GobstonesHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/gobstones" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/golang_highlight_rules" { export const GolangHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/golang" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/graphqlschema_highlight_rules" { export const GraphQLSchemaHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/graphqlschema" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/groovy_highlight_rules" { export const GroovyHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/groovy" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/haml_highlight_rules" { export const HamlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/haml" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/handlebars_highlight_rules" { export const HandlebarsHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/handlebars" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/haskell_cabal_highlight_rules" { export const CabalHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/haskell_cabal" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/haskell_highlight_rules" { export const HaskellHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/haskell" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/haxe_highlight_rules" { export const HaxeHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/haxe" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/hjson_highlight_rules" { export const HjsonHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/hjson" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/html_completions" { export const HtmlCompletions: new () => import("ace-code").Ace.Completion; } declare module "ace-code/src/mode/html_elixir_highlight_rules" { export const HtmlElixirHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/html_elixir" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/html_highlight_rules" { export const HtmlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/html_ruby_highlight_rules" { export const HtmlRubyHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/html_ruby" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/html" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/ini_highlight_rules" { export const IniHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/ini" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/io_highlight_rules" { export const IoHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/io" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/ion_highlight_rules" { export const IonHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/ion" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/jack_highlight_rules" { export const JackHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/jack" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/jade_highlight_rules" { export const JadeHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/jade" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/java_highlight_rules" { export const JavaHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/java" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/javascript_highlight_rules" { export const JavaScriptHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/javascript" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/jexl_highlight_rules" { export const JexlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/jexl" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/js_regex_highlight_rules" { export const JsRegexHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/jsdoc_comment_highlight_rules" { export const JsDocCommentHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/json_highlight_rules" { export const JsonHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/json" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/json5_highlight_rules" { export const Json5HighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/json5" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/jsp_highlight_rules" { export const JspHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/jsp" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/jssm_highlight_rules" { export const JSSMHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/jssm" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/jsx_highlight_rules" { export const JsxHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/jsx" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/julia_highlight_rules" { export const JuliaHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/julia" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/kotlin_highlight_rules" { export const KotlinHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/kotlin" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/latex_highlight_rules" { export const LatexHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/latex" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/latte_highlight_rules" { export const LatteHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/latte" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/less_highlight_rules" { export const LessHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/less" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/liquid_highlight_rules" { export const LiquidHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/liquid" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/lisp_highlight_rules" { export const LispHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/lisp" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/livescript" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/logiql_highlight_rules" { export const LogiQLHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/logiql" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/logtalk_highlight_rules" { export const LogtalkHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/logtalk" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/lsl_highlight_rules" { export const LSLHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/lsl" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/lua_highlight_rules" { export const LuaHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/lua" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/luapage_highlight_rules" { export const LuaPageHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/luapage" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/lucene_highlight_rules" { export const LuceneHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/lucene" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/makefile_highlight_rules" { export const MakefileHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/makefile" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/markdown_highlight_rules" { export const MarkdownHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/markdown" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/mask_highlight_rules" { export const MaskHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/mask" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/matching_brace_outdent" { export const MatchingBraceOutdent: new () => import("ace-code").Ace.Outdent; } declare module "ace-code/src/mode/matching_parens_outdent" { export const MatchingParensOutdent: new () => import("ace-code").Ace.Outdent; } declare module "ace-code/src/mode/matlab_highlight_rules" { export const MatlabHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/matlab" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/maze_highlight_rules" { export const MazeHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/maze" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/mediawiki_highlight_rules" { export const MediaWikiHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/mediawiki" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/mel_highlight_rules" { export const MELHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/mel" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/mips_highlight_rules" { export const MIPSHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/mips" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/mixal_highlight_rules" { export const MixalHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/mixal" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/mushcode_highlight_rules" { export const MushCodeRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/mushcode" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/mysql_highlight_rules" { export const MysqlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/mysql" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/nasal_highlight_rules" { export const NasalHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/nasal" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/nginx_highlight_rules" { export const NginxHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/nginx" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/nim_highlight_rules" { export const NimHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/nim" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/nix_highlight_rules" { export const NixHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/nix" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/nsis_highlight_rules" { export const NSISHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/nsis" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/nunjucks_highlight_rules" { export const NunjucksHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/nunjucks" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/objectivec_highlight_rules" { export const ObjectiveCHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/objectivec" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/ocaml_highlight_rules" { export const OcamlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/ocaml" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/odin_highlight_rules" { export const OdinHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/odin" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/partiql_highlight_rules" { export const PartiqlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/partiql" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/pascal_highlight_rules" { export const PascalHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/pascal" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/perl_highlight_rules" { export const PerlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/perl" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/pgsql_highlight_rules" { export const PgsqlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/pgsql" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/php_completions" { export const PhpCompletions: new () => import("ace-code").Ace.Completion; } declare module "ace-code/src/mode/php_highlight_rules" { export const PhpHighlightRules: new () => import("ace-code").Ace.HighlightRules; export const PhpLangHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/php_laravel_blade_highlight_rules" { export const PHPLaravelBladeHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/php_laravel_blade" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/php" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/pig_highlight_rules" { export const PigHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/pig" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/plain_text" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/plsql_highlight_rules" { export const plsqlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/plsql" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/powershell_highlight_rules" { export const PowershellHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/powershell" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/praat_highlight_rules" { export const PraatHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/praat" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/prisma_highlight_rules" { export const PrismaHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/prisma" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/prolog_highlight_rules" { export const PrologHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/prolog" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/properties_highlight_rules" { export const PropertiesHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/properties" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/protobuf_highlight_rules" { export const ProtobufHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/protobuf" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/prql_highlight_rules" { export const PrqlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/prql" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/puppet_highlight_rules" { export const PuppetHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/puppet" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/python_highlight_rules" { export const PythonHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/python" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/qml_highlight_rules" { export const QmlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/qml" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/r_highlight_rules" { export const RHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/r" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/raku_highlight_rules" { export const RakuHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/raku" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/razor_completions" { export const RazorCompletions: new () => import("ace-code").Ace.Completion; } declare module "ace-code/src/mode/razor_highlight_rules" { export const RazorHighlightRules: new () => import("ace-code").Ace.HighlightRules; export const RazorLangHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/razor" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/rdoc_highlight_rules" { export const RDocHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/rdoc" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/red_highlight_rules" { export const RedHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/red" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/redshift_highlight_rules" { export const RedshiftHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/redshift" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/rhtml_highlight_rules" { export const RHtmlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/rhtml" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/robot_highlight_rules" { export const RobotHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/robot" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/rst_highlight_rules" { export const RSTHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/rst" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/ruby_highlight_rules" { export const constantOtherSymbol: { token: string; regex: string; }; export const qString: { token: string; regex: string; }; export const qqString: { token: string; regex: string; }; export const tString: { token: string; regex: string; }; export const constantNumericHex: { token: string; regex: string; }; export const constantNumericBinary: { token: string; regex: RegExp; }; export const constantNumericDecimal: { token: string; regex: RegExp; }; export const constantNumericOctal: { token: string; regex: RegExp; }; export const constantNumericRational: { token: string; regex: RegExp; }; export const constantNumericComplex: { token: string; regex: RegExp; }; export const constantNumericFloat: { token: string; regex: string; }; export const instanceVariable: { token: string; regex: string; }; export const RubyHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/ruby" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/rust_highlight_rules" { export const RustHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/rust" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/sac_highlight_rules" { export const sacHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/sac" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/sass_highlight_rules" { export const SassHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/sass" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/scad_highlight_rules" { export const scadHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/scad" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/scala_highlight_rules" { export const ScalaHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/scala" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/scheme_highlight_rules" { export const SchemeHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/scheme" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/scrypt_highlight_rules" { export const scryptHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/scrypt" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/scss_highlight_rules" { export const ScssHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/scss" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/sh_highlight_rules" { export const reservedKeywords: string; export const languageConstructs: string; export const ShHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/sh" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/sjs_highlight_rules" { export const SJSHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/sjs" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/slim_highlight_rules" { export const SlimHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/slim" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/smarty_highlight_rules" { export const SmartyHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/smarty" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/smithy_highlight_rules" { export const SmithyHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/smithy" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/snippets" { export const SnippetHighlightRules: new () => import("ace-code").Ace.HighlightRules; export const SnippetGroupHighlightRules: new () => import("ace-code").Ace.HighlightRules; export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/soy_template_highlight_rules" { export const SoyTemplateHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/soy_template" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/space_highlight_rules" { export const SpaceHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/space" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/sparql_highlight_rules" { export const SPARQLHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/sparql" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/sql_highlight_rules" { export const SqlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/sql" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/sqlserver_highlight_rules" { export const SqlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/sqlserver" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/stylus_highlight_rules" { export const StylusHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/stylus" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/svg_highlight_rules" { export const SvgHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/svg" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/swift_highlight_rules" { export const HighlightRules: new () => import("ace-code").Ace.HighlightRules; export const SwiftHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/swift" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/tcl_highlight_rules" { export const TclHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/tcl" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/terraform_highlight_rules" { export const TerraformHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/terraform" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/tex_highlight_rules" { export const TexHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/tex" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/text_highlight_rules" { export const TextHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/text" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/textile_highlight_rules" { export const TextileHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/textile" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/toml_highlight_rules" { export const TomlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/toml" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/tsv_highlight_rules" { export const TsvHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/tsv" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/tsx_highlight_rules" { export const TsxHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/tsx" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/turtle_highlight_rules" { export const TurtleHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/turtle" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/twig_highlight_rules" { export const TwigHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/twig" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/typescript_highlight_rules" { export const TypeScriptHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/typescript" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/vala_highlight_rules" { export const ValaHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/vala" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/vbscript_highlight_rules" { export const VBScriptHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/vbscript" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/velocity_highlight_rules" { export const VelocityHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/velocity" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/verilog_highlight_rules" { export const VerilogHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/verilog" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/vhdl_highlight_rules" { export const VHDLHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/vhdl" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/visualforce_highlight_rules" { export const VisualforceHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/visualforce" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/vue_highlight_rules" { export const VueHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/vue" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/wollok_highlight_rules" { export const WollokHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/wollok" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/xml_highlight_rules" { export const XmlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/xml" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/yaml_highlight_rules" { export const YamlHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/yaml" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/zeek_highlight_rules" { export const ZeekHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/zeek" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } declare module "ace-code/src/mode/zig_highlight_rules" { export const ZigHighlightRules: new () => import("ace-code").Ace.HighlightRules; } declare module "ace-code/src/mode/zig" { export const Mode: new () => import("ace-code").Ace.SyntaxMode; } ================================================ FILE: ace.d.ts ================================================ /* This file is generated using `npm run update-types` */ /// /// /// /// /// /// declare module "ace-code" { export namespace Ace { type Anchor = import("ace-code/src/anchor").Anchor; type Editor = import("ace-code/src/editor").Editor; type EditSession = import("ace-code/src/edit_session").EditSession; type Document = import("ace-code/src/document").Document; type Fold = import("ace-code/src/edit_session/fold").Fold; type FoldLine = import("ace-code/src/edit_session/fold_line").FoldLine; type Range = import("ace-code/src/range").Range; type VirtualRenderer = import("ace-code/src/virtual_renderer").VirtualRenderer; type UndoManager = import("ace-code/src/undomanager").UndoManager; type Tokenizer = import("ace-code/src/tokenizer").Tokenizer; type TokenIterator = import("ace-code/src/token_iterator").TokenIterator; type Selection = import("ace-code/src/selection").Selection; type Autocomplete = import("ace-code/src/autocomplete").Autocomplete; type InlineAutocomplete = import("ace-code/src/ext/inline_autocomplete").InlineAutocomplete; type CompletionProvider = import("ace-code/src/autocomplete").CompletionProvider; type AcePopup = import("ace-code/src/autocomplete/popup").AcePopup; type AceInline = import("ace-code/src/autocomplete/inline").AceInline; type MouseEvent = import("ace-code/src/mouse/mouse_event").MouseEvent; type RangeList = import("ace-code/src/range_list").RangeList; type FilteredList = import("ace-code/src/autocomplete").FilteredList; type LineWidgets = import("ace-code/src/line_widgets").LineWidgets; type SearchBox = import("ace-code/src/ext/searchbox").SearchBox; type Occur = import("ace-code/src/occur").Occur; type DefaultHandlers = import("ace-code/src/mouse/default_handlers").DefaultHandlers; type GutterHandler = import("ace-code/src/mouse/default_gutter_handler").GutterHandler; type DragdropHandler = import("ace-code/src/mouse/dragdrop_handler").DragdropHandler; type AppConfig = import("ace-code/src/lib/app_config").AppConfig; type Config = typeof import("ace-code/src/config"); type GutterTooltip = import("ace-code/src/mouse/default_gutter_handler").GutterTooltip; type GutterKeyboardEvent = import("ace-code/src/keyboard/gutter_handler").GutterKeyboardEvent; type HoverTooltip = import("ace-code/src/tooltip").HoverTooltip; type Tooltip = import("ace-code/src/tooltip").Tooltip; type TextInput = import("ace-code/src/keyboard/textinput").TextInput; type DiffChunk = import("ace-code/src/ext/diff/base_diff_view").DiffChunk; type AfterLoadCallback = (err: Error | null, module: unknown) => void; type LoaderFunction = (moduleName: string, afterLoad: AfterLoadCallback) => void; export interface ConfigOptions { packaged: boolean; workerPath: string | null; modePath: string | null; themePath: string | null; basePath: string; suffix: string; loadWorkerFromBlob: boolean; sharedPopups: boolean; useStrictCSP: boolean | null; } interface Theme { cssClass?: string; cssText?: string; padding?: number | string; isDark?: boolean; } interface ScrollBar { setVisible(visible: boolean): void; [key: string]: any; } interface HScrollbar extends ScrollBar { setWidth(width: number): void; } interface VScrollbar extends ScrollBar { setHeight(width: number): void; } interface LayerConfig { width: number; padding: number; firstRow: number; firstRowScreen: number; lastRow: number; lineHeight: number; characterWidth: number; minHeight: number; maxHeight: number; offset: number; height: number; gutterOffset: number; } interface HardWrapOptions { /** First row of the range to process */ startRow: number; /** Last row of the range to process */ endRow: number; /** Whether to merge short adjacent lines that fit within the limit */ allowMerge?: boolean; /** Maximum column width for line wrapping (defaults to editor's print margin) */ column?: number; } interface CommandBarOptions { maxElementsOnTooltip: number; alwaysShow: boolean; showDelay: number; hideDelay: number; } interface ScreenCoordinates { row: number; column: number; side?: 1 | -1; offsetX?: number; } interface 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 **/ getFoldAt(row: number, column: number, side?: number): Ace.Fold; /** * Returns all folds in the given range. Note, that this will return folds **/ getFoldsInRange(range: Ace.Range | Ace.Delta): Ace.Fold[]; getFoldsInRangeList(ranges: Ace.Range[] | Ace.Range): Ace.Fold[]; /** * Returns all folds in the document */ getAllFolds(): Ace.Fold[]; /** * 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" */ getFoldStringAt(row: number, column: number, trim?: number, foldLine?: Ace.FoldLine): string | null; getFoldLine(docRow: number, startFoldLine?: Ace.FoldLine): null | Ace.FoldLine; /** * Returns the fold which starts after or contains docRow */ getNextFoldLine(docRow: number, startFoldLine?: Ace.FoldLine): null | Ace.FoldLine; getFoldedRowCount(first: number, last: number): number; /** * Adds a new fold. * The new created Fold object or an existing fold object in case the * passed in range fits an existing fold exactly. */ addFold(placeholder: Ace.Fold | string, range?: Ace.Range): Ace.Fold; addFolds(folds: Ace.Fold[]): void; removeFold(fold: Ace.Fold): void; removeFolds(folds: Ace.Fold[]): void; expandFold(fold: Ace.Fold): void; expandFolds(folds: Ace.Fold[]): void; unfold(location?: number | null | Ace.Point | Ace.Range | Ace.Range[], expandInner?: boolean): Ace.Fold[] | undefined; /** * 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. **/ isRowFolded(docRow: number, startFoldRow?: Ace.FoldLine): boolean; getRowFoldEnd(docRow: number, startFoldRow?: Ace.FoldLine): number; getRowFoldStart(docRow: number, startFoldRow?: Ace.FoldLine): number; getFoldDisplayLine(foldLine: Ace.FoldLine, endRow?: number | null, endColumn?: number | null, startRow?: number | null, startColumn?: number | null): string; getDisplayLine(row: number, endColumn: number | null, startRow: number | null, startColumn: number | null): string; toggleFold(tryToUnfold?: boolean): void; getCommentFoldRange(row: number, column: number, dir?: number): Ace.Range | undefined; foldAll(startRow?: number | null, endRow?: number | null, depth?: number | null, test?: Function): void; foldToLevel(level: number): void; foldAllComments(): void; setFoldStyle(style: string): void; foldWidgets: any[]; getFoldWidget: any; getFoldWidgetRange: any; getParentFoldRangeData(row: number, ignoreCurrent?: boolean): { range?: Ace.Range; firstRange?: Ace.Range; }; onFoldWidgetClick(row: number, e: any): void; toggleFoldWidget(toggleParent?: boolean): void; updateFoldWidgets(delta: Ace.Delta): void; tokenizerUpdateFoldWidgets(e: any): void; } interface BracketMatch { findMatchingBracket: (position: Point, chr?: string) => Point; getBracketRange: (pos: Point) => null | Range; /** * Returns: * * null if there is no any bracket at `pos`; * * two Ranges if there is opening and closing brackets; * * one Range if there is only one bracket */ getMatchingBracketRanges: (pos: Point, isBackwards?: boolean) => null | Range[]; /** * Returns [[Range]]'s for matching tags and tag names, if there are any */ getMatchingTags: (pos: Point) => { closeTag: Range; closeTagName: Range; openTag: Range; openTagName: Range; }; } interface IRange { start: Point; end: Point; } interface LineWidget { editor?: Editor; el?: HTMLElement; rowCount?: number; hidden?: boolean; column?: number; row: number; session?: EditSession; html?: string; text?: string; className?: string; coverGutter?: boolean; pixelHeight?: number; type?: any; destroy?: () => void; coverLine?: boolean; fixedWidth?: boolean; fullWidth?: boolean; screenWidth?: number; rowsAbove?: number; lenses?: CodeLenseCommand[]; } type NewLineMode = "auto" | "unix" | "windows"; interface EditSessionOptions { wrap: "off" | "free" | "printmargin" | boolean | number; wrapMethod: "code" | "text" | "auto"; indentedSoftWrap: boolean; firstLineNumber: number; useWorker: boolean; useSoftTabs: boolean; tabSize: number; navigateWithinSoftTabs: boolean; foldStyle: "markbegin" | "markbeginend" | "manual"; overwrite: boolean; newLineMode: NewLineMode; mode: SyntaxMode | string; } interface VirtualRendererOptions { animatedScroll: boolean; showInvisibles: boolean; showPrintMargin: boolean; printMarginColumn: number; printMargin: boolean | number; showGutter: boolean; fadeFoldWidgets: boolean; showFoldWidgets: boolean; showLineNumbers: boolean; displayIndentGuides: boolean; highlightIndentGuides: boolean; highlightGutterLine: boolean; hScrollBarAlwaysVisible: boolean; vScrollBarAlwaysVisible: boolean; fontSize: string | number; fontFamily: string; maxLines: number; minLines: number; scrollPastEnd: number; fixedWidthGutter: boolean; customScrollbar: boolean; theme: string; hasCssTransforms: boolean; maxPixelHeight: number; useSvgGutterIcons: boolean; showFoldedAnnotations: boolean; useResizeObserver: boolean; } interface MouseHandlerOptions { scrollSpeed: number; dragDelay: number; dragEnabled: boolean; focusTimeout: number; } interface EditorOptions extends EditSessionOptions, MouseHandlerOptions, VirtualRendererOptions { selectionStyle: "fullLine" | "screenLine" | "text" | "line"; highlightActiveLine: boolean; highlightSelectedWord: boolean; readOnly: boolean; copyWithEmptySelection: boolean; cursorStyle: "ace" | "slim" | "smooth" | "wide"; mergeUndoDeltas: true | false | "always"; behavioursEnabled: boolean; wrapBehavioursEnabled: boolean; enableAutoIndent: boolean; enableBasicAutocompletion: boolean | Completer[]; enableLiveAutocompletion: boolean | Completer[]; liveAutocompletionDelay: number; liveAutocompletionThreshold: number; enableSnippets: boolean; autoScrollEditorIntoView: boolean; keyboardHandler: string | null; placeholder: string; value: string; session: EditSession; relativeLineNumbers: boolean; enableMultiselect: boolean; enableKeyboardAccessibility: boolean; enableCodeLens: boolean; textInputAriaLabel: string; enableMobileMenu: boolean; } interface EventsBase { [key: string]: any; } interface EditSessionEvents { /** * Emitted when the document changes. */ "change": (delta: Delta, emitter: EditSession) => void; /** * Emitted when the tab size changes, via [[EditSession.setTabSize]]. */ "changeTabSize": (e: undefined, emitter: EditSession) => void; /** * Emitted when the ability to overwrite text changes, via [[EditSession.setOverwrite]]. */ "changeOverwrite": (overwrite: boolean, emitter: EditSession) => void; /** * Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change. */ "changeBreakpoint": (e: { row?: number; breakpoint?: boolean; }, emitter: EditSession) => void; /** * Emitted when a front marker changes. */ "changeFrontMarker": (e: undefined, emitter: EditSession) => void; /** * Emitted when a back marker changes. */ "changeBackMarker": (e: undefined, emitter: EditSession) => void; /** * Emitted when an annotation changes, like through [[EditSession.setAnnotations]]. */ "changeAnnotation": (e: {}, emitter: EditSession) => void; /** * Emitted when a background tokenizer asynchronously processes new rows. */ "tokenizerUpdate": (e: { data: { first: number; last: number; }; }, emitter: EditSession) => void; /** * Emitted when the current mode changes. */ "changeMode": (e: any, emitter: EditSession) => void; /** * Emitted when the wrap mode changes. */ "changeWrapMode": (e: any, emitter: EditSession) => void; /** * Emitted when the wrapping limit changes. */ "changeWrapLimit": (e: any, emitter: EditSession) => void; /** * Emitted when a code fold is added or removed. */ "changeFold": (e: any, emitter: EditSession) => void; /** * Emitted when the scroll top changes. * @param scrollTop The new scroll top value **/ "changeScrollTop": (scrollTop: number, emitter: EditSession) => void; /** * Emitted when the scroll left changes. * @param scrollLeft The new scroll left value **/ "changeScrollLeft": (scrollLeft: number, emitter: EditSession) => void; "changeEditor": (e: { editor?: Editor; oldEditor?: Editor; }, emitter: EditSession) => void; "changeSelection": (e: undefined, emitter: EditSession) => void; "startOperation": (op: { command?: { name?: string; }; args?: any; }, emitter: EditSession) => void; "endOperation": (op: any, emitter: EditSession) => void; "beforeEndOperation": (e: undefined, emitter: EditSession) => void; } interface EditorEvents { "change": (delta: Delta, emitter: Editor) => void; "changeSelection": (e: undefined, emitter: Editor) => void; "input": (e: undefined, emitter: Editor) => void; /** * Emitted whenever the [[EditSession]] changes. * @param e An object with two properties, `oldSession` and `session`, that represent the old and new [[EditSession]]s. **/ "changeSession": (e: { oldSession: EditSession; session: EditSession; }, emitter: Editor) => void; "blur": (e: any, emitter: Editor) => void; "mousedown": (e: MouseEvent, emitter: Editor) => void; "mousemove": (e: MouseEvent & { scrollTop?: any; }, emitter: Editor) => void; "changeStatus": (e: any, emitter: Editor) => void; "keyboardActivity": (e: any, emitter: Editor) => void; "mousewheel": (e: MouseEvent, emitter: Editor) => void; "mouseup": (e: MouseEvent, emitter: Editor) => void; "beforeEndOperation": (e: any, emitter: Editor) => void; "nativecontextmenu": (e: any, emitter: Editor) => void; "destroy": (e: any, emitter: Editor) => void; "focus": (e: any, emitter: Editor) => void; /** * Emitted when text is copied. * @param text The copied text **/ "copy": (e: { text: string; }, emitter: Editor) => void; /** * Emitted when text is pasted. **/ "paste": (e: { text: string; event?: ClipboardEvent; }, emitter: Editor) => void; /** * Emitted when the selection style changes, via [[Editor.setSelectionStyle]]. * @param data Contains one property, `data`, which indicates the new selection style **/ "changeSelectionStyle": (data: "fullLine" | "screenLine" | "text" | "line", emitter: Editor) => void; "changeMode": (e: { mode?: Ace.SyntaxMode; oldMode?: Ace.SyntaxMode; }, emitter: Editor) => void; //from searchbox extension "findSearchBox": (e: { match: boolean; }, emitter: Editor) => void; //from code_lens extension "codeLensClick": (e: any, emitter: Editor) => void; "select": (e: undefined, emitter: Editor) => void; "gutterkeydown": (e: GutterKeyboardEvent, emitter: Editor) => void; "gutterclick": (e: MouseEvent, emitter: Editor) => void; "showGutterTooltip": (e: GutterTooltip, emitter: Editor) => void; "hideGutterTooltip": (e: GutterTooltip, emitter: Editor) => void; "compositionStart": (e: undefined, emitter: Editor) => void; } interface AcePopupEvents { "click": (e: MouseEvent, emitter: AcePopup) => void; "dblclick": (e: MouseEvent, emitter: AcePopup) => void; "tripleclick": (e: MouseEvent, emitter: AcePopup) => void; "quadclick": (e: MouseEvent, emitter: AcePopup) => void; "show": (e: undefined, emitter: AcePopup) => void; "hide": (e: undefined, emitter: AcePopup) => void; "select": (hide: boolean, emitter: AcePopup) => void; "changeHoverMarker": (e: any, emitter: AcePopup) => void; } interface DocumentEvents { /** * 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 * **/ "change": (e: Delta, emitter: Document) => void; "changeNewLineMode": (e: undefined, emitter: Document) => void; } interface AnchorEvents { /** * 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()`]]. * @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 **/ "change": (e: { old: Point; value: Point; }, emitter: Anchor) => void; } interface BackgroundTokenizerEvents { /** * Fires whenever the background tokeniziers between a range of rows are going to be updated. * @param e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated. **/ "update": (e: { data: { first: number; last: number; }; }, emitter: import("ace-code/src/background_tokenizer").BackgroundTokenizer) => void; } interface SelectionEvents { /** * Emitted when the cursor position changes. **/ "changeCursor": (e: undefined, emitter: Selection) => void; /** * Emitted when the cursor selection changes. **/ "changeSelection": (e: undefined, emitter: Selection) => void; } interface MultiSelectionEvents extends SelectionEvents { "multiSelect": (e: undefined, emitter: Selection) => void; "addRange": (e: { range: Range; }, emitter: Selection) => void; "removeRange": (e: { ranges: Range[]; }, emitter: Selection) => void; "singleSelect": (e: undefined, emitter: Selection) => void; } interface PlaceHolderEvents { "cursorEnter": (e: any, emitter: import("ace-code/src/placeholder").PlaceHolder) => void; "cursorLeave": (e: any, emitter: import("ace-code/src/placeholder").PlaceHolder) => void; } interface GutterEvents { "changeGutterWidth": (width: number, emitter: import("ace-code/src/layer/gutter").Gutter) => void; "afterRender": (e: undefined, emitter: import("ace-code/src/layer/gutter").Gutter) => void; } interface TextEvents { "changeCharacterSize": (e: any, emitter: import("ace-code/src/layer/text").Text) => void; } interface VirtualRendererEvents { "afterRender": (e: any, emitter: VirtualRenderer) => void; "beforeRender": (e: any, emitter: VirtualRenderer) => void; "themeLoaded": (e: { theme: string | Theme; }, emitter: VirtualRenderer) => void; "themeChange": (e: { theme: string | Theme; }, emitter: VirtualRenderer) => void; "scrollbarVisibilityChanged": (e: undefined, emitter: VirtualRenderer) => void; "changeCharacterSize": (e: any, emitter: VirtualRenderer) => void; "resize": (e: any, emitter: VirtualRenderer) => void; "autosize": (e: undefined, emitter: VirtualRenderer) => void; } type EmitParameters any> = T extends (first: infer First, ...rest: any[]) => any ? [ First ] : [ ]; export class EventEmitter any; }> { once(name: K, callback: T[K]): void; setDefaultHandler(name: string, callback: Function): void; removeDefaultHandler(name: string, callback: Function): void; on(name: K, callback: T[K], capturing?: boolean): T[K]; addEventListener(name: K, callback: T[K], capturing?: boolean): T[K]; off(name: K, callback: T[K]): void; removeListener(name: K, callback: T[K]): void; removeEventListener(name: K, callback: T[K]): void; removeAllListeners(name?: string): void; } interface SearchOptions { /**The string or regular expression you're looking for*/ needle: string | RegExp; preventScroll: boolean; /**Whether to search backwards from where cursor currently is*/ backwards: boolean; /**The starting [[Range]] or cursor position to begin the search*/ start: Range; /**Whether or not to include the current line in the search*/ skipCurrent: boolean; /**The [[Range]] to search within. Set this to `null` for the whole document*/ range: Range | null; preserveCase: boolean; /**Whether the search is a regular expression or not*/ regExp: boolean; /**Whether the search matches only on whole words*/ wholeWord: boolean; /**Whether the search ought to be case-sensitive*/ caseSensitive: boolean; /**Whether to wrap the search back to the beginning when it hits the end*/ wrap: boolean; re: any; } interface Point { row: number; column: number; } type Position = Point; interface Delta { action: "insert" | "remove"; start: Point; end: Point; lines: string[]; id?: number; folds?: Fold[]; } interface Annotation { row: number; column: number; text: string; type: string; } export interface MarkerGroupItem { range: Range; className: string; } type MarkerGroup = import("ace-code/src/marker_group").MarkerGroup; export interface Command { name?: string; bindKey?: string | { mac?: string; win?: string; }; readOnly?: boolean; exec?: (editor?: Editor | any, args?: any) => void; isAvailable?: (editor: Editor) => boolean; description?: string; multiSelectAction?: "forEach" | "forEachLine" | Function; scrollIntoView?: true | "cursor" | "center" | "selectionPart" | "animate" | "selection" | "none"; aceCommandGroup?: string; passEvent?: boolean; level?: number; action?: string; } type CommandLike = Command | ((editor: Editor) => void) | ((sb: SearchBox) => void); type KeyboardHandler = Partial & { attach?: (editor: Editor) => void; detach?: (editor: Editor) => void; getStatusText?: (editor?: any, data?: any) => string; }; export interface MarkerLike { range?: Range; type: string; renderer?: MarkerRenderer; clazz: string; inFront?: boolean; id?: number; update?: (html: string[], // TODO maybe define Marker class marker: any, session: EditSession, config: any) => void; [key: string]: any; } type MarkerRenderer = (html: string[], range: Range, left: number, top: number, config: any) => void; interface Token { type: string; value: string; index?: number; start?: number; } type BaseCompletion = import("ace-code/src/autocomplete").BaseCompletion; type SnippetCompletion = import("ace-code/src/autocomplete").SnippetCompletion; type ValueCompletion = import("ace-code/src/autocomplete").ValueCompletion; type Completion = import("ace-code/src/autocomplete").Completion; type HighlightRule = ({ defaultToken: string; } | { include: string; } | { todo: string; } | { token: string | string[] | ((value: string) => string); regex: string | RegExp; next?: string | (() => void); push?: string; comment?: string; caseInsensitive?: boolean; nextState?: string; }) & { [key: string]: any; }; type HighlightRulesMap = Record; type KeywordMapper = (keyword: string) => string; interface HighlightRules { addRules(rules: HighlightRulesMap, prefix?: string): void; getRules(): HighlightRulesMap; embedRules(rules: (new () => HighlightRules) | HighlightRulesMap, prefix: string, escapeRules?: boolean, append?: boolean): void; getEmbeds(): string[]; normalizeRules(): void; createKeywordMapper(map: Record, defaultToken?: string, ignoreCase?: boolean, splitChar?: string): KeywordMapper; } type FoldWidget = "start" | "end" | ""; interface FoldMode { foldingStartMarker: RegExp; foldingStopMarker?: RegExp; getFoldWidget(session: EditSession, foldStyle: string, row: number): FoldWidget; getFoldWidgetRange(session: EditSession, foldStyle: string, row: number): Range | undefined; indentationBlock(session: EditSession, row: number, column?: number): Range | undefined; openingBracketBlock(session: EditSession, bracket: string, row: number, column: number, typeRe?: RegExp): Range | undefined; closingBracketBlock(session: EditSession, bracket: string, row: number, column: number, typeRe?: RegExp): Range | undefined; } type BehaviorAction = (state: string | string[], action: string, editor: Editor, session: EditSession, text: string | Range) => ({ text: string; selection: number[]; } | Range) & { [key: string]: any; } | undefined; type BehaviorMap = Record>; interface Behaviour { add(name: string, action: string, callback: BehaviorAction): void; addBehaviours(behaviours: BehaviorMap): void; remove(name: string): void; inherit(mode: SyntaxMode | (new () => SyntaxMode), filter: string[]): void; getBehaviours(filter?: string[]): BehaviorMap; } interface Outdent { checkOutdent(line: string, input: string): boolean; autoOutdent(doc: Document, row: number): number | undefined; } interface SyntaxMode { HighlightRules: { new(config?: any): HighlightRules; }; //TODO: fix this foldingRules?: FoldMode; /** * characters that indicate the start of a line comment */ lineCommentStart?: string; /** * characters that indicate the start and end of a block comment */ blockComment?: { start: string; end: string; }; tokenRe?: RegExp; nonTokenRe?: RegExp; completionKeywords: string[]; transformAction: BehaviorAction; path?: string; getTokenizer(): Tokenizer; toggleCommentLines(state: string | string[], session: EditSession, startRow: number, endRow: number): void; toggleBlockComment(state: string | string[], session: EditSession, range: Range, cursor: Point): void; getNextLineIndent(state: string | string[], line: string, tab: string): string; checkOutdent(state: string | string[], line: string, input: string): boolean; autoOutdent(state: string | string[], doc: EditSession, row: number): void; // TODO implement WorkerClient types createWorker(session: EditSession): any; createModeDelegates(mapping: { [key: string]: string; }): void; getKeywords(append?: boolean): Array; getCompletions(state: string | string[], session: EditSession, pos: Point, prefix: string): Completion[]; } interface OptionsBase { [key: string]: any; } class OptionsProvider { setOptions(optList: Partial): void; getOptions(optionNames?: Array | Partial): Partial; setOption(name: K, value: T[K]): void; getOption(name: K): T[K]; } type KeyBinding = import("ace-code/src/keyboard/keybinding").KeyBinding; interface CommandMap { [name: string]: Command; } type execEventHandler = (obj: { editor: Editor; command: Command; args: any[]; }, emitter: CommandManager) => void; interface CommandManagerEvents { "exec": execEventHandler; "afterExec": execEventHandler; "commandUnavailable": execEventHandler; } type CommandManager = import("ace-code/src/commands/command_manager").CommandManager; interface SavedSelection { start: Point; end: Point; isBackwards: boolean; } var Selection: { new(session: EditSession): Selection; }; type CompleterCallback = (error: any, completions: Completion[]) => void; interface Completer { /** Regular expressions defining valid identifier characters for completion triggers */ identifierRegexps?: Array; /** Main completion method that provides suggestions for the given context */ getCompletions(editor: Editor, session: EditSession, position: Point, prefix: string, callback: CompleterCallback): void; /** Returns documentation tooltip for a completion item */ getDocTooltip?(item: Completion): void | string | Completion; /** Called when a completion item becomes visible */ onSeen?: (editor: Ace.Editor, completion: Completion) => void; /** Called when a completion item is inserted */ onInsert?: (editor: Ace.Editor, completion: Completion) => void; /** Cleanup method called when completion is cancelled */ cancel?(): void; /** Unique identifier for this completer */ id?: string; /** Characters that trigger autocompletion when typed */ triggerCharacters?: string[]; /** Whether to hide inline preview text */ hideInlinePreview?: boolean; /** Custom insertion handler for completion items */ insertMatch?: (editor: Editor, data: Completion) => void; } interface CompletionOptions { matches?: Completion[]; } type CompletionProviderOptions = { exactMatch?: boolean; ignoreCaption?: boolean; }; type GatherCompletionRecord = { prefix: string; matches: Completion[]; finished: boolean; }; type CompletionCallbackFunction = (err: Error | undefined, data: GatherCompletionRecord) => void; type CompletionProviderCallback = (this: import("ace-code/src/autocomplete").Autocomplete, err: Error | undefined, completions: import("ace-code/src/autocomplete").FilteredList, finished: boolean) => void; type AcePopupNavigation = "up" | "down" | "start" | "end"; interface EditorMultiSelectProperties { inMultiSelectMode?: boolean; /** * Updates the cursor and marker layers. **/ updateSelectionMarkers: () => void; /** * Adds the selection and cursor. * @param orientedRange A range containing a cursor **/ addSelectionMarker: (orientedRange: Ace.Range & { marker?: any; }) => Ace.Range & { marker?: any; }; /** * Removes the selection marker. * @param range The selection range added with [[Editor.addSelectionMarker `addSelectionMarker()`]]. **/ removeSelectionMarker: (range: Ace.Range & { marker?: any; }) => void; removeSelectionMarkers: (ranges: (Ace.Range & { marker?: any; })[]) => void; /** * Executes a command for each selection range. * @param cmd The command to execute * @param [args] Any arguments for the command **/ forEachSelection: (cmd: Object, args?: string, options?: Object) => void; /** * Removes all the selections except the last added one. **/ exitMultiSelectMode: () => void; getSelectedText: () => string; /** * Finds and selects all the occurrences of `needle`. * @param needle The text to find * @param options The search options * @param additive keeps * @returns {Number} The cumulative count of all found matches **/ findAll: (needle?: string, options?: Partial, additive?: boolean) => number; /** * Adds a cursor above or below the active cursor. * @param dir The direction of lines to select: -1 for up, 1 for down * @param [skip] If `true`, removes the active selection range */ selectMoreLines: (dir: number, skip?: boolean) => void; /** * Transposes the selected ranges. * @param {Number} dir The direction to rotate selections **/ transposeSelections: (dir: number) => void; /** * Finds the next occurrence of text in an active selection and adds it to the selections. * @param {Number} dir The direction of lines to select: -1 for up, 1 for down * @param {Boolean} [skip] If `true`, removes the active selection range **/ selectMore: (dir: number, skip?: boolean, stopAtFirst?: boolean) => void; /** * Aligns the cursors or selected text. **/ alignCursors: () => void; multiSelect?: any; } /** * Provider interface for code lens functionality */ interface CodeLenseProvider { /** * Compute code lenses for the given edit session * @param session The edit session to provide code lenses for * @param callback Callback function that receives errors and code lenses */ provideCodeLenses: (session: EditSession, callback: (err: any, payload: CodeLense[]) => void) => void; } /** * Represents a command associated with a code lens */ interface CodeLenseCommand { /** * Command identifier that will be executed */ id?: string; /** * Display title for the code lens */ title: string; /** * Argument(s) to pass to the command when executed */ arguments?: any; } /** * Represents a code lens - an actionable UI element displayed above a code line */ interface CodeLense { /** * Starting position where the code lens should be displayed */ start: Point; /** * Command to execute when the code lens is activated */ command?: CodeLenseCommand; } interface CodeLenseEditorExtension { codeLensProviders?: CodeLenseProvider[]; } interface ElasticTabstopsEditorExtension { elasticTabstops?: import("ace-code/src/ext/elastic_tabstops_lite").ElasticTabstopsLite; } interface TextareaEditorExtension { setDisplaySettings?: (settings: any) => void; } interface PromptEditorExtension { cmdLine?: Editor; } interface OptionsEditorExtension { } interface MultiSelectProperties { ranges: Ace.Range[] | null; rangeList: Ace.RangeList | null; /** * Adds a range to a selection by entering multiselect mode, if necessary. * @param {Ace.Range} range The new range to add * @param {Boolean} [$blockChangeEvents] Whether or not to block changing events **/ addRange(range: Ace.Range, $blockChangeEvents?: boolean): any; inMultiSelectMode: boolean; toSingleRange(range?: Ace.Range): void; /** * Removes a Range containing pos (if it exists). * @param {Ace.Point} pos The position to remove, as a `{row, column}` object **/ substractPoint(pos: Ace.Point): any; /** * Merges overlapping ranges ensuring consistency after changes **/ mergeOverlappingRanges(): void; rangeCount: number; /** * Returns a concatenation of all the ranges. **/ getAllRanges(): Ace.Range[]; /** * Splits all the ranges into lines. **/ splitIntoLines(): void; joinSelections(): void; toggleBlockSelection(): void; /** * * Gets list of ranges composing rectangular block on the screen * * @param {Ace.ScreenCoordinates} screenCursor The cursor to use * @param {Ace.ScreenCoordinates} screenAnchor The anchor to use * @param {Boolean} [includeEmptyLines] If true, this includes ranges inside the block which are empty due to clipping **/ rectangularRangeBlock(screenCursor: Ace.ScreenCoordinates, screenAnchor: Ace.ScreenCoordinates, includeEmptyLines?: boolean): Ace.Range[]; index?: number; } type AcePopupEventsCombined = Ace.EditorEvents & Ace.AcePopupEvents; type AcePopupWithEditor = Ace.EventEmitter & Ace.Editor; type InlineAutocompleteAction = "prev" | "next" | "first" | "last"; type TooltipCommandFunction = (editor: Ace.Editor) => T; export interface TooltipCommand extends Ace.Command { enabled?: TooltipCommandFunction | boolean; getValue?: TooltipCommandFunction; type: "button" | "text" | "checkbox"; iconCssClass?: string; cssClass?: string; } export type CommandBarTooltip = import("ace-code/src/ext/command_bar").CommandBarTooltip; export type TokenizeResult = Array>; export interface StaticHighlightOptions { /** Syntax mode (e.g., 'ace/mode/javascript'). Auto-detected from CSS class if not provided */ mode?: string | SyntaxMode; /** Color theme (e.g., 'ace/theme/textmate'). Defaults to 'ace/theme/textmate' */ theme?: string | Theme; /** Whether to trim whitespace from code content */ trim?: boolean; /** Starting line number for display */ firstLineNumber?: number; /** Whether to show line numbers gutter */ showGutter?: boolean; } export interface Operation { command: { name?: string; }; args: any; selectionBefore?: Range | Range[]; selectionAfter?: Range | Range[]; docChanged?: boolean; selectionChanged?: boolean; } export interface CommandBarEvents { "hide": (e: undefined, emitter: import("ace-code/src/ext/command_bar").CommandBarTooltip) => void; "show": (e: undefined, emitter: import("ace-code/src/ext/command_bar").CommandBarTooltip) => void; "alwaysShow": (e: boolean, emitter: import("ace-code/src/ext/command_bar").CommandBarTooltip) => void; } export interface FontMetricsEvents { "changeCharacterSize": (e: { data: { height: number; width: number; }; }, emitter: import("ace-code/src/layer/font_metrics").FontMetrics) => void; } export interface OptionPanelEvents { "setOption": (e: { name: string; value: any; }, emitter: import("ace-code/src/ext/options").OptionPanel) => void; } export interface ScrollbarEvents { "scroll": (e: { data: number; }, emitter: ScrollBar) => void; } export interface TextInputAriaOptions { activeDescendant?: string; role?: string; setLabel?: boolean; inline?: boolean; } } export const config: typeof import("ace-code/src/config"); export function edit(el?: string | (HTMLElement & { env?: any; value?: any; }) | null, options?: Partial): Editor; export function createEditSession(text: import("ace-code/src/document").Document | string, mode?: import("ace-code").Ace.SyntaxMode): EditSession; import { Editor } from "ace-code/src/editor"; import { EditSession } from "ace-code/src/edit_session"; import { Range } from "ace-code/src/range"; import { UndoManager } from "ace-code/src/undomanager"; import { VirtualRenderer as Renderer } from "ace-code/src/virtual_renderer"; export var version: "1.43.6"; export { Range, Editor, EditSession, UndoManager, Renderer as VirtualRenderer }; } ================================================ FILE: amplify.yml ================================================ version: 0.1 frontend: phases: preBuild: commands: - npm install # IMPORTANT - Please verify your build commands build: commands: - make build artifacts: # IMPORTANT - Please verify your build output directory baseDirectory: / files: - '**/*' cache: paths: - node_modules/**/* ================================================ 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: demo/autocompletion.html ================================================ ACE Autocompletion demo













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



  
  
  Editor
  


autoresizing editor
minHeight = 2 lines



================================================ FILE: demo/code_lens.html ================================================ ACE Code Lens demo










================================================
FILE: demo/csp.html
================================================



  
  
  
  Editor
















================================================
FILE: demo/diff/examples/editor.16.js
================================================
"use strict";

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 LineWidgets = require("./line_widgets").LineWidgets;

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, options) {
    this.$toDestroy = [];
    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.destroyed)
            this.session.bgTokenizer.scheduleStart();
    }.bind(this));
    
    this.on("change", function(_, _self) {
        _self._$emitInputEvent.schedule(31);
    });

    this.setSession(session || options && options.session || new EditSession(""));
    config.resetOptions(this);
    if (options)
        this.setOptions(options);
    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, true));
        
        // 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(commandEvent) {
        if (this.curOp) {
            if (!commandEvent || this.curOp.command)
                return;
            this.prevOp = this.curOp;
        }
        if (!commandEvent) {
            this.previousCommand = null;
            commandEvent = {};
        }

        this.$opResetTimer.schedule();
        this.curOp = this.session.curOp = {
            command: commandEvent.command || {},
            args: commandEvent.args,
            scrollTop: this.renderer.scrollTop
        };
        this.curOp.selectionBefore = this.selection.toJSON();
    };

    this.endOperation = function(e) {
        if (this.curOp && this.session) {
            if (e && e.returnValue === false || !this.session)
                return (this.curOp = null);
            if (e == true && this.curOp.command && this.curOp.command.name == "mouse")
                return;
            this._signal("beforeEndOperation");
            if (!this.curOp) return;
            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" && keyboardHandler != "ace") {
            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.destroyed)
            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.$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.destroyed) return;
            if (session.$bracketHighlight) {
                session.$bracketHighlight.markerIds.forEach(function(id) {
                    session.removeMarker(id);
                });
                session.$bracketHighlight = null;
            }
            var pos = self.getCursorPosition();
            var handler = self.getKeyboardHandler();
            var isBackwards = handler && handler.$getDirectionForHighlight && handler.$getDirectionForHighlight(self);
            var ranges = session.getMatchingBracketRanges(pos, isBackwards);

            if (!ranges) {
                var iterator = new TokenIterator(session, pos.row, pos.column);
                var token = iterator.getCurrentToken();

                if (token && /\b(?:tag-open|tag-name)/.test(token.type)) {
                    var tagNamesRanges = session.getMatchingTags(pos);
                    if (tagNamesRanges) ranges = [tagNamesRanges.openTagName, tagNamesRanges.closeTagName];
                }
            }
            if (!ranges && session.$mode.getMatching)
                ranges = session.$mode.getMatching(self.session);
            if (!ranges) {
                if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide();
                return;
            }

            var markerType = "ace_bracket";
            if (!Array.isArray(ranges)) {
                ranges = [ranges];
            } else if (ranges.length == 1) {
                markerType = "ace_error_bracket";
            }

            // show adjacent ranges as one
            if (ranges.length == 2) {
                if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0)
                    ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)];
                else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0)
                    ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)];
            }

            session.$bracketHighlight = {
                ranges: ranges,
                markerIds: ranges.map(function(range) {
                    return session.addMarker(range, markerType, "text");
                })
            };
            if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide();
        }, 50);
    };

    /**
     *
     * Brings the current `textInput` into focus.
     **/
    this.focus = function() {
        this.textInput.focus();
    };

    /**
     * Returns `true` if the current `textInput` is in focus.
     * @return {Boolean}
     **/
    this.isFocused = function() {
        return this.textInput.isFocused();
    };

    /**
     *
     * Blurs the current `textInput`.
     **/
    this.blur = function() {
        this.textInput.blur();
    };

    /**
     * Emitted once the editor comes into focus.
     * @event focus
     *
     *
     **/
    this.onFocus = function(e) {
        if (this.$isFocused)
            return;
        this.$isFocused = true;
        this.renderer.showCursor();
        this.renderer.visualizeFocus();
        this._emit("focus", e);
    };

    /**
     * Emitted once the editor has been blurred.
     * @event blur
     *
     *
     **/
    this.onBlur = function(e) {
        if (!this.$isFocused)
            return;
        this.$isFocused = false;
        this.renderer.hideCursor();
        this.renderer.visualizeBlur();
        this._emit("blur", e);
    };

    this.$cursorChange = function() {
        this.renderer.updateCursor();
        this.$highlightBrackets();
        this.$updateHighlightActiveLine();
    };

    /**
     * Emitted whenever the document is changed.
     * @event change
     * @param {Object} e Contains a single property, `data`, which has the delta of changes
     *
     *
     *
     **/
    this.onDocumentChange = function(delta) {
        // Rerender and emit "change" event.
        var wrap = this.session.$useWrapMode;
        var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity);
        this.renderer.updateLines(delta.start.row, lastRow, wrap);

        this._signal("change", delta);
        
        // Update cursor because tab characters can influence the cursor position.
        this.$cursorChange();
    };

    this.onTokenizerUpdate = function(e) {
        var rows = e.data;
        this.renderer.updateLines(rows.first, rows.last);
    };


    this.onScrollTopChange = function() {
        this.renderer.scrollToY(this.session.getScrollTop());
    };

    this.onScrollLeftChange = function() {
        this.renderer.scrollToX(this.session.getScrollLeft());
    };

    /**
     * Emitted when the selection changes.
     *
     **/
    this.onCursorChange = function() {
        this.$cursorChange();
        this._signal("changeSelection");
    };

    this.$updateHighlightActiveLine = function() {
        var session = this.getSession();

        var highlight;
        if (this.$highlightActiveLine) {
            if (this.$selectionStyle != "line" || !this.selection.isMultiLine())
                highlight = this.getCursorPosition();
            if (this.renderer.theme && this.renderer.theme.$selectionColorConflict && !this.selection.isEmpty())
                highlight = false;
            if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 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);
        // maximum allowed size for regular expressions in 32000, 
        // but getting close to it has significant impact on the performance
        if (needle.length > 5000 || !/[\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 : false;
        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;
    
            var isFullLine = lines.length == 2 && (!lines[0] || !lines[1]);
            if (lines.length != ranges.length || isFullLine)
                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);
        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 (this.$enableAutoIndent) {
            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.autoIndent = function () {
        var session = this.session;
        var mode = session.getMode();

        var startRow, endRow;
        if (this.selection.isEmpty()) {
            startRow = 0;
            endRow = session.doc.getLength() - 1;
        } else {
            var selectedRange = this.getSelectionRange();

            startRow = selectedRange.start.row;
            endRow = selectedRange.end.row;
        }

        var prevLineState = "";
        var prevLine = "";
        var lineIndent = "";
        var line, currIndent, range;
        var tab = session.getTabString();

        for (var row = startRow; row <= endRow; row++) {
            if (row > 0) {
                prevLineState = session.getState(row - 1);
                prevLine = session.getLine(row - 1);
                lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab);
            }

            line = session.getLine(row);
            currIndent = mode.$getIndent(line);
            if (lineIndent !== currIndent) {
                if (currIndent.length > 0) {
                    range = new Range(row, 0, row, currIndent.length);
                    session.remove(range);
                }
                if (lineIndent.length > 0) {
                    session.insert({row: row, column: 0}, lineIndent);
                }
            }

            mode.autoOutdent(prevLineState, session, row);
        }
    };


    this.onTextInput = function(text, composition) {
        if (!composition)
            return this.keyBinding.onTextInput(text);
        
        this.startOperation({command: { name: "insertstring" }});
        var applyComposition = this.applyComposition.bind(this, text, composition);
        if (this.selection.rangeCount)
            this.forEachSelection(applyComposition);
        else
            applyComposition();
        this.endOperation();
    };
    
    this.applyComposition = function(text, composition) {
        if (composition.extendLeft || composition.extendRight) {
            var r = this.selection.getRange();
            r.start.column -= composition.extendLeft;
            r.end.column += composition.extendRight;
            if (r.start.column < 0) {
                r.start.row--;
                r.start.column += this.session.getLine(r.start.row).length + 1;
            }
            this.selection.setRange(r);
            if (!text && !r.isEmpty())
                this.remove();
        }
        if (text || !this.selection.isEmpty())
            this.insert(text, true);
        if (composition.restoreStart || composition.restoreEnd) {
            var r = this.selection.getRange();
            r.start.column -= composition.restoreStart;
            r.end.column -= composition.restoreEnd;
            this.selection.setRange(r);
        }
    };

    this.onCommandKey = function(e, hashId, keyCode) {
        return 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();
    };

    this.setHighlightIndentGuides = function(highlight) {
        this.renderer.setHighlightIndentGuides(highlight);
    };

    this.getHighlightIndentGuides = function() {
        return this.renderer.getHighlightIndentGuides();
    };

    /**
     * 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();
        if (this.selection.isEmpty())
            this.selection.selectLeft();
        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);
    };

    /**
     * Set the "ghost" text in provided position. "Ghost" text is a kind of
     * preview text inside the editor which can be used to preview some code
     * inline in the editor such as, for example, code completions.
     * 
     * @param {String} text Text to be inserted as "ghost" text
     * @param {object} position Position to insert text to
     */
    this.setGhostText = function(text, position) {
        if (!this.session.widgetManager) {
            this.session.widgetManager = new LineWidgets(this.session);
            this.session.widgetManager.attach(this);
        }
        this.renderer.setGhostText(text, position);
    };

    /**
     * Removes "ghost" text currently displayed in the editor.
     */
    this.removeGhostText = function() {
        if (!this.session.widgetManager) return;

        this.renderer.removeGhostText();
    };

    /**
     * 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));

            }
        } else {
            this.toggleWord();
        }
    };

    this.$toggleWordPairs = [
        ["first", "last"],
        ["true", "false"],
        ["yes", "no"],
        ["width", "height"],
        ["top", "bottom"],
        ["right", "left"],
        ["on", "off"],
        ["x", "y"],
        ["get", "set"],
        ["max", "min"],
        ["horizontal", "vertical"],
        ["show", "hide"],
        ["add", "remove"],
        ["up", "down"],
        ["before", "after"],
        ["even", "odd"],
        ["in", "out"],
        ["inside", "outside"],
        ["next", "previous"],
        ["increase", "decrease"],
        ["attach", "detach"],
        ["&&", "||"],
        ["==", "!="]
    ];

    this.toggleWord = function () {
        var row = this.selection.getCursor().row;
        var column = this.selection.getCursor().column;
        this.selection.selectWord();
        var currentState = this.getSelectedText();
        var currWordStart = this.selection.getWordRange().start.column;
        var wordParts = currentState.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g, '$1 ').split(/\s/);
        var delta = column - currWordStart - 1;
        if (delta < 0) delta = 0;
        var curLength = 0, itLength = 0;
        var that = this;
        if (currentState.match(/[A-Za-z0-9_]+/)) {
            wordParts.forEach(function (item, i) {
                itLength = curLength + item.length;
                if (delta >= curLength && delta <= itLength) {
                    currentState = item;
                    that.selection.clearSelection();
                    that.moveCursorTo(row, curLength + currWordStart);
                    that.selection.selectTo(row, itLength + currWordStart);
                }
                curLength = itLength;
            });
        }

        var wordPairs = this.$toggleWordPairs;
        var reg;
        for (var i = 0; i < wordPairs.length; i++) {
            var item = wordPairs[i];
            for (var j = 0; j <= 1; j++) {
                var negate = +!j;
                var firstCondition = currentState.match(new RegExp('^\\s?_?(' + lang.escapeRegExp(item[j]) + ')\\s?$', 'i'));
                if (firstCondition) {
                    var secondCondition = currentState.match(new RegExp('([_]|^|\\s)(' + lang.escapeRegExp(firstCondition[1]) + ')($|\\s)', 'g'));
                    if (secondCondition) {
                        reg = currentState.replace(new RegExp(lang.escapeRegExp(item[j]), 'i'), function (result) {
                            var res = item[negate];
                            if (result.toUpperCase() == result) {
                                res = res.toUpperCase();
                            } else if (result.charAt(0).toUpperCase() == result.charAt(0)) {
                                res = res.substr(0, 0) + item[negate].charAt(0).toUpperCase() + res.substr(1);
                            }
                            return res;
                        });
                        this.insert(reg);
                        reg = "";
                    }
                }
            }
        }
    };

    /**
     * Finds link at defined {row} and {column}
     * @returns {String}
     **/
    this.findLinkAt = function (row, column) {
        var line = this.session.getLine(row);
        var wordParts = line.split(/((?:https?|ftp):\/\/[\S]+)/);
        var columnPosition = column;
        if (columnPosition < 0) columnPosition = 0;
        var previousPosition = 0, currentPosition = 0, match;
        for (let item of wordParts) {
            currentPosition = previousPosition + item.length;
            if (columnPosition >= previousPosition && columnPosition <= currentPosition) {
                if (item.match(/((?:https?|ftp):\/\/[\S]+)/)) {
                    match = item.replace(/[\s:.,'";}\]]+$/, "");
                    break;
                }
            }
            previousPosition = currentPosition;
        }
        return match;
    };

    /**
     * Open valid url under cursor in another tab
     * @returns {Boolean}
     **/
    this.openLink = function () {
        var cursor =  this.selection.getCursor();
        var url = this.findLinkAt(cursor.row, cursor.column);
        if (url)
            window.open(url, '_blank');
        return url != null;
    };

    /**
     * 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(compositionState) {
        this.renderer.showComposition(compositionState);
    };

    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 tokenCount = 0;
        if (prevToken && prevToken.type.indexOf('tag-name') !== -1) {
            prevToken = iterator.stepBackward();
        }
        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 === '<' && tokenCount > 1) {
                    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() {
        if (this.$toDestroy) {
            this.$toDestroy.forEach(function(el) {
                el.destroy();
            });
            this.$toDestroy = null;
        }
        if (this.$mouseHandler)
            this.$mouseHandler.destroy();
        this.renderer.destroy();
        this._signal("destroy", this);
        if (this.session)
            this.session.destroy();
        if (this._$emitInputEvent)
            this._$emitInputEvent.cancel();
        this.removeAllListeners();
    };

    /**
     * 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));
    };

    /**
     * opens a prompt displaying message
     **/
    this.prompt = function(message, options, callback) {
        var editor = this;
        config.loadModule("ace/ext/prompt", function (module) {
            module.prompt(editor, message, options, callback);
        });
    };

}).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) {
            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},
    enableAutoIndent: {initialValue: true},
    autoScrollEditorIntoView: {
        set: function(val) {this.setAutoScrollEditorIntoView(val);}
    },
    keyboardHandler: {
        set: function(val) { this.setKeyboardHandler(val); },
        get: function() { return this.$keybindingId; },
        handlesSet: true
    },
    value: {
        set: function(val) { this.session.setValue(val); },
        get: function() { return this.getValue(); },
        handlesSet: true,
        hidden: true
    },
    session: {
        set: function(val) { this.setSession(val); },
        get: function() { return this.session; },
        handlesSet: true,
        hidden: true
    },
    
    showLineNumbers: {
        set: function(show) {
            this.renderer.$gutterLayer.setShowLineNumbers(show);
            this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER);
            if (show && this.$relativeLineNumbers)
                relativeNumberRenderer.attach(this);
            else
                relativeNumberRenderer.detach(this);
        },
        initialValue: true
    },
    relativeLineNumbers: {
        set: function(value) {
            if (this.$showLineNumbers && value)
                relativeNumberRenderer.attach(this);
            else
                relativeNumberRenderer.detach(this);
        }
    },
    placeholder: {
        set: function(message) {
            if (!this.$updatePlaceholder) {
                this.$updatePlaceholder = function() {
                    var value = this.session && (this.renderer.$composition || this.getValue());
                    if (value && this.renderer.placeholderNode) {
                        this.renderer.off("afterRender", this.$updatePlaceholder);
                        dom.removeCssClass(this.container, "ace_hasPlaceholder");
                        this.renderer.placeholderNode.remove();
                        this.renderer.placeholderNode = null;
                    } else if (!value && !this.renderer.placeholderNode) {
                        this.renderer.on("afterRender", this.$updatePlaceholder);
                        dom.addCssClass(this.container, "ace_hasPlaceholder");
                        var el = dom.createElement("div");
                        el.className = "ace_placeholder";
                        el.textContent = this.$placeholder || "";
                        this.renderer.placeholderNode = el;
                        this.renderer.content.appendChild(this.renderer.placeholderNode);
                    } else if (!value && this.renderer.placeholderNode) {
                        this.renderer.placeholderNode.textContent = this.$placeholder || "";
                    }
                }.bind(this);
                this.on("input", this.$updatePlaceholder);
            }
            this.$updatePlaceholder();
        }
    },
    customScrollbar: "renderer",
    hScrollBarAlwaysVisible: "renderer",
    vScrollBarAlwaysVisible: "renderer",
    highlightGutterLine: "renderer",
    animatedScroll: "renderer",
    showInvisibles: "renderer",
    showPrintMargin: "renderer",
    printMarginColumn: "renderer",
    printMargin: "renderer",
    fadeFoldWidgets: "renderer",
    showFoldWidgets: "renderer",
    displayIndentGuides: "renderer",
    highlightIndentGuides: "renderer",
    showGutter: "renderer",
    fontSize: "renderer",
    fontFamily: "renderer",
    maxLines: "renderer",
    minLines: "renderer",
    scrollPastEnd: "renderer",
    fixedWidthGutter: "renderer",
    theme: "renderer",
    hasCssTransforms: "renderer",
    maxPixelHeight: "renderer",
    useTextareaForIME: "renderer",

    scrollSpeed: "$mouseHandler",
    dragDelay: "$mouseHandler",
    dragEnabled: "$mouseHandler",
    focusTimeout: "$mouseHandler",
    tooltipFollowsMouse: "$mouseHandler",

    firstLineNumber: "session",
    overwrite: "session",
    newLineMode: "session",
    useWorker: "session",
    useSoftTabs: "session",
    navigateWithinSoftTabs: "session",
    tabSize: "session",
    wrap: "session",
    indentedSoftWrap: "session",
    foldStyle: "session",
    mode: "session"
});


var relativeNumberRenderer = {
    getText: function(session, row) {
        return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9 ? "\xb7" : ""))) + "";
    },
    getWidth: function(session, lastLineNumber, config) {
        return Math.max(
            lastLineNumber.toString().length,
            (config.lastRow + 1).toString().length,
            2
        ) * 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);
        this.update(null, editor);
    },
    detach: function(editor) {
        if (editor.renderer.$gutterLayer.$renderer == this)
            editor.renderer.$gutterLayer.$renderer = null;
        editor.off("changeSelection", this.update);
        this.update(null, editor);
    }
};

exports.Editor = Editor;


================================================
FILE: demo/diff/examples/editor.17.js
================================================
"use strict";

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 LineWidgets = require("./line_widgets").LineWidgets;

var clipboard = require("./clipboard");
var keys = require('./lib/keys');

/**
 * 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(renderer, session, options) {
        this.$toDestroy = [];
        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.destroyed)
                this.session.bgTokenizer.scheduleStart();
        }.bind(this));

        this.on("change", function(_, _self) {
            _self._$emitInputEvent.schedule(31);
        });

        this.setSession(session || options && options.session || new EditSession(""));
        config.resetOptions(this);
        if (options)
            this.setOptions(options);
        config._signal("editor", this);
    }

    $initOperationListeners() {
        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, true));
        
        // 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);
    }

    startOperation(commandEvent) {
        if (this.curOp) {
            if (!commandEvent || this.curOp.command)
                return;
            this.prevOp = this.curOp;
        }
        if (!commandEvent) {
            this.previousCommand = null;
            commandEvent = {};
        }

        this.$opResetTimer.schedule();
        this.curOp = this.session.curOp = {
            command: commandEvent.command || {},
            args: commandEvent.args,
            scrollTop: this.renderer.scrollTop
        };
        this.curOp.selectionBefore = this.selection.toJSON();
    }

    endOperation(e) {
        if (this.curOp && this.session) {
            if (e && e.returnValue === false || !this.session)
                return (this.curOp = null);
            if (e == true && this.curOp.command && this.curOp.command.name == "mouse")
                return;
            this._signal("beforeEndOperation");
            if (!this.curOp) return;
            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;
        }
    }
    
    $historyTracker(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
     *
     **/
    setKeyboardHandler(keyboardHandler, cb) {
        if (keyboardHandler && typeof keyboardHandler === "string" && keyboardHandler != "ace") {
            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}
     *
     **/
    getKeyboardHandler() {
        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
     *
     **/
    setSession(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.destroyed)
            session.bgTokenizer.scheduleStart();
    }

    /**
     * Returns the current session being used.
     * @returns {EditSession}
     **/
    getSession() {
        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
     **/
    setValue(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
     **/
    getValue() {
        return this.session.getValue();
    }

    /**
     *
     * Returns the currently highlighted selection.
     * @returns {Selection} The selection object
     **/
    getSelection() {
        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
     **/
    resize(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
     **/
    setTheme(theme, cb) {
        this.renderer.setTheme(theme, cb);
    }

    /**
     * {:VirtualRenderer.getTheme}
     *
     * @returns {String} The set theme
     * @related VirtualRenderer.getTheme
     **/
    getTheme() {
        return this.renderer.getTheme();
    }

    /**
     * {:VirtualRenderer.setStyle}
     * @param {String} style A class name
     *
     *
     * @related VirtualRenderer.setStyle
     **/
    setStyle(style) {
        this.renderer.setStyle(style);
    }

    /**
     * {:VirtualRenderer.unsetStyle}
     * @related VirtualRenderer.unsetStyle
     **/
    unsetStyle(style) {
        this.renderer.unsetStyle(style);
    }

    /**
     * Gets the current font size of the editor text.
     */
    getFontSize() {
        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")
     *
     *
     **/
    setFontSize(size) {
        this.setOption("fontSize", size);
    }

    $highlightBrackets() {
        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.destroyed) return;
            if (session.$bracketHighlight) {
                session.$bracketHighlight.markerIds.forEach(function(id) {
                    session.removeMarker(id);
                });
                session.$bracketHighlight = null;
            }
            var pos = self.getCursorPosition();
            var handler = self.getKeyboardHandler();
            var isBackwards = handler && handler.$getDirectionForHighlight && handler.$getDirectionForHighlight(self);
            var ranges = session.getMatchingBracketRanges(pos, isBackwards);

            if (!ranges) {
                var iterator = new TokenIterator(session, pos.row, pos.column);
                var token = iterator.getCurrentToken();

                if (token && /\b(?:tag-open|tag-name)/.test(token.type)) {
                    var tagNamesRanges = session.getMatchingTags(pos);
                    if (tagNamesRanges) ranges = [tagNamesRanges.openTagName, tagNamesRanges.closeTagName];
                }
            }
            if (!ranges && session.$mode.getMatching)
                ranges = session.$mode.getMatching(self.session);
            if (!ranges) {
                if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide();
                return;
            }

            var markerType = "ace_bracket";
            if (!Array.isArray(ranges)) {
                ranges = [ranges];
            } else if (ranges.length == 1) {
                markerType = "ace_error_bracket";
            }

            // show adjacent ranges as one
            if (ranges.length == 2) {
                if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0)
                    ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)];
                else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0)
                    ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)];
            }

            session.$bracketHighlight = {
                ranges: ranges,
                markerIds: ranges.map(function(range) {
                    return session.addMarker(range, markerType, "text");
                })
            };
            if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide();
        }, 50);
    }

    /**
     *
     * Brings the current `textInput` into focus.
     **/
    focus() {
        this.textInput.focus();
    }

    /**
     * Returns `true` if the current `textInput` is in focus.
     * @return {Boolean}
     **/
    isFocused() {
        return this.textInput.isFocused();
    }

    /**
     *
     * Blurs the current `textInput`.
     **/
    blur() {
        this.textInput.blur();
    }

    /**
     * Emitted once the editor comes into focus.
     * @event focus
     *
     *
     **/
    onFocus(e) {
        if (this.$isFocused)
            return;
        this.$isFocused = true;
        this.renderer.showCursor();
        this.renderer.visualizeFocus();
        this._emit("focus", e);
    }

    /**
     * Emitted once the editor has been blurred.
     * @event blur
     *
     *
     **/
    onBlur(e) {
        if (!this.$isFocused)
            return;
        this.$isFocused = false;
        this.renderer.hideCursor();
        this.renderer.visualizeBlur();
        this._emit("blur", e);
    }

    $cursorChange() {
        this.renderer.updateCursor();
        this.$highlightBrackets();
        this.$updateHighlightActiveLine();
    }

    /**
     * Emitted whenever the document is changed.
     * @event change
     * @param {Object} delta Contains a single property, `data`, which has the delta of changes
     *
     *
     *
     **/
    onDocumentChange(delta) {
        // Rerender and emit "change" event.
        var wrap = this.session.$useWrapMode;
        var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity);
        this.renderer.updateLines(delta.start.row, lastRow, wrap);

        this._signal("change", delta);
        
        // Update cursor because tab characters can influence the cursor position.
        this.$cursorChange();
    }

    onTokenizerUpdate(e) {
        var rows = e.data;
        this.renderer.updateLines(rows.first, rows.last);
    }


    onScrollTopChange() {
        this.renderer.scrollToY(this.session.getScrollTop());
    }

    onScrollLeftChange() {
        this.renderer.scrollToX(this.session.getScrollLeft());
    }

    /**
     * Emitted when the selection changes.
     *
     **/
    onCursorChange() {
        this.$cursorChange();
        this._signal("changeSelection");
    }

    $updateHighlightActiveLine() {
        var session = this.getSession();

        var highlight;
        if (this.$highlightActiveLine) {
            if (this.$selectionStyle != "line" || !this.selection.isMultiLine())
                highlight = this.getCursorPosition();
            if (this.renderer.theme && this.renderer.theme.$selectionColorConflict && !this.selection.isEmpty())
                highlight = false;
            if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 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");
        }
    }

    onSelectionChange(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");
    }

    $getSelectionHighLightRegexp() {
        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);
        // maximum allowed size for regular expressions in 32000, 
        // but getting close to it has significant impact on the performance
        if (needle.length > 5000 || !/[\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;
    }


    onChangeFrontMarker() {
        this.renderer.updateFrontMarkers();
    }

    onChangeBackMarker() {
        this.renderer.updateBackMarkers();
    }


    onChangeBreakpoint() {
        this.renderer.updateBreakpoints();
    }

    onChangeAnnotation() {
        this.renderer.setAnnotations(this.session.getAnnotations());
    }


    onChangeMode (e) {
        this.renderer.updateText();
        this._emit("changeMode", e);
    }


    onChangeWrapLimit() {
        this.renderer.updateFull();
    }

    onChangeWrapMode() {
        this.renderer.onResize(true);
    }


    onChangeFold() {
        // 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}
     **/
    getSelectedText() {
        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}
     **/
    getCopyText () {
        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 : false;
        return e.text;
    }

    /**
     * Called whenever a text "copy" happens.
     **/
    onCopy() {
        this.commands.exec("copy", this);
    }

    /**
     * Called whenever a text "cut" happens.
     **/
    onCut() {
        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
     *
     *
     **/
    onPaste(text, event) {
        var e = {text: text, event: event};
        this.commands.exec("paste", this, e);
    }
    
    $handlePaste(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;
    
            var isFullLine = lines.length == 2 && (!lines[0] || !lines[1]);
            if (lines.length != ranges.length || isFullLine)
                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]);
            }
        }
    }

    execCommand(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
     *
     **/
    insert(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);
        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 (this.$enableAutoIndent) {
            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);
        }
    }

    autoIndent() {
        var session = this.session;
        var mode = session.getMode();

        var startRow, endRow;
        if (this.selection.isEmpty()) {
            startRow = 0;
            endRow = session.doc.getLength() - 1;
        } else {
            var selectedRange = this.getSelectionRange();

            startRow = selectedRange.start.row;
            endRow = selectedRange.end.row;
        }

        var prevLineState = "";
        var prevLine = "";
        var lineIndent = "";
        var line, currIndent, range;
        var tab = session.getTabString();

        for (var row = startRow; row <= endRow; row++) {
            if (row > 0) {
                prevLineState = session.getState(row - 1);
                prevLine = session.getLine(row - 1);
                lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab);
            }

            line = session.getLine(row);
            currIndent = mode.$getIndent(line);
            if (lineIndent !== currIndent) {
                if (currIndent.length > 0) {
                    range = new Range(row, 0, row, currIndent.length);
                    session.remove(range);
                }
                if (lineIndent.length > 0) {
                    session.insert({row: row, column: 0}, lineIndent);
                }
            }

            mode.autoOutdent(prevLineState, session, row);
        }
    }


    onTextInput(text, composition) {
        if (!composition)
            return this.keyBinding.onTextInput(text);
        
        this.startOperation({command: { name: "insertstring" }});
        var applyComposition = this.applyComposition.bind(this, text, composition);
        if (this.selection.rangeCount)
            this.forEachSelection(applyComposition);
        else
            applyComposition();
        this.endOperation();
    }
    
    applyComposition(text, composition) {
        if (composition.extendLeft || composition.extendRight) {
            var r = this.selection.getRange();
            r.start.column -= composition.extendLeft;
            r.end.column += composition.extendRight;
            if (r.start.column < 0) {
                r.start.row--;
                r.start.column += this.session.getLine(r.start.row).length + 1;
            }
            this.selection.setRange(r);
            if (!text && !r.isEmpty())
                this.remove();
        }
        if (text || !this.selection.isEmpty())
            this.insert(text, true);
        if (composition.restoreStart || composition.restoreEnd) {
            var r = this.selection.getRange();
            r.start.column -= composition.restoreStart;
            r.end.column -= composition.restoreEnd;
            this.selection.setRange(r);
        }
    }

    onCommandKey(e, hashId, keyCode) {
        return 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
     **/
    setOverwrite(overwrite) {
        this.session.setOverwrite(overwrite);
    }

    /**
     * Returns `true` if overwrites are enabled; `false` otherwise.
     * @returns {Boolean}
     * @related EditSession.getOverwrite
     **/
    getOverwrite() {
        return this.session.getOverwrite();
    }

    /**
     * Sets the value of overwrite to the opposite of whatever it currently is.
     * @related EditSession.toggleOverwrite
     **/
    toggleOverwrite() {
        this.session.toggleOverwrite();
    }

    /**
     * Sets how fast the mouse scrolling should do.
     * @param {Number} speed A value indicating the new speed (in milliseconds)
     **/
    setScrollSpeed(speed) {
        this.setOption("scrollSpeed", speed);
    }

    /**
     * Returns the value indicating how fast the mouse scroll speed is (in milliseconds).
     * @returns {Number}
     **/
    getScrollSpeed() {
        return this.getOption("scrollSpeed");
    }

    /**
     * Sets the delay (in milliseconds) of the mouse drag.
     * @param {Number} dragDelay A value indicating the new delay
     **/
    setDragDelay(dragDelay) {
        this.setOption("dragDelay", dragDelay);
    }

    /**
     * Returns the current mouse drag delay.
     * @returns {Number}
     **/
    getDragDelay() {
        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} val The new selection style "line"|"text"
     *
     **/
    setSelectionStyle(val) {
        this.setOption("selectionStyle", val);
    }

    /**
     * Returns the current selection style.
     * @returns {String}
     **/
    getSelectionStyle() {
        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
     **/
    setHighlightActiveLine(shouldHighlight) {
        this.setOption("highlightActiveLine", shouldHighlight);
    }
    /**
     * Returns `true` if current lines are always highlighted.
     * @return {Boolean}
     **/
    getHighlightActiveLine() {
        return this.getOption("highlightActiveLine");
    }
    setHighlightGutterLine(shouldHighlight) {
        this.setOption("highlightGutterLine", shouldHighlight);
    }

    getHighlightGutterLine() {
        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
     *
     **/
    setHighlightSelectedWord(shouldHighlight) {
        this.setOption("highlightSelectedWord", shouldHighlight);
    }

    /**
     * Returns `true` if currently highlighted words are to be highlighted.
     * @returns {Boolean}
     **/
    getHighlightSelectedWord() {
        return this.$highlightSelectedWord;
    }

    setAnimatedScroll(shouldAnimate){
        this.renderer.setAnimatedScroll(shouldAnimate);
    }

    getAnimatedScroll(){
        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
     *
     **/
    setShowInvisibles(showInvisibles) {
        this.renderer.setShowInvisibles(showInvisibles);
    }

    /**
     * Returns `true` if invisible characters are being shown.
     * @returns {Boolean}
     **/
    getShowInvisibles() {
        return this.renderer.getShowInvisibles();
    }

    setDisplayIndentGuides(display) {
        this.renderer.setDisplayIndentGuides(display);
    }

    getDisplayIndentGuides() {
        return this.renderer.getDisplayIndentGuides();
    }

    setHighlightIndentGuides(highlight) {
        this.renderer.setHighlightIndentGuides(highlight);
    }

    getHighlightIndentGuides() {
        return this.renderer.getHighlightIndentGuides();
    }

    /**
     * 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
     *
     **/
    setShowPrintMargin(showPrintMargin) {
        this.renderer.setShowPrintMargin(showPrintMargin);
    }

    /**
     * Returns `true` if the print margin is being shown.
     * @returns {Boolean}
     **/
    getShowPrintMargin() {
        return this.renderer.getShowPrintMargin();
    }

    /**
     * Sets the column defining where the print margin should be.
     * @param {Number} showPrintMargin Specifies the new print margin
     *
     **/
    setPrintMarginColumn(showPrintMargin) {
        this.renderer.setPrintMarginColumn(showPrintMargin);
    }

    /**
     * Returns the column number of where the print margin is.
     * @returns {Number}
     **/
    getPrintMarginColumn() {
        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
     *
     **/
    setReadOnly(readOnly) {
        this.setOption("readOnly", readOnly);
    }

    /**
     * Returns `true` if the editor is set to read-only mode.
     * @returns {Boolean}
     **/
    getReadOnly() {
        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
     *
     **/
    setBehavioursEnabled(enabled) {
        this.setOption("behavioursEnabled", enabled);
    }

    /**
     * Returns `true` if the behaviors are currently enabled. {:BehaviorsDef}
     *
     * @returns {Boolean}
     **/
    getBehavioursEnabled() {
        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
     *
     **/
    setWrapBehavioursEnabled(enabled) {
        this.setOption("wrapBehavioursEnabled", enabled);
    }

    /**
     * Returns `true` if the wrapping behaviors are currently enabled.
     **/
    getWrapBehavioursEnabled() {
        return this.getOption("wrapBehavioursEnabled");
    }

    /**
     * Indicates whether the fold widgets should be shown or not.
     * @param {Boolean} show Specifies whether the fold widgets are shown
     **/
    setShowFoldWidgets(show) {
        this.setOption("showFoldWidgets", show);

    }
    /**
     * Returns `true` if the fold widgets are shown.
     * @return {Boolean}
     **/
    getShowFoldWidgets() {
        return this.getOption("showFoldWidgets");
    }

    setFadeFoldWidgets(fade) {
        this.setOption("fadeFoldWidgets", fade);
    }

    getFadeFoldWidgets() {
        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"
     *
     **/
    remove(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.
     **/
    removeWordRight() {
        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.
     **/
    removeWordLeft() {
        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.
     **/
    removeToLineStart() {
        if (this.selection.isEmpty())
            this.selection.selectLineStart();
        if (this.selection.isEmpty())
            this.selection.selectLeft();
        this.session.remove(this.getSelectionRange());
        this.clearSelection();
    }

    /**
     * Removes all the words to the right of the current selection, until the end of the line.
     **/
    removeToLineEnd() {
        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'`).
     **/
    splitLine() {
        if (!this.selection.isEmpty()) {
            this.session.remove(this.getSelectionRange());
            this.clearSelection();
        }

        var cursor = this.getCursorPosition();
        this.insert("\n");
        this.moveCursorToPosition(cursor);
    }

    /**
     * Set the "ghost" text in provided position. "Ghost" text is a kind of
     * preview text inside the editor which can be used to preview some code
     * inline in the editor such as, for example, code completions.
     * 
     * @param {String} text Text to be inserted as "ghost" text
     * @param {object} position Position to insert text to
     */
    setGhostText(text, position) {
        if (!this.session.widgetManager) {
            this.session.widgetManager = new LineWidgets(this.session);
            this.session.widgetManager.attach(this);
        }
        this.renderer.setGhostText(text, position);
    }

    /**
     * Removes "ghost" text currently displayed in the editor.
     */
    removeGhostText() {
        if (!this.session.widgetManager) return;

        this.renderer.removeGhostText();
    }

    /**
     * Transposes current line.
     **/
    transposeLetters() {
        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.
     **/
    toLowerCase() {
        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.
     **/
    toUpperCase() {
        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
     **/
    indent() {
        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
     **/
    blockIndent() {
        var rows = this.$getSelectedRows();
        this.session.indentRows(rows.first, rows.last, "\t");
    }

    /**
     * Outdents the current line.
     * @related EditSession.outdentRows
     **/
    blockOutdent() {
        var selection = this.session.getSelection();
        this.session.outdentRows(selection.getRange());
    }

    // TODO: move out of core when we have good mechanism for managing extensions
    sortLines() {
        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.
     **/
    toggleCommentLines() {
        var state = this.session.getState(this.getCursorPosition().row);
        var rows = this.$getSelectedRows();
        this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
    }

    toggleBlockComment() {
        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}
     **/
    getNumberAt(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)
     *
     **/
    modifyNumber(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));

            }
        } else {
            this.toggleWord();
        }
    }
    
    toggleWord() {
        var row = this.selection.getCursor().row;
        var column = this.selection.getCursor().column;
        this.selection.selectWord();
        var currentState = this.getSelectedText();
        var currWordStart = this.selection.getWordRange().start.column;
        var wordParts = currentState.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g, '$1 ').split(/\s/);
        var delta = column - currWordStart - 1;
        if (delta < 0) delta = 0;
        var curLength = 0, itLength = 0;
        var that = this;
        if (currentState.match(/[A-Za-z0-9_]+/)) {
            wordParts.forEach(function (item, i) {
                itLength = curLength + item.length;
                if (delta >= curLength && delta <= itLength) {
                    currentState = item;
                    that.selection.clearSelection();
                    that.moveCursorTo(row, curLength + currWordStart);
                    that.selection.selectTo(row, itLength + currWordStart);
                }
                curLength = itLength;
            });
        }

        var wordPairs = this.$toggleWordPairs;
        var reg;
        for (var i = 0; i < wordPairs.length; i++) {
            var item = wordPairs[i];
            for (var j = 0; j <= 1; j++) {
                var negate = +!j;
                var firstCondition = currentState.match(new RegExp('^\\s?_?(' + lang.escapeRegExp(item[j]) + ')\\s?$', 'i'));
                if (firstCondition) {
                    var secondCondition = currentState.match(new RegExp('([_]|^|\\s)(' + lang.escapeRegExp(firstCondition[1]) + ')($|\\s)', 'g'));
                    if (secondCondition) {
                        reg = currentState.replace(new RegExp(lang.escapeRegExp(item[j]), 'i'), function (result) {
                            var res = item[negate];
                            if (result.toUpperCase() == result) {
                                res = res.toUpperCase();
                            } else if (result.charAt(0).toUpperCase() == result.charAt(0)) {
                                res = res.substr(0, 0) + item[negate].charAt(0).toUpperCase() + res.substr(1);
                            }
                            return res;
                        });
                        this.insert(reg);
                        reg = "";
                    }
                }
            }
        }
    }

    /**
     * Finds link at defined {row} and {column}
     * @returns {String}
     **/
    findLinkAt(row, column) {
        var line = this.session.getLine(row);
        var wordParts = line.split(/((?:https?|ftp):\/\/[\S]+)/);
        var columnPosition = column;
        if (columnPosition < 0) columnPosition = 0;
        var previousPosition = 0, currentPosition = 0, match;
        for (let item of wordParts) {
            currentPosition = previousPosition + item.length;
            if (columnPosition >= previousPosition && columnPosition <= currentPosition) {
                if (item.match(/((?:https?|ftp):\/\/[\S]+)/)) {
                    match = item.replace(/[\s:.,'";}\]]+$/, "");
                    break;
                }
            }
            previousPosition = currentPosition;
        }
        return match;
    }

    /**
     * Open valid url under cursor in another tab
     * @returns {Boolean}
     **/
    openLink() {
        var cursor =  this.selection.getCursor();
        var url = this.findLinkAt(cursor.row, cursor.column);
        if (url)
            window.open(url, '_blank');
        return url != null;
    }

    /**
     * Removes all the lines in the current selection
     * @related EditSession.remove
     **/
    removeLines() {
        var rows = this.$getSelectedRows();
        this.session.removeFullLines(rows.first, rows.last);
        this.clearSelection();
    }

    duplicateSelection() {
        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
     **/
    moveLinesDown() {
        this.$moveLines(1, false);
    }

    /**
     * Shifts all the selected lines up one row.
     * @returns {Number} On success, it returns -1.
     * @related EditSession.moveLinesDown
     **/
    moveLinesUp() {
        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} range 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
     **/
    moveText(range, toPosition, copy) {
        return this.session.moveText(range, toPosition, copy);
    }

    /**
     * Copies all the selected lines up one row.
     * @returns {Number} On success, returns 0.
     *
     **/
   copyLinesUp() {
        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
     *
     **/
    copyLinesDown() {
        this.$moveLines(1, true);
    }

    /**
     * for internal use
     * @ignore
     *
     **/
    $moveLines(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}
     **/
    $getSelectedRows(range) {
        range = (range || this.getSelectionRange()).collapseRows();

        return {
            first: this.session.getRowFoldStart(range.start.row),
            last: this.session.getRowFoldEnd(range.end.row)
        };
    }

    onCompositionStart(compositionState) {
        this.renderer.showComposition(compositionState);
    }

    onCompositionUpdate(text) {
        this.renderer.setCompositionText(text);
    }

    onCompositionEnd() {
        this.renderer.hideComposition();
    }

    /**
     * {:VirtualRenderer.getFirstVisibleRow}
     *
     * @returns {Number}
     * @related VirtualRenderer.getFirstVisibleRow
     **/
    getFirstVisibleRow() {
        return this.renderer.getFirstVisibleRow();
    }

    /**
     * {:VirtualRenderer.getLastVisibleRow}
     *
     * @returns {Number}
     * @related VirtualRenderer.getLastVisibleRow
     **/
    getLastVisibleRow() {
        return this.renderer.getLastVisibleRow();
    }

    /**
     * Indicates if the row is currently visible on the screen.
     * @param {Number} row The row to check
     *
     * @returns {Boolean}
     **/
    isRowVisible(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}
     **/
    isRowFullyVisible(row) {
        return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
    }

    /**
     * Returns the number of currently visible rows.
     * @returns {Number}
     **/
    $getVisibleRowCount() {
        return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
    }

    $moveByPage(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.
     **/
    selectPageDown() {
        this.$moveByPage(1, true);
    }

    /**
     * Selects the text from the current position of the document until where a "page up" finishes.
     **/
    selectPageUp() {
        this.$moveByPage(-1, true);
    }

    /**
     * Shifts the document to wherever "page down" is, as well as moving the cursor position.
     **/
    gotoPageDown() {
       this.$moveByPage(1, false);
    }

    /**
     * Shifts the document to wherever "page up" is, as well as moving the cursor position.
     **/
    gotoPageUp() {
        this.$moveByPage(-1, false);
    }

    /**
     * Scrolls the document to wherever "page down" is, without changing the cursor position.
     **/
    scrollPageDown() {
        this.$moveByPage(1);
    }

    /**
     * Scrolls the document to wherever "page up" is, without changing the cursor position.
     **/
    scrollPageUp() {
        this.$moveByPage(-1);
    }

    /**
     * Moves the editor to the specified row.
     * @related VirtualRenderer.scrollToRow
     **/
    scrollToRow(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
     **/
    scrollToLine(line, center, animate, callback) {
        this.renderer.scrollToLine(line, center, animate, callback);
    }

    /**
     * Attempts to center the current selection on the screen.
     **/
    centerSelection() {
        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
     **/
    getCursorPosition() {
        return this.selection.getCursor();
    }

    /**
     * Returns the screen position of the cursor.
     * @returns {Position}
     * @related EditSession.documentToScreenPosition
     **/
    getCursorPositionScreen() {
        return this.session.documentToScreenPosition(this.getCursorPosition());
    }

    /**
     * {:Selection.getRange}
     * @returns {Range}
     * @related Selection.getRange
     **/
    getSelectionRange() {
        return this.selection.getRange();
    }
    
    /**
     * Selects all the text in editor.
     * @related Selection.selectAll
     **/
    selectAll() {
        this.selection.selectAll();
    }

    /**
     * {:Selection.clearSelection}
     * @related Selection.clearSelection
     **/
    clearSelection() {
        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
     **/
    moveCursorTo(row, column) {
        this.selection.moveCursorTo(row, column);
    }

    /**
     * Moves the cursor to the position indicated by `pos.row` and `pos.column`.
     * @param {Position} pos An object with two properties, row and column
     * @related Selection.moveCursorToPosition
     **/
    moveCursorToPosition(pos) {
        this.selection.moveCursorToPosition(pos);
    }

    /**
     * Moves the cursor's row and column to the next matching bracket or HTML tag.
     *
     **/
    jumpToMatching(select, expand) {
        var cursor = this.getCursorPosition();
        var iterator = new TokenIterator(this.session, cursor.row, cursor.column);
        var prevToken = iterator.getCurrentToken();
        var tokenCount = 0;
        if (prevToken && prevToken.type.indexOf('tag-name') !== -1) {
            prevToken = iterator.stepBackward();
        }
        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 === '<' && tokenCount > 1) {
                    depth[token.value]++;
                }
                else if (prevToken.value === '= 0; --i) {
            if(this.$tryReplace(ranges[i], replacement)) {
                replaced++;
            }
        }

        this.selection.setSelectionRange(selection);

        return replaced;
    }

    $tryReplace(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}
     **/
    getLastSearchOptions() {
        return this.$search.getOptions();
    }

    /**
     * Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]].
     * @param {String|RegExp|Object} 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
     **/
    find(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
     **/
    findNext(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
     **/
    findPrevious(options, animate) {
        this.find(options, {skipCurrent: true, backwards: true}, animate);
    }

    revealRange(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
     **/
    undo() {
        this.session.getUndoManager().undo(this.session);
        this.renderer.scrollCursorIntoView(null, 0.5);
    }

    /**
     * {:UndoManager.redo}
     * @related UndoManager.redo
     **/
    redo() {
        this.session.getUndoManager().redo(this.session);
        this.renderer.scrollCursorIntoView(null, 0.5);
    }

    /**
     *
     * Cleans up the entire editor.
     **/
    destroy() {
        if (this.$toDestroy) {
            this.$toDestroy.forEach(function(el) {
                el.destroy();
            });
            this.$toDestroy = null;
        }
        if (this.$mouseHandler)
            this.$mouseHandler.destroy();
        this.renderer.destroy();
        this._signal("destroy", this);
        if (this.session)
            this.session.destroy();
        if (this._$emitInputEvent)
            this._$emitInputEvent.cancel();
        this.removeAllListeners();
    }

    /**
     * Enables automatic scrolling of the cursor into view when editor itself is inside scrollable element
     * @param {Boolean} enable default true
     **/
    setAutoScrollEditorIntoView(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);
        };
    }


    $resetCursorStyle() {
        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));
    }

    /**
     * opens a prompt displaying message
     **/
    prompt(message, options, callback) {
        var editor = this;
        config.loadModule("ace/ext/prompt", function (module) {
            module.prompt(editor, message, options, callback);
        });
    }

}

Editor.$uid = 0;
Editor.prototype.curOp = null;
Editor.prototype.prevOp = {};
// TODO use property on commands instead of this
Editor.prototype.$mergeableCommands = ["backspace", "del", "insertstring"];
Editor.prototype.$toggleWordPairs = [
    ["first", "last"],
    ["true", "false"],
    ["yes", "no"],
    ["width", "height"],
    ["top", "bottom"],
    ["right", "left"],
    ["on", "off"],
    ["x", "y"],
    ["get", "set"],
    ["max", "min"],
    ["horizontal", "vertical"],
    ["show", "hide"],
    ["add", "remove"],
    ["up", "down"],
    ["before", "after"],
    ["even", "odd"],
    ["in", "out"],
    ["inside", "outside"],
    ["next", "previous"],
    ["increase", "decrease"],
    ["attach", "detach"],
    ["&&", "||"],
    ["==", "!="]
];

oop.implement(Editor.prototype, EventEmitter);


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) {
            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},
    enableAutoIndent: {initialValue: true},
    autoScrollEditorIntoView: {
        set: function(val) {this.setAutoScrollEditorIntoView(val);}
    },
    keyboardHandler: {
        set: function(val) { this.setKeyboardHandler(val); },
        get: function() { return this.$keybindingId; },
        handlesSet: true
    },
    value: {
        set: function(val) { this.session.setValue(val); },
        get: function() { return this.getValue(); },
        handlesSet: true,
        hidden: true
    },
    session: {
        set: function(val) { this.setSession(val); },
        get: function() { return this.session; },
        handlesSet: true,
        hidden: true
    },
    
    showLineNumbers: {
        set: function(show) {
            this.renderer.$gutterLayer.setShowLineNumbers(show);
            this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER);
            if (show && this.$relativeLineNumbers)
                relativeNumberRenderer.attach(this);
            else
                relativeNumberRenderer.detach(this);
        },
        initialValue: true
    },
    relativeLineNumbers: {
        set: function(value) {
            if (this.$showLineNumbers && value)
                relativeNumberRenderer.attach(this);
            else
                relativeNumberRenderer.detach(this);
        }
    },
    placeholder: {
        set: function(message) {
            if (!this.$updatePlaceholder) {
                this.$updatePlaceholder = function() {
                    var value = this.session && (this.renderer.$composition || this.getValue());
                    if (value && this.renderer.placeholderNode) {
                        this.renderer.off("afterRender", this.$updatePlaceholder);
                        dom.removeCssClass(this.container, "ace_hasPlaceholder");
                        this.renderer.placeholderNode.remove();
                        this.renderer.placeholderNode = null;
                    } else if (!value && !this.renderer.placeholderNode) {
                        this.renderer.on("afterRender", this.$updatePlaceholder);
                        dom.addCssClass(this.container, "ace_hasPlaceholder");
                        var el = dom.createElement("div");
                        el.className = "ace_placeholder";
                        el.textContent = this.$placeholder || "";
                        this.renderer.placeholderNode = el;
                        this.renderer.content.appendChild(this.renderer.placeholderNode);
                    } else if (!value && this.renderer.placeholderNode) {
                        this.renderer.placeholderNode.textContent = this.$placeholder || "";
                    }
                }.bind(this);
                this.on("input", this.$updatePlaceholder);
            }
            this.$updatePlaceholder();
        }
    },
    enableKeyboardAccessibility: {
        set: function(value) {
            var blurCommand = {
                name: "blurTextInput",
                description: "Set focus to the editor content div to allow tabbing through the page",
                bindKey: "Esc",
                exec: function(editor) {
                    editor.blur();
                    editor.renderer.content.focus();
                },
                readOnly: true
            };

            var focusOnEnterKeyup = function (e) {
                if (e.target == this.renderer.content && e.keyCode === keys['enter']){
                    e.stopPropagation();
                    e.preventDefault();
                    this.focus();
                }
            };

            var keyboardFocusClassName = "ace_keyboard-focus";

            // Prevent focus to be captured when tabbing through the page. When focus is set to the content div, 
            // press Enter key to give focus to Ace and press Esc to again allow to tab through the page.
            if (value){
                this.textInput.getElement().setAttribute("tabindex", -1);
                this.renderer.content.setAttribute("tabindex", 0);
                this.renderer.content.classList.add(keyboardFocusClassName);
                this.renderer.content.setAttribute("aria-label",
                    "Editor, press Enter key to start editing, press Escape key to exit"
                );

                this.renderer.content.addEventListener("keyup", focusOnEnterKeyup.bind(this));
                this.commands.addCommand(blurCommand);
            } else {
                this.textInput.getElement().setAttribute("tabindex", 0);
                this.renderer.content.setAttribute("tabindex", -1);
                this.renderer.content.classList.remove(keyboardFocusClassName);
                this.renderer.content.setAttribute("aria-label", "");
            
                this.renderer.content.removeEventListener("keyup", focusOnEnterKeyup.bind(this));
                this.commands.removeCommand(blurCommand);
            }
        },
        initialValue: false
    },
    customScrollbar: "renderer",
    hScrollBarAlwaysVisible: "renderer",
    vScrollBarAlwaysVisible: "renderer",
    highlightGutterLine: "renderer",
    animatedScroll: "renderer",
    showInvisibles: "renderer",
    showPrintMargin: "renderer",
    printMarginColumn: "renderer",
    printMargin: "renderer",
    fadeFoldWidgets: "renderer",
    showFoldWidgets: "renderer",
    displayIndentGuides: "renderer",
    highlightIndentGuides: "renderer",
    showGutter: "renderer",
    fontSize: "renderer",
    fontFamily: "renderer",
    maxLines: "renderer",
    minLines: "renderer",
    scrollPastEnd: "renderer",
    fixedWidthGutter: "renderer",
    theme: "renderer",
    hasCssTransforms: "renderer",
    maxPixelHeight: "renderer",
    useTextareaForIME: "renderer",
    useResizeObserver: "renderer",
    useSvgGutterIcons: "renderer",

    scrollSpeed: "$mouseHandler",
    dragDelay: "$mouseHandler",
    dragEnabled: "$mouseHandler",
    focusTimeout: "$mouseHandler",
    tooltipFollowsMouse: "$mouseHandler",

    firstLineNumber: "session",
    overwrite: "session",
    newLineMode: "session",
    useWorker: "session",
    useSoftTabs: "session",
    navigateWithinSoftTabs: "session",
    tabSize: "session",
    wrap: "session",
    indentedSoftWrap: "session",
    foldStyle: "session",
    mode: "session"
});


var relativeNumberRenderer = {
    getText: function(session, row) {
        return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9 ? "\xb7" : ""))) + "";
    },
    getWidth: function(session, lastLineNumber, config) {
        return Math.max(
            lastLineNumber.toString().length,
            (config.lastRow + 1).toString().length,
            2
        ) * 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);
        this.update(null, editor);
    },
    detach: function(editor) {
        if (editor.renderer.$gutterLayer.$renderer == this)
            editor.renderer.$gutterLayer.$renderer = null;
        editor.off("changeSelection", this.update);
        this.update(null, editor);
    }
};

exports.Editor = Editor;


================================================
FILE: demo/diff/examples/editor.40.js
================================================
"use strict";

/**
 * @typedef {import("./virtual_renderer").VirtualRenderer} VirtualRenderer
 * @typedef {import("./selection").Selection} Selection
 * @typedef {import("../ace-internal").Ace.Point} Point
 * @typedef {import("../ace-internal").Ace.SearchOptions} SearchOptions
 */

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 GutterKeyboardHandler = require("./keyboard/gutter_handler").GutterKeyboardHandler;
var nls = require("./config").nls;

var clipboard = require("./clipboard");
var keys = require('./lib/keys');

var event = require("./lib/event");
var HoverTooltip = require("./tooltip").HoverTooltip;

/**
 * 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
     * @param {Partial} [options] The default options
     **/
    constructor(renderer, session, options) {
        /**@type{EditSession}*/this.session;
        this.$toDestroy = [];

        var container = renderer.getContainerElement();
        /**@type {HTMLElement & {env?:any, value?:any}}*/
        this.container = container;
        /**@type {VirtualRenderer}*/
        this.renderer = renderer;
        /**@type {string}*/
        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
            /**@type {MouseHandler}*/
            this.$mouseHandler = new MouseHandler(this);
            new FoldHandler(this);
        }
        /**@type {KeyBinding}*/
        this.keyBinding = new KeyBinding(this);
        /**@type {Search}*/
        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.destroyed)
                this.session.bgTokenizer.scheduleStart();
        }.bind(this));

        this.on("change", function(_, _self) {
            _self._$emitInputEvent.schedule(31);
        });

        this.setSession(session || options && options.session || new EditSession(""));
        config.resetOptions(this);
        if (options)
            this.setOptions(options);
        config._signal("editor", this);
    }

    $initOperationListeners() {
        this.commands.on("exec", this.startOperation.bind(this), true);
        this.commands.on("afterExec", this.endOperation.bind(this), true);
    }

    startOperation(commandEvent) {
        this.session.startOperation(commandEvent);
    }

    /**
     * @arg e
     */
    endOperation(e) {
        this.session.endOperation(e);
    }

    onStartOperation(commandEvent) {
        this.curOp = this.session.curOp;
        this.curOp.scrollTop = this.renderer.scrollTop;
        this.prevOp = this.session.prevOp;

        if (!commandEvent) {
            this.previousCommand = null;
        }
    }

    /**
     * @arg e
     */
    onEndOperation(e) {
        if (this.curOp && this.session) {
            if (e && e.returnValue === false) {
                this.curOp = null;
                return;
            }

            this._signal("beforeEndOperation");
            if (!this.curOp) return;

            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);
            }

            this.$lastSel = this.session.selection.toJSON();
            this.prevOp = this.curOp;
            this.curOp = null;
        }
    }

    /**
     * @param e
     */
    $historyTracker(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 | import("../ace-internal").Ace.KeyboardHandler | null} keyboardHandler The new key handler
     * @param {() => void} [cb]
     **/
    setKeyboardHandler(keyboardHandler, cb) {
        if (keyboardHandler && typeof keyboardHandler === "string" && keyboardHandler != "ace") {
            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;
            // @ts-ignore
            this.keyBinding.setKeyboardHandler(keyboardHandler);
            cb && cb();
        }
    }

    /**
     * Returns the keyboard handler, such as "vim" or "windows".
     * @returns {Object}
     **/
    getKeyboardHandler() {
        return this.keyBinding.getKeyboardHandler();
    }



    /**
     * Sets a new editsession to use. This method also emits the `'changeSession'` event.
     * @param {EditSession} [session] The new session to use
     **/
    setSession(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);
            this.session.off("startOperation", this.$onStartOperation);
            this.session.off("endOperation", this.$onEndOperation);

            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.$onStartOperation = this.onStartOperation.bind(this);
            this.session.on("startOperation", this.$onStartOperation);
            this.$onEndOperation = this.onEndOperation.bind(this);
            this.session.on("endOperation", this.$onEndOperation);

            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});
        if (oldSession) oldSession.$editor = null;
        session && session._signal("changeEditor", {editor: this});
        if (session) session.$editor = this;

        if (session && !session.destroyed)
            session.bgTokenizer.scheduleStart();
    }

    /**
     * Returns the current session being used.
     * @returns {EditSession}
     **/
    getSession() {
        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
     **/
    setValue(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
     **/
    getValue() {
        return this.session.getValue();
    }

    /**
     *
     * Returns the currently highlighted selection.
     * @returns {Selection} The selection object
     **/
    getSelection() {
        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
     **/
    resize(force) {
        this.renderer.onResize(force);
    }

    /**
     * {:VirtualRenderer.setTheme}
     * @param {string | import("../ace-internal").Ace.Theme} theme The path to a theme
     * @param {() => void} [cb] optional callback called when theme is loaded
     **/
    setTheme(theme, cb) {
        this.renderer.setTheme(theme, cb);
    }

    /**
     * {:VirtualRenderer.getTheme}
     *
     * @returns {String} The set theme
     * @related VirtualRenderer.getTheme
     **/
    getTheme() {
        return this.renderer.getTheme();
    }

    /**
     * {:VirtualRenderer.setStyle}
     * @param {String} style A class name
     * @related VirtualRenderer.setStyle
     **/
    setStyle(style) {
        this.renderer.setStyle(style);
    }

    /**
     * {:VirtualRenderer.unsetStyle}
     * @related VirtualRenderer.unsetStyle
     * @param {string} style
     */
    unsetStyle(style) {
        this.renderer.unsetStyle(style);
    }

    /**
     * Gets the current font size of the editor text.
     * @return {string | number}
     */
    getFontSize() {
        return this.getOption("fontSize") ||
           dom.computedStyle(this.container).fontSize;
    }

    /**
     * Set a new font size (in pixels) for the editor text.
     * @param {String | number} size A font size ( _e.g._ "12px")
     **/
    setFontSize(size) {
        this.setOption("fontSize", size);
    }

    $highlightBrackets() {
        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.destroyed) return;
            if (session.$bracketHighlight) {
                session.$bracketHighlight.markerIds.forEach(function(id) {
                    session.removeMarker(id);
                });
                session.$bracketHighlight = null;
            }
            var pos = self.getCursorPosition();
            var handler = self.getKeyboardHandler();
            var isBackwards = handler && handler.$getDirectionForHighlight && handler.$getDirectionForHighlight(self);
            var ranges = session.getMatchingBracketRanges(pos, isBackwards);

            if (!ranges) {
                var iterator = new TokenIterator(session, pos.row, pos.column);
                var token = iterator.getCurrentToken();

                if (token && /\b(?:tag-open|tag-name)/.test(token.type)) {
                    var tagNamesRanges = session.getMatchingTags(pos);
                    if (tagNamesRanges) {
                        ranges = [
                            tagNamesRanges.openTagName.isEmpty() ? tagNamesRanges.openTag : tagNamesRanges.openTagName,
                            tagNamesRanges.closeTagName.isEmpty() ? tagNamesRanges.closeTag : tagNamesRanges.closeTagName
                        ];
                    }
                }
            }
            if (!ranges && session.$mode.getMatching)
                ranges = session.$mode.getMatching(self.session);
            if (!ranges) {
                if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide();
                return;
            }

            var markerType = "ace_bracket";
            if (!Array.isArray(ranges)) {
                ranges = [ranges];
            } else if (ranges.length == 1) {
                markerType = "ace_error_bracket";
            }

            // show adjacent ranges as one
            if (ranges.length == 2) {
                if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0)
                    ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)];
                else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0)
                    ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)];
            }

            session.$bracketHighlight = {
                ranges: ranges,
                markerIds: ranges.map(function(range) {
                    return session.addMarker(range, markerType, "text");
                })
            };
            if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide();
        }, 50);
    }

    /**
     *
     * Brings the current `textInput` into focus.
     **/
    focus() {
        this.textInput.focus();
    }

    /**
     * Returns `true` if the current `textInput` is in focus.
     * @return {Boolean}
     **/
    isFocused() {
        return this.textInput.isFocused();
    }

    /**
     *
     * Blurs the current `textInput`.
     **/
    blur() {
        this.textInput.blur();
    }

    /**
     * Emitted once the editor comes into focus.
     * @internal
     **/
    onFocus(e) {
        if (this.$isFocused)
            return;
        this.$isFocused = true;
        this.renderer.showCursor();
        this.renderer.visualizeFocus();
        this._emit("focus", e);
    }

    /**
     * Emitted once the editor has been blurred.
     * @internal
     **/
    onBlur(e) {
        if (!this.$isFocused)
            return;
        this.$isFocused = false;
        this.renderer.hideCursor();
        this.renderer.visualizeBlur();
        this._emit("blur", e);
    }

    /**
     */
    $cursorChange() {
        this.renderer.updateCursor();
        this.$highlightBrackets();
        this.$updateHighlightActiveLine();
    }

    /**
     * Emitted whenever the document is changed.
     * @param {import("../ace-internal").Ace.Delta} delta Contains a single property, `data`, which has the delta of changes
     * @internal
     **/
    onDocumentChange(delta) {
        // Rerender and emit "change" event.
        var wrap = this.session.$useWrapMode;
        var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity);
        this.renderer.updateLines(delta.start.row, lastRow, wrap);

        this._signal("change", delta);

        // Update cursor because tab characters can influence the cursor position.
        this.$cursorChange();
    }

    /**
     * @internal
     */
    onTokenizerUpdate(e) {
        var rows = e.data;
        this.renderer.updateLines(rows.first, rows.last);
    }

    /**
     * @internal
     */
    onScrollTopChange() {
        this.renderer.scrollToY(this.session.getScrollTop());
    }

    /**
     * @internal
     */
    onScrollLeftChange() {
        this.renderer.scrollToX(this.session.getScrollLeft());
    }

    /**
     * Emitted when the selection changes.
     * @internal
     **/
    onCursorChange() {
        this.$cursorChange();
        this._signal("changeSelection");
    }

    /**
     */
    $updateHighlightActiveLine() {
        var session = this.getSession();
        /**@type {Point|false}*/
        var highlight;
        if (this.$highlightActiveLine) {
            if (this.$selectionStyle != "line" || !this.selection.isMultiLine())
                highlight = this.getCursorPosition();
            if (this.renderer.theme && this.renderer.theme.$selectionColorConflict && !this.selection.isEmpty())
                highlight = false;
            if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 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");
        }
    }

    /**
     * @param e
     * @internal
     */
    onSelectionChange(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");
    }

    $getSelectionHighLightRegexp() {
        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);
        // maximum allowed size for regular expressions in 32000,
        // but getting close to it has significant impact on the performance
        if (needle.length > 5000 || !/[\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;
    }

    /**
     * @internal
     */
    onChangeFrontMarker() {
        this.renderer.updateFrontMarkers();
    }

    /**
     * @internal
     */
    onChangeBackMarker() {
        this.renderer.updateBackMarkers();
    }

    /**
     * @internal
     */
    onChangeBreakpoint() {
        this.renderer.updateBreakpoints();
    }

    /**
     * @internal
     */
    onChangeAnnotation() {
        this.renderer.setAnnotations(this.session.getAnnotations());
    }

    /**
     * @param e
     * @internal
     */
    onChangeMode (e) {
        this.renderer.updateText();
        this._emit("changeMode", e);
    }

    /**
     * @internal
     */
    onChangeWrapLimit() {
        this.renderer.updateFull();
    }

    /**
     * @internal
     */
    onChangeWrapMode() {
        this.renderer.onResize(true);
    }


    /**
     * @internal
     */
    onChangeFold() {
        // 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}
     **/
    getSelectedText() {
        return this.session.getTextRange(this.getSelectionRange());
    }


    /**
     * Returns the string of text currently highlighted.
     * @returns {String}
     **/
    getCopyText () {
        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 : false;
        return e.text;
    }

    /**
     * Called whenever a text "copy" happens.
     * @internal
     **/
    onCopy() {
        this.commands.exec("copy", this);
    }

    /**
     * Called whenever a text "cut" happens.
     * @internal
     **/
    onCut() {
        this.commands.exec("cut", this);
    }


    /**
     * Called whenever a text "paste" happens.
     * @param {String} text The pasted text
     * @param {ClipboardEvent} [event]
     * @internal
     **/
    onPaste(text, event) {
        var e = {text: text, event: event};
        this.commands.exec("paste", this, e);
    }

    /**
     *
     * @param {string | {text: string, event?: ClipboardEvent}} e
     * @returns {boolean}
     */
    $handlePaste(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;

            var isFullLine = lines.length == 2 && (!lines[0] || !lines[1]);
            if (lines.length != ranges.length || isFullLine)
                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]);
            }
        }
    }

    /**
     *
     * @param {string | string[]} command
     * @param [args]
     * @return {boolean}
     */
    execCommand(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
     * @param {boolean} [pasted]
     **/
    insert(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 = 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);
        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 (this.$enableAutoIndent) {
            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);
        }
    }

    autoIndent() {
        var session = this.session;
        var mode = session.getMode();

        var ranges = this.selection.isEmpty()
            ? [new Range(0, 0, session.doc.getLength() - 1, 0)]
            : this.selection.getAllRanges();

        /**@type{string|string[]}*/
        var prevLineState = "";
        var prevLine = "";
        var lineIndent = "";
        var tab = session.getTabString();
        for (var i = 0; i < ranges.length; i++) {
            var startRow = ranges[i].start.row;
            var endRow = ranges[i].end.row;

            for (var row = startRow; row <= endRow; row++) {
                if (row > 0) {
                    prevLineState = session.getState(row - 1);
                    prevLine = session.getLine(row - 1);
                    lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab);
                }

                var line = session.getLine(row);
                var currIndent = mode.$getIndent(line);
                if (lineIndent !== currIndent) {
                    if (currIndent.length > 0) {
                        var range = new Range(row, 0, row, currIndent.length);
                        session.remove(range);
                    }
                    if (lineIndent.length > 0) {
                        session.insert({row: row, column: 0}, lineIndent);
                    }
                }

                mode.autoOutdent(prevLineState, session, row);
            }
        }
    }

    /**
     *
     * @param text
     * @param composition
     * @returns {*}
     * @internal
     */
    onTextInput(text, composition) {
        if (!composition)
            return this.keyBinding.onTextInput(text);

        this.startOperation({command: { name: "insertstring" }});
        var applyComposition = this.applyComposition.bind(this, text, composition);
        if (this.selection.rangeCount)
            this.forEachSelection(applyComposition);
        else
            applyComposition();
        this.endOperation();
    }

    /**
     * @param {string} [text]
     * @param {any} [composition]
     */
    applyComposition(text, composition) {
        if (composition.extendLeft || composition.extendRight) {
            var r = this.selection.getRange();
            r.start.column -= composition.extendLeft;
            r.end.column += composition.extendRight;
            if (r.start.column < 0) {
                r.start.row--;
                r.start.column += this.session.getLine(r.start.row).length + 1;
            }
            this.selection.setRange(r);
            if (!text && !r.isEmpty())
                this.remove();
        }
        if (text || !this.selection.isEmpty())
            this.insert(text, true);
        if (composition.restoreStart || composition.restoreEnd) {
            var r = this.selection.getRange();
            r.start.column -= composition.restoreStart;
            r.end.column -= composition.restoreEnd;
            this.selection.setRange(r);
        }
    }

    /**
     * @internal
     */
    onCommandKey(e, hashId, keyCode) {
        return 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
     **/
    setOverwrite(overwrite) {
        this.session.setOverwrite(overwrite);
    }

    /**
     * Returns `true` if overwrites are enabled; `false` otherwise.
     * @returns {Boolean}
     * @related EditSession.getOverwrite
     **/
    getOverwrite() {
        return this.session.getOverwrite();
    }

    /**
     * Sets the value of overwrite to the opposite of whatever it currently is.
     * @related EditSession.toggleOverwrite
     **/
    toggleOverwrite() {
        this.session.toggleOverwrite();
    }

    /**
     * Sets how fast the mouse scrolling should do.
     * @param {Number} speed A value indicating the new speed (in milliseconds)
     **/
    setScrollSpeed(speed) {
        this.setOption("scrollSpeed", speed);
    }

    /**
     * Returns the value indicating how fast the mouse scroll speed is (in milliseconds).
     * @returns {Number}
     **/
    getScrollSpeed() {
        return this.getOption("scrollSpeed");
    }

    /**
     * Sets the delay (in milliseconds) of the mouse drag.
     * @param {Number} dragDelay A value indicating the new delay
     **/
    setDragDelay(dragDelay) {
        this.setOption("dragDelay", dragDelay);
    }

    /**
     * Returns the current mouse drag delay.
     * @returns {Number}
     **/
    getDragDelay() {
        return this.getOption("dragDelay");
    }


    /**
     * Draw selection markers spanning whole line, or only over selected text. Default value is "line"
     * @param {"fullLine" | "screenLine" | "text" | "line"} val The new selection style "line"|"text"
     **/
    setSelectionStyle(val) {
        this.setOption("selectionStyle", val);
    }

    /**
     * Returns the current selection style.
     * @returns {import("../ace-internal").Ace.EditorOptions["selectionStyle"]}
     **/
    getSelectionStyle() {
        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
     **/
    setHighlightActiveLine(shouldHighlight) {
        this.setOption("highlightActiveLine", shouldHighlight);
    }
    /**
     * Returns `true` if current lines are always highlighted.
     * @return {Boolean}
     **/
    getHighlightActiveLine() {
        return this.getOption("highlightActiveLine");
    }

    /**
     * @param {boolean} shouldHighlight
     */
    setHighlightGutterLine(shouldHighlight) {
        this.setOption("highlightGutterLine", shouldHighlight);
    }

    /**
     * @returns {Boolean}
     */
    getHighlightGutterLine() {
        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
     **/
    setHighlightSelectedWord(shouldHighlight) {
        this.setOption("highlightSelectedWord", shouldHighlight);
    }

    /**
     * Returns `true` if currently highlighted words are to be highlighted.
     * @returns {Boolean}
     **/
    getHighlightSelectedWord() {
        return this.$highlightSelectedWord;
    }

    /**
     * @param {boolean} shouldAnimate
     */
    setAnimatedScroll(shouldAnimate){
        this.renderer.setAnimatedScroll(shouldAnimate);
    }

    /**
     * @return {boolean}
     */
    getAnimatedScroll(){
        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
     **/
    setShowInvisibles(showInvisibles) {
        this.renderer.setShowInvisibles(showInvisibles);
    }

    /**
     * Returns `true` if invisible characters are being shown.
     * @returns {Boolean}
     **/
    getShowInvisibles() {
        return this.renderer.getShowInvisibles();
    }

    /**
     * @param {boolean} display
     */
    setDisplayIndentGuides(display) {
        this.renderer.setDisplayIndentGuides(display);
    }

    /**
     * @return {boolean}
     */
    getDisplayIndentGuides() {
        return this.renderer.getDisplayIndentGuides();
    }

    /**
     * @param {boolean} highlight
     */
    setHighlightIndentGuides(highlight) {
        this.renderer.setHighlightIndentGuides(highlight);
    }

    /**
     * @return {boolean}
     */
    getHighlightIndentGuides() {
        return this.renderer.getHighlightIndentGuides();
    }

    /**
     * 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
     *
     **/
    setShowPrintMargin(showPrintMargin) {
        this.renderer.setShowPrintMargin(showPrintMargin);
    }

    /**
     * Returns `true` if the print margin is being shown.
     * @returns {Boolean}
     **/
    getShowPrintMargin() {
        return this.renderer.getShowPrintMargin();
    }

    /**
     * Sets the column defining where the print margin should be.
     * @param {Number} showPrintMargin Specifies the new print margin
     *
     **/
    setPrintMarginColumn(showPrintMargin) {
        this.renderer.setPrintMarginColumn(showPrintMargin);
    }

    /**
     * Returns the column number of where the print margin is.
     * @returns {Number}
     **/
    getPrintMarginColumn() {
        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
     **/
    setReadOnly(readOnly) {
        this.setOption("readOnly", readOnly);
    }

    /**
     * Returns `true` if the editor is set to read-only mode.
     * @returns {Boolean}
     **/
    getReadOnly() {
        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
     **/
    setBehavioursEnabled(enabled) {
        this.setOption("behavioursEnabled", enabled);
    }

    /**
     * Returns `true` if the behaviors are currently enabled. {:BehaviorsDef}
     * @returns {Boolean}
     **/
    getBehavioursEnabled() {
        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
     **/
    setWrapBehavioursEnabled(enabled) {
        this.setOption("wrapBehavioursEnabled", enabled);
    }

    /**
     * Returns `true` if the wrapping behaviors are currently enabled.
     * @returns {boolean}
     **/
    getWrapBehavioursEnabled() {
        return this.getOption("wrapBehavioursEnabled");
    }

    /**
     * Indicates whether the fold widgets should be shown or not.
     * @param {Boolean} show Specifies whether the fold widgets are shown
     **/
    setShowFoldWidgets(show) {
        this.setOption("showFoldWidgets", show);

    }
    /**
     * Returns `true` if the fold widgets are shown.
     * @return {Boolean}
     **/
    getShowFoldWidgets() {
        return this.getOption("showFoldWidgets");
    }

    /**
     * @param {boolean} fade
     */
    setFadeFoldWidgets(fade) {
        this.setOption("fadeFoldWidgets", fade);
    }

    /**
     * @returns {boolean}
     */
    getFadeFoldWidgets() {
        return this.getOption("fadeFoldWidgets");
    }

    /**
     * Removes the current selection or one character.
     * @param {'left' | 'right'} [dir] The direction of the deletion to occur, either "left" or "right"
     **/
    remove(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)
                // @ts-expect-error TODO: possible bug, new_range could be not a Range
                range = new_range;
        }

        this.session.remove(range);
        this.clearSelection();
    }

    /**
     * Removes the word directly to the right of the current selection.
     **/
    removeWordRight() {
        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.
     **/
    removeWordLeft() {
        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.
     **/
    removeToLineStart() {
        if (this.selection.isEmpty())
            this.selection.selectLineStart();
        if (this.selection.isEmpty())
            this.selection.selectLeft();
        this.session.remove(this.getSelectionRange());
        this.clearSelection();
    }

    /**
     * Removes all the words to the right of the current selection, until the end of the line.
     **/
    removeToLineEnd() {
        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'`).
     **/
    splitLine() {
        if (!this.selection.isEmpty()) {
            this.session.remove(this.getSelectionRange());
            this.clearSelection();
        }

        var cursor = this.getCursorPosition();
        this.insert("\n");
        this.moveCursorToPosition(cursor);
    }

    /**
     * Set the "ghost" text in provided position. "Ghost" text is a kind of
     * preview text inside the editor which can be used to preview some code
     * inline in the editor such as, for example, code completions.
     *
     * @param {String} text Text to be inserted as "ghost" text
     * @param {Point} [position] Position to insert text to
     */
    setGhostText(text, position) {
        this.renderer.setGhostText(text, position);
    }

    /**
     * Removes "ghost" text currently displayed in the editor.
     */
    removeGhostText() {
        this.renderer.removeGhostText();
    }

    /**
     * Transposes current line.
     **/
    transposeLetters() {
        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.
     **/
    toLowerCase() {
        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.
     **/
    toUpperCase() {
        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
     **/
    indent() {
        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
     **/
    blockIndent() {
        var rows = this.$getSelectedRows();
        this.session.indentRows(rows.first, rows.last, "\t");
    }

    /**
     * Outdents the current line.
     * @related EditSession.outdentRows
     **/
    blockOutdent() {
        var selection = this.session.getSelection();
        this.session.outdentRows(selection.getRange());
    }

    // TODO: move out of core when we have good mechanism for managing extensions
    sortLines() {
        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.
     **/
    toggleCommentLines() {
        var state = this.session.getState(this.getCursorPosition().row);
        var rows = this.$getSelectedRows();
        this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
    }

    toggleBlockComment() {
        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 {any}
     **/
    getNumberAt(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)
     **/
    modifyNumber(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
        // @ts-ignore
        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));

            }
        } else {
            this.toggleWord();
        }
    }

    /**
     */
    toggleWord() {
        var row = this.selection.getCursor().row;
        var column = this.selection.getCursor().column;
        this.selection.selectWord();
        var currentState = this.getSelectedText();
        var currWordStart = this.selection.getWordRange().start.column;
        var wordParts = currentState.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g, '$1 ').split(/\s/);
        var delta = column - currWordStart - 1;
        if (delta < 0) delta = 0;
        var curLength = 0, itLength = 0;
        var that = this;
        if (currentState.match(/[A-Za-z0-9_]+/)) {
            wordParts.forEach(function (item, i) {
                itLength = curLength + item.length;
                if (delta >= curLength && delta <= itLength) {
                    currentState = item;
                    that.selection.clearSelection();
                    that.moveCursorTo(row, curLength + currWordStart);
                    that.selection.selectTo(row, itLength + currWordStart);
                }
                curLength = itLength;
            });
        }

        var wordPairs = this.$toggleWordPairs;
        var reg;
        for (var i = 0; i < wordPairs.length; i++) {
            var item = wordPairs[i];
            for (var j = 0; j <= 1; j++) {
                var negate = +!j;
                var firstCondition = currentState.match(new RegExp('^\\s?_?(' + lang.escapeRegExp(item[j]) + ')\\s?$', 'i'));
                if (firstCondition) {
                    var secondCondition = currentState.match(new RegExp('([_]|^|\\s)(' + lang.escapeRegExp(firstCondition[1]) + ')($|\\s)', 'g'));
                    if (secondCondition) {
                        reg = currentState.replace(new RegExp(lang.escapeRegExp(item[j]), 'i'), function (result) {
                            var res = item[negate];
                            if (result.toUpperCase() == result) {
                                res = res.toUpperCase();
                            } else if (result.charAt(0).toUpperCase() == result.charAt(0)) {
                                res = res.substr(0, 0) + item[negate].charAt(0).toUpperCase() + res.substr(1);
                            }
                            return res;
                        });
                        this.insert(reg);
                        reg = "";
                    }
                }
            }
        }
    }

    /**
     * Finds link at defined {row} and {column}
     * @returns {String}
     **/
    findLinkAt(row, column) {
        var line = this.session.getLine(row);
        var wordParts = line.split(/((?:https?|ftp):\/\/[\S]+)/);
        var columnPosition = column;
        if (columnPosition < 0) columnPosition = 0;
        var previousPosition = 0, currentPosition = 0, match;
        for (let item of wordParts) {
            currentPosition = previousPosition + item.length;
            if (columnPosition >= previousPosition && columnPosition <= currentPosition) {
                if (item.match(/((?:https?|ftp):\/\/[\S]+)/)) {
                    match = item.replace(/[\s:.,'";}\]]+$/, "");
                    break;
                }
            }
            previousPosition = currentPosition;
        }
        return match;
    }

    /**
     * Open valid url under cursor in another tab
     * @returns {Boolean}
     **/
    openLink() {
        var cursor =  this.selection.getCursor();
        var url = this.findLinkAt(cursor.row, cursor.column);
        if (url)
            window.open(url, '_blank');
        return url != null;
    }

    /**
     * Removes all the lines in the current selection
     * @related EditSession.remove
     **/
    removeLines() {
        var rows = this.$getSelectedRows();
        this.session.removeFullLines(rows.first, rows.last);
        this.clearSelection();
    }

    duplicateSelection() {
        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));
            range.start = point;
            range.end = endPoint;

            sel.setSelectionRange(range, reverse);
        }
    }

    /**
     * Shifts all the selected lines down one row.
     *
     * @related EditSession.moveLinesUp
     **/
    moveLinesDown() {
        this.$moveLines(1, false);
    }

    /**
     * Shifts all the selected lines up one row.
     * @related EditSession.moveLinesDown
     **/
    moveLinesUp() {
        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} range The range of text you want moved within the document
     * @param {Point} toPosition The location (row and column) where you want to move the text to
     * @param {boolean} [copy]
     *
     * @returns {Range} The new range where the text was moved to.
     * @related EditSession.moveText
     **/
    moveText(range, toPosition, copy) {
        return this.session.moveText(range, toPosition, copy);
    }

    /**
     * Copies all the selected lines up one row.
     *
     **/
   copyLinesUp() {
        this.$moveLines(-1, true);
    }

    /**
     * Copies all the selected lines down one row.
     * @related EditSession.duplicateLines
     *
     **/
    copyLinesDown() {
        this.$moveLines(1, true);
    }

    /**
     * for internal use
     * @ignore
     *
     **/
    $moveLines(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;
            // @ts-expect-error TODO: possible bug, no args in parameters
            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}
     **/
    $getSelectedRows(range) {
        range = (range || this.getSelectionRange()).collapseRows();

        return {
            first: this.session.getRowFoldStart(range.start.row),
            last: this.session.getRowFoldEnd(range.end.row)
        };
    }

    /**
     * @internal
     */
    onCompositionStart(compositionState) {
        this.renderer.showComposition(compositionState);
    }

    /**
     * @internal
     */
    onCompositionUpdate(text) {
        this.renderer.setCompositionText(text);
    }

    /**
     * @internal
     */
    onCompositionEnd() {
        this.renderer.hideComposition();
    }

    /**
     * {:VirtualRenderer.getFirstVisibleRow}
     *
     * @returns {Number}
     * @related VirtualRenderer.getFirstVisibleRow
     **/
    getFirstVisibleRow() {
        return this.renderer.getFirstVisibleRow();
    }

    /**
     * {:VirtualRenderer.getLastVisibleRow}
     *
     * @returns {Number}
     * @related VirtualRenderer.getLastVisibleRow
     **/
    getLastVisibleRow() {
        return this.renderer.getLastVisibleRow();
    }

    /**
     * Indicates if the row is currently visible on the screen.
     * @param {Number} row The row to check
     *
     * @returns {Boolean}
     **/
    isRowVisible(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}
     **/
    isRowFullyVisible(row) {
        return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
    }

    /**
     * Returns the number of currently visible rows.
     * @returns {Number}
     **/
    $getVisibleRowCount() {
        return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
    }

    $moveByPage(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.
     **/
    selectPageDown() {
        this.$moveByPage(1, true);
    }

    /**
     * Selects the text from the current position of the document until where a "page up" finishes.
     **/
    selectPageUp() {
        this.$moveByPage(-1, true);
    }

    /**
     * Shifts the document to wherever "page down" is, as well as moving the cursor position.
     **/
    gotoPageDown() {
       this.$moveByPage(1, false);
    }

    /**
     * Shifts the document to wherever "page up" is, as well as moving the cursor position.
     **/
    gotoPageUp() {
        this.$moveByPage(-1, false);
    }

    /**
     * Scrolls the document to wherever "page down" is, without changing the cursor position.
     **/
    scrollPageDown() {
        this.$moveByPage(1);
    }

    /**
     * Scrolls the document to wherever "page up" is, without changing the cursor position.
     **/
    scrollPageUp() {
        this.$moveByPage(-1);
    }

    /**
     * Moves the editor to the specified row.
     * @related VirtualRenderer.scrollToRow
     * @param {number} row
     */
    scrollToRow(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 {() => void} [callback] Function to be called when the animation has finished
     *
     * @related VirtualRenderer.scrollToLine
     **/
    scrollToLine(line, center, animate, callback) {
        this.renderer.scrollToLine(line, center, animate, callback);
    }

    /**
     * Attempts to center the current selection on the screen.
     **/
    centerSelection() {
        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 {Point} An object that looks something like this:
     *
     * ```json
     * { row: currRow, column: currCol }
     * ```
     *
     * @related Selection.getCursor
     **/
    getCursorPosition() {
        return this.selection.getCursor();
    }

    /**
     * Returns the screen position of the cursor.
     * @returns {Point}
     * @related EditSession.documentToScreenPosition
     **/
    getCursorPositionScreen() {
        return this.session.documentToScreenPosition(this.getCursorPosition());
    }

    /**
     * {:Selection.getRange}
     * @returns {Range}
     * @related Selection.getRange
     **/
    getSelectionRange() {
        return this.selection.getRange();
    }

    /**
     * Selects all the text in editor.
     * @related Selection.selectAll
     **/
    selectAll() {
        this.selection.selectAll();
    }

    /**
     * {:Selection.clearSelection}
     * @related Selection.clearSelection
     **/
    clearSelection() {
        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
     **/
    moveCursorTo(row, column) {
        this.selection.moveCursorTo(row, column);
    }

    /**
     * Moves the cursor to the position indicated by `pos.row` and `pos.column`.
     * @param {Point} pos An object with two properties, row and column
     * @related Selection.moveCursorToPosition
     **/
    moveCursorToPosition(pos) {
        this.selection.moveCursorToPosition(pos);
    }

    /**
     * Moves the cursor's row and column to the next matching bracket or HTML tag.
     * @param {boolean} [select]
     * @param {boolean} [expand]
     */
    jumpToMatching(select, expand) {
        var cursor = this.getCursorPosition();
        var iterator = new TokenIterator(this.session, cursor.row, cursor.column);
        var prevToken = iterator.getCurrentToken();
        var tokenCount = 0;
        if (prevToken && prevToken.type.indexOf('tag-name') !== -1) {
            prevToken = iterator.stepBackward();
        }
        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 === '<' && tokenCount > 1) {
                    depth[token.value]++;
                }
                else if (prevToken.value === '} [options] The [[Search `Search`]] options to use
     * @return {number}
     **/
    replace(replacement, options) {
        if (options)
            this.$search.set(options);

        var range = this.$search.find(this.session);
        var replaced = 0;
        if (!range)
            return replaced;

        if (this.$tryReplace(range, replacement)) {
            replaced = 1;
        }

        this.selection.setSelectionRange(range);
        this.renderer.scrollSelectionIntoView(range.start, range.end);

        return replaced;
    }

    /**
     * Replaces all occurrences of `options.needle` with the value in `replacement`.
     * @param {String} [replacement] The text to replace with
     * @param {Partial} [options] The [[Search `Search`]] options to use
     * @return {number}
     **/
    replaceAll(replacement, options) {
        if (options) {
            this.$search.set(options);
        }

        var ranges = this.$search.findAll(this.session);
        var replaced = 0;
        if (!ranges.length)
            return replaced;

        var selection = this.getSelectionRange();
        this.selection.moveTo(0, 0);

        for (var i = ranges.length - 1; i >= 0; --i) {
            if(this.$tryReplace(ranges[i], replacement)) {
                replaced++;
            }
        }

        this.selection.setSelectionRange(selection);

        return replaced;
    }

    /**
     * @param {import("../ace-internal").Ace.IRange} range
     * @param {string} [replacement]
     */
    $tryReplace(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 {Partial}
     **/
    getLastSearchOptions() {
        return this.$search.getOptions();
    }

    /**
     * Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]].
     * @param {String|RegExp|Object} needle The text to search for (optional)
     * @param {Partial} [options] An object defining various search properties
     * @param {Boolean} [animate] If `true` animate scrolling
     * @related Search.find
     **/
    find(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 {Partial} [options] search options
     * @param {Boolean} [animate] If `true` animate scrolling
     *
     * @related Editor.find
     **/
    findNext(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 {Partial} [options] search options
     * @param {Boolean} [animate] If `true` animate scrolling
     *
     * @related Editor.find
     **/
    findPrevious(options, animate) {
        this.find(options, {skipCurrent: true, backwards: true}, animate);
    }

    /**
     *
     * @param {Range} range
     * @param {boolean} [animate]
     */
    revealRange(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
     **/
    undo() {
        this.session.getUndoManager().undo(this.session);
        this.renderer.scrollCursorIntoView(null, 0.5);
    }

    /**
     * {:UndoManager.redo}
     * @related UndoManager.redo
     **/
    redo() {
        this.session.getUndoManager().redo(this.session);
        this.renderer.scrollCursorIntoView(null, 0.5);
    }

    /**
     *
     * Cleans up the entire editor.
     **/
    destroy() {
        if (this.$toDestroy) {
            this.$toDestroy.forEach(function(el) {
                el.destroy();
            });
            this.$toDestroy = null;
        }
        if (this.$mouseHandler)
            this.$mouseHandler.destroy();
        this.renderer.destroy();
        this._signal("destroy", this);
        if (this.session)
            this.session.destroy();
        if (this._$emitInputEvent)
            this._$emitInputEvent.cancel();
        this.removeAllListeners();

    }

    /**
     * Enables automatic scrolling of the cursor into view when editor itself is inside scrollable element
     * @param {Boolean} enable default true
     **/
    setAutoScrollEditorIntoView(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);
        };
    }

    $resetCursorStyle() {
        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));
    }

    /**
     * opens a prompt displaying message
     **/
    prompt(message, options, callback) {
        var editor = this;
        config.loadModule("ace/ext/prompt", function (module) {
            module.prompt(editor, message, options, callback);
        });
    }

}

Editor.$uid = 0;
Editor.prototype.curOp = null;
Editor.prototype.prevOp = {};
// TODO use property on commands instead of this
Editor.prototype.$mergeableCommands = ["backspace", "del", "insertstring"];
Editor.prototype.$toggleWordPairs = [
    ["first", "last"],
    ["true", "false"],
    ["yes", "no"],
    ["width", "height"],
    ["top", "bottom"],
    ["right", "left"],
    ["on", "off"],
    ["x", "y"],
    ["get", "set"],
    ["max", "min"],
    ["horizontal", "vertical"],
    ["show", "hide"],
    ["add", "remove"],
    ["up", "down"],
    ["before", "after"],
    ["even", "odd"],
    ["in", "out"],
    ["inside", "outside"],
    ["next", "previous"],
    ["increase", "decrease"],
    ["attach", "detach"],
    ["&&", "||"],
    ["==", "!="]
];

oop.implement(Editor.prototype, EventEmitter);


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(/**@type{boolean}*/readOnly) {
            this.textInput.setReadOnly(readOnly);
            this.$resetCursorStyle();
            if (!this.$readOnlyCallback) {
                this.$readOnlyCallback = (e) => {
                    var shouldShow = false;
                    if (e && e.type == "keydown") {
                        shouldShow = e && e.key && e.key.length == 1 && !e.ctrlKey && !e.metaKey;
                        if (!shouldShow) return;
                    } else if (e && e.type !== "exec") {
                        shouldShow = true;
                    }
                    if (shouldShow) {
                        if (!this.hoverTooltip) {
                            this.hoverTooltip = new HoverTooltip();
                        }
                        var domNode = dom.createElement("div");
                        domNode.textContent = nls("editor.tooltip.disable-editing", "Editing is disabled");
                        if (!this.hoverTooltip.isOpen) {
                            this.hoverTooltip.showForRange(this, this.getSelectionRange(), domNode);
                        }
                    } else if (this.hoverTooltip && this.hoverTooltip.isOpen) {
                        this.hoverTooltip.hide();
                    }
                };
            }
            var textArea = this.textInput.getElement();
            if (readOnly) {
                event.addListener(textArea, "keydown", this.$readOnlyCallback, this);
                this.commands.on("exec", this.$readOnlyCallback);
                this.commands.on("commandUnavailable", this.$readOnlyCallback);
            } else {
                event.removeListener(textArea, "keydown", this.$readOnlyCallback);
                this.commands.off("exec", this.$readOnlyCallback);
                this.commands.off("commandUnavailable", this.$readOnlyCallback);
                if (this.hoverTooltip) {
                    this.hoverTooltip.destroy();
                    this.hoverTooltip = null;
                }
            }
        },
        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},
    enableAutoIndent: {initialValue: true},
    autoScrollEditorIntoView: {
        set: function(val) {this.setAutoScrollEditorIntoView(val);}
    },
    keyboardHandler: {
        set: function(val) { this.setKeyboardHandler(val); },
        get: function() { return this.$keybindingId; },
        handlesSet: true
    },
    value: {
        set: function(val) { this.session.setValue(val); },
        get: function() { return this.getValue(); },
        handlesSet: true,
        hidden: true
    },
    session: {
        set: function(val) { this.setSession(val); },
        get: function() { return this.session; },
        handlesSet: true,
        hidden: true
    },

    showLineNumbers: {
        set: function(show) {
            this.renderer.$gutterLayer.setShowLineNumbers(show);
            this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER);
            if (show && this.$relativeLineNumbers)
                relativeNumberRenderer.attach(this);
            else
                relativeNumberRenderer.detach(this);
        },
        initialValue: true
    },
    relativeLineNumbers: {
        set: function(value) {
            if (this.$showLineNumbers && value)
                relativeNumberRenderer.attach(this);
            else
                relativeNumberRenderer.detach(this);
        }
    },
    placeholder: {
        /**
         * @param message
         */
        set: function(message) {
            if (!this.$updatePlaceholder) {
                this.$updatePlaceholder = function() {
                    var hasValue = this.session && (this.renderer.$composition ||
                         this.session.getLength() > 1 || this.session.getLine(0).length > 0);
                    if (hasValue && this.renderer.placeholderNode) {
                        this.renderer.off("afterRender", this.$updatePlaceholder);
                        dom.removeCssClass(this.container, "ace_hasPlaceholder");
                        this.renderer.placeholderNode.remove();
                        this.renderer.placeholderNode = null;
                    } else if (!hasValue && !this.renderer.placeholderNode) {
                        this.renderer.on("afterRender", this.$updatePlaceholder);
                        dom.addCssClass(this.container, "ace_hasPlaceholder");
                        var el = dom.createElement("div");
                        el.className = "ace_placeholder";
                        el.textContent = this.$placeholder || "";
                        this.renderer.placeholderNode = el;
                        this.renderer.content.appendChild(this.renderer.placeholderNode);
                    } else if (!hasValue && this.renderer.placeholderNode) {
                        this.renderer.placeholderNode.textContent = this.$placeholder || "";
                    }
                }.bind(this);
                // @ts-ignore
                this.on("input", this.$updatePlaceholder);
            }
            this.$updatePlaceholder();
        }
    },
    enableKeyboardAccessibility: {
        set: function(value) {
            var blurCommand = {
                name: "blurTextInput",
                description: "Set focus to the editor content div to allow tabbing through the page",
                bindKey: "Esc",
                exec: function(editor) {
                    editor.blur();
                    editor.renderer.scroller.focus();
                },
                readOnly: true
            };

            var focusOnEnterKeyup = function (e) {
                if (e.target == this.renderer.scroller && e.keyCode === keys['enter']){
                    e.preventDefault();
                    var row = this.getCursorPosition().row;

                    if (!this.isRowVisible(row))
                        this.scrollToLine(row, true, true);

                    this.focus();
                }
            };
            /**@type {GutterKeyboardHandler}*/
            var gutterKeyboardHandler;

            // If keyboard a11y mode is enabled we:
            // - Enable keyboard operability gutter.
            // - Prevent tab-trapping.
            // - Hide irrelevant elements from assistive technology.
            // - On Windows, set more lines to the textarea.
            // - set aria-label to the text input.
            if (value){
                this.renderer.enableKeyboardAccessibility = true;
                this.renderer.keyboardFocusClassName = "ace_keyboard-focus";

                this.textInput.getElement().setAttribute("tabindex", -1);
                // VoiceOver on Mac OS works best with single line in the textarea, the screen readers on
                // Windows work best with multiple lines in the textarea.
                this.textInput.setNumberOfExtraLines(useragent.isWin ? 3 : 0);
                this.renderer.scroller.setAttribute("tabindex", 0);
                this.renderer.scroller.setAttribute("role", "group");
                this.renderer.scroller.setAttribute("aria-roledescription", nls("editor.scroller.aria-roledescription", "editor"));
                this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName);
                this.renderer.scroller.setAttribute("aria-label",
                    nls("editor.scroller.aria-label", "Editor content, press Enter to start editing, press Escape to exit")
                );

                this.renderer.scroller.addEventListener("keyup", focusOnEnterKeyup.bind(this));
                this.commands.addCommand(blurCommand);

                this.renderer.$gutter.setAttribute("tabindex", 0);
                this.renderer.$gutter.setAttribute("aria-hidden", false);
                this.renderer.$gutter.setAttribute("role", "group");
                this.renderer.$gutter.setAttribute("aria-roledescription", nls("editor.gutter.aria-roledescription", "editor gutter"));
                this.renderer.$gutter.setAttribute("aria-label",
                    nls("editor.gutter.aria-label", "Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")
                );
                this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName);

                this.renderer.content.setAttribute("aria-hidden", true);

                if (!gutterKeyboardHandler)
                    gutterKeyboardHandler = new GutterKeyboardHandler(this);

                gutterKeyboardHandler.addListener();

                this.textInput.setAriaOptions({
                    setLabel: true
                });
            } else {
                this.renderer.enableKeyboardAccessibility = false;

                this.textInput.getElement().setAttribute("tabindex", 0);
                this.textInput.setNumberOfExtraLines(0);
                this.renderer.scroller.setAttribute("tabindex", -1);
                this.renderer.scroller.removeAttribute("role");
                this.renderer.scroller.removeAttribute("aria-roledescription");
                this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName);
                this.renderer.scroller.removeAttribute("aria-label");

                this.renderer.scroller.removeEventListener("keyup", focusOnEnterKeyup.bind(this));
                this.commands.removeCommand(blurCommand);

                this.renderer.content.removeAttribute("aria-hidden");

                this.renderer.$gutter.setAttribute("tabindex", -1);
                this.renderer.$gutter.setAttribute("aria-hidden", true);
                this.renderer.$gutter.removeAttribute("role");
                this.renderer.$gutter.removeAttribute("aria-roledescription");
                this.renderer.$gutter.removeAttribute("aria-label");
                this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName);

                if (gutterKeyboardHandler)
                    gutterKeyboardHandler.removeListener();
            }
        },
        initialValue: false
    },
    textInputAriaLabel: {
        set: function(val) { this.$textInputAriaLabel = val; },
        initialValue: ""
    },
    enableMobileMenu: {
        /**
         * @param {boolean} val
         */
        set: function(val) { this.$enableMobileMenu = val; },
        initialValue: true
    },
    customScrollbar: "renderer",
    hScrollBarAlwaysVisible: "renderer",
    vScrollBarAlwaysVisible: "renderer",
    highlightGutterLine: "renderer",
    animatedScroll: "renderer",
    showInvisibles: "renderer",
    showPrintMargin: "renderer",
    printMarginColumn: "renderer",
    printMargin: "renderer",
    fadeFoldWidgets: "renderer",
    showFoldWidgets: "renderer",
    displayIndentGuides: "renderer",
    highlightIndentGuides: "renderer",
    showGutter: "renderer",
    fontSize: "renderer",
    fontFamily: "renderer",
    maxLines: "renderer",
    minLines: "renderer",
    scrollPastEnd: "renderer",
    fixedWidthGutter: "renderer",
    theme: "renderer",
    hasCssTransforms: "renderer",
    maxPixelHeight: "renderer",
    useTextareaForIME: "renderer",
    useResizeObserver: "renderer",
    useSvgGutterIcons: "renderer",
    showFoldedAnnotations: "renderer",

    scrollSpeed: "$mouseHandler",
    dragDelay: "$mouseHandler",
    dragEnabled: "$mouseHandler",
    focusTimeout: "$mouseHandler",
    tooltipFollowsMouse: "$mouseHandler",

    firstLineNumber: "session",
    overwrite: "session",
    newLineMode: "session",
    useWorker: "session",
    useSoftTabs: "session",
    navigateWithinSoftTabs: "session",
    tabSize: "session",
    wrap: "session",
    indentedSoftWrap: "session",
    foldStyle: "session",
    mode: "session"
});


var relativeNumberRenderer = {
    getText: function(/**@type{EditSession}*/session, /**@type{number}*/row) {
        return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9 ? "\xb7" : ""))) + "";
    },
    getWidth: function(session, /**@type{number}*/lastLineNumber, config) {
        return Math.max(
            lastLineNumber.toString().length,
            (config.lastRow + 1).toString().length,
            2
        ) * config.characterWidth;
    },
    update: function(e, /**@type{Editor}*/editor) {
        editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER);
    },
    attach: function(/**@type{Editor}*/editor) {
        editor.renderer.$gutterLayer.$renderer = this;
        editor.on("changeSelection", this.update);
        this.update(null, editor);
    },
    detach: function(/**@type{Editor}*/editor) {
        if (editor.renderer.$gutterLayer.$renderer == this)
            editor.renderer.$gutterLayer.$renderer = null;
        editor.off("changeSelection", this.update);
        this.update(null, editor);
    }
};
exports.Editor = Editor;


================================================
FILE: demo/diff/index.html
================================================



    Ace-diff - Simple Demo #1

    

    


 

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













================================================
FILE: demo/i18n.html
================================================



  
  
  ACE Editor StatusBar Demo
  


Russian  
Armenian  
English 
Spanish 

    








================================================
FILE: demo/inline_autocompletion.html
================================================



  
  ACE Inline Autocompletion demo
  













================================================
FILE: demo/keyboard_shortcuts.html
================================================



  
  
  Editor
  




    








================================================
FILE: demo/kitchen-sink/demo.js
================================================
"use strict";

require("ace/ext/rtl");

require("ace/multi_select");
require("./inline_editor");
var devUtil = require("./dev_util");
require("./file_drop");

var config = require("ace/config");
config.setLoader(function(moduleName, cb) {
    require([moduleName], function(module) {
        cb(null, module);
    });
});

var env = {};

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

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 Range = require("ace/range").Range;

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

var createDiffView = require("ace/ext/diff").createDiffView;


var doclist = require("./doclist");
var layout = require("./layout");
var util = require("./util");
var saveOption = util.saveOption;

require("ace/ext/elastic_tabstops_lite");
require("ace/incremental_search");

require("ace/ext/whitespaces_in_selection");

var TokenTooltip = require("./token_tooltip").TokenTooltip;
require("ace/config").defineOptions(Editor.prototype, "editor", {
    showTokenInfo: {
        set: function(val) {
            if (val) {
                this.tokenTooltip = this.tokenTooltip || new TokenTooltip(this);
            }
            else if (this.tokenTooltip) {
                this.tokenTooltip.destroy();
                delete this.tokenTooltip;
            }
        },
        get: function() {
            return !!this.tokenTooltip;
        },
        handlesSet: true
    }
});

require("ace/config").defineOptions(Editor.prototype, "editor", {
    useAceLinters: {
        set: function(val) {
            var enabled = !!val;
            if (enabled && !window.languageProvider) {
                loadLanguageProvider(this);
            }
            else if (enabled) {
                window.languageProvider.registerEditor(this);
            } else {
                if (window.languageProvider) {
                    window.languageProvider.unregisterEditor(this, true);
                    window.languageProvider = null;
                }
                if (this.getOption("useAceSpellCheck")) {
                    this.setOption("useAceSpellCheck", false);
                    saveOption("useAceSpellCheck", false);
                    if (env.optionsPanel) {
                        env.optionsPanel.editor = this;
                        env.optionsPanel.render();
                    }
                }
            }
        }
    }
});

require("ace/config").defineOptions(Editor.prototype, "editor", {
    useAceSpellCheck: {
        set: function(val) {
            var nextValue = !!val;
            if (window.useAceSpellCheck === nextValue) return;
            window.useAceSpellCheck = nextValue;
            if (nextValue && !this.getOption("useAceLinters")) {
                this.setOption("useAceLinters", true);
                saveOption("useAceLinters", true);
                if (env.optionsPanel) {
                    env.optionsPanel.editor = this;
                    env.optionsPanel.render();
                }
                return;
            }
            if (window.languageProvider && this.getOption("useAceLinters")) {
                window.languageProvider.unregisterEditor(this, true);
                window.languageProvider = null;
                loadLanguageProvider(this);
            }
        },
        get: function() {
            return window.useAceSpellCheck !== false;
        },
        handlesSet: true
    }
});

var {HoverTooltip} = require("ace/tooltip");
var MarkerGroup = require("ace/marker_group").MarkerGroup;
var docTooltip = new HoverTooltip();
window.useAceSpellCheck = true;

function loadLanguageProvider(editor) {
    function loadScript(cb) {
        if (define.amd) {
            require([
                "https://mkslanc.github.io/ace-linters/build/ace-linters.js"
            ], function(m) {
                cb(m.LanguageProvider);
            });
        } else {
            net.loadScript([
                "https://mkslanc.github.io/ace-linters/build/ace-linters.js"
            ], function() {
                cb(window.LanguageProvider);
            });
        }
    }
    loadScript(function(LanguageProvider) {
        var services = [];
        if (window.useAceSpellCheck !== false) {
            services.push({
                name: "ace-spell-check",
                className: "AceSpellCheck",
                modes: "*",
                script: "ace-spell-check.js",
                cdnUrl: "https://unpkg.com/ace-spell-check@latest/build"
            });
        }

        var languageProvider = LanguageProvider.fromCdn({
            services: services,
            serviceManagerCdn:"https://mkslanc.github.io/ace-linters/build",
            includeDefaultLinters: true
        }, {
            functionality: {
                hover: true,
                completion: {
                    overwriteCompleters: true
                },
                completionResolve: true,
                format: true,
                documentHighlights: true,
                signatureHelp: false
            }
        });
        window.languageProvider = languageProvider;
        languageProvider.registerEditor(editor);
    });
}



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.setOption("placeholder", "Enter a command...");
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: "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);
        }
    }
});


/*********** manage layout ***************************/
function handleToggleActivate(target) {
    if (dom.hasCssClass(sidePanelContainer, "closed"))
        onResize(null, false);
    else if (dom.hasCssClass(target, "toggleButton"))
        onResize(null, true);
};
var sidePanelContainer = document.getElementById("sidePanel");
sidePanelContainer.onclick = function(e) {
    handleToggleActivate(e.target);
};
var optionToggle = document.getElementById("optionToggle");
optionToggle.onkeydown = function(e) {
    if (e.code === "Space" || e.code === "Enter") {
        handleToggleActivate(e.target);
    }
};
var consoleHeight = 20;
function onResize(e, closeSidePanel) {
    var left = 280;
    var width = document.documentElement.clientWidth;
    var height = document.documentElement.clientHeight;
    if (closeSidePanel == null)
        closeSidePanel = width < 2 * left;
    if (closeSidePanel) {
        left = 20;
        document.getElementById("optionToggle").setAttribute("aria-label", "Show Options");
    } else
        document.getElementById("optionToggle").setAttribute("aria-label", "Hide Options");
    width -= left;
    container.style.width = width + "px";
    container.style.height = height - consoleHeight + "px";
    container.style.left = left + "px";
    env.split.resize();

    consoleEl.style.width = width + "px";
    consoleEl.style.left = left + "px";
    cmdLine.resize();
    
    sidePanel.style.width = left + "px";
    sidePanel.style.height = height + "px";
    dom.setCssClass(sidePanelContainer, "closed", closeSidePanel);
}

window.onresize = onResize;
onResize();

/*********** options panel ***************************/
var diffView;
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];
    doclist.pickDocument(s);
};
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);
    }
};

var initDoc = (session) => {
    if (!session)
        return;
    doclist.addToHistory(session.name);
    session = env.split.setSession(session);
    whitespace.detectIndentation(session);
    optionsPanel.render();
    env.editor.focus();
    if (diffView) {
        diffView.detach()
        diffView = createDiffView({
            inline: "b",
            editorB: editor,
            valueA: editor.getValue()
        });
    }
}

doclist.pickDocument = function(name) {
    doclist.loadDoc(name, initDoc);
};



var OptionPanel = require("ace/ext/options").OptionPanel;
var optionsPanel = env.optionsPanel = new OptionPanel(env.editor);

var originalAutocompleteCommand = null;


optionsPanel.add({
    Main: {
        Document: {
            type: "select",
            path: "doc",
            items: doclist.all,
            position: -101,
            onchange: doclist.pickDocument,
            getValue: function() {
                return env.editor.session.name || "javascript";
            }
        },
        Split: {
            type: "buttonBar",
            path: "split",
            values: ["None", "Below", "Beside"],
            position: -100,
            onchange: function(value) {
                var sp = env.split;
                if (value == "Below" || value == "Beside") {
                    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;
                    }
                } else {
                    sp.setSplits(1);
                }
            },
            getValue: function() {
                var sp = env.split;
                return sp.getSplits() == 1
                    ? "None"
                    : sp.getOrientation() == sp.BELOW
                    ? "Below"
                    : "Beside";
            }
        },
        "Show diffs": {
            position: -102,
            type: "buttonBar",
            path: "diffView",
            values: ["None", "Inline"],
            onchange: function (value) {
                    if (value === "Inline" && !diffView) {
                        diffView = createDiffView({
                            inline: "b",
                            editorB: editor,
                            valueA: editor.getValue()
                        });
                    }
                    else if (value === "None") {
                        if (diffView) {
                            diffView.detach();
                            diffView = null;
                        }
                    }
            },
            getValue: function() {
                return !diffView ? "None"
                    : "Inline";
            }
        }
    },
    More: {
        "RTL": {
            path: "rtl",
            position: 900
        },
        "Line based RTL switching": {
            path: "rtlText",
            position: 900
        },
        "Show token info": {
            path: "showTokenInfo",
            position: 2000
        },
        "Inline preview for autocomplete": {
            path: "inlineEnabledForAutocomplete",
            position: 2000,
            onchange: function(value) {
                var Autocomplete = require("ace/autocomplete").Autocomplete;
                if (value && !originalAutocompleteCommand) {
                    originalAutocompleteCommand = Autocomplete.startCommand.exec;
                    Autocomplete.startCommand.exec = function(editor) {
                        var autocomplete = Autocomplete.for(editor);
                        autocomplete.inlineEnabled = true;
                        originalAutocompleteCommand(...arguments);
                    }
                } else if (!value) {
                    var autocomplete = Autocomplete.for(editor);
                    autocomplete.destroy();
                    if (originalAutocompleteCommand)
                        Autocomplete.startCommand.exec = originalAutocompleteCommand;
                    originalAutocompleteCommand = null;
                }
            },
            getValue: function() {
                return !!originalAutocompleteCommand;
            }
        },
        "Use Ace Linters": {
            position: 3000,
            path: "useAceLinters"
        },
        "Use Spell Checker": {
            position: 3001,
            path: "useAceSpellCheck"
        },
        "Show whitespaces in selection": {
            position: 3100,
            path: "showWhitespacesInSelection"
        },
        "Show Textarea Position": devUtil.textPositionDebugger,
        "Text Input Debugger": devUtil.textInputDebugger,
    }
});

var optionsPanelContainer = document.getElementById("optionsPanel");
optionsPanel.render();
optionsPanelContainer.insertBefore(optionsPanel.container, optionsPanelContainer.firstChild);
optionsPanel.on("setOption", function(e) {
    util.saveOption(e.name, e.value);
});

function updateUIEditorOptions() {
    optionsPanel.editor = env.editor;
    optionsPanel.render();
}

env.editor.on("changeSession", function() {
    for (var i in env.editor.session.$options) {
        if (i == "mode") continue;
        var value = util.getOption(i);
        if (value != undefined) {
            env.editor.setOption(i, value);
        }
    }
});

if (localStorage.last_session) {
    try {
        var sessionObj = JSON.parse(localStorage.last_session);
        var session = EditSession.fromJSON(localStorage.last_session);
        session.name = sessionObj.name;
        var cachedDoc = doclist.fileCache[session.name.toLowerCase()];
        if (cachedDoc) {
            cachedDoc.session = session;
        }
        initDoc(session);
    } catch (e) {
        console.error(e);
        optionsPanel.setOption("doc", util.getOption("doc") || "JavaScript");
    }
}
for (var i in optionsPanel.options) {
    if (i === "doc") continue;
    var value = util.getOption(i);
    if (value != undefined) {
        if ((i == "mode" || i == "theme") && !/[/]/.test(value))
            value = "ace/" + i + "/" + value;
        optionsPanel.setOption(i, value);
    }
}
optionsPanel.render();


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)});
}

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

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();
};

optionsPanelContainer.insertBefore(
    dom.buildDom(["div", {style: "text-align:right;width: 80%"},
        ["div", {}, 
            ["button", {onclick: env.editSnippets}, "Edit Snippets"]],
        ["div", {}, 
            ["button", {onclick: function() {
                var info = navigator.platform + "\n" + navigator.userAgent;
                if (env.editor.getValue() == info)
                    return env.editor.undo();
                env.editor.setValue(info, -1);
                env.editor.setOption("wrap", 80);
            }}, "Show Browser Info"]],
        devUtil.getUI(),
        ["div", {},
            "Open Dialog ",
            ["button",  {onclick: openTestDialog.bind(null, false)}, "Scale"],
            ["button",  {onclick: openTestDialog.bind(null, true)}, "Height"]
        ]
    ]),
    optionsPanelContainer.children[1]
);


var resetSession = () => {
    if (localStorage) {
        localStorage.last_session = undefined;
    }
    try {
        var session = env.editor.session;
        if (session.name)
            var cachedDoc = doclist.fileCache[session.name.toLowerCase()];
        if (cachedDoc) {
            cachedDoc.session = undefined;
        }
        optionsPanel.setOption("doc", util.getOption("doc") || "JavaScript");
    } catch (e) {
        console.error(e);
    }
};

optionsPanelContainer.insertBefore(
    dom.buildDom(["div", {style: "text-align:center;width: 100%"},
        ["div", {},
            ["button", {onclick: resetSession}, "Reset session"]],
    ]),
    optionsPanelContainer.children[0]
);

function openTestDialog(animateHeight) {
    if (window.dialogEditor) 
        window.dialogEditor.destroy();
    var editor = ace.edit(null, {
        value: "test editor", 
        mode: "ace/mode/javascript",
        enableBasicAutocompletion: true
    });
    window.dialogEditor = editor;

    editor.completer.parentNode = editor.container;
    if (window.languageProvider)
        window.languageProvider.registerEditor(editor);

    var dialog = dom.buildDom(["div", {
        style: "transition: all 1s; position: fixed; z-index: 100000;"
          + "background: darkblue; border: solid 1px black; display: flex; flex-direction: column"
        }, 
        ["div", {}, "test dialog"],
        editor.container
    ], document.body);
    editor.container.style.flex = "1";
    if (animateHeight) {
        dialog.style.width = "0vw";
        dialog.style.height = "0vh";
        dialog.style.left = "20vw";
        dialog.style.top = "20vh";
        setTimeout(function() {            
            dialog.style.width = "80vw";
            dialog.style.height = "80vh";
            dialog.style.left = "10vw";
            dialog.style.top = "10vh";
        }, 0);
        
    } else {
        dialog.style.width = "80vw";
        dialog.style.height = "80vh";
        dialog.style.left = "10vw";
        dialog.style.top = "10vh";
        dialog.style.transform = "scale(0)";
        setTimeout(function() {
            dialog.style.transform = "scale(1)"
        }, 0);
    }
    function close(e) {
        if (!e || !dialog.contains(e.target)) {
            if (animateHeight) {
                dialog.style.width = "0vw";
                dialog.style.height = "0vh";
                dialog.style.left = "80vw";
                dialog.style.top = "80vh";
            } else {
                dialog.style.transform = "scale(0)"
            }
            window.removeEventListener("mousedown", close);
            dialog.addEventListener("transitionend", function() {
                dialog.remove();
                editor.destroy();
            });
        }
    }
    window.addEventListener("mousedown", close);
    editor.focus()
    editor.commands.bindKey("Esc", function() { close(); });
}


require("ace/ext/language_tools");
require("ace/ext/inline_autocomplete");
env.editor.setOptions({
    enableBasicAutocompletion: true,
    enableInlineAutocompletion: true,
    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();
}

window.onbeforeunload = function () {
    if (env.editor && localStorage) {
        var sessionObj = env.editor.session.toJSON();
        sessionObj.name = util.getOption("doc") || "JavaScript";
        localStorage.last_session = JSON.stringify(sessionObj);
    }
};


================================================
FILE: demo/kitchen-sink/dev_util.js
================================================
var ace = require("ace/ace");
var dom = require("ace/lib/dom");
var event = require("ace/lib/event");
var Range = require("ace/range").Range;
var EditSession = require("ace/edit_session").EditSession;
var UndoManager = require("ace/undomanager").UndoManager;
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(){  return ace });
def(window, "editor", function(){  return window.env.editor == logEditor ? editor : window.env.editor });
def(window, "session", function(){ return window.editor.session });
def(window, "split", function(){  return window.env.split });


def(window, "devUtil", function(){ return exports });

exports.addGlobals = function() {
    window.oop = require("ace/lib/oop");
    window.dom = require("ace/lib/dom");
    window.user = require("ace/test/user");
    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;
    window.setValue = setValue;
    window.testValue = testValue;
    window.logToAce = exports.log;
};

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 + "");
}
function setValue(editor, value) {
    editor.setValue(value, 1);
}
function testValue(editor, value) {
    assert.equal(editor.getValue(), value);
}

 
var editor;
var logEditor;
var logSession
exports.openLogView = function() {
    exports.addGlobals();
    var sp = window.env.split;
    sp.setSplits(1);
    sp.setSplits(2);
    sp.setOrientation(sp.BESIDE);
    editor = sp.$editors[0];
    logEditor = sp.$editors[1];
    
    if (!logSession) {
        logSession = new EditSession(localStorage.lastTestCase || "", "ace/mode/javascript");
        logSession.setUndoManager(new UndoManager)
    }
    logEditor.setSession(logSession);
    logEditor.session.foldAll();
    logEditor.on("input", save);
}
exports.record = function() {
    exports.addGlobals();
    exports.openLogView();
    
    logEditor.setValue("var Range = require(\"ace/range\").Range;\n"
        + getSelection + "\n"
        + testSelection + "\n"
        + setSelection + "\n"
        + testValue + "\n"
        + setValue + "\n"
        + "\n//-------------------------------------\n", 1);
    logEditor.session.foldAll();

    addAction({
        type: "setValue",
        data: editor.getValue()
    });
    addAction({
        type: "setSelection",
        data: getSelection(editor)
    });
    editor.commands.on("afterExec", onAfterExec);
    editor.on("mouseup", onMouseUp);
    editor.selection.on("beforeEndOperation", onBeforeEndOperation);
    editor.session.on("change", reportChange);
    editor.selection.on("changeCursor", reportCursorChange);
    editor.selection.on("changeSelection", reportSelectionChange);
}

exports.stop = function() {
    save();
    editor.commands.off("afterExec", onAfterExec);
    editor.off("mouseup", onMouseUp);
    editor.off("beforeEndOperation", onBeforeEndOperation);
    editor.session.off("change", reportChange);
    editor.selection.off("changeCursor", reportCursorChange);
    editor.selection.off("changeSelection", reportSelectionChange);
    logEditor.off("input", save);
}
exports.closeLogView = function() {
    exports.stop(); 
    var sp = window.env.split;
    sp.setSplits(1);
}

exports.play = function() {
    exports.openLogView();
    exports.stop();
    var code = logEditor ? logEditor.getValue() : localStorage.lastTestCase;
    var fn = new Function("editor", "debugger;\n" + code);
    fn(editor);
}
var reportChange = reportEvent.bind(null, "change");
var reportCursorChange = reportEvent.bind(null, "CursorChange");
var reportSelectionChange = reportEvent.bind(null, "SelectionChange");

function save() {
    localStorage.lastTestCase = logEditor.getValue();
}

function reportEvent(name) {
    addAction({
        type: "event",
        source: name
    });
} 
function onSelection() {
    addAction({
        type: "event",
        data: "change",
        source: "operationEnd"
    });
} 
function onBeforeEndOperation() {
    addAction({
        type: "setSelection",
        data: getSelection(editor),
        source: "operationEnd"
    });
} 
function onMouseUp() {
    addAction({
        type: "setSelection",
        data: getSelection(editor),
        source: "mouseup"
    });
}
function onAfterExec(e) {
    addAction({
        type: "exec",
        data: e
    });
    addAction({
        type: "value",
        data: editor.getValue()
    });
    addAction({
        type: "selection",
        data: getSelection(editor)
    });
}

function addAction(a) {
    var str = toString(a);
    if (str) {
        logEditor.insert(str + "\n");
        logEditor.renderer.scrollCursorIntoView();
    }
}

var lastValue = "";
function toString(x) {
    var str = "";
    var data = x.data;
    switch (x.type) {
        case "exec": 
            str = 'editor.execCommand("' 
                + data.command.name
                + (data.args ? '", ' + JSON.stringify(data.args) : '"')
            + ')';
            break;
        case "setSelection":
            str = 'setSelection(editor, ' + JSON.stringify(data)  + ')';
            break;
        case "setValue":
            if (lastValue != data) {
                lastValue = data;
                str = 'editor.setValue(' + JSON.stringify(data) + ', -1)';
            }
            else {
                return;
            }
            break;
        case "selection":
            str = 'testSelection(editor, ' + JSON.stringify(data) + ')';
            break;
        case "value":
            if (lastValue != data) {
                lastValue = data;
                str = 'testValue(editor, ' + JSON.stringify(data) + ')';
            }
            else  {
                return;
            }
            break;
    }
    return str + (x.source ? " // " + x.source : "");
}

exports.getUI = function(container) {
    return ["div", {role: "group", "aria-label": "Test"},
        " Test ", 
        ["button", {"aria-label": "Open Log View", onclick: exports.openLogView}, "O"],
        ["button", {onclick: exports.record}, "Record"],
        ["button", {onclick: exports.stop}, "Stop"],
        ["button", {onclick: exports.play}, "Play"],
        ["button", {"aria-label": "Close Log View", onclick: exports.closeLogView}, "X"],
    ];
};


var ignoreEvents = false;
exports.textInputDebugger = {
    position: 2000,
    path: "textInputDebugger",
    onchange: function(value) {
        var sp = env.split;
        if (sp.getSplits() == 2) {
            sp.setSplits(1);
        }
        if (env.textarea) {
            if (env.textarea.detach)
                env.textarea.detach();
            env.textarea.oldParent.appendChild(env.textarea);
            env.textarea.className = env.textarea.oldClassName;
            env.textarea = null;
        }
        if (value) {
            this.showConsole();
        }
    },
    showConsole: function() {
        var editor = env.split.$editors[0];
        var text = editor.textInput.getElement();
        text.oldParent = text.parentNode;
        text.oldClassName = text.className;
        text.className = "text-input-debug";
        document.body.appendChild(text);
        env.textarea = text;
        
        var addToLog = function(e) {
            if (ignoreEvents) return;
            var data = {
                _: e.type, 
                data: e.data,
                inputType: e.inputType,
                range: [text.selectionStart, text.selectionEnd], 
                value: text.value, 
                key: e.key && {
                    code: e.code,
                    key: e.key, 
                    keyCode: e.keyCode
                },
                modifier: event.getModifierString(e) || undefined
            };
            var str = JSON.stringify(data).replace(/"(\w+)":/g, " $1: ");
            exports.log(str);
        };
        var events = ["select", "input", "keypress", "keydown", "keyup", 
            "compositionstart", "compositionupdate", "compositionend", "cut", "copy", "paste"
        ];
        events.forEach(function(name) {
            text.addEventListener(name, addToLog, true);
        });
        function onMousedown(ev) {
            if (ev.domEvent.target == text)
                ev.$pos = editor.getCursorPosition();
        }
        text.detach = function() {
            delete text.value;
            delete text.setSelectionRange;
            
            events.forEach(function(name) {
                text.removeEventListener(name, addToLog, true);
            });
            editor.off("mousedown", onMousedown);
        };
        editor.on("mousedown", onMousedown);
        
        text.__defineSetter__("value", function(v) {
            this.__proto__.__lookupSetter__("value").call(this, v); 
            console.log(v);
        });
        text.__defineGetter__("value", function(v) {
            var v = this.__proto__.__lookupGetter__("value").call(this); 
            return v;
        });
        text.setSelectionRange = function(start, end) {
            ignoreEvents = true;
            this.__proto__.setSelectionRange.call(this, start, end)
            ignoreEvents = false;
        }
        exports.openConsole();
        editor.focus();
    },
    getValue: function() {
        return !!env.textarea;
    }
};

exports.textPositionDebugger = {
    position: 2000,
    path: "textPositionDebugger",
    onchange: function(value) {
        document.body.classList[value ? "add" : "remove"]("show-text-input")
    },
    getValue: function() {
        return document.body.classList.contains("show-text-input");
    }
};

exports.openConsole = function() {
    var sp = env.split;
    var logEditor = sp.$editors[1];
    if (!logEditor) {
        sp.setSplits(2);
        sp.setOrientation(sp.BELOW);
        logEditor = sp.$editors[1];
    }
    if (!exports.session)
        exports.session = new EditSession("");
    logEditor.setSession(exports.session);
    return logEditor
};
exports.log = function(str) {   
    var logEditor = exports.openConsole();
    logEditor.navigateFileEnd();
    logEditor.insert(str + ",\n");
    logEditor.renderer.scrollCursorIntoView();
};

exports.addGlobals();


================================================
FILE: demo/kitchen-sink/doclist.js
================================================
"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",
};

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.define && window.define.modules) try {
    for (var path in window.define.modules) {
        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.toLowerCase()] = doc;
        list.push(doc);
    }

    return list;
}

function loadDoc(name, callback) {
    var doc = fileCache[name.toLowerCase()];
    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 = "src/" + parts.slice(1).join("/");

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

function saveDoc(name, callback) {
    var doc = name;
    if (typeof(name) === 'string') {
        doc = fileCache[name.toLowerCase()];
    }
    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 = "src/" + parts.slice(1).join("/");

    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/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/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/alda.alda
================================================
# Example taken from https://github.com/alda-lang/alda-core/blob/master/examples/across_the_sea.alda
(tempo! 90)
(quant! 95)

piano:
  o5 g- > g- g-/f > e- d-4. < b-8 d-2 | c-4 e- d- d- g-

flute:
  r2 g-4 a- b-2. > d-32~ e-16.~8 < b-2 a- g-1

================================================
FILE: demo/kitchen-sink/docs/apex.apex
================================================
public class testBlockDuplicatesLeadTrigger {
	
	static testMethod void testDuplicateTrigger(){  
	
		Lead[] l1 =new Lead[]{
			new Lead(  Email='homer@fox.tv', LastName='Simpson', Company='fox' )
		};
		insert l1;		// add a known lead
		
		Lead[] l2 =new Lead[]{
			new Lead(  Email='homer@fox.tv', LastName='Simpson', Company='fox' )
		};
		// try to add a matching lead
		try {	insert l2;	} catch ( System.DmlException e) { 
			system.assert(e.getMessage().contains('first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, A lead with this email address already exists'),
			 e.getMessage());
		}
		
		// test duplicates in the same batch
		Lead[] l3 =new Lead[]{
			new Lead(  Email='marge@fox.tv', LastName='Simpson', Company='fox' ),
			new Lead(  Email='marge@fox.tv', LastName='Simpson', Company='fox' )
		};		
		try { insert l3;	} catch ( System.DmlException e) { 
			system.assert(e.getMessage().contains('first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Another new lead has the same email'),
				e.getMessage());
			
		}
		
		// test update also
		Lead[] lup = new Lead[]{
			new Lead(  Email='marge@fox.tv',  LastName='Simpson', Company='fox' )
		};
		insert lup;
		Lead marge = [ select id,Email from lead where Email = 'marge@fox.tv' limit 1];
		system.assert(marge!=null);
		marge.Email = 'homer@fox.tv'; 
		
		try { update marge; } catch ( System.DmlException e) { 
			system.assert(e.getMessage().contains('irst error: FIELD_CUSTOM_VALIDATION_EXCEPTION, A lead with this email address already exists'),
				e.getMessage());	
		}
	}
}

================================================
FILE: demo/kitchen-sink/docs/aql.aql
================================================
FOR user IN users
  FILTER user.username == "olivier"
  RETURN user

================================================
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/asl.dsl
================================================
/*
 * Intel ACPI Component Architecture
 * AML/ASL+ Disassembler version 20180105
 *
 * ASL example
 */
DefinitionBlock ("", "SSDT", 1, "PmRef", "Cpu0Ist", 0x00003000)
{
    External (_PR_.CPU0, DeviceObj)
    External (_SB_.CPUP, UnknownObj)

    Scope (\_PR.CPU0)
    {
        Method (_PCT, 0, NotSerialized)  // _PCT: Performance Control
        {
            If (((CFGD & One) && (PDC0 & One)))
            {
                Return (Package (0x02)
                {
                    ResourceTemplate ()
                    {
                        Register (FFixedHW, 
                            0x00,               // Bit Width
                            0x00,               // Bit Offset
                            0x0000000000000000, // Address
                            ,)
                    }, 

                    ResourceTemplate ()
                    {
                        Register (FFixedHW, 
                            0x00,               // Bit Width
                            0x00,               // Bit Offset
                            0x0000000000000000, // Address
                            ,)
                    }
                })
            }

            Return (Package (0x02)
            {
                ResourceTemplate ()
                {
                    Register (SystemIO, 
                        0x10,               // Bit Width
                        0x00,               // Bit Offset
                        0x0000000000001000, // Address
                        ,)
                }, 

                ResourceTemplate ()
                {
                    Register (SystemIO, 
                        0x08,               // Bit Width
                        0x00,               // Bit Offset
                        0x00000000000000B3, // Address
                        ,)
                }
            })
        }

        Name (PSDF, Zero)
        Method (_PSD, 0, NotSerialized)  // _PSD: Power State Dependencies
        {
            If (!PSDF)
            {
                DerefOf (HPSD [Zero]) [0x04] = TCNT /* External reference */
                DerefOf (SPSD [Zero]) [0x04] = TCNT /* External reference */
                PSDF = Ones
            }

            If ((PDC0 & 0x0800))
            {
                Return (HPSD) /* \_PR_.CPU0.HPSD */
            }

            Return (SPSD) /* \_PR_.CPU0.SPSD */
        }
    }
}



================================================
FILE: demo/kitchen-sink/docs/assembly_arm32.s
================================================
.section .text
.global _start
.global msg

_start:
    bl _asmtest
    mov r1, r0 // move return value into r1 for syscall write

/* syscall write(int fd, const void *buf, size_t count) */
    mov r0, #1 
    //ldr r1, =msg // done by above call to _asmtest
    ldr r2, =len 
    mov r7, #4 
    svc #0

/* syscall exit(int status) */
    mov r0, #0 
    mov r7, #1 
    svc #0

_asmtest:                           // Start of the function
    ldr r0, =msg                    ; loads pointer for msg into r0
    bx lr                           // Returns from the function


msg:
.ascii "Hello, ARM32!\n"
len = . - msg

// All of these should match as instructions

addhs
adceqs
qaddne
qdaddcs
subcc
sbclo
rsbmi
rscpl
qsubvs
qdsubvc
mulhi
mlals
umullge
umlallt
umaalgt
smullle
smlalal
smulbb
smulwb
smlabt
smlawt
smlaltb
smuad
smladx
smlald
smusdx
smlsd
smlsldx
smmul
smmlar
smmls
mia
miaph
miatt
clz
sadd16
qsub16
shadd8
usub8
uqaddsubx
uhsubaddx
usad8
usada8
mov
movt
movw
mvn
mrs
msr
mra
mar
cpy
tst
teq
and
eor
orr
bic
cmp
cmn
ssat
ssat16
usat
usat16
pkhbt
pkhtb
sxth
sxtb16
sxtb
uxth
uxtb16
uxtb
sxtah
sxtab16
sxtab
uxtah
uxtab16
uxtab
rev
rev16
revsh
sel
b
bl
bx
blx
blx
bxj
cpsid
cpsie
cps
setend
srsia
rfeib
srsda
rfedb
srsfd
rfeed
srsfa
rfeea
bkpt
swi
svc
nop
ldr
ldrt
ldrb
ldrbt
ldrsb
ldrh
ldrsh
ldrd
ldmia
ldmfa
pld
ldrex
str
strt
strb
strbt
strh
strd
stmia
stmfd
strex
swp
swpb
cdp
cdp2
mrc
mrc2
mrrc
mrrc2
mcr
mcr2
mcrr
mcrr2
ldc
ldc2
stc
stc2

// End instruction matching test


================================================
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/astro.astro
================================================
---
const visible = true;
const name = "Legend Sabbir"
---
{visible && 

Show me!

} {visible ?

Show me!

:

Else show me!

}

{name}

================================================ 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/basic.bas ================================================ 120 OPEN"R" #1 "INVEN.DAT",39 125 FIELD#1,1 AS F$,30 AS D$, 2 AS Q$,2 AS R$,4 AS PH 130 PRINT:PRINT "FUNCTIONS:":PRINT 135 PRINT 1,"INITIALIZE FILE" 140 PRINT 2 "CREATE A NEW ENTRY" 150 PRINT 3,"DISPLAY INVENTORY FOR ONE PART" 160 PRINT 4 "ADD TO STOCK" 170 PRINT 5,"SUBTRACT FROM STOCK" 180 PRINT 6,"DISPLAY ALL ITEMS BELOW REORDER LEVEL" 220 PRINT:PRINT:INPUT"FUNCTION";FUNCTION 225 IF (FUNCTION<1)OR(FUNCTION>6) THEN PRINT "BAD FUNCTION NUMBER":GOTO 130 230 ON FUNCTION GOSUB 900,250,390,480,560,680 240 GOTO 220 560 REM REMOVE FROM STOCK 570 GOSUB 840 580 IF ASC(F$)=255 THEN PRINT "NULL ENTRY":RETURN 590 PRINT DH 600 INPUT "QUANTITY TO SUBTRACT";S% 610 Q%=CVI(Q$) 620 IF (Q%-S%)<0 THEN PRINT "ONIY";Q%; "IN STOCK":GOTO 600 630 Q%=Q%-S% 640 IF Q%=100) THEN PRINT "BAD PART NUMBER": GOTO 840 ELSE GET#1 J>ART%:RETURN END REM INITIALIZE FILE INPUT "ARE YOU SURE";B$:IF B$<="Y" THEN RETURN LSET F$=CHR$(255) FOR O=1 TO 100 PUT#1J NEXT I 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/bibtex.bib ================================================ @Comment{ @Book{tes03, author = {John Smith}, title = {Cooking}, publisher = {Culinary Expert}, year = 1890 } } @String(mar = "march") @Book{sweig-42, Author = { Stefan Sweig }, title = { The impossible book }, publisher = { Dead Poet Society}, year = 1942, month = mar } @String {firstname = "John"} @String {lastname = "Smith"} @String {email = firstname # "." # lastname # "@imag.en"} @Article{key01, title = { The history of @ sign } } Everything " " outside {entries} is treated as comment in BibTeX. @Article{key03, title = "A {bunch {of} braces {in}} title" } @preamble {"This bibliography was generated on \today"} ================================================ 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 (print (re-matches #"abc(.*) (r)" "abcxyz r") ) ================================================ FILE: demo/kitchen-sink/docs/clue.clue ================================================ @iflua jit { local fn pack(...) { return love.data.pack("string", ...) } local fn unpack(...) { return love.data.unpack(...) } local fn mtype(x) { if type(x) != "number" { return } elseif x == math.floor(x) { return "integer" } else { return "float" } } local utf8len = require("utf8").len local tconcat, tunpack = table.concat, _G.unpack local ssub = string.sub local type, pcall, pairs, select = type, pcall, pairs, select } @else { @if all(not(lua(5.4)), not(lua(5.3))) { @print "Warning: Lua version not specified, defaulting to Lua5.4" } local {pack, unpack} = string local mtype, utf8len = math.type, utf8.len local tconcat, tunpack = table.concat, table.unpack local ssub = string.sub local type, pcall, pairs, select = type, pcall, pairs, select } //ENCODER local encode_value //forward declaration local fn is_an_array(value) { local expected = 1 for k of value { if k != expected { return false } expected += 1 } return true } local encoder_functions = { ["nil"] = fn { return pack("B", 0xc0) }, ["boolean"] = fn(value) { if value { return pack("B", 0xc3) } else { return pack("B", 0xc2) } }, ["number"] = fn(value) { if mtype(value) == "integer" { if value >= 0 { if value < 128 { return pack("B", value) } elseif value <= 0xff { return pack("BB", 0xcc, value) } elseif value <= 0xffff { return pack(">BI2", 0xcd, value) } elseif value <= 0xffffffff { return pack(">BI4", 0xce, value) } else { return pack(">BI8", 0xcf, value) } } else { if value >= -32 { return pack("B", 0xe0 + (value + 32)) } elseif value >= -128 { return pack("Bb", 0xd0, value) } elseif value >= -32768 { return pack(">Bi2", 0xd1, value) } elseif value >= -2147483648 { return pack(">Bi4", 0xd2, value) } else { return pack(">Bi8", 0xd3, value) } } } else { local test = unpack("f", pack("f", value)) if test == value { //check if we can use float return pack(">Bf", 0xca, value) } else { return pack(">Bd", 0xcb, value) } } }, ["string"] = fn(value) { local len = #value if utf8len(value) { //check if it is a real utf8 string or just byte junk if len < 32 { return pack("B", 0xa0 + len) .. value } elseif len < 256 { return pack(">Bs1", 0xd9, value) } elseif len < 65536 { return pack(">Bs2", 0xda, value) } else { return pack(">Bs4", 0xdb, value) } } else { //encode it as byte-junk :) if len < 256 { return pack(">Bs1", 0xc4, value) } elseif len < 65536 { return pack(">Bs2", 0xc5, value) } else { return pack(">Bs4", 0xc6, value) } } }, ["table"] = fn(value) { if is_an_array(value) { //it seems to be a proper Lua array local elements = {} for i, v of value { elements[i] = encode_value(v) } local length = #elements if length < 16 { return pack(">B", 0x90 + length) .. tconcat(elements) } elseif length < 65536 { return pack(">BI2", 0xdc, length) .. tconcat(elements) } else { return pack(">BI4", 0xdd, length) .. tconcat(elements) } } else { //encode as a map local elements = {} for k, v of value { if type(v) != "function" { elements[#elements + 1] = encode_value(k) elements[#elements + 1] = encode_value(v) } } local length = #elements /_ 2 if length < 16 { return pack(">B", 0x80 + length) .. tconcat(elements) } elseif length < 65536 { return pack(">BI2", 0xde, length) .. tconcat(elements) } else { return pack(">BI4", 0xdf, length) .. tconcat(elements) } } }, ["function"] = fn { return pack("B", 0xc0) } } encode_value = fn(value) { return encoder_functions[type(value)](value) } local fn encode(...) { local data = {} for i = 1, select("#", ...) { data[#data + 1] = encode_value(select(i, ...)) } return tconcat(data) } //DECODER local decode_value //forward declaration local fn decode_array(data, position, length) { local elements, value = {} for i = 1, length { value, position = decode_value(data, position) elements[i] = value } return elements, position } local fn decode_map(data, position, length) { local elements, key, value = {} for i = 1, length { key, position = decode_value(data, position) value, position = decode_value(data, position) elements[key] = value } return elements, position } local decoder_functions = { [0xc0] = fn(data, position) { return nil, position }, [0xc2] = fn(data, position) { return false, position }, [0xc3] = fn(data, position) { return true, position }, [0xc4] = fn(data, position) { return unpack(">s1", data, position) }, [0xc5] = fn(data, position) { return unpack(">s2", data, position) }, [0xc6] = fn(data, position) { return unpack(">s4", data, position) }, [0xca] = fn(data, position) { return unpack(">f", data, position) }, [0xcb] = fn(data, position) { return unpack(">d", data, position) }, [0xcc] = fn(data, position) { return unpack(">B", data, position) }, [0xcd] = fn(data, position) { return unpack(">I2", data, position) }, [0xce] = fn(data, position) { return unpack(">I4", data, position) }, [0xcf] = fn(data, position) { return unpack(">I8", data, position) }, [0xd0] = fn(data, position) { return unpack(">b", data, position) }, [0xd1] = fn(data, position) { return unpack(">i2", data, position) }, [0xd2] = fn(data, position) { return unpack(">i4", data, position) }, [0xd3] = fn(data, position) { return unpack(">i8", data, position) }, [0xd9] = fn(data, position) { return unpack(">s1", data, position) }, [0xda] = fn(data, position) { return unpack(">s2", data, position) }, [0xdb] = fn(data, position) { return unpack(">s4", data, position) }, [0xdc] = fn(data, position) { local length length, position = unpack(">I2", data, position) return decode_array(data, position, length) }, [0xdd] = fn(data, position) { local length length, position = unpack(">I4", data, position) return decode_array(data, position, length) }, [0xde] = fn(data, position) { local length length, position = unpack(">I2", data, position) return decode_map(data, position, length) }, [0xdf] = fn(data, position) { local length length, position = unpack(">I4", data, position) return decode_map(data, position, length) }, } //add fix-array, fix-map, fix-string, fix-int stuff for i = 0x00, 0x7f { decoder_functions[i] = fn(data, position) { return i, position } } for i = 0x80, 0x8f { decoder_functions[i] = fn(data, position) { return decode_map(data, position, i - 0x80) } } for i = 0x90, 0x9f { decoder_functions[i] = fn(data, position) { return decode_array(data, position, i - 0x90) } } for i = 0xa0, 0xbf { decoder_functions[i] = fn(data, position) { local length = i - 0xa0 return ssub(data, position, position + length - 1), position + length } } for i = 0xe0, 0xff { decoder_functions[i] = fn(data, position) { return -32 + (i - 0xe0), position } } decode_value = fn(data, position) { local byte, value byte, position = unpack("B", data, position) value, position = decoder_functions[byte](data, position) return value, position } //INTERFACE return { _AUTHOR = "Felice D'Angelo ", _VERSION = "0.2.1", //primary encode function encode = fn(...) { local data, ok = {} for i = 1, select("#", ...) { ok, data[i] = pcall(encode_value, select(i, ...)) if !ok { return nil, "cannot encode MessagePack" } } return tconcat(data) }, //encode just one value encode_one = fn(value) { local ok, data = pcall(encode_value, value) if ok { return data } else { return nil, "cannot encode MessagePack" } }, //primary decode function decode = fn(data, position) { local values, value, ok = {} position ||= 1 while position <= #data { ok, value, position = pcall(decode_value, data, position) if ok { values[#values + 1] = value } else { return nil, "cannot decode MessagePack" } } return tunpack(values) }, //decode just one value decode_one = fn(data, position) { local value, ok ok, value, position = pcall(decode_value, data, position || 1) if ok { return value, position } else { return nil, "cannot decode MessagePack" } }, } ================================================ FILE: demo/kitchen-sink/docs/cobol.CBL ================================================ GNU >>SOURCE FORMAT IS FIXED Cobol *> *************************************************************** *> Purpose: Say hello to GNU Cobol Hello *> Tectonics: cobc -x bigworld.cob money *> *************************************************************** identification division. program-id. bigworld. DATA data division. working-storage section. 01 hello pic $$$$,$$$,$$$,$$$,$$$,$$$.99. 01 world pic s9(18)v99 value zero. 01 people pic ZZZ,ZZZ,ZZZ,ZZ9. 01 persons pic 9(18) value 7182044470. 01 each pic 9(5)v99 value 26202.42. *> *************************************************************** CODE procedure division. multiply persons by each giving world on size error display "We did it. We broke the world bank" end-display end-multiply move world to hello move persons to people display "Hello, world" end-display display " " end-display display "On " function locale-date(20130927) " at " function locale-time(120000) ", according to UN estimates:" end-display display "You were home to some " people " people," " with an estimated worth of " hello end-display goback. end program bigworld. ================================================ 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/crystal.cr ================================================ # crystal comment require "llvm" NUM_CELLS = 30000 CELL_SIZE_IN_BYTES = 1 abstract class Instruction abstract def compile(program, bb) end class Increment < Instruction def initialize(@amount : Int32) end def compile(program, bb) cell_val_is_zero = builder.icmp LLVM::IntPredicate::EQ, cell_val, zero call_args = [@ctx.int32.const_int(NUM_CELLS), @ctx.int32.const_int(CELL_SIZE_IN_BYTES)] builder.cond cell_val_is_zero, loop_after, loop_body_block @body.each do |instruction| loop_body_block = instruction.compile(program, loop_body_block) end builder.position_at_end loop_body_block unless matching_close_index error "Unmatched '[' at position #{i}" end bb end end ================================================ 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 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; font-size: 3vmin; 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 } } @viewport { min-zoom: 1; max-zoom: 200%; user-zoom: fixed; } ================================================ FILE: demo/kitchen-sink/docs/csv.csv ================================================ col1,col2 long,col3,col4, "col1,with quotes",col2,col3,col4, col1,col2,col"""3,co""l4, col1,col2,col3"broken",col4, col1",-"col2,col3,col4,col5 col1,"col2 multiline","col3 multiline""string 3","col4 multiline string 4" col1,col2,"c,o,l""3",col4,col5,col6,col7,col8,col9,col10,col11,col12,col13 col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13 col1,col2,col3,col4,col5,col6,co"l7,col8,col9,col10,11,col12,col13 ================================================ FILE: demo/kitchen-sink/docs/curly.curly ================================================

{{author_name}}

================================================ FILE: demo/kitchen-sink/docs/cuttlefish.conf ================================================ include extras.conf # overflow config file ring_size = 32 # experimental anti_entropy = debug # logging log.error.file = /var/log/error.log log.console.file = /var/log/console.log log.syslog = on ================================================ 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/django.djt ================================================ {% extends "base.html" %} {% block title %}Ace Django Template{% endblock %} {% block content %}

Hello, {{ name|default:"World" }}!

{% endblock %}

{% comment %} This content should be green. {% endcomment %}

{#line comment#}

================================================ 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/edifact.edi ================================================ UNB+UNOA:1+005435656:1+006415160:1+060515:1434+00000000000778' UNH+00000000000117+INVnrOIC:D:97B:UN' BGM+380+342459+9' DTM+3:20060515:102' RFF+ON:521052' NAD+BY+792820524::16++CUMMINS MID-RANGE ENGINE PLANT' NAD+SE+005435656::16++GENERAL WIDGET COMPANY' CUX+1:USD' LIN+1++157870:IN' IMD+F++:::WIDGET' QTY+47:1020:EA' ALI+US' MOA+203:1202.58' PRI+INV:1.179' LIN+2++157871:IN' IMD+F++:::DIFFERENT WIDGET' QTY+47:20:EA' ALI+JP' MOA+203:410' PRI+INV:20.5' UNS+S' MOA+39:2137.58' ALC+C+ABG' MOA+8:525' UNT+23+00000000000117' UNZ+1+00000000000778' ================================================ 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). % Print the data using the pretty print specifier io:format("Here is the data: ~p~n", [Data]). ================================================ FILE: demo/kitchen-sink/docs/flix.flix ================================================ /// Mooo's `n` times on channel `c`. def mooo(tx: Sender[String, r], n: Int32): Unit \ IO = match n { case 0 => () case x => Channel.send("Mooo!", tx); mooo(tx, x - 1) } /// Meow's `n` times on channel `c`. def meow(tx: Sender[String, r], n: Int32): Unit \ IO = match n { case 0 => () case x => Channel.send("Meow!", tx); meow(tx, x - 1) } /// Hiss'es `n` times on channel `c`. def hiss(tx: Sender[String, r], n: Int32): Unit \ IO = match n { case 0 => () case x => Channel.send("Hiss!", tx); hiss(tx, x - 1) } /// Start the animal farm... def main(): Unit \ IO = region rc { let (tx1, rx1) = Channel.buffered(rc, 10); let (tx2, rx2) = Channel.buffered(rc, 10); let (tx3, rx3) = Channel.buffered(rc, 10); spawn mooo(tx1, 0) @ rc; spawn meow(tx2, 3) @ rc; spawn hiss(tx3, 7) @ rc; select { case m <- recv(rx1) => m |> println case m <- recv(rx2) => m |> println case m <- recv(rx3) => m |> println } } ================================================ 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.f ================================================ #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/fsharp.fsi ================================================ (* fsharp (* example *) *) module Test = let (*) x y = (x + y) let func1 x = if x < 100 then x*x else x*x + 1 let list = (-1, 42) :: [ for i in 0 .. 99 -> (i, func1(i)) ] let verbatim = @"c:\Program "" Files\" let trippleQuote = """ "hello world" """ // print printfn "The table of squares from 0 to 99 is:\n%A" list ================================================ FILE: demo/kitchen-sink/docs/fsl.fsl ================================================ machine_name : "BGP"; machine_version : 1.0.0; machine_author : "John Haugeland "; machine_license : MIT; graph_layout : dot; Idle 'Invite' => Invited; Invited 'Invite, 1xx' -> Invited; Invited '3xx' -> Redirecting; Invited 'Cancel' -> Cancelling; Invited '200' => Accepted; Invited '407' => AuthRequested; Invited '4xx-6xx' -> Failed; AuthRequested 'Ack' => Invited; Redirecting 'Act' -> Redirected; Cancelling '200 (Invite)' -> LateCancel; Cancelling '200 (Cancel)' -> Cancelled; Accepted 'Cancel' -> LateCancel; Accepted 'Ack' => Established; Failed 'Ack' -> Terminated; Redirected 'Invite' -> Invited; Redirected 'Timeout' -> Terminated; LateCancel 'Ack' -> Established; Cancelled '487' -> Failed; Established 'Invite' => SessionModifying; Established 'Bye' -> Closing; SessionModifying '488' -> SessionModificationRefused; SessionModifying '200' => SessionModified; Closing 'Bye,Ack,200 (Invite)' -> Closing; Closing '200 (Bye)' -> Terminated; SessionModificationRefused 'Ack' -> Established; SessionModified 'Ack' => Established; SessionModified 'Bye' -> Closing; ================================================ 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 ================================================ /* * A Gobstones implementation of Conwey's Game of Life * that tries to use most of Gobstones syntax. * * Check out more about Gobstones at http://gobstones.org */ ----------------------------------------------------------- -- HELPERS TO MOVE AROUND ALL THE BOARD -- ----------------------------------------------------------- // This helpers allow the user to move around the board // one cell at a time procedure GoToStartOfBoard(firstDir, secondDir) { IrAlBorde(opuesto(firstDir)) IrAlBorde(opuesto(secondDir)) } function isEndOfBoard(firstDir, secondDir) { return (not puedeMover(firstDir) && not puedeMover(secondDir)) } procedure NextCellOfTheBoard(firstDir, secondDir) { if (puedeMover(firstDir)) { Mover(firstDir) } else { IrAlBorde(opuesto(firstDir)) Mover(secondDir) } } ----------------------------------------------------------- -- TYPE DECLARATIONS -- ----------------------------------------------------------- // The cell type declarations type CellStatus is variant { case Alive {} case Dead {} } type Cell is record { field status # CellStatus field color # Color } ----------------------------------------------------------- -- PROGRAM DEFINITION -- ----------------------------------------------------------- interactive program { # Map key press to actions K_UP -> { PrepareNextTick() } K_RIGHT -> { CompleteNextTick() } K_RETURN -> { SimulateNextTick() } } /* program { return ( numberOfNeighbors()) } */ ----------------------------------------------------------- -- FUNCTIONS -- ----------------------------------------------------------- function isCellAlive() { return (hayBolitas(Verde)) } function cellStatus() { return ( choose Alive when (isCellAlive()) Dead otherwise ) } function readCell() { return ( Cell(color <- Verde, status <- cellStatus()) ) } function numberOfNeighbors() { amountOfNeighbors := 0 foreach dir in [minDir() .. maxDir()] { amountOfNeighbors := amountOfNeighbors + aliveCellsAt(dir) } return (amountOfNeighbors) } function aliveCellsAt(dir) { firstCompare := puedeMover(dir) && hasAliveCellAt(dir) secondCompare := puedeMover(dir) && puedeMover(siguiente(dir)) && hasAliveCellAtD(dir) value := matching (firstCompare) select 1 on True 0 otherwise + matching (secondCompare) select 1 on True 0 otherwise return (value) } function hasAliveCellAt(dir) { Mover(dir) return (isCellAlive()) } function hasAliveCellAtD(dir) { Mover(dir) Mover(siguiente(dir)) return (isCellAlive()) } ----------------------------------------------------------- -- ROCEDURES DECLARATIONS -- ----------------------------------------------------------- procedure TagAsReanimated() { Poner(Azul) } procedure TagAsDead() { Poner(Rojo) } procedure ProcessAction() { switch (hayBolitas(Rojo)) { True -> { Sacar(Verde); Sacar(Rojo) } _ -> {} } switch (hayBolitas(Azul)) { True -> { Poner(Verde); Sacar(Azul) } _ -> {} } } procedure TagCell(numNeighbors) { if ( isCellAlive() && numNeighbors < 2) { TagAsDead() } elseif ( isCellAlive() && numNeighbors > 3) { TagAsDead() } elseif ((not isCellAlive()) && numNeighbors == 3) { TagAsReanimated() } } procedure SimulateTicks(amount) { repeat(amount) { SimulateNextTick() } } procedure SimulateNextTick() { PrepareNextTick() CompleteNextTick() } procedure PrepareNextTick() { GoToStartOfBoard(Norte, Este) while (not isEndOfBoard(Norte, Este)) { TagCell(numberOfNeighbors()) NextCellOfTheBoard(Norte, Este) } TagCell(numberOfNeighbors()) } procedure CompleteNextTick() { GoToStartOfBoard(Norte, Este) while (not isEndOfBoard(Norte, Este)) { ProcessAction() NextCellOfTheBoard(Norte, Este) } ProcessAction() } ================================================ 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/haxe.hx ================================================ class Haxe { public static function main() { // Say Hello! var greeting:String = "Hello World"; trace(greeting); var targets:Array<String> = ["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/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/ion.ion ================================================ // Comment /* Multi Line Comment */ [1,2,3,45 /*TODO: should be 42, obviously*/, 2016-04-21T08:10:46Z, 2016-04-21T08:10:46-08:00, 2016-04-21, 2016, 0x5, 0b0110] (5 7 1 3 [ 'a', 'b', null, null.int, null.bool, null.list, true, false, nan, -inf, +inf, "str", "str with embedded \" ", '''str with embedded \''' ''', {{"clob content"}}, {{ AB/ }} ]) ''' multi line string ''' states::{ // https://amzn.github.io/ion-docs/docs/spec.html root: rules::[ include::'value' ], // https://amzn.github.io/ion-docs/docs/spec.html#string string: rules::[ match :: { regex: "(\\\")((?:\\\\\"|[^\"])*)(\\\")", token: ['string.dblq.punc.start', 'string.dblq', 'string.dblq.punc.end'] }, push::{ regex: "\'{3}", token: 'string.trpq.punc.start', states: rules::[ pop :: { regex: "\'{3}", token: 'string.trpq.punc.end', }, match::{ regex: "(?:\\\\'*|.|[^']*)", token: 'string.trpq' } ] }, ], /* ... */ } { "json": { "compatibility": true, "open sourced": "2016-04-21T08:10:46Z", "foo": 9, "bar": 1.1, "baz": [{"id": 1}, {"id":2}] } } ================================================ 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/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 ================================================ import java.util.ArrayList; import java.util.Vector; public class InfiniteLoop { /* * This will cause the program to hang... * * Taken from: * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/ */ @Override public static void main(String[] args) { double d = Double.parseDouble("2.2250738585072012e-308"); // unreachable code System.out.println("Value: " + d); } } String name = "Joan"; String info = STR."My name is \{name}"; STR."Today's weather is \{ getFeelsLike() }, with a temperature of \{ getTemperature()++ } degrees \{ getUnit() }" String nestedMultilineTemplates() { return STR.""" { "outerKey1": "outerValue1", "nestedTemplate": "\{ STR.""" { "innerKey": "\{innerValue.get()}" } """ }", "outerKey2": "outerValue2" } """; } var to = "working"; module com.example.myapp { /** * Test doc comment * @property test */ requires transitive java.base; //comment exports com.example.myapp.api; /* multiline comment */ opens com.example.myapp.internal to other.module; uses com.example.myapp.service.MyService; provides com.example.myapp.service.MyService with com.example.myapp.impl.MyServiceImpl; } ================================================ FILE: demo/kitchen-sink/docs/javascript.js ================================================ /** * * @param {string[]} items * @param nada */ function foo(items, nada) { for (var i=0; i<items.length; i++) { alert(items[i] + "juhu\n"); } // Real Tab. } ================================================ FILE: demo/kitchen-sink/docs/jexl.jexl ================================================ #pragma execution.option 42 ## ## This is a test script ## /* This is a multi-line comment */ if (out != null and result == null) out.println("The result is " + result); x = ~/\w+\/test/; y = 2; result = x * y + 5; if (out != null) out.println("The result is " + result); @lenient @silent x.someMethod(); `multi-line string with ${var interpolation = "Hey!"} and \escap\u00E9 chars` ================================================ 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/json5.json5 ================================================ { foo: 'bar', while: true, this: 'is a \ multi-line string', // this is an inline comment here: 'is another', // inline comment /* this is a block comment that continues on another line */ hex: 0xDEADbeef, half: .5, delta: +10, to: Infinity, // and beyond! finally: 'a trailing comma', oh: [ "we shouldn't forget", 'arrays can have', 'trailing commas too', ], } ================================================ FILE: demo/kitchen-sink/docs/jsoniq.jq ================================================ (: Single line comment :) (: : Multi-line comment block : JSONiq uses XQuery-style comments :) let $string := "Hello, JSONiq!" let $number := 42 let $decimal := 3.14159 let $scientific := 1.5e10 let $boolean_true := true let $person := { "name": "John Doe", "age": 30, "email": "john@example.com", "active": true, "balance": 1250.50, "metadata": null } let $result := for $i in 1 to 10 let $squared := $i * $i where $i mod 2 eq 0 order by $squared descending return { "number": $i, "squared": $squared } let $admins := for $user in $data.users[] where $user.roles[] = "admin" order by $user.name ascending return $user.name (: Conditional Expressions :) let $status := if ($person.age >= 18) then "adult" else "minor" let $tier := if ($person.balance >= 1000) then "gold" else if ($person.balance >= 500) then "silver" else "bronze" (: Quantified Expressions :) let $has_admin := some $user in $data.users[] satisfies $user.roles[] = "admin" let $all_active := every $user in $data.users[] satisfies exists($user.name) (: Type Expressions :) let $typed_value := 42 cast as string let $check := $person.name instance of string let $treated := $number treat as integer let $eq := 5 eq 5 let $ne := 5 ne 3 let $lt := 3 lt 5 let $le := 3 le 5 let $gt := 5 gt 3 let $ge := 5 ge 3 let $concat := "Hello" || " " || "World" let $contains := contains("JSONiq", "JSON") let $substring := substring("Hello World", 1, 5) let $upper := upper-case("hello") let $lower := lower-case("HELLO") let $length := string-length("JSONiq") (: User-Defined Function :) declare function local:greet($name as string) as string { "Hello, " || $name || "!" }; declare function local:factorial($n as integer) as integer { if ($n le 1) then 1 else $n * local:factorial($n - 1) }; declare function local:filter-by-age($users, $min-age as integer) { for $user in $users[] where $user.age >= $min-age return $user }; return { "greeting": local:greet("World"), "factorial_5": local:factorial(5), "admins": $admins, "status": $status, "tier": $tier, "has_admin": $has_admin, "grouped": $grouped } ================================================ FILE: demo/kitchen-sink/docs/jsp.jsp ================================================ <%-- initial comment --%> <%@ page import="java.util.Date" %> <%--@ page isELIgnored="true" //Now EL will be ignored --%> <html> <jsp:declaration> int day = 3; </jsp:declaration> <%@ include file="relative url" %> <jsp:directive.include file="relative url" /> <head> <title>Day <%= day %>

Today's date: <%= (new java.util.Date()).toLocaleString()%>

<%! int day = 3; %> <%-- This comment will not be visible in the page source --%>

Today's date: <%= (new java.util.Date()).toLocaleString()%>

<%! int i = 0; %> int j = 10; <%-- This is JSP comment --%> <%@ directive attribute="value" %>

Select Languages:

Java
.NET
PHP
C/C++
PERL
<% 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]); } } %> <% switch(day) { case 0: out.println("It\'s Sunday."); break; case 1: out.println("It\'s Monday."); break; case 2: out.println("It\'s Tuesday."); break; case 3: out.println("It\'s Wednesday."); break; case 4: out.println("It\'s Thursday."); break; case 5: out.println("It\'s Friday."); break; //hello default: out.println("It's Saturday."); } %>

out.println("Your IP address is " + request.getRemoteAddr());

================================================ 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 ================================================ import * as React from "react"; export default () => { return (
Keywords here are not highlighted, for example class or instance.
); } ================================================ 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 ================================================ #!/usr/bin/env kotlinc -script /*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(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] } class Test public constructor { } var test = "test" /** * 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) { // 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/latte.latte ================================================ {$title} {* comment *}

My Webpage

{$variable} {=$variable} {XXXX::func($variable /* comment */)|filter} {$variable?->obj|filter:10, abc, 'x$var', "x$var"|filter2} {if} ... {/if true} ================================================ 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 ================================================ There are a couple of different Liquid variations in circulation. This grammars supports both the Standard and Shopify Liquid variations. The following examples can be found in full at: Standard Variation: https://shopify.github.io/liquid Shopify Variation: https://shopify.dev/docs/api/liquid 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:
    {% for product in products %}
  • {{ product.title }}

    Only {{ product.price | format_as_money }}

    {{ product.description | prettyprint | truncate: 200 }}

  • {% endfor %}
Some more features include:

Filters

The word "tobi" in uppercase: {{ 'tobi' | upcase }}

The word "tobi" has {{ 'tobi' | size }} letters!

Change "Hello world" to "Hi world": {{ 'Hello world' | replace: 'Hello', 'Hi' }}

The date today is {{ 'now' | date: "%Y %b %d" }}

If

{% if user.name == 'tobi' or user.name == 'marc' %} hi marc or tobi {% endif %}

Comments

{% # Line Comment %} {% comment %} Block Comment {% endcomment %}

Case

{% case template %} {% when 'index' %} Welcome {% when 'product' %} {{ product.vendor | link_to_vendor }} / {{ product.title }} {% else %} {{ page_title }} {% endcase %}

For Loops

{% for item in array %} {{ item }} {% endfor %}

Tables

{% tablerow item in items cols: 3 %} {% if tablerowloop.col_first %} First column: {{ item.variable }} {% else %} Different column: {{ item.variable }} {% endif %} {% endtablerow %}

Embedded Code Blocks

This support Shopify Liquid variation JSON schema code blocks {% schema %} { "string": "bar", "boolean": true, "number": 100, "object": { "array": [100, false, "string", {}, [] ] } } {% endschema %} This support Shopify Liquid variation Stylesheet and Style code blocks {% style %} .class { font-size: 10px; /* comment */ } {% endstyle %} {% stylesheet %} .class { font-size: 10px; /* comment */ } {% endstylesheet %} This support Shopify Liquid variation JavaScript code blocks {% javascript %} function foo (param) { return 'something' // comment } {% endjavascript %} ================================================ 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](https://ace.c9.io). # # 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/logtalk.lgt ================================================ :- object(bottles). :- initialization(sing(99)). sing(0) :- write('No more bottles of beer on the wall, no more bottles of beer.'), nl, write('Go to the store and buy some more, 99 bottles of beer on the wall.'), nl, nl. sing(N) :- N > 0, N2 is N - 1, beers(N), write(' of beer on the wall, '), beers(N), write(' of beer.'), nl, write('Take one down and pass it around, '), beers(N2), write(' of beer on the wall.'), nl, nl, sing(N2). beers(0) :- write('no more bottles'). beers(1) :- write('1 bottle'). beers(N) :- N > 1, write(N), write(' bottles'). :- end_object. ================================================ 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 ================================================  <% --[[-- index.lp from the Kepler Project's LuaDoc HTML doclet. http://keplerproject.github.com/luadoc/ --]] %> 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/mediawiki.wiki ================================================ {{Languages}} '''Ace''' is a standalone code editor written in [[wikipedia:JavaScript|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 [http://www.cloud9ide.com/ Cloud9 IDE] 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 [http://ajaxorg.github.com/ace/ demo] or get a [http://run.cloud9ide.com Cloud9 IDE account] 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 [http://ajaxorg.github.com/ace/build/textarea/editor.html Ace Bookmarklet]. == Documentation == You find a lot more sample code in the [https://github.com/ajaxorg/ace/blob/master/demo/demo.js demo app]. There is also some documentation on the [https://github.com/ajaxorg/ace/wiki wiki page]. If you still need help, feel free to drop a mail on the [http://groups.google.com/group/ace-discuss ace mailing list]. ================================================ 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/mips.s ================================================ # Original source from https://eng.libretexts.org # Kann, Charles W., "Introduction To MIPS Assembly Language Programming" (2015). Open Textbooks. 2. # https://cupola.gettysburg.edu/oer/2 # Program File: Program2-1.asm # Author: Charles Kann # Purpose: First program, Hello World .text # Define the program instructions. main: # Label to define the main program. li $v0,4 # Load 4 into $v0 to indicate a print string. la $a0, greeting # Load the address of the greeting into $a0. syscall # Print greeting. The print is indicated by # $v0 having a value of 4, and the string to # print is stored at the address in $a0. li $v0, 10 # Load a 10 (halt) into $v0. syscall # The program ends. .data # Define the program data. greeting: .asciiz "Hello World" #The string to print. ================================================ 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 ================================================ -- Single line comment /* * Multi-line comment block * */ # Hash-style comment (MySQL specific) -- Database and Table Operations CREATE DATABASE IF NOT EXISTS demo_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; USE demo_db; CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50) NOT NULL UNIQUE, email VARCHAR(100) NOT NULL, password_hash CHAR(64), balance DECIMAL(10, 2) DEFAULT 0.00, is_active BOOLEAN DEFAULT TRUE, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME ON UPDATE CURRENT_TIMESTAMP, profile_data JSON, INDEX idx_email (email), FULLTEXT INDEX idx_username (username) ) ENGINE=InnoDB; -- Insert Statements INSERT INTO users (username, email, password_hash) VALUES ('john_doe', 'john@example.com', SHA2('password123', 256)), ('jane_smith', 'jane@example.com', SHA2('secure456', 256)); -- Select with Various Clauses SELECT u.id, u.username, CONCAT(UPPER(LEFT(u.username, 1)), LOWER(SUBSTRING(u.username, 2))) AS formatted_name, COALESCE(u.balance, 0) AS balance, DATE_FORMAT(u.created_at, '%Y-%m-%d') AS join_date FROM users u WHERE u.is_active = TRUE AND u.created_at >= '2024-01-01' AND u.email LIKE '%@example.com' AND u.id BETWEEN 1 AND 1000 AND u.username IN ('john_doe', 'jane_smith') AND u.profile_data IS NOT NULL GROUP BY u.id HAVING COUNT(*) > 0 ORDER BY u.created_at DESC LIMIT 10 OFFSET 0; -- Update Statement UPDATE users SET balance = balance + 100.50, updated_at = NOW() WHERE username = 'john_doe'; -- Delete Statement DELETE FROM users WHERE is_active = FALSE AND created_at < DATE_SUB(NOW(), INTERVAL 1 YEAR); -- Join Example SELECT u.username, o.order_id, o.total_amount FROM users u INNER JOIN orders o ON u.id = o.user_id LEFT JOIN order_items oi ON o.order_id = oi.order_id WHERE o.status != 'cancelled'; -- Subquery and EXISTS SELECT * FROM users WHERE EXISTS ( SELECT 1 FROM orders WHERE orders.user_id = users.id AND orders.total_amount > 500 ); -- CASE Expression SELECT username, CASE WHEN balance >= 1000 THEN 'Premium' WHEN balance >= 100 THEN 'Standard' ELSE 'Basic' END AS tier FROM users; -- Window Functions SELECT username, balance, ROW_NUMBER() OVER (ORDER BY balance DESC) AS rank, SUM(balance) OVER (PARTITION BY is_active) AS total_by_status FROM users; -- Variables SET @user_count = (SELECT COUNT(*) FROM users); SET @tax_rate = 0.08; SELECT @user_count AS total_users; -- Stored Procedure DELIMITER // CREATE PROCEDURE GetUserByEmail(IN user_email VARCHAR(100)) BEGIN DECLARE user_exists INT DEFAULT 0; SELECT COUNT(*) INTO user_exists FROM users WHERE email = user_email; IF user_exists > 0 THEN SELECT * FROM users WHERE email = user_email; ELSE SELECT 'User not found' AS message; END IF; END // DELIMITER ; -- Function CREATE FUNCTION CalculateDiscount(price DECIMAL(10,2), discount_pct INT) RETURNS DECIMAL(10,2) DETERMINISTIC BEGIN RETURN price * (1 - discount_pct / 100); END; -- Trigger CREATE TRIGGER before_user_update BEFORE UPDATE ON users FOR EACH ROW BEGIN SET NEW.updated_at = NOW(); END; -- Transaction START TRANSACTION; UPDATE users SET balance = balance - 50 WHERE id = 1; UPDATE users SET balance = balance + 50 WHERE id = 2; COMMIT; -- Common Table Expression (CTE) WITH active_users AS ( SELECT * FROM users WHERE is_active = TRUE ) SELECT * FROM active_users WHERE balance > 100; -- EXPLAIN for query analysis EXPLAIN SELECT * FROM users WHERE email = 'test@example.com'; -- Numeric literals SELECT 42, 3.14159, 1e10, 0x1A2B, b'101010'; -- String literals SELECT 'single quotes', "double quotes", `backtick identifiers`; ================================================ FILE: demo/kitchen-sink/docs/nasal.nas ================================================ var sayHello = func(names, favorite) { foreach (var name; names) { printf("Hello %s, %s is the best!", name, favorite); } } sayHello(["World", "FlightGear"], "Nasal"); ================================================ FILE: demo/kitchen-sink/docs/nginx.nginx ================================================ user www www; ## Default: nobody worker_processes 5; ## Default: 1 error_log logs/error.log; pid logs/nginx.pid; worker_rlimit_nofile 8192; events { worker_connections 4096; ## Default: 1024 } http { include conf/mime.types; include /etc/nginx/proxy.conf; include /etc/nginx/fastcgi.conf; index index.html index.htm index.php; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] $status ' '"$request" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; tcp_nopush on; server_names_hash_bucket_size 128; # this seems to be required for some vhosts server { # php/fastcgi listen 80; server_name domain1.com www.domain1.com; access_log logs/domain1.access.log main; root html; location ~ \.php$ { fastcgi_pass 127.0.0.1:1025; } } server { # simple reverse-proxy listen 80; server_name domain2.com www.domain2.com; access_log logs/domain2.access.log main; # serve static files location ~ ^/(images|javascript|js|css|flash|media|static)/ { root /var/www/virtual/big.server.com/htdocs; expires 30d; } # pass requests for dynamic content to rails/turbogears/zope, et al location / { proxy_pass http://127.0.0.1:8080; } } upstream big_server_com { server 127.0.0.3:8000 weight=5; server 127.0.0.3:8001 weight=5; server 192.168.0.1:8000; server 192.168.0.1:8001; } server { # simple load balancing listen 80; server_name big.server.com; access_log logs/big.server.access.log main; location / { proxy_pass http://big_server_com; } } } ================================================ FILE: demo/kitchen-sink/docs/nim.nim ================================================ #[ #[ Multiline comment in already commented out code. ]# proc p[T](x: T) = discard ]# echo "This is code" var p = 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64 proc getAlphabet(): string = var accm = "" for letter in 'a'..'z': # see iterators accm.add(letter) return accm assert("a" * 10 == "aaaaaaaaaa") ================================================ 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/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/nunjucks.nunjucks ================================================ {{ foo.bar }} {{ foo["bar"] }} {{ foo | title }} {{ foo | join(",") }} {{ foo | replace("foo", "bar") | capitalize }} {% block header %} This is the default content {% endblock %}
{% block left %}{% endblock %}
{% block right %} This is more content {% endblock %}
{% extends "parent.html" %} {% block left %} This is the left side! {% endblock %} {% block right %} This is the right side! {% endblock %} {% block right %} {{ super() }} Right side! {% endblock %} {% if variable %} It is true {% endif %} {% if hungry %} I am hungry {% elif tired %} I am tired {% else %} I am good! {% endif %}

Posts

    {% for item in items %}
  • {{ item.title }}
  • {% else %}
  • This would display if the 'item' collection were empty
  • {% endfor %}
{% for ingredient, amount in food %} Use {{ amount }} of {{ ingredient }} {% endfor %} {% for fruit, color in fruits %} Did you know that {{ fruit }} is {{ color }}? {% endfor %} {% for x, y, z in points %} Point: {{ x }}, {{ y }}, {{ z }} {% endfor %}

Posts

    {% asyncEach item in items %} {% include "item-template.html" %} {% endeach %}

Posts

    {% asyncAll item in items %}
  • {{ item.id | lookup }}
  • {% endall %}
{% macro field(name, value='', type='text') %}
{% endmacro %} {{ username }} {% set username = "joe" %} {{ username }} {% set standardModal %} {% include 'standardModalData.html' %} {% endset %}
{% set standardModal %} {% include 'standardModalData.html' %} {% endset %}
{% include "missing.html" ignore missing %} {% import "forms.html" as forms %} {{ forms.label('Username') }} {{ forms.field('user') }} {{ forms.label('Password') }} {{ forms.field('pass', type='password') }} {% from "forms.html" import field, label as description %} {{ description('Username') }} {{ field('user') }} {{ description('Password') }} {{ field('pass', type='password') }} {{ foo(1, 2, bar=3, baz=4) }} {# Loop through all the users #} {% for user in users %}...{% endfor %} {% set cls = cycler("odd", "even") %} {% for row in rows %}
{{ row.name }}
{% endfor %} ================================================ 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/odin.odin ================================================ package main import "core:fmt" main :: proc() { program := "+ + * 😃 - /" accumulator := 0 for token in program { switch token { case '+': accumulator += 1 case '-': accumulator -= 1 case '*': accumulator *= 2 case '/': accumulator /= 2 case '😃': accumulator *= accumulator case: // Ignore everything else } } fmt.printf("The program \"%s\" calculates the value %d\n", program, accumulator) } ================================================ FILE: demo/kitchen-sink/docs/partiql.partiql ================================================ -- comment /* multi line comment */ SELECT "a", b, c FROM stuff s INNER CROSS JOIN @s WHERE f(s) -- comment -- comment SELECT VALUE {'sensor': s.sensor, 'readings': (SELECT VALUE l.co FROM logs as l WHERE l.sensor = s.sensor ) } FROM sensors AS s SELECT VALUE (PIVOT v AT g FROM UNPIVOT r as v At g WHERE g LIKE 'co%') FROM sensors AS r SELECT x.* FROM [{'a':1, 'b':1}, {'a':2}, 'foo'] AS x -- NOTE: the embedded ion values parse as ion (inside the backticks "`") SELECT x.* FROM `[{'a':1, 'b':1}, {'a':2}, "foo"]` AS x SELECT VALUE {v.a: v.b, v.c: v.d} FROM <<{'a':'same', 'b':1, 'c':'same', 'd':2}>> AS v WHERE v.b SELECT u.id, feedbackId, commentId, upvoteId FROM users as u, u.feedbacks as feedback at feedbackId LEFT CROSS JOIN feedback.comments as comment AT commentId LEFT CROSS JOIN UNPIVOT comment.upvotes as upvote at upvoteId SELECT ( SELECT numRec, tabulated FROM committed.changes changes, (SELECT u.id, feedbackId, commentId, upvoteId FROM changes.tabulated as u, u.feedbacks as feedback at feedbackId LEFT CROSS JOIN feedback.comments as comment AT commentId LEFT CROSS JOIN UNPIVOT comment.upvotes as upvote at upvoteId ) as tabulated, changes.numRec as numRec ) AS changes FROM incoming_committed committed SELECT SUM(AVG(n)) FROM <> AS n SELECT attributeId, COUNT(*) as the_count FROM repeating_things GROUP BY attributeId GROUP AS g HAVING 1 = 0 ================================================ 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/php_laravel_blade.blade.php ================================================ App Name - @yield('title') @extends('layouts.app') @section('sidebar') @parent

This is appended to the master sidebar.

@endsection @if (count($records) === 1) I have one record! @elseif (count($records) > 1) I have multiple records! @else I don't have any records! @endif @foreach ($users as $user) @if ($user->type == 1) @continue @endif
  • {{ $user->name }}
  • @if ($user->number == 5) @break @endif @endforeach @foreach ($users as $user) @continue($user->type == 1)
  • {{ $user->name }}
  • @break($user->number == 5) @endforeach
    @include('shared.errors')
    @includeIf('view.name', ['some' => 'data']) @env('local') // The application is in the local environment... @elseenv('testing') // The application is in the testing environment... @else // The application is not in the local or testing environment... @endenv
    @yield('content')
    {{-- comment --}} @if ( {{-- comment --}} /*block comment*/ #another comment $user->type == 1 // c comment /* comment*/ ) # not a comment
    @endif ================================================ 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/plsql.plsql ================================================ create table t ( id integer, month varchar(3), value integer ); insert into t (month, value) values ('jan', 1); insert into t (month, value) values ('jan', 1); insert into t (month, value) values ('oct', 3); insert into t (month, value) values ('dec', 96); select * from (select month, value from t) pivot ( sum(value) for month in ('jan', 'oct', 'dec') ); ================================================ 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 $h1 = @{ FirstName = "James"; LastName = "Anderson"; IDNum = 123 } $last = "Anderson"; $IDNum = 120 $h2 = @{ FirstName = "James"; LastName = $last; IDNum = $IDNum + 3 } $h3 = @{ } $h4 = @{ 10 = "James"; 20.5 = "Anderson"; $true = 123 } ${Maximum_Count_26} ${Name with`twhite space and `{punctuation`}} ${E:\\File.txt} "C:\Temp\" {mkdir "C:\Temp\"} "C:\Temp\" @" This is a here string $h1 = @{ FirstName = "James"; LastName = "Anderson"; IDNum = 123 } $last = "Anderson"; $IDNum = 120 $h2 = @{ FirstName = "James"; LastName = $last; IDNum = $IDNum + 3 } $h3 = @{ } $h4 = @{ 10 = "James"; 20.5 = "Anderson"; $true = 123 } $j = 20 still string $($i = 10) # pipeline gets nothing $(($i = 10)) # pipeline gets int 10 $($i = 10; $j) # pipeline gets int 20 $(($i = 10); $j) # pipeline gets [object[]](10,20) $(($i = 10); ++$j) # pipeline gets int 10 $(($i = 10); (++$j)) # pipeline gets [object[]](10,22) $($i = 10; ++$j) # pipeline gets nothing $(2,4,6) # pipeline gets [object[]](2,4,6) "@ @' Expressions inside should be recognised as string $h1 = @{ FirstName = "James"; LastName = "Anderson"; IDNum = 123 } $last = "Anderson"; $IDNum = 120 $h2 = @{ FirstName = "James"; LastName = $last; IDNum = $IDNum + 3 } $h3 = @{ } $h4 = @{ 10 = "James"; 20.5 = "Anderson"; $true = 123 } '@ ================================================ 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 with parentheses procedure newStyle (.str1$, .num, .str2$) # Command with "local" variable .local = Get total duration endproc # New-style procedure declaration with colon procedure newStyle: .str1$, .num, .str2$ # Command with "local" variable newStyle.local = Get total duration endproc ================================================ FILE: demo/kitchen-sink/docs/prisma.prisma ================================================ generator photon { provider = "photonjs" } model User { id String @default(cuid()) @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt firstName String lastName String email String @unique password String phone String responseRate Float? responseTime Int? ReportsTo User? @relation("EmployeeToEmployee_ReportsTo") employees User[] @relation("EmployeeToEmployee_ReportsTo") isSuperHost Boolean ownedPlaces Place[] location Location? bookings Booking[] paymentAccount PaymentAccount[] sentMessages Message[] @relation("SentMessages") receivedMessages Message[] @relation("ReceivedMessages") notifications Notification[] profilePicture Picture? hostingExperiences Experience[] } model Place { id String @default(cuid()) @id name String size PLACE_SIZES? shortDescription String description String slug String maxGuests Int numBedrooms Int numBeds Int numBaths Int reviews Review[] amenities Amenities host User pricing Pricing location Location views Views guestRequirements GuestRequirements? policies Policies? houseRules HouseRules? bookings Booking[] pictures Picture[] popularity Int } model Pricing { id String @default(cuid()) @id place Place monthlyDiscount Int? weeklyDiscount Int? perNight Int smartPricing Boolean basePrice Int averageWeekly Int averageMonthly Int cleaningFee Int? securityDeposit Int? extraGuests Int? weekendPricing Int? currency CURRENCY? } model GuestRequirements { id String @default(cuid()) @id govIssuedId Boolean recommendationsFromOtherHosts Boolean guestTripInformation Boolean place Place } model Policies { id String @default(cuid()) @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt checkInStartTime Float checkInEndTime Float checkoutTime Float place Place } model HouseRules { id String @default(cuid()) @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt suitableForChildren Boolean? suitableForInfants Boolean? petsAllowed Boolean? smokingAllowed Boolean? partiesAndEventsAllowed Boolean? additionalRules String? } model Views { id String @default(cuid()) @id lastWeek Int place Place } model Location { id String @default(cuid()) @id lat Float lng Float neighbourHood Neighbourhood? user User? place Place? address String directions String experience Experience? restaurant Restaurant? } model Neighbourhood { id String @default(cuid()) @id locations Location[] name String slug String homePreview Picture? city City featured Boolean popularity Int } model City { id String @default(cuid()) @id name String neighbourhoods Neighbourhood[] } model Picture { id String @default(cuid()) @id url String } model Experience { id String @default(cuid()) @id category ExperienceCategory? title String host User location Location pricePerPerson Int reviews Review[] preview Picture popularity Int } model ExperienceCategory { id String @default(cuid()) @id mainColor String name String experience Experience? } model Amenities { id String @default(cuid()) @id place Place elevator Boolean petsAllowed Boolean internet Boolean kitchen Boolean wirelessInternet Boolean familyKidFriendly Boolean freeParkingOnPremises Boolean hotTub Boolean pool Boolean smokingAllowed Boolean wheelchairAccessible Boolean breakfast Boolean cableTv Boolean suitableForEvents Boolean dryer Boolean washer Boolean indoorFireplace Boolean tv Boolean heating Boolean hangers Boolean iron Boolean hairDryer Boolean doorman Boolean paidParkingOffPremises Boolean freeParkingOnStreet Boolean gym Boolean airConditioning Boolean shampoo Boolean essentials Boolean laptopFriendlyWorkspace Boolean privateEntrance Boolean buzzerWirelessIntercom Boolean babyBath Boolean babyMonitor Boolean babysitterRecommendations Boolean bathtub Boolean changingTable Boolean childrensBooksAndToys Boolean childrensDinnerware Boolean crib Boolean } model Review { id String @default(cuid()) @id createdAt DateTime @default(now()) text String stars Int accuracy Int location Int checkIn Int value Int cleanliness Int communication Int place Place experience Experience? } model Booking { id String @default(cuid()) @id createdAt DateTime @default(now()) bookee User place Place startDate DateTime endDate DateTime payment Payment? } model Payment { id String @default(cuid()) @id createdAt DateTime @default(now()) serviceFee Float placePrice Float totalPrice Float booking Booking paymentMethod PaymentAccount } model PaymentAccount { id String @default(cuid()) @id createdAt DateTime @default(now()) type PAYMENT_PROVIDER? user User payments Payment[] paypal PaypalInformation? creditcard CreditCardInformation? } model PaypalInformation { id String @default(cuid()) @id createdAt DateTime @default(now()) email String paymentAccount PaymentAccount } model CreditCardInformation { id String @default(cuid()) @id createdAt DateTime @default(now()) cardNumber String expiresOnMonth Int expiresOnYear Int securityCode String firstName String lastName String postalCode String country String paymentAccount PaymentAccount? } model Message { id String @default(cuid()) @id createdAt DateTime @default(now()) from User @relation("SentMessages") to User @relation("ReceivedMessages") deliveredAt DateTime readAt DateTime } model Notification { id String @default(cuid()) @id createdAt DateTime @default(now()) type NOTIFICATION_TYPE? user User link String readDate DateTime } model Restaurant { id String @default(cuid()) @id createdAt DateTime @default(now()) title String avgPricePerPerson Int pictures Picture[] location Location isCurated Boolean slug String popularity Int } enum CURRENCY { CAD CHF EUR JPY USD ZAR } enum PLACE_SIZES { ENTIRE_HOUSE ENTIRE_APARTMENT ENTIRE_EARTH_HOUSE ENTIRE_CABIN ENTIRE_VILLA ENTIRE_PLACE ENTIRE_BOAT PRIVATE_ROOM } enum PAYMENT_PROVIDER { PAYPAL CREDIT_CARD } enum NOTIFICATION_TYPE { OFFER INSTANT_BOOK RESPONSIVENESS NEW_AMENITIES HOUSE_RULES } ================================================ 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/prql.prql ================================================ from invoices filter invoice_date >= @1970-01-16 derive { transaction_fees = 0.8, income = total - transaction_fees } filter income > 1 group customer_id ( aggregate { average total, sum_income = sum income, ct = count total, } ) sort {-sum_income} take 10 join c=customers (==customer_id) derive name = f"{c.last_name}, {c.first_name}" select { c.customer_id, name, sum_income } derive db_version = s"version()" ================================================ FILE: demo/kitchen-sink/docs/puppet.epp ================================================ define apache::vhost ($port, $docroot, $servername = $title, $vhost_name = '*') { include apache include apache::params $vhost_dir = $apache::params::vhost_dir file { "${vhost_dir}/${servername}.conf": content => template('apache/vhost-default.conf.erb'), owner => 'www', group => 'www', mode => '644', require => Package['httpd'], notify => Service['httpd'], } } type MyModule::Tree = Array[Variant[Data, Tree]] function apache::bool2http(Variant[String, Boolean] $arg) >> String { case $arg { false, undef, /(?i:false)/ : { 'Off' } true, /(?i:true)/ : { 'On' } default : { "$arg" } } } # A class with parameters class apache (String $version = 'latest') { package {'httpd': ensure => $version, # Using the class parameter from above before => File['/etc/httpd.conf'], } file {'/etc/httpd.conf': ensure => file, owner => 'httpd', content => template('apache/httpd.conf.erb'), # Template from a module } service {'httpd': ensure => running, enable => true, subscribe => File['/etc/httpd.conf'], } } if $is_virtual { warning( 'Tried to include class ntp on virtual machine; this node might be misclassified.' ) } elsif $operatingsystem == 'Darwin' { warning( 'This NTP module does not yet work on our Mac laptops.' ) else { include ntp } ================================================ 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/qml.qml ================================================ // A simple example import QtQuick 2.7 import QtQuick.Controls 2.3 Rectangle { color: "red" anchors.fill: parent Text { text: "WEEEEEEEEEE" font.pixelSize: 50 color: "white" anchors.centerIn: parent RotationAnimator on rotation { running: true loops: Animation.Infinite from: 0 to: 360 duration: 1500 } } } ================================================ 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/raku.raku ================================================ =begin comment Raku example for ace =end comment class Cook is Employee { has @.utensils is rw; has @.cookbooks is rw; method cook( $food ) { say "Cooking $food"; } method clean_utensils { say "Cleaning $_" for @.utensils; } } class Baker is Cook { method cook( $confection ) { say "Baking a tasty $confection"; } } my $cook = Cook.new( utensils => , cookbooks => 'The Joy of Cooking', salary => 40000); $cook.cook( 'pizza' ); # OUTPUT: «Cooking pizza␤» say $cook.utensils.perl; # OUTPUT: «["spoon", "ladle", "knife", "pan"]␤» say $cook.cookbooks.perl; # OUTPUT: «["The Joy of Cooking"]␤» say $cook.salary; # OUTPUT: «40000␤» my $baker = Baker.new( utensils => 'self cleaning oven', cookbooks => "The Baker's Apprentice", salary => 50000); $baker.cook('brioche'); # OUTPUT: «Baking a tasty brioche␤» say $baker.utensils.perl; # OUTPUT: «["self cleaning oven"]␤» say $baker.cookbooks.perl; # OUTPUT: «["The Baker's Apprentice"]␤» say $baker.salary; # OUTPUT: «50000␤» ================================================ 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/robot.robot ================================================ *** Settings *** Documentation Robot Framework 4 syntax recipes cheat sheet robot. ... Demonstrates Robot Framework syntax in a concise format. Library MyLibrary Library MyLibrary WITH NAME HelloLibrary Library MyLibrary greeting=Howdy! WITH NAME HowdyLibrary Resource keywords.robot Suite Setup Log Suite Setup! Suite Teardown Log Suite Teardown! Test Setup Log Test Setup! Test Teardown Log Test Teardown! Test Timeout 2 minutes Variables variables.py *** Variables *** ${STRING}= cat ${NUMBER}= ${1} @{LIST}= one two three &{DICTIONARY}= string=${STRING} number=${NUMBER} list=@{LIST} ${ENVIRONMENT_VARIABLE}= %{PATH=Default value} *** Keywords *** A keyword without arguments Log No arguments. A keyword with a required argument [Arguments] ${argument} Log Required argument: ${argument} A keyword with an optional argument [Arguments] ${argument}=Default value Log Optional argument: ${argument} ... Another arg A keyword with any number of arguments [Arguments] @{varargs} Log Any number of arguments: @{varargs} A keyword with one or more arguments [Arguments] ${argument} @{varargs} Log One or more arguments: ${argument} @{varargs} A keyword that returns a value [Return] Return value A keyword with documentation [Documentation] This is keyword documentation. No Operation *** Test Cases *** Call keywords with a varying number of arguments [Tags] Test Another Tag A keyword without arguments A keyword with a required argument Argument A keyword with a required argument argument=Argument A keyword with an optional argument A keyword with an optional argument Argument A keyword with an optional argument argument=Argument A keyword with any number of arguments A keyword with any number of arguments arg1 arg2 arg3 arg4 arg5 A keyword with one or more arguments arg1 A keyword with one or more arguments arg1 arg2 arg3 Call a keyword that returns a value ${value}= A keyword that returns a value Log ${value} # Return value Do conditional IF - ELSE IF - ELSE execution IF ${NUMBER} > 1 Log Greater than one. ELSE IF "${STRING}" == "dog" Log It's a dog! ELSE Log Probably a cat. 🤔 END Loop a list Log ${LIST} # ['one', 'two', 'three'] FOR ${item} IN @{LIST} Log ${item} # one, two, three END FOR ${item} IN one two three Log ${item} # one, two, three END Loop a dictionary Log ${DICTIONARY} # {'string': 'cat', 'number': 1, 'list': ['one', 'two', 'three']} FOR ${key_value_tuple} IN &{DICTIONARY} Log ${key_value_tuple} # ('string', 'cat'), ('number', 1), ('list', ['one', 'two', 'three']) END FOR ${key} IN @{DICTIONARY} Log ${key}=${DICTIONARY}[${key}] # string=cat, number=1, list=['one', 'two', 'three'] END Loop a range from 0 to end index FOR ${index} IN RANGE 10 Log ${index} # 0-9 END Loop a range from start to end index FOR ${index} IN RANGE 1 10 Log ${index} # 1-9 END Loop a range from start to end index with steps FOR ${index} IN RANGE 0 10 2 Log ${index} # 0, 2, 4, 6, 8 END Nest loops @{alphabets}= Create List a b c Log ${alphabets} # ['a', 'b', 'c'] @{numbers}= Create List ${1} ${2} ${3} Log ${numbers} # [1, 2, 3] FOR ${alphabet} IN @{alphabets} FOR ${number} IN @{numbers} Log ${alphabet}${number} # a1, a2, a3, b1, b2, b3, c1, c2, c3 END END Exit a loop on condition FOR ${i} IN RANGE 5 Exit For Loop If ${i} == 2 Log ${i} # 0, 1 END Continue a loop from the next iteration on condition FOR ${i} IN RANGE 3 Continue For Loop If ${i} == 1 Log ${i} # 0, 2 END Create a scalar variable ${animal}= Set Variable dog Log ${animal} # dog Log ${animal}[0] # d Log ${animal}[-1] # g Create a number variable ${π}= Set Variable ${3.14} Log ${π} # 3.14 Create a list variable @{animals}= Create List dog cat bear Log ${animals} # ['dog', 'cat', 'bear'] Log ${animals}[0] # dog Log ${animals}[-1] # bear Create a dictionary variable &{dictionary}= Create Dictionary key1=value1 key2=value2 Log ${dictionary} # {'key1': 'value1', 'key2': 'value2'} Log ${dictionary}[key1] # value1 Log ${dictionary.key2} # value2 Access the items in a sequence (list, string) ${string}= Set Variable Hello world! Log ${string}[0] # H Log ${string}[:5] # Hello Log ${string}[6:] # world! Log ${string}[-1] # ! @{list}= Create List one two three four five Log ${list} # ['one', 'two', 'three', 'four', 'five'] Log ${list}[0:6:2] # ['one', 'three', 'five'] Call a custom Python library ${greeting}= MyLibrary.Get Greeting Log ${greeting} # Hello! ${greeting}= HelloLibrary.Get Greeting Log ${greeting} # Hello! ${greeting}= HowdyLibrary.Get Greeting Log ${greeting} # Howdy! Call a keyword from a separate resource file My keyword in a separate resource file Access a variable in a separate variable file Log ${MY_VARIABLE_FROM_A_SEPARATE_VARIABLE_FILE} Split arguments to multiple lines A keyword with any number of arguments ... arg1 ... arg2 ... arg3 Log available variables Log Variables # ${/} = / # &{DICTIONARY} = { string=cat | number=1 | list=['one', 'two', 'three'] } # ${OUTPUT_DIR} = /Users//... # ... Evaluate Python expressions ${path}= Evaluate os.environ.get("PATH") ${path}= Set Variable ${{os.environ.get("PATH")}} Use special variables Log ${EMPTY} # Like the ${SPACE}, but without the space. Log ${False} # Boolean False. Log ${None} # Python None Log ${null} # Java null. Log ${SPACE} # ASCII space (\x20). Log ${SPACE * 4} # Four spaces. Log "${SPACE}" # Quoted space (" "). Log ${True} # Boolean True. LOG ${CURDIR} # Current directory ================================================ 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; } struct ConstGenericStruct<const N: usize>([(); N]); // T constrains by being an argument to GenericTrait. impl<T> GenericTrait<T> for i32 { /* ... */ } // T constrains by being an arguement to GenericStruct impl<T> Trait for GenericStruct<T> { /* ... */ } // Likewise, N constrains by being an argument to ConstGenericStruct impl<const N: usize> Trait for ConstGenericStruct<N> { /* ... */ } // T constrains by being in an associated type in a bound for type `U` which is // itself a generic parameter constraining the trait. impl<T, U> GenericTrait<U> for u32 where U: HasAssocType<Ty = T> { /* ... */ } // Like previous, except the type is `(U, isize)`. `U` appears inside the type // that includes `T`, and is not the type itself. impl<T, U> GenericStruct<U> where (U, isize): HasAssocType<Ty = T> { /* ... */ } //! - Inner line doc //!! - Still an inner line doc (but with a bang at the beginning) /*! - Inner block doc */ /*!! - Still an inner block doc (but with a bang at the beginning) */ /** - Outer block doc (exactly) 2 asterisks */ let multiline = r##" This is a raw string. r#"nested string"# "##; let empty = br##""##; let _strings = [r"hello\", br"hello\", cr"hello\" ]; macro_rules! mac_variant { ($vis:vis $name:ident) => { enum $name { $vis Unit, $vis Tuple(u8, u16), $vis Struct { f: u8 }, } } } ================================================ FILE: demo/kitchen-sink/docs/sac.sac ================================================ /***************************************************************************** * * SAC demo program * * This SAC demo program implements 2-dimensional relaxation on double * precision floating point numbers applying a 4-point stencil and fixed * boundary conditions. * * The vertical (SIZE1) and the horizontal (SIZE2) array size as well as * the number of iterations to be performed (LOOP) may be set at compile * time. * *****************************************************************************/ #ifndef LOOP #define LOOP 100 #endif #ifndef SIZE1 #define SIZE1 1000 #endif #ifndef SIZE2 #define SIZE2 1000 #endif use Array: all; use StdIO: all; inline double[+] onestep(double[+] B) { A = with { ( . < x < . ) : 0.25*(B[x+[1,0]] + B[x-[1,0]] + B[x+[0,1]] + B[x-[0,1]]); } : modarray( B ); return(A); } inline double[+] relax(double[+] A, int steps) { for (k=0; k<steps; k++) { A = onestep(A); } return(A); } int main () { A = with { ( . <= x <= . ) : 0.0d; } : genarray( [SIZE1,SIZE2] ); A = modarray(A, [0,1], 500.0d); A = relax( A, LOOP); z = with { ( 0*shape(A) <= x < shape(A) ) : A[x]; } : fold( +, 0d ); #if 0 printf("%.10g\n", z); return(0); #else print( z); return( 0); #endif } ================================================ 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/scrypt.scrypt ================================================ // https://github.com/sCrypt-Inc/boilerplate/blob/master/contracts/ackermann.scrypt contract Ackermann { int a; // a = 2 int b; // b = 1 static const int LOOPCOUNT = 14; function ackermann(int m, int n) : int { bytes stk = num2bin(m, 1); // run this function off chain to get the loop count and set it here // e.g., (2, 1) requires 14 loops, (3, 5) 42438 loop (LOOPCOUNT) { if (len(stk) > 0) { bytes top = stk[0 : 1]; m = unpack(top); // pop stk = stk[1 : len(stk)]; if (m == 0) { n = n + m + 1; } else if (n == 0) { n++; m--; // push stk = num2bin(m, 1) + stk; } else { stk = num2bin(m - 1, 1) + stk; stk = num2bin(m, 1) + stk; n--; } } } return n; } // y = 5 public function unlock(int y) { require(y == this.ackermann(this.a, this.b)); } } ================================================ 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/slim.slim ================================================ doctype html html head title Slim Examples meta name="keywords" content="template language" meta name="author" content=author link rel="icon" type="image/png" href=file_path("favicon.png") javascript: alert('Slim supports embedded javascript!') body h1 Markup examples #content p This example shows you how a basic Slim file looks. == yield - if items.any? table#items - for item in items tr td.name = item.name td.price = item.price - else p No items found. Please add some inventory. Thank you! div id="footer" == render 'footer' | Copyright © #{@year} #{@author} indenting test - @page_current = true ================================================ 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/smithy.smithy ================================================ namespace example.weather /// Provides weather forecasts. @paginated(inputToken: "nextToken", outputToken: "nextToken", pageSize: "pageSize") service Weather { version: "2006-03-01", resources: [City], operations: [GetCurrentTime] } resource City { identifiers: { cityId: CityId }, read: GetCity, list: ListCities, resources: [Forecast], } resource Forecast { identifiers: { cityId: CityId }, read: GetForecast, } // "pattern" is a trait. @pattern("^[A-Za-z0-9 ]+$") string CityId @readonly operation GetCity { input: GetCityInput, output: GetCityOutput, errors: [NoSuchResource] } structure GetCityInput { // "cityId" provides the identifier for the resource and // has to be marked as required. @required cityId: CityId } structure GetCityOutput { // "required" is used on output to indicate if the service // will always provide a value for the member. @required name: String, @required coordinates: CityCoordinates, } // This structure is nested within GetCityOutput. structure CityCoordinates { @required latitude: Float, @required longitude: Float, } // "error" is a trait that is used to specialize // a structure as an error. @error("client") structure NoSuchResource { @required resourceType: String } // The paginated trait indicates that the operation may // return truncated results. @readonly @paginated(items: "items") operation ListCities { input: ListCitiesInput, output: ListCitiesOutput } structure ListCitiesInput { nextToken: String, pageSize: Integer } structure ListCitiesOutput { nextToken: String, @required items: CitySummaries, } // CitySummaries is a list of CitySummary structures. list CitySummaries { member: CitySummary } // CitySummary contains a reference to a City. @references([{resource: City}]) structure CitySummary { @required cityId: CityId, @required name: String, } @readonly operation GetCurrentTime { output: GetCurrentTimeOutput } structure GetCurrentTimeOutput { @required time: Timestamp } @readonly operation GetForecast { input: GetForecastInput, output: GetForecastOutput } // "cityId" provides the only identifier for the resource since // a Forecast doesn't have its own. structure GetForecastInput { @required cityId: CityId, } structure GetForecastOutput { chanceOfRain: Float } ================================================ 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/terraform.tf ================================================ export TF_LOG=TRACE # An AMI variable "ami" { description = "the AMI to use" } /* A multi line comment. */ resource "aws_instance" "web" { ami = "${var.ami}" count = 2 source_dest_check = false connection { user = "root" } } resource "aws_instance" "web" { subnet = "${var.env == "production" ? var.prod_subnet : var.dev_subnet}" } variable "count" { default = 2 } variable "hostnames" { default = { "0" = "example1.org" "1" = "example2.net" } } data "template_file" "web_init" { # Render the template once for each instance count = "${length(var.hostnames)}" template = "${file("templates/web_init.tpl")}" vars { # count.index tells us the index of the instance we are rendering hostname = "${var.hostnames[count.index]}" } } resource "aws_instance" "web" { # Create one instance for each hostname count = "${length(var.hostnames)}" # Pass each instance its corresponding template_file user_data = "${data.template_file.web_init.*.rendered[count.index]}" } variable "count" { default = 2 } # Define the common tags for all resources locals { common_tags = { Component = "awesome-app" Environment = "production" } } # Create a resource that blends the common tags with instance-specific tags. resource "aws_instance" "server" { ami = "ami-123456" instance_type = "t2.micro" tags = "${merge( local.common_tags, map( "Name", "awesome-app-server", "Role", "server" ) )}" } $ terraform apply -var foo=bar -var foo=baz $ terraform apply -var 'foo={quux="bar"}' -var 'foo={bar="baz"}' $ terraform apply -var-file=foo.tfvars -var-file=bar.tfvars $ TF_VAR_somemap='{foo = "bar", baz = "qux"}' terraform plan resource "aws_instance" "web" { # ... count = "${var.count}" # Tag the instance with a counter starting at 1, ie. web-001 tags { Name = "${format("web-%03d", count.index + 1)}" } } ================================================ 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/text.txt ================================================ This is just some text! // These # are -- not <!-- comments --> (but indent actions work) This is just some text! ================================================ 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/tsv.tsv ================================================ col1 col2 long col3 col4 "col1 with quotes" col2 col3 col4 col1 col2 col"""3 co""l4 col1 col2 col3"broken" col4 col1" -"col2 col3 col4 col5 col1 "col2 multiline" "col3 multiline""string 3" "col4 multiline string 4" col1 col2 "c o l""3" col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col1 col2 col3 col4 col5 col6 co"l7 col8 col9 col10 11 col12 col13 ================================================ 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; use 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 : unsigned (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 <= std_logic_vector(count); end architecture; ================================================ FILE: demo/kitchen-sink/docs/visualforce.vfp ================================================ {!IF(AND(Price < 1, Quantity < 1), "Small", null)} ================================================ FILE: demo/kitchen-sink/docs/vue.vue ================================================ ================================================ 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 version: 1.2.3.4 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/docs/zeek.zeek ================================================ # An example of the Zeek scripting language. ##! A Zeekygen-style summmary comment. # TODO: just an example of a todo-indicator @load base/frameworks/notice @if ( F ) @endif module Example; export { type SimpleEnum: enum { ONE, TWO, THREE }; redef enum SimpleEnum += { ## A Zeekygen-style comment. FOUR, FIVE, ##< A Zeekygen-style comment. }; type SimpleRecord: record { field1: count; field2: bool; } &redef; redef record SimpleRecord += { field3: string &optional; field4: string &default="blah"; }; const init_option: bool = T; option runtime_option: bool = F; global test_opaque: opaque of md5; global test_vector: vector of count; global myfunction: function(msg: string, c: count &default=0): count; global myhook: hook(tag: string); global myevent: event(tag: string); } function myfunction(msg: string, c: count): count { print "in myfunction", msg, c; return 0; } event myevent(msg: string) &priority=1 { print "in myevent"; } hook myhook(msg: string) { print "in myevent"; } event zeek_init() { local b = T; local s = "\xff\xaf\"and more after the escaped quote"; local p = /foo|bar\xbe\/and more after the escaped slash/; local c = 10; local sr = SimpleRecord($field1 = 0, $field2 = T, $field3 = "hi"); print sr?$field3, sr$field1; local myset: set[string] = set("one", "two", "three"); add myset["four"]; delete myset["one"]; for ( ms in myset ) { print ms is string, s as string; print s[1:3]; local tern: count = s == "two" ? 2 : 0; if ( s !in myset ) print fmt("error %4.2f: %s", 3.14159, "wtf?"); } switch ( c ) { case 1: break; case 2: fallthrough; default: break; } if ( ! b ) print "here"; else print "there"; while ( c != 0 ) { if ( c >= 5 ) c += 0; else if ( c == 8 ) c -= 0; c = c / 1; c = c / 1; c = c - 1; } print |myset|; print ~5; print 1 & 0xff; print 2 ^ 5; myfunction("hello function"); hook myhook("hell hook"); event myevent("hello event"); schedule 1sec { myevent("hello scheduled event") }; print 0, 7; print 0xff, 0xdeadbeef; print 3.14159; print 1234.0; print 1234e0; print .003E-23; print .003E+23; print 123/udp; print 8000/tcp; print 13/icmp; print 42/unknown; print google.com; print 192.168.50.1; print 255.255.255.255; print 0.0.0.0; print 10.0.0.0/16; print [2001:0db8:85a3:0000:0000:8a2e:0370:7334]; # test for case insensitivity print [2001:0DB8:85A3:0000:0000:8A2E:0370:7334]; # any case mixture is allowed print [2001:0dB8:85a3:0000:0000:8A2E:0370:7334]; # leading zeroes of a 16-bit group may be omitted print [2001:db8:85a3:0:0:8a2e:370:7334]; # a single occurrence of consecutive groups of zeroes may be replaced by :: print [2001:db8:85a3::8a2e:370:7334]; # all zeroes should work print [0:0:0:0:0:0:0:0]; # all zeroes condensed should work print [::]; # hybrid ipv6-ipv4 address should work print [2001:db8:0:0:0:FFFF:192.168.0.5]; # hybrid ipv6-ipv4 address with zero ommission should work print [2001:db8::FFFF:192.168.0.5]; print [2001:0db8:85a3:0000:0000:8a2e:0370:7334]/64; print 1day, 1days, 1.0day, 1.0days; print 1hr, 1hrs, 1.0hr, 1.0hrs; print 1min, 1mins, 1.0min, 1.0mins; print 1sec, 1secs, 1.0sec, 1.0secs; print 1msec, 1msecs, 1.0msec, 1.0msecs; print 1usec, 1usecs, 1.0usec, 1.0usecs; } ================================================ FILE: demo/kitchen-sink/docs/zig.zig ================================================ const std = @import("std"); pub fn main() !void { const stdout = std.io.getStdOut().writer(); try stdout.print("Hello, {s}!\n", .{"world"}); } ================================================ FILE: demo/kitchen-sink/file_drop.js ================================================ 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 ================================================ "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 ================================================ "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 ================================================ /* eslint-env browser */ /* global importScripts Response Request */ /** * requirejs compatible loader for cloud9 * * supports the following loaders * require("text!./path.md") - load a file as text * require("json!./file.json") - load a file as json * require("asset-url!./directory-or-a-file") - get a url for a image, html or audio file or * a whole directory, files required this way are copied to the cdn without modifications * require("webworker!./modulname") - get a url that can be used to start a webworker * require("webworker!!./modulname") - get a url for webworker, and include all the * instances of require("!./modulname") in a bundle for that worker * require("language!./modulname") - the commonly used tagname for language worker * require("vfs!./module") - bundles js file with it's dependencies in a way that can be used * on vfs worker, either as a vfs extension or a standalone executable * require("architect!./modulname") - wraps module in a function allowing * delayed initialization of architect plugins * TODO: * require("glob!./ace/mode/*(:-_test|_highlight_rules).js").load("css", function() {}) - * require("lazy!./module").load(function() {}) - */ (function() { var global = (function() { return this; })(); if (!global && typeof window != "undefined") global = window; // can happen in strict mode if (!global && typeof self != "undefined") global = self; // can happen in webworker var commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$|`([^`\\]|\\.)*`)/gm; var cjsRequireRegExp = /require\s*\(\s*["']([^'"\s]+)["']\s*\)/g; function getInlineDeps(fn) { var deps = []; if (fn.length) { fn .toString() .replace(commentRegExp, "") .replace(cjsRequireRegExp, function(match, dep, index, str) { var i = index; while (str.charCodeAt((i -= 1)) <= 32) {} if (str.charAt(i) !== ".") deps.push(dep); }); deps = ["require", "exports", "module"].concat(deps); } return deps; } var define = function(name, deps, callback) { // Allow for anonymous modules if (typeof name !== "string") { callback = deps; deps = name; name = null; } // This module may not have dependencies if (deps && !Array.isArray(deps)) { callback = deps; deps = null; } if (nextModule) { if (!name || name == nextModule.name) { name = nextModule.name; deps = deps || nextModule.deps; nextModule = null; } } if (!name) return defQueue.push([deps, callback]); if (define.loaded[name]) return; if (!deps && typeof callback == "function") deps = getInlineDeps(callback); define.loaded[name] = { id: name, deps: normalizeNames(name, deps || []), factory: callback, exports: {}, packaged: true, }; if (define.loading[name]) delete define.loading[name]; if (define.lastModule) define.pending.push(name); else define.lastModule = name; }; var defQueue = []; var nextModule; var addToLoadQueue = function(missing, deps, callback, errback) { var toLoad = missing.length; var map = {}; define.queue.push({ deps: deps, map: map, toLoad: toLoad, callback: callback, errback: errback, }); for (var i = 0; i < missing.length; ++i) { var p = missing[i]; map[p] = 1; if (!define.loading[p]) { define.loading[p] = 1; require.load(p); } } }; var processLoadQueue = function(err, id) { var changed = false; if (err) { if (!id) id = err.id; define.errors[id] = err; define.queue.forEach(function(r) { if (r.map[id]) { r.toLoad = -1; if (r.errback) r.errback(err); } }); if (define.lastModule == id) define.lastModule = null; define.pending = define.pending.filter(function(p) { return p != id; }); changed = true; err.from = []; for (var i in define.loaded) { var index = define.loaded[i].deps.indexOf(id); if (index != -1) { err.from.push(define.loaded[i].id); } } console.error("Error loading " + id + " required from " + err.from.slice(0, 2)); } else if (id && !defQueue.length && !define.loaded[id]) { // the script didn't call define defQueue = [(config.shim && config.shim[id]) || [[], null]]; } if (defQueue.length) { if (defQueue.length > 1) throw new Error("more than one module in defqueue"); define(id, defQueue[0][0], defQueue[0][1]); defQueue.length = 0; } var pending = define.pending; define.queue.forEach(function(r) { pending.forEach(function(id) { if (r.map[id]) r.toLoad--; }); if (r.map[define.lastModule]) r.toLoad--; if (!r.toLoad) { changed = true; _require("", r.deps, r.callback, r.errback); } }); define.lastModule = null; if (pending.length) define.pending = []; if (changed) { define.queue = define.queue.filter(function(r) { return r.toLoad > 0; }); } }; define.amd = {}; define.queue = []; define.loaded = {}; define.errors = {}; define.loading = {}; define.pending = []; define.modules = {require: 1, exports: 1, module: 1}; define.fetchedUrls = {}; var activateModule = function(name) { var module = define.loaded[name]; var exports = module.exports; if (typeof module.factory !== "function") { exports = module.factory; } else { var req = function(path, callback) { return _require(name, path, callback); }; req.config = config; req.toUrl = function(id) { return require.toUrl(id); }; var missing = checkMissing(module.deps); if (missing.length) return missing; module.define = define; var specialModules = { require: req, exports: exports, module: module, }; if (name.lastIndexOf("architect!", 0) == 0 && !module.pluginFactory) { module.pluginFactory = module.factory; module.factory = activateArchitectModule; } define.modules[name] = exports; var args = module.deps.slice(0, module.factory.length); var returnValue = args.length ? module.factory.apply( module, args.map(function(name) { return specialModules[name] || lookup(name); }) ) : module.factory(req, exports, module); exports = returnValue == undefined ? module.exports : returnValue; } if (!config.$keepLoaders) delete define.loaded[name]; define.modules[name] = exports; }; var checkMissing = function(deps, seen, missing) { missing = missing || {}; seen = seen || {}; for (var i = 0; i < deps.length; ++i) { var depName = deps[i]; if (!define.modules[depName]) { var dep = define.loaded[depName]; if (!dep) missing[depName] = 1; else if (!missing[depName] && !seen[depName]) { seen[depName] = 1; checkMissing(dep.deps, seen, missing); } } } return Object.keys(missing); }; var lookup = function(moduleName) { var mod = define.modules[moduleName]; if (mod === undefined && define.loaded[moduleName]) { activateModule(moduleName); mod = define.modules[moduleName]; } return mod; }; var _require = function(parentId, moduleName, callback, errback) { if (typeof moduleName === "string") { var depName = normalizeName(parentId, moduleName); var module = lookup(depName); if (module !== undefined) { if (typeof callback == "function") callback(module); return module; } else if (typeof importScripts != "undefined" || syncLoaders.test(moduleName)) { addToLoadQueue([depName], [depName]); return lookup(depName); } } else if (Array.isArray(moduleName)) { var deps = normalizeNames(parentId, moduleName); var missing = checkMissing(deps); if (!missing.length) { var args = deps.map(lookup); return callback && callback.apply(null, args); } else { return addToLoadQueue(missing, deps, callback, errback); } } }; var normalizeName = function(parentId, moduleName) { if (/!/.test(parentId)) parentId = parentId.split("!").pop(); // normalize plugin requires var i = moduleName.indexOf("!"); if (i !== -1) { return ( normalizeName(parentId, moduleName.slice(0, i)) + "!" + normalizeName(parentId, moduleName.slice(i + 1)) ); } // normalize relative requires if (moduleName.charAt(0) == ".") { var parentChunks = parentId.split("/"); var parentModule = parentChunks.shift(); if (parentModule.charAt(0) == "@") { parentModule = parentModule + "/" + parentChunks.shift(); } var path = parentChunks.slice(0, -1).join("/"); moduleName = parentModule + (path ? "/" + path : "") + "/" + moduleName; while (moduleName.indexOf(".") !== -1 && previous != moduleName) { var previous = moduleName; moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); } } return moduleName; }; var normalizeNames = function(parentId, moduleNames) { return moduleNames.map(function(name) { return normalizeName(parentId, name); }); }; var require = function(module, callback, errback) { return _require("", module, callback, errback); }; var config = (require.config = function(cfg) { if (cfg.baseUrl) config.baseUrl = cfg.baseUrl.replace(/\/*$/, "/"); if (cfg.host) host = cfg.host; if (Array.isArray(cfg.packages)) { cfg.packages.forEach(function(pkg) { if (typeof pkg === "string") pkg = {name: pkg}; config.packages[pkg.name] = { name: pkg.name, location: (pkg.location || pkg.name).replace(/\/*$/, "/"), main: (pkg.main || "main").replace(/\.js$/, "").replace(/^\.\//, ""), }; }); } else if (cfg.packages) { config.packages = cfg.packages; } cfg.paths && Object.keys(cfg.paths).forEach(function(p) { config.paths[p] = cfg.paths[p]; }); if ( cfg.useCache && global.caches && (location.protocol === "https:" || location.hostname == "localhost") ) { config.useCache = true; checkCache(); } if (cfg.transform) config.transform = cfg.transform; if (/\bes5\b/.test(cfg.transform) && !global.shimIncluded) { if (!console.assert) { console.assert = function assert() {}; // This method is used by the following es6 shim. } var oldFlags = RegExp.prototype.flags; RegExp.prototype.flags = true; require(["js-polyfills/es6"]); RegExp.prototype.flags = oldFlags; global.shimIncluded = true; } if (cfg.assetUrl) config.assetUrl = cfg.assetUrl; if (cfg.$keepLoaders != undefined) config.$keepLoaders = cfg.$keepLoaders; }); require.resetConfig = function(cfg) { var location = global.location; var baseUrl = location ? location.protocol + "//" + location.host + location.pathname.split("/").slice(0, -1).join("/") : ""; config.packages = Object.create(null); config.paths = Object.create(null); config.baseUrl = baseUrl; config.useCache = false; config.transform = ""; if (cfg) require.config(cfg); }; require.getConfig = function() { var script = document.querySelector("script[src*=require]"); return { packages: config.packages, paths: config.paths, baseUrl: config.baseUrl, useCache: config.useCache, transform: config.transform, host: host, requireSourceUrl: !config.packed && script && script.src, assetUrl: config.assetUrl, }; }; require.resetConfig(); define.undef = require.undef = function(module, recursive) { module = normalizeName("", module); if (recursive) { var root = (module + "/").replace(/\/+$/, "/"); undefAll(root, define.errors); undefAll(root, define.loaded); undefAll(root, define.modules); undefAll(root, define.loading); } else { undefOne(module, require.toUrl(module, ".js")); } }; function undefOne(module, path) { delete define.errors[module]; delete define.loaded[module]; delete define.modules[module]; delete define.loading[module]; delete define.fetchedUrls[path]; } function undefAll(module, hash) { Object.keys(hash).forEach(function(key) { var i = key.indexOf("!") + 1; if (key.lastIndexOf(module, 0) == 0) undefOne(key, require.toUrl(key, ".js")); if (i) { var plugin = key.slice(0, i - 1); var resource = key.slice(i); if (resource.lastIndexOf(module, 0) == 0 || plugin.lastIndexOf(module, 0) == 0) { undefOne(key, require.toUrl(key, "")); undefOne(resource, require.toUrl(resource, "")); } } }); } require.toUrl = function(moduleName, ext, skipExt, isStatic) { var absRe = /^([\w\+\.\-]+:|\/)/; var index = moduleName.indexOf("!"); if (index !== -1 || !ext || /^\//.test(moduleName)) ext = ""; var paths = config.paths; var pkgs = config.packages; var testPath = moduleName; var tail = ""; while (testPath) { if (paths[testPath]) { moduleName = paths[testPath] + tail; break; } if (pkgs[testPath]) { moduleName = pkgs[testPath].location + (tail || pkgs[testPath].main); break; } var i = testPath.lastIndexOf("/"); if (i === -1) break; tail = testPath.substr(i) + tail; testPath = testPath.slice(0, i); } if (skipExt) return testPath; var url = ext == ".js" && moduleName.slice(-3) == ext ? moduleName : moduleName + ext; if (moduleName.slice(-3) == ".ts") { url = moduleName.slice(0, -3) + ext; } if (!absRe.test(url)) { if (ext == ".js" && require.config.transform) url = addTransform(url, moduleName); var baseUrl = config.baseUrl; if (baseUrl.slice(-1) != "/") baseUrl += "/"; url = baseUrl + url; } if (url[0] == "/") url = host + url; return url; }; function addTransform(url, moduleName) { var transform = require.config.transform; if (!Array.isArray(transform)) transform = [transform]; return ( "~/" + transform .map(function(part) { if (typeof part == "string") return part; if (moduleName.lastIndexOf(part[0], 0) != -1) return part[1]; }) .filter(Boolean) .join(",") + "/" + url ).replace("//", "/"); } function loadText(path, callback) { var xhr = new global.XMLHttpRequest(); xhr.open("GET", path, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); xhr.onload = function(e) { if (xhr.status > 399 && xhr.status < 600) return callback(xhr); callback(null, xhr.responseText, xhr); }; xhr.onabort = xhr.onerror = function(e) { callback(e); }; xhr.send(""); } /*** cache ***/ var host = location.protocol + "//" + location.hostname + (location.port ? ":" + location.port : ""); var loadScript = function(path, id, callback) { if (!/^\w+:/.test(path)) path = host + path; var onLoad = function(e, val) { if (e) return processLoadQueue({id: id, path: path}); if (!/^(\s|\/\*([^*]|[*](?!\/))*\*\/|\/\/.*[\r]?\n)*define\s*\(\s*function\s*\(\s*require\b/.test(val) && !/define\(\[\],/.test(val)) val = "define(function(require, exports, module){" + val + "\n});" nextModule = {name: id}; /* eslint no-eval:0 */ global.eval(val + "\n//# sourceURL=" + path); callback(null, id); return define.loaded[id]; }; loadCached(path, onLoad); }; var loadCached = function(path, callback) { return loadText(path, callback); }; require.load = function(module) { var i = module.indexOf("!") + 1; if (i) { var plugin = module.substring(0, i); module = module.substr(i); if (typeof require[plugin] == "function") { require[plugin](module, processLoadQueue); } else if (config.baseUrl) { if (require[plugin]) return (require[plugin][plugin + module] = 1); require[plugin] = Object.create(null); require[plugin][plugin + module] = 1; require([plugin.slice(0, -1)], function(p) { var pending = require[plugin]; definePlugin(plugin, p); Object.keys(pending).forEach(function(p) { delete define.loading[p]; }); require(Object.keys(pending)); }); } else { console.error("require plugin " + plugin + "missing"); } } else { var url = require.toUrl(module, ".js"); if (define.fetchedUrls[url] & 1) return false; define.fetchedUrls[url] |= 1; loadScript(url, module, processLoadQueue); } }; function definePlugin(plugin, p) { require[plugin] = function(moduleName, processLoadQueue) { p.load(moduleName, require, function(value) { define(plugin + moduleName, [], function() { return value; }); processLoadQueue(); }); }; } /*** plugins ***/ var syncLoaders = /^(language!|webworker!|vfs!|asset-url!)/; require["language!"] = function(module, callback) { define("language!" + module, [], module); callback(); }; require["webworker!"] = function(module, callback) { var url = require.toUrl(module.split("!").pop(), ".js"); define("webworker!" + module, [], url); callback(); }; require["asset-url!"] = function(module, callback) { var url = require.toUrl(module.split("!").pop(), "", "", true); define("asset-url!" + module, [], url); callback(); }; require["vfs!"] = function(module, callback) { var url = require.MODULE_LOAD_URL + "/~node/" + module; if (define.fetchedUrls[url] & 4) return false; define.fetchedUrls[url] |= 4; define("vfs!" + module, [], { srcUrl: url, path: module, }); callback(); }; require["text!"] = function(module, callback) { var url = require.toUrl(module); if (define.fetchedUrls[url] & 2) return false; define.fetchedUrls[url] |= 2; var onLoad = function(e, val) { if (e) console.error("Couldn't load module " + module, e); define("text!" + module, [], val); callback(); }; loadCached(url, onLoad); }; require["json!"] = function(module, callback) { require["text!"](module, function() { var val = JSON.parse(require("text!" + module)); define("json!" + module, [], val); callback(); }); }; require["ace/requirejs/text!"] = function(module, callback) { var url = require.toUrl(module); if (define.fetchedUrls[url] & 2) return false; define.fetchedUrls[url] |= 2; var onLoad = function(e, val) { if (e) console.error("Couldn't load module " + module, e); define("ace/requirejs/text!" + module, [], val); callback(); }; loadCached(url, onLoad); }; require["architect!"] = function(module, callback) { var url = require.toUrl(module, ".js"); if (define.fetchedUrls[url] & 1) return false; define.fetchedUrls[url] |= 1; loadScript(url, "architect!" + module, processLoadQueue); }; function activateArchitectModule(_1, _2, _3) { var module = this; return function() { module.pluginFactory(_1, _2, _3); if (typeof module.exports == "function" && module.exports.consumes) { return module.exports.apply(this, arguments); } return module.exports; }; } /*** add global define ***/ if (!global.define || !global.define.packaged) { define.original = global.define; global.define = define; global.define.packaged = true; } if (!global.require || !global.require.packaged) { global.require = require; global.require.packaged = true; } if (!global.requirejs) global.requirejs = require; global.miniRequire = require; })(); ================================================ 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; } .toggleButton { display: inline-block; cursor: pointer; position: absolute; } .toggleButton>div { width: 15px; height: 2px; margin: 3px 2px; background-color: #eee; pointer-events: none; transition: 0.5s; } #sidePanel *:focus { outline: 3px solid orange; } #sidePanel a { display: inline-block; } #sidePanel:not(.closed) .toggleButton >div:nth-child(1) {transform: translate(0px, 5px) rotate(-45deg)} #sidePanel:not(.closed) .toggleButton >div:nth-child(2) {opacity: 0} #sidePanel:not(.closed) .toggleButton >div:nth-child(3) {transform: translate(0px, -5px) rotate(45deg)} #sidePanel.closed>*:not(.toggleButton) {display: none} .show-text-input .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; } .text-input-debug { height: 100px!important; position: absolute!important; transform: none!important; top: 0px!important; left: 7px!important; width: 260px!important; z-index: 1000!important; opacity: 1!important; font-size: 1em!important; } .language_highlight_error { position: absolute; border-bottom: dotted 1px #e00404; z-index: 2000; border-radius: 0; } .language_highlight_warning { position: absolute; border-bottom: solid 1px #DDC50F; z-index: 2000; border-radius: 0; } .language_highlight_info { position: absolute; border-bottom: dotted 1px #999; z-index: 2000; border-radius: 0; } .language_highlight_text, .language_highlight_read, .language_highlight_write { position: absolute; box-sizing: border-box; border: solid 1px #888; z-index: 2000; } .language_highlight_write { border: solid 1px #F88; } .ace_tooltip pre { margin: 0; } ================================================ FILE: demo/kitchen-sink/token_tooltip.js ================================================ "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; class TokenTooltip extends Tooltip { constructor(editor) { if (editor.tokenTooltip) return; super(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); } token = {}; range = new Range(); update() { 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; } if (!this.isOpen) { this.setTheme(r.theme); } 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"); }; onMouseMove(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); }; onMouseOut(e) { if (e && e.currentTarget.contains(e.relatedTarget)) return; this.hide(); this.editor.session.removeMarker(this.marker); this.$timer = clearTimeout(this.$timer); }; setPosition(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); }; destroy() { this.onMouseOut(); event.removeListener(this.editor.renderer.scroller, "mousemove", this.onMouseMove); event.removeListener(this.editor.renderer.content, "mouseout", this.onMouseOut); delete this.editor.tokenTooltip; }; } exports.TokenTooltip = TokenTooltip; ================================================ FILE: demo/kitchen-sink/util.js ================================================ "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.getOption = function(name) { if (urlOptions[name]) return urlOptions[name]; return localStorage && localStorage.getItem(name); }; exports.saveOption = function(name, value) { if (value == false) value = ""; localStorage && localStorage.setItem(name, value); }; 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.editor0.session.setUndoManager(new UndoManager()); split.editor1 = split[1] = new Editor(new Renderer(e1)); split.editor1.session.setUndoManager(new UndoManager()); 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"; }; /***************************/ function saveOptionFromElement(el, val) { if (!el.onchange && !el.onclick) return; if ("checked" in el) { localStorage && localStorage.setItem(el.id, el.checked ? 1 : 0); } else { 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); saveOptionFromElement(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); saveOptionFromElement(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.js",
        baseUrl: ".",
        paths: {
            ace : "../../lib/ace",
            demo: "../../demo/kitchen-sink"
        },
        packages: [
        ],
        include: [
            "ace/ace"
        ],
        exclude: [
        ],
        out: "./dist/bundle.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/shadow-dom.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"], function() { setValue(); }); require(["ace/config"], function() { var config = require("ace/config"); config.setLoader(function(moduleName, cb) { require([moduleName], function(module) { cb(null, module); }); }); }) } else { require = ace.require; setValue() } function setValue() { require("ace/lib/net").get(document.baseURI, function(text) { var el = document.getElementById("editor"); if (el) el.env.editor.session.setValue(text); }); loadAceLinters(); } function loadAceLinters() { if (typeof define == "function" && define.amd) { require([ "https://mkslanc.github.io/ace-linters/build/ace-linters.js" ], function(m) { addLinters(m.LanguageProvider); }); } else { require("ace/lib/net").loadScript( "https://mkslanc.github.io/ace-linters/build/ace-linters.js", function() { addLinters(window.LanguageProvider); } ) } function addLinters(LanguageProvider) { var languageProvider = LanguageProvider.fromCdn("https://mkslanc.github.io/ace-linters/build", { functionality: { hover: true, completion: { overwriteCompleters: false }, completionResolve: true, format: true, documentHighlights: true, signatureHelp: false } }); window.languageProvider = languageProvider; document.querySelectorAll(".ace_editor").forEach(function(el) { var editor = el.env && el.env.editor; if (editor) { editor.setOption("enableBasicAutocompletion", true) languageProvider.registerEditor(editor); } }); } } ================================================ 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 t = Date.now(); var highlighted = highlighter.render(data, new JavaScriptMode(), theme); console.log("Rendered " + (data.length/1000) + "kb in " + (Date.now() - t) + "ms"); 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/test_ace_builds/index.ts ================================================ import * as ace from "ace-builds"; import {Range, Ace} from "ace-builds"; import "ace-builds/src-noconflict/ext-language_tools"; import "../../src/test/mockdom.js"; var HoverTooltip = ace.require("ace/tooltip").HoverTooltip; import "ace-builds/src-noconflict/mode-javascript"; import "ace-builds/src-noconflict/theme-monokai"; import {DiffViewOptions } from "ace-builds/src-noconflict/ext-diff"; import "ace-builds/src-noconflict/ext-diff"; const diff = ace.require("ace/ext/diff"); const MarkerGroup = ace.require("ace/marker_group").MarkerGroup; const MouseEvent = ace.require("ace/mouse/mouse_event").MouseEvent; var Tooltip = ace.require("ace/tooltip").Tooltip; var popupManager = ace.require("ace/tooltip").popupManager; const editor = ace.edit(null); // should not be an error editor.setTheme("ace/theme/monokai"); editor.session.setMode("ace/mode/javascript"); function configure(config: Ace.Config) { config.setDefaultValues("editor", { fontSize: 14, showPrintMargin: false, }) } configure(ace.config) // should not be a error const markerGroup: Ace.MarkerGroup = new MarkerGroup(editor.session); const markers: Ace.MarkerGroupItem[] = [ { range: new Range(0, 0, 10, 10), className: "test-class" } ] markerGroup.setMarkers(markers); markerGroup.markers.every(marker => { console.log(marker.range); return true; }); const hover: Ace.HoverTooltip = new HoverTooltip(); hover.setDataProvider((e: any, editor: Ace.Editor) => { const domNode = document.createElement("div"); hover.showForRange(editor, new Range(1, 3, 3, 1), domNode, e); }); hover.addToEditor(editor); editor.commands.on('afterExec', ({editor, command}) => { console.log(editor.getValue(), command.name); }); editor.commands.on('exec', ({editor, command}) => { console.log(editor.getValue(), command.name); }); editor.container.addEventListener('click', (e: MouseEvent) => { var mouseEvent: Ace.MouseEvent = new MouseEvent(e, editor); mouseEvent.x = e.x * 2; }); var tooltip: Ace.Tooltip = new Tooltip(editor.container); tooltip.show('hello'); popupManager.addPopup(tooltip); editor.destroy && editor.destroy(); const diffViewOptions: DiffViewOptions = { maxDiffs: 1000, folding: true } var diffView = diff.createDiffView({ valueB: "test", inline: "b" }, diffViewOptions); diffView.setProvider(new diff.DiffProvider()); diffView.destroy(); ================================================ FILE: demo/test_ace_builds/package.json ================================================ { "name": "ace-test-package", "version": "1.0.0", "description": "Test package for Ace builds", "main": "index.js", "scripts": { "build": "tsc -p tsconfig.json", "test": "node index.js" }, "dependencies": { "ace-builds": "file:../../ace-builds-latest.tgz" }, "devDependencies": { "typescript": "^5.8.2" } } ================================================ FILE: demo/test_ace_builds/tsconfig.json ================================================ { "compilerOptions": { "strict": true, "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictBindCallApply": true, "strictPropertyInitialization": true, "noImplicitThis": true, "alwaysStrict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, // "noUncheckedIndexedAccess": true, // "noImplicitOverride": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "module": "commonjs", "target": "es2020", "moduleResolution": "node" }, "include": ["*.ts"], "exclude": ["node_modules"] } ================================================ FILE: demo/test_package/index.ts ================================================ import * as ace from "ace-code"; import {EditSession, Range} from "ace-code"; import {Autocomplete, FilteredList} from "ace-code/src/autocomplete"; import {beautify} from "ace-code/src/ext/beautify"; import {registerCodeLensProvider, setLenses} from "ace-code/src/ext/code_lens"; import {CommandBarTooltip} from "ace-code/src/ext/command_bar"; import {ElasticTabstopsLite} from "ace-code/src/ext/elastic_tabstops_lite"; import {MarkerGroup, MarkerGroupItem} from "ace-code/src/marker_group"; import {HoverTooltip} from "ace-code/src/tooltip"; import {hardWrap} from "ace-code/src/ext/hardwrap"; import {SearchBox} from "ace-code/src/ext/searchbox"; import {themesByName} from 'ace-code/src/ext/themelist'; import("ace-code/src/ext/language_tools"); import "../../src/test/mockdom.js"; import {tokenize} from "ace-code/src/ext/simple_tokenizer"; import {JavaScriptHighlightRules} from "ace-code/src/mode/javascript_highlight_rules"; import {highlight} from "ace-code/src/ext/static_highlight"; import {createDiffView, DiffProvider, DiffViewOptions} from "ace-code/src/ext/diff"; import {Mode as HtmlMode} from "ace-code/src/mode/html"; // TODO this does not work in node // import "ace-code/esm-resolver"; import { config } from "ace-code"; import {AcePopup} from "ace-code/src/autocomplete/popup"; config.setLoader(async function(moduleName, cb) { moduleName = moduleName.replace("ace/", "ace-code/src/") let module = await import(moduleName); cb(null, module); }); const editor = ace.edit(null, { mode: new HtmlMode() }); // should not be an error editor.setTheme("ace/theme/monokai"); editor.session.setMode("ace/mode/javascript"); function configure(config: ace.Ace.Config) { config.setDefaultValues("editor", { fontSize: 14, showPrintMargin: false, }) } configure(ace.config) // should not be a error Autocomplete.for(editor).getCompletionProvider() // should not be an error const markerGroup = new MarkerGroup(editor.session); const markers: MarkerGroupItem[] = [ { range: new Range(0, 0, 10, 10), className: "test-class" } ] markerGroup.setMarkers(markers); markerGroup.markers.every(marker => { console.log(marker.range); return true; }); const hover = new HoverTooltip(); hover.setDataProvider((e, editor) => { const domNode = document.createElement("div"); hover.showForRange(editor, new Range(1, 3, 3, 1), domNode, e); }); hover.addToEditor(editor); beautify(editor.session); registerCodeLensProvider(editor, { provideCodeLenses: function (session, callback) { const lenses = [{ start: {row: 2, column: 1}, command: {title: "2"} }]; setTimeout(function () { callback(null, [{ start: {row: 2, column: 1}, command: {title: "2"} }]); setLenses(session, lenses); }); } }); var commandBar = new CommandBarTooltip(editor.container); var command: ace.Ace.TooltipCommand = { name: "test", exec: function (editor: ace.Editor) { alert(editor.getValue()); }, type: "checkbox" } commandBar.registerCommand("test", command); const elasticTabStopLite = new ElasticTabstopsLite(editor); elasticTabStopLite.processRows([1, 2, 4]); hardWrap(editor, { startRow: 1, endRow: 2, }); const searchBox = new SearchBox(editor); searchBox.show("Test", true); tokenize("some content", new JavaScriptHighlightRules()); highlight(editor.container, { mode: "ace/mode/abap", showGutter: true }) setTimeout(function() { editor.destroy(); }, 20) function createPopup() { const popup = new AcePopup(); popup.container.style.width = "100%"; popup.renderer.textarea.setAttribute("tabindex", "-1"); popup.setSelectOnHover(true); return popup; } const acePopup = createPopup(); const activeCommand = acePopup.getData(acePopup.getRow()); if (activeCommand && activeCommand.command && activeCommand.command.name) { acePopup.setData([]); } acePopup.destroy(); const filter = new FilteredList([]); filter.setFilter("test"); editor.session.startOperation(); editor.session.endOperation(); editor.on("paste", (e, emitter) => { if (e.event && e.event.clipboardData) { var htmlString = e.event.clipboardData.getData("text/html") if (htmlString) { e.text = htmlString } if (emitter.session) { console.log("no error"); } } }) editor.session.on("changeMode", (e, emitter) => { return e && emitter instanceof EditSession }) if (themesByName.textmate) console.log(themesByName.textmate.theme); editor.commands.on('afterExec', ({editor, command}) => { console.log(editor.getValue(), command.name); }); editor.commands.on('exec', ({editor, command}) => { console.log(editor.getValue(), command.name); }); const diffViewOptions: DiffViewOptions = { maxDiffs: 1000, folding: true } var diffView = createDiffView({ valueB: "test", inline: "b" }, diffViewOptions); diffView.setProvider(new DiffProvider()); diffView.destroy(); editor.setSession(null); console.log(editor.destroyed); editor.destroy(); console.log(editor.destroyed); ================================================ FILE: demo/test_package/package.json ================================================ { "name": "ace-test-package", "version": "1.0.0", "description": "Test package for Ace", "main": "index.js", "scripts": { "build": "tsc -p tsconfig.json", "test": "node index.js" }, "dependencies": { "ace-code": "file:../../ace-code-latest.tgz" }, "devDependencies": { "typescript": "^5.6.2" } } ================================================ FILE: demo/test_package/tsconfig.json ================================================ { "compilerOptions": { "strict": true, "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictBindCallApply": true, "strictPropertyInitialization": true, "noImplicitThis": true, "alwaysStrict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, // "noUncheckedIndexedAccess": true, // "noImplicitOverride": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "module": "commonjs", "target": "es2020", "moduleResolution": "node" }, "include": ["*.ts"], "exclude": ["node_modules"] } ================================================ FILE: demo/toolbar.html ================================================ Editor ================================================ FILE: demo/transform.html ================================================ Editor
    editor1
    editor2
    editor3
    editor4
    editor
    Auto scroll into view css Zoom css Transform
    ================================================ FILE: demo/webpack/demo.js ================================================ "use strict"; // import ace import ace from '../../build' // import Range from ace (it is also available as ace.Range) import {Range, EditSession} from '../../build/' // import modes that you want to include into your main bundle import "../../build/src-noconflict/mode-javascript"; // import webpack resolver to dynamically load modes, you need to install file-loader for this to work! import "../../build/webpack-resolver"; // if you want to allow dynamic loading of only a few modules use setModuleUrl for each of them manually /* import jsWorkerUrl from "file-loader!../../build/src-noconflict/worker-javascript"; ace.config.setModuleUrl("ace/mode/javascript_worker", jsWorkerUrl) */ var editor = ace.edit(null, { maxLines: 50, minLines: 10, value: "var hello = 'world'" + "\n", mode: "ace/mode/javascript", bug: 1 }) editor.selection.setRange(new Range(0,0,0,3)) document.body.appendChild(editor.container) /* import {Mode as JSMode} from "../../build/src-noconflict/mode-javascript" editor.setMode( new JSMode()) */ ================================================ FILE: demo/webpack/demo.ts ================================================ "use strict"; // import ace import ace from '../../build' // import Range from ace (it is also available as ace.Range) import {Range, EditSession} from '../../build/' // import modes that you want to include into your main bundle import "../../build/src-noconflict/mode-javascript"; // import webpack resolver to dynamically load modes, you need to install file-loader for this to work! import "../../build/webpack-resolver"; // if you want to allow dynamic loading of only a few modules use setModuleUrl for each of them manually /* import jsWorkerUrl from "file-loader!../../build/src-noconflict/worker-javascript"; ace.config.setModuleUrl("ace/mode/javascript_worker", jsWorkerUrl) */ var editor = ace.edit(null, { maxLines: 50, minLines: 10, value: "var hello = 'world'" + "\n", mode: "ace/mode/javascript", bug: 1 }) editor.selection.setRange(new Range(0,0,0,3)) document.body.appendChild(editor.container) /* import {Mode as JSMode} from "../../build/src-noconflict/mode-javascript" editor.setMode( new JSMode()) */ ================================================ FILE: demo/webpack/index.html ================================================ ================================================ FILE: demo/webpack/package.json ================================================ { "name": "ace-webpack-demo", "version": "1.0.0", "description": "", "scripts": { "start": "webpack-dev-server" }, "keywords": [], "author": "", "dependencies": { "file-loader": "^1.1.11", "webpack": "^4.0.1", "webpack-cli": "^2.0.10" }, "devDependencies": { "webpack-dev-server": "^3.1.0" } } ================================================ FILE: demo/webpack/webpack.config.js ================================================ "use strict"; module.exports = { mode: "development", entry: "./demo.js", output: { path: __dirname + "/dist", filename: "bundle.js" }, node: { global: false, process: false, Buffer: false, __filename: "mock", __dirname: "mock", setImmediate: false }, resolveLoader: { modules: [ "node_modules", __dirname + "/node_modules", ], }, devServer: { contentBase: __dirname, compress: true, port: 9000 } }; ================================================ 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/css/font-awesome.css
    ================================================
    /*!
     *  Font Awesome 3.2.1
     *  the iconic font designed for Bootstrap
     *  ------------------------------------------------------------------------------
     *  The full suite of pictographic icons, examples, and documentation can be
     *  found at http://fontawesome.io.  Stay up to date on Twitter at
     *  http://twitter.com/fontawesome.
     *
     *  License
     *  ------------------------------------------------------------------------------
     *  - The Font Awesome font is licensed under SIL OFL 1.1 -
     *    http://scripts.sil.org/OFL
     *  - Font Awesome CSS, LESS, and SASS files are licensed under MIT License -
     *    http://opensource.org/licenses/mit-license.html
     *  - Font Awesome documentation licensed under CC BY 3.0 -
     *    http://creativecommons.org/licenses/by/3.0/
     *  - Attribution is no longer required in Font Awesome 3.0, but much appreciated:
     *    "Font Awesome by Dave Gandy - http://fontawesome.io"
     *
     *  Author - Dave Gandy
     *  ------------------------------------------------------------------------------
     *  Email: dave@fontawesome.io
     *  Twitter: http://twitter.com/byscuits
     *  Work: Lead Product Designer @ Kyruus - http://kyruus.com
     */
    /* FONT PATH
     * -------------------------- */
     @font-face {
      font-family: 'FontAwesome';
      src: url('../font/fontawesome-webfont.eot?v=3.2.1');
      src: url('../font/fontawesome-webfont.eot?#iefix&v=3.2.1') format('embedded-opentype'), url('../font/fontawesome-webfont.woff?v=3.2.1') format('woff'), url('../font/fontawesome-webfont.ttf?v=3.2.1') format('truetype'), url('../font/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg');
      font-weight: normal;
      font-style: normal;
    }
    /* FONT AWESOME CORE
     * -------------------------- */
    [class^="icon-"],
    [class*=" icon-"] {
      font-family: FontAwesome;
      font-weight: normal;
      font-style: normal;
      text-decoration: inherit;
      -webkit-font-smoothing: antialiased;
      *margin-right: .3em;
    }
    [class^="icon-"]:before,
    [class*=" icon-"]:before {
      text-decoration: inherit;
      display: inline-block;
      speak: none;
    }
    /* makes the font 33% larger relative to the icon container */
    .icon-large:before {
      vertical-align: -10%;
      font-size: 1.3333333333333333em;
    }
    /* makes sure icons active on rollover in links */
    a [class^="icon-"],
    a [class*=" icon-"] {
      display: inline;
    }
    /* increased font size for icon-large */
    [class^="icon-"].icon-fixed-width,
    [class*=" icon-"].icon-fixed-width {
      display: inline-block;
      width: 1.1428571428571428em;
      text-align: right;
      padding-right: 0.2857142857142857em;
    }
    [class^="icon-"].icon-fixed-width.icon-large,
    [class*=" icon-"].icon-fixed-width.icon-large {
      width: 1.4285714285714286em;
    }
    .icons-ul {
      margin-left: 2.142857142857143em;
      list-style-type: none;
    }
    .icons-ul > li {
      position: relative;
    }
    .icons-ul .icon-li {
      position: absolute;
      left: -2.142857142857143em;
      width: 2.142857142857143em;
      text-align: center;
      line-height: inherit;
    }
    [class^="icon-"].hide,
    [class*=" icon-"].hide {
      display: none;
    }
    .icon-muted {
      color: #eeeeee;
    }
    .icon-light {
      color: #ffffff;
    }
    .icon-dark {
      color: #333333;
    }
    .icon-border {
      border: solid 1px #eeeeee;
      padding: .2em .25em .15em;
      -webkit-border-radius: 3px;
      -moz-border-radius: 3px;
      border-radius: 3px;
    }
    .icon-2x {
      font-size: 2em;
    }
    .icon-2x.icon-border {
      border-width: 2px;
      -webkit-border-radius: 4px;
      -moz-border-radius: 4px;
      border-radius: 4px;
    }
    .icon-3x {
      font-size: 3em;
    }
    .icon-3x.icon-border {
      border-width: 3px;
      -webkit-border-radius: 5px;
      -moz-border-radius: 5px;
      border-radius: 5px;
    }
    .icon-4x {
      font-size: 4em;
    }
    .icon-4x.icon-border {
      border-width: 4px;
      -webkit-border-radius: 6px;
      -moz-border-radius: 6px;
      border-radius: 6px;
    }
    .icon-5x {
      font-size: 5em;
    }
    .icon-5x.icon-border {
      border-width: 5px;
      -webkit-border-radius: 7px;
      -moz-border-radius: 7px;
      border-radius: 7px;
    }
    .pull-right {
      float: right;
    }
    .pull-left {
      float: left;
    }
    [class^="icon-"].pull-left,
    [class*=" icon-"].pull-left {
      margin-right: .3em;
    }
    [class^="icon-"].pull-right,
    [class*=" icon-"].pull-right {
      margin-left: .3em;
    }
    /* BOOTSTRAP SPECIFIC CLASSES
     * -------------------------- */
    /* Bootstrap 2.0 sprites.less reset */
    [class^="icon-"],
    [class*=" icon-"] {
      display: inline;
      width: auto;
      height: auto;
      line-height: normal;
      vertical-align: baseline;
      background-image: none;
      background-position: 0% 0%;
      background-repeat: repeat;
      margin-top: 0;
    }
    /* more sprites.less reset */
    .icon-white,
    .nav-pills > .active > a > [class^="icon-"],
    .nav-pills > .active > a > [class*=" icon-"],
    .nav-list > .active > a > [class^="icon-"],
    .nav-list > .active > a > [class*=" icon-"],
    .navbar-inverse .nav > .active > a > [class^="icon-"],
    .navbar-inverse .nav > .active > a > [class*=" icon-"],
    .dropdown-menu > li > a:hover > [class^="icon-"],
    .dropdown-menu > li > a:hover > [class*=" icon-"],
    .dropdown-menu > .active > a > [class^="icon-"],
    .dropdown-menu > .active > a > [class*=" icon-"],
    .dropdown-submenu:hover > a > [class^="icon-"],
    .dropdown-submenu:hover > a > [class*=" icon-"] {
      background-image: none;
    }
    /* keeps Bootstrap styles with and without icons the same */
    .btn [class^="icon-"].icon-large,
    .nav [class^="icon-"].icon-large,
    .btn [class*=" icon-"].icon-large,
    .nav [class*=" icon-"].icon-large {
      line-height: .9em;
    }
    .btn [class^="icon-"].icon-spin,
    .nav [class^="icon-"].icon-spin,
    .btn [class*=" icon-"].icon-spin,
    .nav [class*=" icon-"].icon-spin {
      display: inline-block;
    }
    .nav-tabs [class^="icon-"],
    .nav-pills [class^="icon-"],
    .nav-tabs [class*=" icon-"],
    .nav-pills [class*=" icon-"],
    .nav-tabs [class^="icon-"].icon-large,
    .nav-pills [class^="icon-"].icon-large,
    .nav-tabs [class*=" icon-"].icon-large,
    .nav-pills [class*=" icon-"].icon-large {
      line-height: .9em;
    }
    .btn [class^="icon-"].pull-left.icon-2x,
    .btn [class*=" icon-"].pull-left.icon-2x,
    .btn [class^="icon-"].pull-right.icon-2x,
    .btn [class*=" icon-"].pull-right.icon-2x {
      margin-top: .18em;
    }
    .btn [class^="icon-"].icon-spin.icon-large,
    .btn [class*=" icon-"].icon-spin.icon-large {
      line-height: .8em;
    }
    .btn.btn-small [class^="icon-"].pull-left.icon-2x,
    .btn.btn-small [class*=" icon-"].pull-left.icon-2x,
    .btn.btn-small [class^="icon-"].pull-right.icon-2x,
    .btn.btn-small [class*=" icon-"].pull-right.icon-2x {
      margin-top: .25em;
    }
    .btn.btn-large [class^="icon-"],
    .btn.btn-large [class*=" icon-"] {
      margin-top: 0;
    }
    .btn.btn-large [class^="icon-"].pull-left.icon-2x,
    .btn.btn-large [class*=" icon-"].pull-left.icon-2x,
    .btn.btn-large [class^="icon-"].pull-right.icon-2x,
    .btn.btn-large [class*=" icon-"].pull-right.icon-2x {
      margin-top: .05em;
    }
    .btn.btn-large [class^="icon-"].pull-left.icon-2x,
    .btn.btn-large [class*=" icon-"].pull-left.icon-2x {
      margin-right: .2em;
    }
    .btn.btn-large [class^="icon-"].pull-right.icon-2x,
    .btn.btn-large [class*=" icon-"].pull-right.icon-2x {
      margin-left: .2em;
    }
    /* Fixes alignment in nav lists */
    .nav-list [class^="icon-"],
    .nav-list [class*=" icon-"] {
      line-height: inherit;
    }
    /* EXTRAS
     * -------------------------- */
    /* Stacked and layered icon */
    .icon-stack {
      position: relative;
      display: inline-block;
      width: 2em;
      height: 2em;
      line-height: 2em;
      vertical-align: -35%;
    }
    .icon-stack [class^="icon-"],
    .icon-stack [class*=" icon-"] {
      display: block;
      text-align: center;
      position: absolute;
      width: 100%;
      height: 100%;
      font-size: 1em;
      line-height: inherit;
      *line-height: 2em;
    }
    .icon-stack .icon-stack-base {
      font-size: 2em;
      *line-height: 1em;
    }
    /* Animated rotating icon */
    .icon-spin {
      display: inline-block;
      -moz-animation: spin 2s infinite linear;
      -o-animation: spin 2s infinite linear;
      -webkit-animation: spin 2s infinite linear;
      animation: spin 2s infinite linear;
    }
    /* Prevent stack and spinners from being taken inline when inside a link */
    a .icon-stack,
    a .icon-spin {
      display: inline-block;
      text-decoration: none;
    }
    @-moz-keyframes spin {
      0% {
        -moz-transform: rotate(0deg);
      }
      100% {
        -moz-transform: rotate(359deg);
      }
    }
    @-webkit-keyframes spin {
      0% {
        -webkit-transform: rotate(0deg);
      }
      100% {
        -webkit-transform: rotate(359deg);
      }
    }
    @-o-keyframes spin {
      0% {
        -o-transform: rotate(0deg);
      }
      100% {
        -o-transform: rotate(359deg);
      }
    }
    @-ms-keyframes spin {
      0% {
        -ms-transform: rotate(0deg);
      }
      100% {
        -ms-transform: rotate(359deg);
      }
    }
    @keyframes spin {
      0% {
        transform: rotate(0deg);
      }
      100% {
        transform: rotate(359deg);
      }
    }
    /* Icon rotations and mirroring */
    .icon-rotate-90:before {
      -webkit-transform: rotate(90deg);
      -moz-transform: rotate(90deg);
      -ms-transform: rotate(90deg);
      -o-transform: rotate(90deg);
      transform: rotate(90deg);
      filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
    }
    .icon-rotate-180:before {
      -webkit-transform: rotate(180deg);
      -moz-transform: rotate(180deg);
      -ms-transform: rotate(180deg);
      -o-transform: rotate(180deg);
      transform: rotate(180deg);
      filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
    }
    .icon-rotate-270:before {
      -webkit-transform: rotate(270deg);
      -moz-transform: rotate(270deg);
      -ms-transform: rotate(270deg);
      -o-transform: rotate(270deg);
      transform: rotate(270deg);
      filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }
    .icon-flip-horizontal:before {
      -webkit-transform: scale(-1, 1);
      -moz-transform: scale(-1, 1);
      -ms-transform: scale(-1, 1);
      -o-transform: scale(-1, 1);
      transform: scale(-1, 1);
    }
    .icon-flip-vertical:before {
      -webkit-transform: scale(1, -1);
      -moz-transform: scale(1, -1);
      -ms-transform: scale(1, -1);
      -o-transform: scale(1, -1);
      transform: scale(1, -1);
    }
    /* ensure rotation occurs inside anchor tags */
    a .icon-rotate-90:before,
    a .icon-rotate-180:before,
    a .icon-rotate-270:before,
    a .icon-flip-horizontal:before,
    a .icon-flip-vertical:before {
      display: inline-block;
    }
    /* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen
       readers do not read off random characters that represent icons */
    .icon-glass:before {
      content: "\f000";
    }
    .icon-music:before {
      content: "\f001";
    }
    .icon-search:before {
      content: "\f002";
    }
    .icon-envelope-alt:before {
      content: "\f003";
    }
    .icon-heart:before {
      content: "\f004";
    }
    .icon-star:before {
      content: "\f005";
    }
    .icon-star-empty:before {
      content: "\f006";
    }
    .icon-user:before {
      content: "\f007";
    }
    .icon-film:before {
      content: "\f008";
    }
    .icon-th-large:before {
      content: "\f009";
    }
    .icon-th:before {
      content: "\f00a";
    }
    .icon-th-list:before {
      content: "\f00b";
    }
    .icon-ok:before {
      content: "\f00c";
    }
    .icon-remove:before {
      content: "\f00d";
    }
    .icon-zoom-in:before {
      content: "\f00e";
    }
    .icon-zoom-out:before {
      content: "\f010";
    }
    .icon-power-off:before,
    .icon-off:before {
      content: "\f011";
    }
    .icon-signal:before {
      content: "\f012";
    }
    .icon-gear:before,
    .icon-cog:before {
      content: "\f013";
    }
    .icon-trash:before {
      content: "\f014";
    }
    .icon-home:before {
      content: "\f015";
    }
    .icon-file-alt:before {
      content: "\f016";
    }
    .icon-time:before {
      content: "\f017";
    }
    .icon-road:before {
      content: "\f018";
    }
    .icon-download-alt:before {
      content: "\f019";
    }
    .icon-download:before {
      content: "\f01a";
    }
    .icon-upload:before {
      content: "\f01b";
    }
    .icon-inbox:before {
      content: "\f01c";
    }
    .icon-play-circle:before {
      content: "\f01d";
    }
    .icon-rotate-right:before,
    .icon-repeat:before {
      content: "\f01e";
    }
    .icon-refresh:before {
      content: "\f021";
    }
    .icon-list-alt:before {
      content: "\f022";
    }
    .icon-lock:before {
      content: "\f023";
    }
    .icon-flag:before {
      content: "\f024";
    }
    .icon-headphones:before {
      content: "\f025";
    }
    .icon-volume-off:before {
      content: "\f026";
    }
    .icon-volume-down:before {
      content: "\f027";
    }
    .icon-volume-up:before {
      content: "\f028";
    }
    .icon-qrcode:before {
      content: "\f029";
    }
    .icon-barcode:before {
      content: "\f02a";
    }
    .icon-tag:before {
      content: "\f02b";
    }
    .icon-tags:before {
      content: "\f02c";
    }
    .icon-book:before {
      content: "\f02d";
    }
    .icon-bookmark:before {
      content: "\f02e";
    }
    .icon-print:before {
      content: "\f02f";
    }
    .icon-camera:before {
      content: "\f030";
    }
    .icon-font:before {
      content: "\f031";
    }
    .icon-bold:before {
      content: "\f032";
    }
    .icon-italic:before {
      content: "\f033";
    }
    .icon-text-height:before {
      content: "\f034";
    }
    .icon-text-width:before {
      content: "\f035";
    }
    .icon-align-left:before {
      content: "\f036";
    }
    .icon-align-center:before {
      content: "\f037";
    }
    .icon-align-right:before {
      content: "\f038";
    }
    .icon-align-justify:before {
      content: "\f039";
    }
    .icon-list:before {
      content: "\f03a";
    }
    .icon-indent-left:before {
      content: "\f03b";
    }
    .icon-indent-right:before {
      content: "\f03c";
    }
    .icon-facetime-video:before {
      content: "\f03d";
    }
    .icon-picture:before {
      content: "\f03e";
    }
    .icon-pencil:before {
      content: "\f040";
    }
    .icon-map-marker:before {
      content: "\f041";
    }
    .icon-adjust:before {
      content: "\f042";
    }
    .icon-tint:before {
      content: "\f043";
    }
    .icon-edit:before {
      content: "\f044";
    }
    .icon-share:before {
      content: "\f045";
    }
    .icon-check:before {
      content: "\f046";
    }
    .icon-move:before {
      content: "\f047";
    }
    .icon-step-backward:before {
      content: "\f048";
    }
    .icon-fast-backward:before {
      content: "\f049";
    }
    .icon-backward:before {
      content: "\f04a";
    }
    .icon-play:before {
      content: "\f04b";
    }
    .icon-pause:before {
      content: "\f04c";
    }
    .icon-stop:before {
      content: "\f04d";
    }
    .icon-forward:before {
      content: "\f04e";
    }
    .icon-fast-forward:before {
      content: "\f050";
    }
    .icon-step-forward:before {
      content: "\f051";
    }
    .icon-eject:before {
      content: "\f052";
    }
    .icon-chevron-left:before {
      content: "\f053";
    }
    .icon-chevron-right:before {
      content: "\f054";
    }
    .icon-plus-sign:before {
      content: "\f055";
    }
    .icon-minus-sign:before {
      content: "\f056";
    }
    .icon-remove-sign:before {
      content: "\f057";
    }
    .icon-ok-sign:before {
      content: "\f058";
    }
    .icon-question-sign:before {
      content: "\f059";
    }
    .icon-info-sign:before {
      content: "\f05a";
    }
    .icon-screenshot:before {
      content: "\f05b";
    }
    .icon-remove-circle:before {
      content: "\f05c";
    }
    .icon-ok-circle:before {
      content: "\f05d";
    }
    .icon-ban-circle:before {
      content: "\f05e";
    }
    .icon-arrow-left:before {
      content: "\f060";
    }
    .icon-arrow-right:before {
      content: "\f061";
    }
    .icon-arrow-up:before {
      content: "\f062";
    }
    .icon-arrow-down:before {
      content: "\f063";
    }
    .icon-mail-forward:before,
    .icon-share-alt:before {
      content: "\f064";
    }
    .icon-resize-full:before {
      content: "\f065";
    }
    .icon-resize-small:before {
      content: "\f066";
    }
    .icon-plus:before {
      content: "\f067";
    }
    .icon-minus:before {
      content: "\f068";
    }
    .icon-asterisk:before {
      content: "\f069";
    }
    .icon-exclamation-sign:before {
      content: "\f06a";
    }
    .icon-gift:before {
      content: "\f06b";
    }
    .icon-leaf:before {
      content: "\f06c";
    }
    .icon-fire:before {
      content: "\f06d";
    }
    .icon-eye-open:before {
      content: "\f06e";
    }
    .icon-eye-close:before {
      content: "\f070";
    }
    .icon-warning-sign:before {
      content: "\f071";
    }
    .icon-plane:before {
      content: "\f072";
    }
    .icon-calendar:before {
      content: "\f073";
    }
    .icon-random:before {
      content: "\f074";
    }
    .icon-comment:before {
      content: "\f075";
    }
    .icon-magnet:before {
      content: "\f076";
    }
    .icon-chevron-up:before {
      content: "\f077";
    }
    .icon-chevron-down:before {
      content: "\f078";
    }
    .icon-retweet:before {
      content: "\f079";
    }
    .icon-shopping-cart:before {
      content: "\f07a";
    }
    .icon-folder-close:before {
      content: "\f07b";
    }
    .icon-folder-open:before {
      content: "\f07c";
    }
    .icon-resize-vertical:before {
      content: "\f07d";
    }
    .icon-resize-horizontal:before {
      content: "\f07e";
    }
    .icon-bar-chart:before {
      content: "\f080";
    }
    .icon-twitter-sign:before {
      content: "\f081";
    }
    .icon-facebook-sign:before {
      content: "\f082";
    }
    .icon-camera-retro:before {
      content: "\f083";
    }
    .icon-key:before {
      content: "\f084";
    }
    .icon-gears:before,
    .icon-cogs:before {
      content: "\f085";
    }
    .icon-comments:before {
      content: "\f086";
    }
    .icon-thumbs-up-alt:before {
      content: "\f087";
    }
    .icon-thumbs-down-alt:before {
      content: "\f088";
    }
    .icon-star-half:before {
      content: "\f089";
    }
    .icon-heart-empty:before {
      content: "\f08a";
    }
    .icon-signout:before {
      content: "\f08b";
    }
    .icon-linkedin-sign:before {
      content: "\f08c";
    }
    .icon-pushpin:before {
      content: "\f08d";
    }
    .icon-external-link:before {
      content: "\f08e";
    }
    .icon-signin:before {
      content: "\f090";
    }
    .icon-trophy:before {
      content: "\f091";
    }
    .icon-github-sign:before {
      content: "\f092";
    }
    .icon-upload-alt:before {
      content: "\f093";
    }
    .icon-lemon:before {
      content: "\f094";
    }
    .icon-phone:before {
      content: "\f095";
    }
    .icon-unchecked:before,
    .icon-check-empty:before {
      content: "\f096";
    }
    .icon-bookmark-empty:before {
      content: "\f097";
    }
    .icon-phone-sign:before {
      content: "\f098";
    }
    .icon-twitter:before {
      content: "\f099";
    }
    .icon-facebook:before {
      content: "\f09a";
    }
    .icon-github:before {
      content: "\f09b";
    }
    .icon-unlock:before {
      content: "\f09c";
    }
    .icon-credit-card:before {
      content: "\f09d";
    }
    .icon-rss:before {
      content: "\f09e";
    }
    .icon-hdd:before {
      content: "\f0a0";
    }
    .icon-bullhorn:before {
      content: "\f0a1";
    }
    .icon-bell:before {
      content: "\f0a2";
    }
    .icon-certificate:before {
      content: "\f0a3";
    }
    .icon-hand-right:before {
      content: "\f0a4";
    }
    .icon-hand-left:before {
      content: "\f0a5";
    }
    .icon-hand-up:before {
      content: "\f0a6";
    }
    .icon-hand-down:before {
      content: "\f0a7";
    }
    .icon-circle-arrow-left:before {
      content: "\f0a8";
    }
    .icon-circle-arrow-right:before {
      content: "\f0a9";
    }
    .icon-circle-arrow-up:before {
      content: "\f0aa";
    }
    .icon-circle-arrow-down:before {
      content: "\f0ab";
    }
    .icon-globe:before {
      content: "\f0ac";
    }
    .icon-wrench:before {
      content: "\f0ad";
    }
    .icon-tasks:before {
      content: "\f0ae";
    }
    .icon-filter:before {
      content: "\f0b0";
    }
    .icon-briefcase:before {
      content: "\f0b1";
    }
    .icon-fullscreen:before {
      content: "\f0b2";
    }
    .icon-group:before {
      content: "\f0c0";
    }
    .icon-link:before {
      content: "\f0c1";
    }
    .icon-cloud:before {
      content: "\f0c2";
    }
    .icon-beaker:before {
      content: "\f0c3";
    }
    .icon-cut:before {
      content: "\f0c4";
    }
    .icon-copy:before {
      content: "\f0c5";
    }
    .icon-paperclip:before,
    .icon-paper-clip:before {
      content: "\f0c6";
    }
    .icon-save:before {
      content: "\f0c7";
    }
    .icon-sign-blank:before {
      content: "\f0c8";
    }
    .icon-reorder:before {
      content: "\f0c9";
    }
    .icon-list-ul:before {
      content: "\f0ca";
    }
    .icon-list-ol:before {
      content: "\f0cb";
    }
    .icon-strikethrough:before {
      content: "\f0cc";
    }
    .icon-underline:before {
      content: "\f0cd";
    }
    .icon-table:before {
      content: "\f0ce";
    }
    .icon-magic:before {
      content: "\f0d0";
    }
    .icon-truck:before {
      content: "\f0d1";
    }
    .icon-pinterest:before {
      content: "\f0d2";
    }
    .icon-pinterest-sign:before {
      content: "\f0d3";
    }
    .icon-google-plus-sign:before {
      content: "\f0d4";
    }
    .icon-google-plus:before {
      content: "\f0d5";
    }
    .icon-money:before {
      content: "\f0d6";
    }
    .icon-caret-down:before {
      content: "\f0d7";
    }
    .icon-caret-up:before {
      content: "\f0d8";
    }
    .icon-caret-left:before {
      content: "\f0d9";
    }
    .icon-caret-right:before {
      content: "\f0da";
    }
    .icon-columns:before {
      content: "\f0db";
    }
    .icon-sort:before {
      content: "\f0dc";
    }
    .icon-sort-down:before {
      content: "\f0dd";
    }
    .icon-sort-up:before {
      content: "\f0de";
    }
    .icon-envelope:before {
      content: "\f0e0";
    }
    .icon-linkedin:before {
      content: "\f0e1";
    }
    .icon-rotate-left:before,
    .icon-undo:before {
      content: "\f0e2";
    }
    .icon-legal:before {
      content: "\f0e3";
    }
    .icon-dashboard:before {
      content: "\f0e4";
    }
    .icon-comment-alt:before {
      content: "\f0e5";
    }
    .icon-comments-alt:before {
      content: "\f0e6";
    }
    .icon-bolt:before {
      content: "\f0e7";
    }
    .icon-sitemap:before {
      content: "\f0e8";
    }
    .icon-umbrella:before {
      content: "\f0e9";
    }
    .icon-paste:before {
      content: "\f0ea";
    }
    .icon-lightbulb:before {
      content: "\f0eb";
    }
    .icon-exchange:before {
      content: "\f0ec";
    }
    .icon-cloud-download:before {
      content: "\f0ed";
    }
    .icon-cloud-upload:before {
      content: "\f0ee";
    }
    .icon-user-md:before {
      content: "\f0f0";
    }
    .icon-stethoscope:before {
      content: "\f0f1";
    }
    .icon-suitcase:before {
      content: "\f0f2";
    }
    .icon-bell-alt:before {
      content: "\f0f3";
    }
    .icon-coffee:before {
      content: "\f0f4";
    }
    .icon-food:before {
      content: "\f0f5";
    }
    .icon-file-text-alt:before {
      content: "\f0f6";
    }
    .icon-building:before {
      content: "\f0f7";
    }
    .icon-hospital:before {
      content: "\f0f8";
    }
    .icon-ambulance:before {
      content: "\f0f9";
    }
    .icon-medkit:before {
      content: "\f0fa";
    }
    .icon-fighter-jet:before {
      content: "\f0fb";
    }
    .icon-beer:before {
      content: "\f0fc";
    }
    .icon-h-sign:before {
      content: "\f0fd";
    }
    .icon-plus-sign-alt:before {
      content: "\f0fe";
    }
    .icon-double-angle-left:before {
      content: "\f100";
    }
    .icon-double-angle-right:before {
      content: "\f101";
    }
    .icon-double-angle-up:before {
      content: "\f102";
    }
    .icon-double-angle-down:before {
      content: "\f103";
    }
    .icon-angle-left:before {
      content: "\f104";
    }
    .icon-angle-right:before {
      content: "\f105";
    }
    .icon-angle-up:before {
      content: "\f106";
    }
    .icon-angle-down:before {
      content: "\f107";
    }
    .icon-desktop:before {
      content: "\f108";
    }
    .icon-laptop:before {
      content: "\f109";
    }
    .icon-tablet:before {
      content: "\f10a";
    }
    .icon-mobile-phone:before {
      content: "\f10b";
    }
    .icon-circle-blank:before {
      content: "\f10c";
    }
    .icon-quote-left:before {
      content: "\f10d";
    }
    .icon-quote-right:before {
      content: "\f10e";
    }
    .icon-spinner:before {
      content: "\f110";
    }
    .icon-circle:before {
      content: "\f111";
    }
    .icon-mail-reply:before,
    .icon-reply:before {
      content: "\f112";
    }
    .icon-github-alt:before {
      content: "\f113";
    }
    .icon-folder-close-alt:before {
      content: "\f114";
    }
    .icon-folder-open-alt:before {
      content: "\f115";
    }
    .icon-expand-alt:before {
      content: "\f116";
    }
    .icon-collapse-alt:before {
      content: "\f117";
    }
    .icon-smile:before {
      content: "\f118";
    }
    .icon-frown:before {
      content: "\f119";
    }
    .icon-meh:before {
      content: "\f11a";
    }
    .icon-gamepad:before {
      content: "\f11b";
    }
    .icon-keyboard:before {
      content: "\f11c";
    }
    .icon-flag-alt:before {
      content: "\f11d";
    }
    .icon-flag-checkered:before {
      content: "\f11e";
    }
    .icon-terminal:before {
      content: "\f120";
    }
    .icon-code:before {
      content: "\f121";
    }
    .icon-reply-all:before {
      content: "\f122";
    }
    .icon-mail-reply-all:before {
      content: "\f122";
    }
    .icon-star-half-full:before,
    .icon-star-half-empty:before {
      content: "\f123";
    }
    .icon-location-arrow:before {
      content: "\f124";
    }
    .icon-crop:before {
      content: "\f125";
    }
    .icon-code-fork:before {
      content: "\f126";
    }
    .icon-unlink:before {
      content: "\f127";
    }
    .icon-question:before {
      content: "\f128";
    }
    .icon-info:before {
      content: "\f129";
    }
    .icon-exclamation:before {
      content: "\f12a";
    }
    .icon-superscript:before {
      content: "\f12b";
    }
    .icon-subscript:before {
      content: "\f12c";
    }
    .icon-eraser:before {
      content: "\f12d";
    }
    .icon-puzzle-piece:before {
      content: "\f12e";
    }
    .icon-microphone:before {
      content: "\f130";
    }
    .icon-microphone-off:before {
      content: "\f131";
    }
    .icon-shield:before {
      content: "\f132";
    }
    .icon-calendar-empty:before {
      content: "\f133";
    }
    .icon-fire-extinguisher:before {
      content: "\f134";
    }
    .icon-rocket:before {
      content: "\f135";
    }
    .icon-maxcdn:before {
      content: "\f136";
    }
    .icon-chevron-sign-left:before {
      content: "\f137";
    }
    .icon-chevron-sign-right:before {
      content: "\f138";
    }
    .icon-chevron-sign-up:before {
      content: "\f139";
    }
    .icon-chevron-sign-down:before {
      content: "\f13a";
    }
    .icon-html5:before {
      content: "\f13b";
    }
    .icon-css3:before {
      content: "\f13c";
    }
    .icon-anchor:before {
      content: "\f13d";
    }
    .icon-unlock-alt:before {
      content: "\f13e";
    }
    .icon-bullseye:before {
      content: "\f140";
    }
    .icon-ellipsis-horizontal:before {
      content: "\f141";
    }
    .icon-ellipsis-vertical:before {
      content: "\f142";
    }
    .icon-rss-sign:before {
      content: "\f143";
    }
    .icon-play-sign:before {
      content: "\f144";
    }
    .icon-ticket:before {
      content: "\f145";
    }
    .icon-minus-sign-alt:before {
      content: "\f146";
    }
    .icon-check-minus:before {
      content: "\f147";
    }
    .icon-level-up:before {
      content: "\f148";
    }
    .icon-level-down:before {
      content: "\f149";
    }
    .icon-check-sign:before {
      content: "\f14a";
    }
    .icon-edit-sign:before {
      content: "\f14b";
    }
    .icon-external-link-sign:before {
      content: "\f14c";
    }
    .icon-share-sign:before {
      content: "\f14d";
    }
    .icon-compass:before {
      content: "\f14e";
    }
    .icon-collapse:before {
      content: "\f150";
    }
    .icon-collapse-top:before {
      content: "\f151";
    }
    .icon-expand:before {
      content: "\f152";
    }
    .icon-euro:before,
    .icon-eur:before {
      content: "\f153";
    }
    .icon-gbp:before {
      content: "\f154";
    }
    .icon-dollar:before,
    .icon-usd:before {
      content: "\f155";
    }
    .icon-rupee:before,
    .icon-inr:before {
      content: "\f156";
    }
    .icon-yen:before,
    .icon-jpy:before {
      content: "\f157";
    }
    .icon-renminbi:before,
    .icon-cny:before {
      content: "\f158";
    }
    .icon-won:before,
    .icon-krw:before {
      content: "\f159";
    }
    .icon-bitcoin:before,
    .icon-btc:before {
      content: "\f15a";
    }
    .icon-file:before {
      content: "\f15b";
    }
    .icon-file-text:before {
      content: "\f15c";
    }
    .icon-sort-by-alphabet:before {
      content: "\f15d";
    }
    .icon-sort-by-alphabet-alt:before {
      content: "\f15e";
    }
    .icon-sort-by-attributes:before {
      content: "\f160";
    }
    .icon-sort-by-attributes-alt:before {
      content: "\f161";
    }
    .icon-sort-by-order:before {
      content: "\f162";
    }
    .icon-sort-by-order-alt:before {
      content: "\f163";
    }
    .icon-thumbs-up:before {
      content: "\f164";
    }
    .icon-thumbs-down:before {
      content: "\f165";
    }
    .icon-youtube-sign:before {
      content: "\f166";
    }
    .icon-youtube:before {
      content: "\f167";
    }
    .icon-xing:before {
      content: "\f168";
    }
    .icon-xing-sign:before {
      content: "\f169";
    }
    .icon-youtube-play:before {
      content: "\f16a";
    }
    .icon-dropbox:before {
      content: "\f16b";
    }
    .icon-stackexchange:before {
      content: "\f16c";
    }
    .icon-instagram:before {
      content: "\f16d";
    }
    .icon-flickr:before {
      content: "\f16e";
    }
    .icon-adn:before {
      content: "\f170";
    }
    .icon-bitbucket:before {
      content: "\f171";
    }
    .icon-bitbucket-sign:before {
      content: "\f172";
    }
    .icon-tumblr:before {
      content: "\f173";
    }
    .icon-tumblr-sign:before {
      content: "\f174";
    }
    .icon-long-arrow-down:before {
      content: "\f175";
    }
    .icon-long-arrow-up:before {
      content: "\f176";
    }
    .icon-long-arrow-left:before {
      content: "\f177";
    }
    .icon-long-arrow-right:before {
      content: "\f178";
    }
    .icon-apple:before {
      content: "\f179";
    }
    .icon-windows:before {
      content: "\f17a";
    }
    .icon-android:before {
      content: "\f17b";
    }
    .icon-linux:before {
      content: "\f17c";
    }
    .icon-dribbble:before {
      content: "\f17d";
    }
    .icon-skype:before {
      content: "\f17e";
    }
    .icon-foursquare:before {
      content: "\f180";
    }
    .icon-trello:before {
      content: "\f181";
    }
    .icon-female:before {
      content: "\f182";
    }
    .icon-male:before {
      content: "\f183";
    }
    .icon-gittip:before {
      content: "\f184";
    }
    .icon-sun:before {
      content: "\f185";
    }
    .icon-moon:before {
      content: "\f186";
    }
    .icon-archive:before {
      content: "\f187";
    }
    .icon-bug:before {
      content: "\f188";
    }
    .icon-vk:before {
      content: "\f189";
    }
    .icon-weibo:before {
      content: "\f18a";
    }
    .icon-renren:before {
      content: "\f18b";
    }
    
    ================================================
    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/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").on("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) { if ($(this).attr("href").indexOf("http") === 0) { return; } e.preventDefault(); if ($(this).attr("href") === "/") { window.location = "https://ace.c9.io"; 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).attr("href") + " img[lazy-src]").each(function() { var val = $.attr(this, "lazy-src"); $.attr(this, "src", val); $.removeAttr(this, "lazy-src"); }); $(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); }); $(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; padding-left: calc(100vw - 100%); background: url(images/body_background.png) repeat-x 0 -15px; padding-left: calc(100vw - 100%); background-color:#e6f5fc; } #ace_editor_demo, #embedded_ace_code { height: 275px; border: 1px solid #DDD; border-radius: 4px; border-bottom-right-radius: 0px; margin-top: 5px; } #ace_editor_demo { margin-bottom: 0px; } #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: linear-gradient(to bottom, #c0deef, #cde9fa 17px, #daf0fb 100px, #e4f4fc 150px, #e6f5fc 250px, #e6f5fc 100%); 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 .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: linear-gradient(to bottom, #fff 0, #fff 2px, #f7f7f7 2px, #f2f2f2 298px); overflow: hidden; padding: 11px 36px 19px 40px; height: 267px; 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); 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. */ @keyframes example { 0% { transform: rotate(0deg); } 25% { transform: rotate(3deg); } 50% { transform: rotate(0deg); } 75% { transform: rotate(-3deg); } } /* This is the element that we apply the animation to. */ li#add_your_site { animation-name: example; animation-duration: 0.4s; animation-timing-function: ease; /* ease is the default */ animation-delay: 0s; /* 0 is the default */ animation-iteration-count: infinite; /* 1 is the default */ 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: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); 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); 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; 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 { transform: rotate(0deg); transition: all 0.5s ease-out; } .rotating-logo:hover { transform: rotate(360deg); transition: all 0.5s ease-in-out; } .nav>li>a.external-nav:hover { text-decoration: underline; } pre { background-color: white!important } ================================================ 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]=M7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}/msie/.test(navigator.userAgent.toLowerCase())&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('

    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

    Getting Help

    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.session.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:

    Loading Ace from a CDN

    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.

    Configuring the editor

    there are several ways to pass configuration to Ace

    // pass options to ace.edit
    ace.edit(element, {
        mode: "ace/mode/javascript",
        selectionStyle: "text"
    })
    // use setOptions method to set several options at once
    editor.setOptions({
        autoScrollEditorIntoView: true,
        copyWithEmptySelection: true,
    });
    // use setOptions method
    editor.setOption("mergeUndoDeltas", "always");
    
    // some options are also available as methods e.g. 
    editor.setTheme(...)
    
    // to get the value of the option use
    editor.getOption("optionName");
    
    

    See Configuring-Ace wiki page for a more detailed list of options.

    Changing the size of the editor

    Ace only checks for changes of the size of it's container when window is resized. If you resize the editor div in another manner, and need Ace to resize, use the following:

    editor.resize()

    if you want editor to change it's size based on contents, use maxLines option as shown in https://ace.c9.io/demo/autoresize.html

    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. Or use themelist extension to get the list of available themes at runtime.

    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.session.setMode("ace/mode/javascript");

    One Editor, Multiple Sessions

    Ace keeps everything about the state of the editor (selection, scroll position, etc.) in editor.session. This means you can grab the session, store it in a var, and set the editor to another session (e.g. a tabbed editor).

    You might accomplish this like so:

    var js = ace.createEditSession("some js code");
    var css = ace.createEditSession(["some", "css", "code here"]);
    // and then to load document into editor, just call
    editor.setSession(js);

    Common Operations

    Set and get content:

    editor.setValue("the new text here");
    editor.setValue("text2", -1); // set value and move cursor to the start of the text
    editor.session.setValue("the new text here"); // set value and reset undo history
    editor.getValue(); // or session.getValue

    Get selected text:

    editor.getSelectedText(); // or for a specific range
    editor.session.getTextRange(editor.getSelectionRange()); 

    Insert at cursor, emulating user input:

    editor.insert("Something cool");

    Replace text in range:

    editor.session.replace(new ace.Range(0, 0, 1, 1), "new text");

    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.session.setTabSize(4);

    Use soft tabs:

    editor.session.setUseSoftTabs(true);

    Set the font size:

    document.getElementById('editor').style.fontSize='12px';

    Toggle word wrapping:

    editor.session.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

    Using undo manager

    To group undo delta of the next edit with the previous one set `mergeUndoDeltas` to true

    editor.session.mergeUndoDeltas = true; 
    editor.session.insert({row: 0, column:0}, Date()+"");

    To start new undo group use `markUndoGroup` method

    editor.insertSnippet("a$0b"); 
    editor.session.markUndoGroup(); 
    editor.insertSnippet("x$0y");

    To disable undo of a an edit in a collaborative editor

    var rev = session.$undoManager.startNewGroup(); // start new undo group
    ... // apply the edit 
    session.$undoManager.markIgnored(rev); // mark the new group as ignored

    To implement undo/redo buttons see https://ace.c9.io/demo/toolbar.html

    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.
    • preventScroll: Whether or not to move the cursor to the next match. 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.session.on('change', function(delta) {
        // delta.start, delta.end, delta.lines, delta.action
    });

    To listen for an selection change:

    editor.session.selection.on('changeSelection', function(e) {
    });

    To listen for a cursor change:

    editor.session.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
        // multiSelectAction: "forEach", optional way to control behavior with multiple cursors
        // scrollIntoView: "cursor", control how cursor is scolled into view after the command
    });

    Configure dynamic loading of modes and themes

    By default ace detcts the url for dynamic loading by finding the script node for ace.js. This doesn't work if ace.js is not loaded with a separate script tag, and in this case it is required to set url explicitely

    ace.config.set("basePath", "https://url.to.a/folder/that/contains-ace-modes");

    Path for one module alone can be configured with:

    ace.config.setModuleUrl("ace/theme/textmate", "url for textmate.js");

    When using ace with webpack, it is possible to configure paths for all submodules using

    require("ace-builds/esm-resolver"); // for new bundlers: webpack 5, rollup, vite
    For webpack 4 use
    require("ace-builds/webpack-resolver"); 

    which depends on file-loader

    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:

    ================================================ FILE: kitchen-sink.html ================================================ Ace Kitchen Sink
    ================================================ FILE: package.json ================================================ { "name": "ace-code", "description": "Ajax.org Code Editor is a full featured source code highlighting editor that powers the Cloud9 IDE", "version": "1.43.6", "homepage": "https://github.com/ajaxorg/ace", "engines": { "node": ">= 0.6.0" }, "author": "Fabian Jakobs ", "main": "src/ace.js", "typings": "ace.d.ts", "repository": { "type": "git", "url": "https://github.com/ajaxorg/ace.git" }, "devDependencies": { "amd-loader": "~0.0.4", "architect-build": "https://github.com/c9/architect-build/tarball/43a6fdeffe", "asyncjs": "~0.0.12", "c8": "^11.0.0", "dryice": "0.4.11", "eslint": "^8.20.0", "mocha": "^11.7.5", "standard-version": "^9.3.2", "typescript": "5.9.2" }, "mappings": { "ace": "." }, "license": "BSD-3-Clause", "files": [ "src", "styles", "ace.d.ts", "ace-modes.d.ts", "types", "esm-resolver.js", "translations", "!**/*_test.js", "!**/_test" ], "scripts": { "start": "node static.js", "test": "mocha \"./src/**/*_test.js\" --exit -p --color", "cover": "c8 --reporter=lcov --reporter=text-summary npm run test", "cover-json": "c8 --reporter=json npm run test", "lint": "eslint \"src/**/*.js\" \"*.js\"", "fix": "npm run lint -- --fix", "typecheck": "tsc -p tsconfig.json", "update-types": "node ./tool/ace_declaration_generator.js", "changelog": "standard-version", "prepack": "node tool/esm_resolver_generator.js && node tool/ace_declaration_generator.js && node Makefile.dryice.js css --target build-styles && rm -rf styles && mv build-styles/css styles" }, "standard-version": { "skip": { "commit": true, "tag": true } }, "prettier": { "printWidth": 120, "tabWidth": 4, "useTabs": false, "semi": true, "singleQuote": false, "trailingComma": "none", "bracketSpacing": false, "arrowParens": "always", "requirePragma": false, "insertPragma": false, "proseWrap": "preserve" } } ================================================ FILE: src/ace.js ================================================ /** * The main class required to set up an Ace instance in the browser. * * @namespace Ace **/ "use strict"; "include loader_build"; var dom = require("./lib/dom"); var Range = require("./range").Range; 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"); /** * Embeds the Ace editor into the DOM, at the element provided by `el`. * @param {String | HTMLElement & {env?: any, value?: any} | null} [el] Either the id of an element, or the element itself * @param {Partial } [options] Options for the editor * @returns {Editor} **/ exports.edit = function(el, options) { 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 = el.textContent; el.innerHTML = ""; } var doc = exports.createEditSession(value); var editor = new Editor(new Renderer(el), doc, options); var env = { document: doc, editor: editor, onResize: editor.resize.bind(editor, null) }; if (oldNode) env.textarea = oldNode; editor.on("destroy", function() { 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 {import('./document').Document | String} text {:textParam} * @param {import("../ace-internal").Ace.SyntaxMode} [mode] {:modeParam} * @returns {EditSession} **/ exports.createEditSession = function(text, mode) { var doc = new EditSession(text, mode); doc.setUndoManager(new UndoManager()); return doc; }; exports.Range = Range; exports.Editor = Editor; exports.EditSession = EditSession; exports.UndoManager = UndoManager; exports.VirtualRenderer = Renderer; var version = exports.config.version; exports.version = version; ================================================ FILE: src/ace_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "use strict"; var dom = require("./lib/dom"); var ace = require("./ace"); var assert = require("./test/assertions"); var lang = require("./lib/lang"); module.exports = { "test: ace edit" : function() { var editor = ace.edit(null, { value: "Helo world" }); assert.equal(editor.getValue(), "Helo world"); var session = ace.createEditSession("Juhu kinners!"); editor.setSession(session); assert.equal(editor.getValue(), "Juhu kinners!"); assert.equal(editor, ace.edit(editor.container)); editor.destroy(); }, "test: edit textarea" : function() { var el = document.createElement("textarea"); document.body.appendChild(el); var editor = ace.edit(el); assert.notEqual(editor.container, el); editor.container.id = "editor1"; assert.equal(editor, ace.edit("editor1")); editor.destroy(); document.body.removeChild(editor.container); }, "test: edit element by id" : function() { var el = document.createElement("div"); document.body.appendChild(el); var editor = null; try { editor = ace.edit("x"); } catch(e) { } assert.equal(editor, null); el.id = "editor2"; el.textContent = "h"; editor = ace.edit("editor2"); assert.equal(el, editor.container); assert.equal("h", editor.getValue()); document.body.removeChild(el); }, "test: destroy": async function(done) { var editor = ace.edit(); var mouseTarget = editor.renderer.getMouseEventTarget(); var textarea = editor.textInput.getElement(); // editor.curOp is undefined after commands sendText(textarea, "x"); assert.ok(!editor.curOp); assert.equal(editor.getValue(), "x"); // editor.curOp is defined if api is used without endOperation editor.insert("1"); assert.ok(editor.curOp); // clicking on editor calls focus var focusCalled = 0; editor.focus = function() { focusCalled++; }; click(mouseTarget); assert.equal(focusCalled, 1); editor.destroy(); // clicking on destroyed editor doesn't call focus click(mouseTarget); assert.equal(focusCalled, 1); await lang.sleep(0); assert.notOk(!!editor.curOp); // input commands on destroed editor without session do not throw errors editor.setSession(null); sendText(textarea, "2"); done(); }, "test: useStrictCSP": function() { ace.config.set("useStrictCSP", undefined); function getStyleNode() { return document.getElementById("test.css"); } assert.ok(!getStyleNode()); dom.importCssString("test{}", "test.css", false); assert.ok(!getStyleNode()); ace.config.set("useStrictCSP", true); assert.ok(!getStyleNode()); ace.config.set("useStrictCSP", false); assert.ok(getStyleNode()); }, "test: resizeObserver": async function(done) { var mockObserver = { disconnect: function() { mockObserver.target = null; }, observe: function(el) { mockObserver.target = el; }, $create: function(fn) { mockObserver.callback = fn; return mockObserver; }, call: function() { setTimeout(function() { if (mockObserver.target) mockObserver.callback([{contentRect: mockObserver.target.getBoundingClientRect()}]); }); } }; if (!window.ResizeObserver) { window.ResizeObserver = mockObserver.$create; } var editor = ace.edit(null); document.body.appendChild(editor.container); editor.container.style.width = "100px"; editor.container.style.height = "100px"; mockObserver.call(); editor.resize(true); assert.ok(!editor.renderer.$resizeTimer.isPending()); assert.equal(editor.renderer.$size.width, 100); editor.container.style.width = "200px"; mockObserver.call(); await lang.sleep(15); if (editor.renderer.$resizeTimer.isPending()) editor.renderer.$resizeTimer.call(); assert.equal(editor.renderer.$size.width, 200); editor.container.style.height = "200px"; mockObserver.call(); await lang.sleep(15); assert.ok(editor.renderer.$resizeTimer.isPending()); editor.container.style.height = "100px"; mockObserver.call(); await lang.sleep(15); assert.ok(!editor.renderer.$resizeTimer.isPending()); editor.setOption("useResizeObserver", false); editor.container.style.height = "300px"; mockObserver.call(); assert.ok(!editor.renderer.$resizeObserver); editor.setOption("useResizeObserver", true); assert.ok(editor.renderer.$resizeObserver); if (window.ResizeObserver === mockObserver.$create) window.ResizeObserver = undefined; editor.destroy(); done(); }, "test: edit template" : function() { var template = document.createElement("template"); var div = document.createElement("div"); template.content = document.createDocumentFragment(); template.content.appendChild(div); var fragment = template.content.cloneNode(true); var el = fragment.firstChild; //emulating template content document fragment behaviour in browser //which cause #4634 issue (virtual Document that doesn't have `documentElement`) el.ownerDocument = {}; var editor = ace.edit(el); assert.equal(editor.container, el); editor.destroy(); } }; /*global CustomEvent*/ function click(node) { node.dispatchEvent(new CustomEvent("mousedown")); } function sendText(textarea, text) { textarea.value = textarea.value.slice(0, textarea.selectionStart) + text + textarea.value.slice(textarea.selectionEnd); textarea.dispatchEvent(new CustomEvent("input")); } require("./test/run")(module); ================================================ FILE: src/anchor.js ================================================ "use strict"; /** * @typedef {import("./document").Document} Document */ 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|import("../ace-internal").Ace.Point} row The starting row position * @param {Number} [column] The starting column position **/ constructor(doc, row, column) { this.$onChange = this.onChange.bind(this); this.attach(doc); if (typeof row != "number") this.setPosition(row.row, row.column); else this.setPosition(row, column); } /** * Returns an object identifying the `row` and `column` position of the current anchor. * @returns {import("../ace-internal").Ace.Point} **/ getPosition() { return this.$clipPositionToDocument(this.row, this.column); } /** * * Returns the current document. * @returns {Document} **/ getDocument() { return this.document; } /** * Internal function called when `"change"` event fired. * @param {import("../ace-internal").Ace.Delta} delta * @internal */ onChange(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); } /** * 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 **/ setPosition(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. * **/ detach() { this.document.off("change", this.$onChange); } /** * When called, the `"change"` event listener is appended. * @param {Document} doc The document to associate with * **/ attach(doc) { /**@type{Document}*/ 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 * @returns {import("../ace-internal").Ace.Point} * **/ $clipPositionToDocument(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; } } /** * experimental: allows anchor to stick to the next on the left */ Anchor.prototype.$insertRight = false; oop.implement(Anchor.prototype, EventEmitter); 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 }; } exports.Anchor = Anchor; ================================================ FILE: src/anchor_test.js ================================================ "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"); } }; require("./test/run")(module); ================================================ FILE: src/apply_delta.js ================================================ "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"); } /** * Applies a delta to a document. * @param {string[]} docLines * @param {import("../ace-internal").Ace.Delta} delta * @param [doNotValidate] */ 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 { // @ts-ignore 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: src/autocomplete/inline.js ================================================ "use strict"; /** * @typedef {import("../editor").Editor} Editor */ var snippetManager = require("../snippets").snippetManager; var AceInlineScreenReader = require("./inline_screenreader").AceInlineScreenReader; /** * This object is used to manage inline code completions rendered into an editor with ghost text. */ class AceInline { /** * Creates the inline completion renderer which renders the inline code completions directly in the target editor. */ constructor() { this.editor = null; } /** * Renders the completion as ghost text to the current cursor position * @param {Editor} editor * @param {import("../../ace-internal").Ace.Completion} completion * @param {string} prefix * @returns {boolean} True if the completion could be rendered to the editor, false otherwise */ show(editor, completion, prefix) { prefix = prefix || ""; if (editor && this.editor && this.editor !== editor) { this.hide(); this.editor = null; this.inlineScreenReader = null; } if (!editor || !completion) { return false; } if (!this.inlineScreenReader) { this.inlineScreenReader = new AceInlineScreenReader(editor); } var displayText = completion.snippet ? snippetManager.getDisplayTextForSnippet(editor, completion.snippet) : completion.value; if (completion.hideInlinePreview || !displayText || !displayText.startsWith(prefix)) { return false; } this.editor = editor; this.inlineScreenReader.setScreenReaderContent(displayText); displayText = displayText.slice(prefix.length); if (displayText === "") { editor.removeGhostText(); } else { editor.setGhostText(displayText); } return true; } isOpen() { if (!this.editor) { return false; } return !!this.editor.renderer.$ghostText; } hide() { if (!this.editor) { return false; } this.editor.removeGhostText(); return true; } destroy() { this.hide(); this.editor = null; if (this.inlineScreenReader) { this.inlineScreenReader.destroy(); this.inlineScreenReader = null; } } } exports.AceInline = AceInline; ================================================ FILE: src/autocomplete/inline_screenreader.js ================================================ "use strict"; /** * This object is used to communicate inline code completions rendered into an editor with ghost text to screen reader users. */ class AceInlineScreenReader { /** * Creates the off-screen div in which the ghost text content in redered and which the screen reader reads. * @param {import("../editor").Editor} editor */ constructor(editor) { this.editor = editor; this.screenReaderDiv = document.createElement("div"); this.screenReaderDiv.classList.add("ace_screenreader-only"); this.editor.container.appendChild(this.screenReaderDiv); } /** * Set the ghost text content to the screen reader div * @param {string} content */ setScreenReaderContent(content) { // Path for when inline preview is used with 'normal' completion popup. if (!this.popup && this.editor.completer && /**@type{import("../autocomplete").Autocomplete}*/(this.editor.completer).popup) { this.popup = /**@type{import("../autocomplete").Autocomplete}*/(this.editor.completer).popup; this.popup.renderer.on("afterRender", function() { let row = this.popup.getRow(); let t = this.popup.renderer.$textLayer; let selected = t.element.childNodes[row - t.config.firstRow]; if (selected) { let idString = "doc-tooltip "; for (let lineIndex = 0; lineIndex < this._lines.length; lineIndex++) { idString += `ace-inline-screenreader-line-${lineIndex} `; } selected.setAttribute("aria-describedby", idString); } }.bind(this)); } // TODO: Path for when special inline completion popup is used. // https://github.com/ajaxorg/ace/issues/5348 // Remove all children of the div while (this.screenReaderDiv.firstChild) { this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild); } this._lines = content.split(/\r\n|\r|\n/); const codeElement = this.createCodeBlock(); this.screenReaderDiv.appendChild(codeElement); } destroy() { this.screenReaderDiv.remove(); } /** * Take this._lines, render it as blocks and add those to the screen reader div. */ createCodeBlock() { const container = document.createElement("pre"); container.setAttribute("id", "ace-inline-screenreader"); for (let lineIndex = 0; lineIndex < this._lines.length; lineIndex++) { const codeElement = document.createElement("code"); codeElement.setAttribute("id", `ace-inline-screenreader-line-${lineIndex}`); const line = document.createTextNode(this._lines[lineIndex]); codeElement.appendChild(line); container.appendChild(codeElement); } return container; } } exports.AceInlineScreenReader = AceInlineScreenReader; ================================================ FILE: src/autocomplete/inline_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; var assert = require("../test/assertions"); var AceInline = require("./inline").AceInline; var Editor = require("../ace").Editor; var EditSession = require("../ace").EditSession; var VirtualRenderer = require("../ace").VirtualRenderer; var lang = require("../lib/lang"); var editor; var editor2; var inline; var textBase = "abc123\n\n "; var completions = [ { value: "foo", score: 4 }, { value: "function", score: 3 }, { value: "foobar", score: 2 }, { snippet: "function foo() {\n console.log('test');\n}", score: 1 }, { snippet: "foobar2", score: 0 }, { value: "f should not show inline", score: 0, hideInlinePreview: true }, { value: "long\nlong\nlong\nlong\nlong\nlong", score: 0 }, { value: "long\nlong\nlong\nlong\nlong\nlong".repeat(100), score: 0 }, { value: "foo suggestion with a\n\n\ngap", score: 0 } ]; var getAllLines = function(editorOverride) { editorOverride = editorOverride || editor; return Array.from(editorOverride.renderer.$textLayer.element.childNodes).map(function (node) { return node.textContent; }).join("\n"); }; var createEditor = function(element) { var renderer = new VirtualRenderer(element); var session = new EditSession(""); return new Editor(renderer, session); }; module.exports = { setUp: function() { var el = document.createElement("div"); el.style.left = "20px"; el.style.top = "30px"; el.style.width = "500px"; el.style.height = "500px"; document.body.appendChild(el); editor = createEditor(el); editor.execCommand("insertstring", textBase + "f"); inline = new AceInline(); editor.getSelection().moveCursorFileEnd(); editor.renderer.$loop._flush(); }, "test: displays the ghost text in the editor on show": function() { inline.show(editor, completions[0], "f"); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "foo"); }, "test: replaces the ghost text in the editor with the latest show": function() { inline.show(editor, completions[0], "f"); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "foo"); inline.show(editor, completions[1], "f"); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "function"); }, "test: renders multi-line ghost text indentation": function() { assert.equal(editor.renderer.$ghostTextWidget, null); inline.show(editor, completions[3], "f"); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase + "function foo() {"); assert.strictEqual(editor.renderer.$ghostTextWidget.el.innerHTML, `
    console.log('test');
    }
    `); }, "test: boundary tests": function() { var noRenderTestCases = [ [null, null, null], [editor, null, null], [editor, null, ""], [null, completions[3], ""] ]; var result; noRenderTestCases.forEach(function(params) { result = inline.show(params[0], params[1], params[2]); editor.renderer.$loop._flush(); assert.notOk(result); assert.equal(editor.renderer.$ghostText, null); assert.equal(editor.renderer.$ghostTextWidget, null); }); var renderTestCases = [ [editor, completions[1], undefined], [editor, completions[1], null], [editor, completions[1], ""] ]; renderTestCases.forEach(function(params) { result = inline.show(params[0], params[1], params[2]); editor.renderer.$loop._flush(); assert.ok(result); assert.strictEqual(editor.renderer.$ghostText.text, "function"); assert.strictEqual(getAllLines(), textBase + "ffunction"); assert.equal(editor.renderer.$ghostTextWidget, null); }); result = inline.show(editor, completions[0], "foo"); editor.renderer.$loop._flush(); assert.ok(result); assert.equal(editor.renderer.$ghostText, null); assert.equal(editor.renderer.$ghostTextWidget, null); }, "test: only renders the ghost text without the prefix": function() { inline.show(editor, completions[1], "fun"); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "fction"); }, "test: verify explicit and implicit hide": function() { inline.show(editor, completions[1], "f"); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "function"); assert.strictEqual(inline.isOpen(), true); inline.hide(); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase + "f"); assert.strictEqual(inline.isOpen(), false); inline.show(editor, completions[1], "function"); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase + "f"); assert.strictEqual(inline.isOpen(), false); }, "test: does not hide previous ghost text if cannot show current one": function() { inline.show(editor, completions[1], "f"); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "function"); assert.strictEqual(inline.isOpen(), true); inline.show(editor, null, ""); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "function"); assert.strictEqual(inline.isOpen(), true); inline.hide(); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase + "f"); assert.strictEqual(inline.isOpen(), false); }, "test: removes ghost text from previous editor if new valid editor is passed to show function": function() { var el = document.createElement("div"); el.style.left = "520px"; el.style.top = "530px"; el.style.width = "500px"; el.style.height = "500px"; document.body.appendChild(el); editor2 = createEditor(el); var editor2Text = "different text\n\n f"; editor2.execCommand("insertstring", editor2Text); inline.show(editor, completions[1], "f"); editor.renderer.$loop._flush(); editor2.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase + "function"); assert.strictEqual(getAllLines(editor2), editor2Text); assert.strictEqual(inline.isOpen(), true); inline.show(editor2, completions[2], "f"); editor.renderer.$loop._flush(); editor2.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase + "f"); assert.strictEqual(getAllLines(editor2), editor2Text + "oobar"); assert.strictEqual(inline.isOpen(), true); inline.show(null, completions[2], "f"); editor.renderer.$loop._flush(); editor2.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase + "f"); assert.strictEqual(getAllLines(editor2), editor2Text + "oobar"); assert.strictEqual(inline.isOpen(), true); }, "test: verify destroy": function() { inline.show(editor, completions[0], "f"); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase + "foo"); inline.destroy(); editor.renderer.$loop._flush(); assert.strictEqual(inline.isOpen(), false); assert.strictEqual(getAllLines(), textBase + "f"); inline.destroy(); editor.renderer.$loop._flush(); assert.strictEqual(inline.isOpen(), false); assert.strictEqual(getAllLines(), textBase + "f"); inline.hide(); editor.renderer.$loop._flush(); assert.strictEqual(inline.isOpen(), false); assert.strictEqual(getAllLines(), textBase + "f"); }, "test: should respect hideInlinePreview": function() { // By default, this option is set to hide. inline.show(editor, completions[5], "f"); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "f"); assert.strictEqual(inline.isOpen(), false); inline.hide(); editor.renderer.$loop._flush(); // Now it should be shown. completions[5].hideInlinePreview = false; inline.show(editor, completions[5], "f"); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "f should not show inline"); assert.strictEqual(inline.isOpen(), true); inline.hide(); editor.renderer.$loop._flush(); // Now it should be shown. completions[5].hideInlinePreview = undefined; inline.show(editor, completions[5], "f"); editor.renderer.$loop._flush(); assert.equal(getAllLines(), textBase + "f should not show inline"); assert.strictEqual(inline.isOpen(), true); inline.hide(); editor.renderer.$loop._flush(); // Reset to state before test. completions[5].hideInlinePreview = true; }, "test: should scroll if inline preview outside": async function(done) { // Fill the editor with new lines to get the cursor to the bottom // of the container editor.execCommand("insertstring", "\n".repeat(200)); var deltaY, row; var initialScrollBy = editor.renderer.scrollBy; var initialScrollToRow = editor.renderer.scrollToRow; editor.renderer.scrollBy = function(_, varY) { deltaY = varY; }; editor.renderer.scrollToRow = function(varRow) { row = varRow; }; inline.show(editor, completions[6], "l"); editor.renderer.$loop._flush(); await lang.sleep(50); // Should scroll 5 lines to get the inline preview into view assert.strictEqual(deltaY, 50); inline.hide(); editor.renderer.$loop._flush(); inline.show(editor, completions[7], "l"); editor.renderer.$loop._flush(); await lang.sleep(50); // Should scroll as much as possbile while keeping the cursor on screen assert.strictEqual(row, 202); editor.renderer.scrollBy = initialScrollBy; editor.renderer.scrollToRow = initialScrollToRow; done(); }, "test: renders multi-line ghost text with empty lines": function() { assert.equal(editor.renderer.$ghostTextWidget, null); inline.show(editor, completions[8], "f"); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase + "foo suggestion with a"); assert.strictEqual(editor.renderer.$ghostTextWidget.el.innerHTML, `
    gap
    `); }, "test: moves tokens to the right of cursor to the end of ghost text for multi line ghost text": function() { editor.execCommand("removetolinestarthard"); editor.execCommand("insertstring", "f hi I should be hidden"); editor.execCommand("gotolinestart"); editor.execCommand("gotoright"); editor.renderer.$loop._flush(); assert.equal(editor.renderer.$ghostTextWidget, null); inline.show(editor, completions[8], "f"); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase.replaceAll(" ", "") + "foo suggestion with a hi I should be hidden"); // The string to the right of the cursor should be hidden tokens now. var tokens = editor.session.getTokens(2); assert.strictEqual(tokens[2].value, " hi I should be hidden"); assert.strictEqual(tokens[2].type, "hidden_token"); // And should be added to the ghost text widget. assert.strictEqual(editor.renderer.$ghostTextWidget.el.textContent, " gap hi I should be hidden"); // Hide inline inline.hide(); editor.renderer.$loop._flush(); assert.equal(editor.renderer.$ghostTextWidget, null); // Text to the right of the cursor should be tokenized normally again. var tokens = editor.session.getTokens(2); assert.strictEqual(tokens[0].value, "f hi I should be hidden"); assert.strictEqual(tokens[0].type, "text"); }, "test: moves tokens to the right of cursor to the end of ghost text for multi line ghost text when triggered inside token": function() { editor.execCommand("removetolinestarthard"); editor.execCommand("insertstring", "fhi I should be hidden"); editor.execCommand("gotolinestart"); editor.execCommand("gotoright"); editor.renderer.$loop._flush(); assert.equal(editor.renderer.$ghostTextWidget, null); inline.show(editor, completions[8], "f"); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), textBase.replaceAll(" ", "") + "foo suggestion with ahi I should be hidden"); // The string to the right of the cursor should be hidden tokens now. var tokens = editor.session.getTokens(2); assert.strictEqual(tokens[2].value, "hi I should be hidden"); assert.strictEqual(tokens[2].type, "hidden_token"); // And should be added to the ghost text widget. assert.strictEqual(editor.renderer.$ghostTextWidget.el.textContent, " gaphi I should be hidden"); // Hide inline inline.hide(); editor.renderer.$loop._flush(); assert.equal(editor.renderer.$ghostTextWidget, null); // Text to the right of the cursor should be tokenized normally again. var tokens = editor.session.getTokens(2); assert.strictEqual(tokens[0].value, "fhi I should be hidden"); assert.strictEqual(tokens[0].type, "text"); }, tearDown: function() { inline.destroy(); editor.destroy(); if (editor2) { editor2.destroy(); } } }; require("../test/run")(module); ================================================ FILE: src/autocomplete/popup.js ================================================ "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 nls = require("../config").nls; var userAgent = require("./../lib/useragent"); var getAriaId = function (index) { return `suggest-aria-id:${index}`; }; // Safari requires different ARIA A11Y attributes compared to other browsers var popupAriaRole = userAgent.isSafari ? "menu" : "listbox"; var optionAriaRole = userAgent.isSafari ? "menuitem" : "option"; var ariaActiveState = userAgent.isSafari ? "aria-current" : "aria-selected"; /** * * @param {HTMLElement} [el] * @return {Editor} */ 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.$focusTimeout = 0; editor.$highlightTagPending = true; return editor; }; /** * This object is used in some places where needed to show popups - like prompt; autocomplete etc. */ class AcePopup { /** * Creates and renders single line editor in popup window. If `parentNode` param is isset, then attaching it to this element. * @param {Element} [parentNode] */ constructor(parentNode) { var el = dom.createElement("div"); /**@type {AcePopup}*/ // @ts-ignore var popup = $singleLineEditor(el); if (parentNode) { parentNode.appendChild(el); } el.style.display = "none"; popup.renderer.content.style.cursor = "default"; popup.renderer.setStyle("ace_autocomplete"); // Set aria attributes for the popup popup.renderer.$textLayer.element.setAttribute("role", popupAriaRole); popup.renderer.$textLayer.element.setAttribute("aria-roledescription", nls("autocomplete.popup.aria-roledescription", "Autocomplete suggestions")); popup.renderer.$textLayer.element.setAttribute("aria-label", nls("autocomplete.popup.aria-label", "Autocomplete suggestions")); popup.renderer.textarea.setAttribute("aria-hidden", "true"); 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 // @ts-ignore 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; popup.isMouseOver = true; 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); } }); // set aria attributes on all visible elements of the popup popup.renderer.on("afterRender", function () { var t = popup.renderer.$textLayer; for (var row = t.config.firstRow, l = t.config.lastRow; row <= l; row++) { const popupRowElement = /** @type {HTMLElement|null} */(t.element.childNodes[row - t.config.firstRow]); popupRowElement.setAttribute("role", optionAriaRole); popupRowElement.setAttribute("aria-roledescription", nls("autocomplete.popup.item.aria-roledescription", "item")); popupRowElement.setAttribute("aria-setsize", popup.data.length); popupRowElement.setAttribute("aria-describedby", "doc-tooltip"); popupRowElement.setAttribute("aria-posinset", row + 1); const rowData = popup.getData(row); if (rowData) { const ariaLabel = `${rowData.caption || rowData.value}${rowData.meta ? `, ${rowData.meta}` : ''}`; popupRowElement.setAttribute("aria-label", ariaLabel); } const highlightedSpans = popupRowElement.querySelectorAll(".ace_completion-highlight"); highlightedSpans.forEach(span => { span.setAttribute("role", "mark"); }); } }); popup.renderer.on("afterRender", function () { var row = popup.getRow(); var t = popup.renderer.$textLayer; var selected = /** @type {HTMLElement|null} */(t.element.childNodes[row - t.config.firstRow]); var el = document.activeElement; // Active element is textarea of main editor if (selected !== popup.selectedNode && popup.selectedNode) { dom.removeCssClass(popup.selectedNode, "ace_selected"); popup.selectedNode.removeAttribute(ariaActiveState); popup.selectedNode.removeAttribute("id"); } el.removeAttribute("aria-activedescendant"); popup.selectedNode = selected; if (selected) { var ariaId = getAriaId(row); dom.addCssClass(selected, "ace_selected"); selected.id = ariaId; t.element.setAttribute("aria-activedescendant", ariaId); el.setAttribute("aria-activedescendant", ariaId); selected.setAttribute(ariaActiveState, "true"); } }); 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", function() { popup.isMouseOver = false; 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) { /**@type {import("../../ace-internal").Ace.Completion &{name?, className?, matchMask?, message?}}*/ var data = popup.data[row]; var tokens = []; if (!data) return tokens; if (typeof data == "string") data = {value: data}; var caption = data.caption || data.value || data.name; function addToken(value, className) { value && tokens.push({ type: (data.className || "") + (className || ""), value: value }); } var lower = caption.toLowerCase(); var filterText = (popup.filterText || "").toLowerCase(); var lastIndex = 0; var lastI = 0; for (var i = 0; i <= filterText.length; i++) { if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) { var sub = filterText.slice(lastI, i); lastI = i; var index = lower.indexOf(sub, lastIndex); if (index == -1) continue; addToken(caption.slice(lastIndex, index), ""); lastIndex = index + sub.length; addToken(caption.slice(index, lastIndex), "completion-highlight"); } } addToken(caption.slice(lastIndex, caption.length), ""); tokens.push({type: "completion-spacer", value: " "}); if (data.meta) tokens.push({type: "completion-meta", value: data.meta}); if (data.message) tokens.push({type: "completion-message", value: data.message}); 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.filterText = ""; popup.isMouseOver = false; popup.data = []; popup.setData = function(list, filterText) { popup.filterText = filterText || ""; 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 - 1, 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"; popup.anchorPos = null; popup.anchor = null; if (popup.isOpen) { popup.isOpen = false; this._signal("hide"); } }; /** * Tries to show the popup anchored to the given position and anchors. * If the anchor is not specified it tries to align to bottom and right as much as possible. * If the popup does not have enough space to be rendered with the given anchors, it returns false without rendering the popup. * The forceShow flag can be used to render the popup in these cases, which slides the popup so it entirely fits on the screen. * @param {{top: number, left: number}} pos * @param {number} lineHeight * @param {"top" | "bottom" | undefined} anchor * @param {boolean} forceShow * @returns {boolean} */ popup.tryShow = function(pos, lineHeight, anchor, forceShow) { if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor && popup.anchorPos.top === pos.top && popup.anchorPos.left === pos.left && popup.anchor === anchor ) { return true; } var el = this.container; var scrollBarSize = this.renderer.scrollBar.width || 10; var screenHeight = window.innerHeight - scrollBarSize; var screenWidth = window.innerWidth - scrollBarSize; var renderer = this.renderer; // var maxLines = Math.min(renderer.$maxLines, this.session.getLength()); var maxH = renderer.$maxLines * lineHeight * 1.4; var dims = { top: 0, bottom: 0, left: 0 }; var spaceBelow = screenHeight - pos.top - 3 * this.$borderSize - lineHeight; var spaceAbove = pos.top - 3 * this.$borderSize; if (!anchor) { if (spaceAbove <= spaceBelow || spaceBelow >= maxH) { anchor = "bottom"; } else { anchor = "top"; } } if (anchor === "top") { dims.bottom = pos.top - this.$borderSize; dims.top = dims.bottom - maxH; } else if (anchor === "bottom") { dims.top = pos.top + lineHeight + this.$borderSize; dims.bottom = dims.top + maxH; } var fitsX = dims.top >= 0 && dims.bottom <= screenHeight; if (!forceShow && !fitsX) { return false; } if (!fitsX) { if (anchor === "top") { renderer.$maxPixelHeight = spaceAbove; } else { renderer.$maxPixelHeight = spaceBelow; } } else { renderer.$maxPixelHeight = null; } if (anchor === "top") { el.style.top = ""; el.style.bottom = (screenHeight + scrollBarSize - dims.bottom) + "px"; popup.isTopdown = false; } else { el.style.top = dims.top + "px"; el.style.bottom = ""; popup.isTopdown = true; } el.style.display = ""; var left = pos.left; if (left + el.offsetWidth > screenWidth) left = screenWidth - el.offsetWidth; el.style.left = left + "px"; el.style.right = ""; dom.$fixPositionBug(el); if (!popup.isOpen) { popup.isOpen = true; this._signal("show"); lastMouseEvent = null; } popup.anchorPos = pos; popup.anchor = anchor; return true; }; popup.show = function(pos, lineHeight, topdownOnly) { this.tryShow(pos, lineHeight, topdownOnly ? "bottom" : undefined, true); }; popup.goTo = function(where) { var row = this.getRow(); var max = this.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.setRow(row); }; 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_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line { background-color: #3a674e; } .ace_editor.ace_autocomplete .ace_line-hover { border: 1px solid #abbffe; margin-top: -1px; background: rgba(233,233,253,0.4); position: absolute; z-index: 2; } .ace_dark.ace_editor.ace_autocomplete .ace_line-hover { border: 1px solid rgba(109, 150, 13, 0.8); background: rgba(58, 103, 78, 0.62); } .ace_completion-meta { opacity: 0.5; margin-left: 0.9em; } .ace_completion-message { margin-left: 0.9em; color: blue; } .ace_editor.ace_autocomplete .ace_completion-highlight{ color: #2d69c7; } .ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{ color: #93ca12; } .ace_editor.ace_autocomplete { width: 300px; z-index: 200000; border: 1px lightgray solid; position: fixed; box-shadow: 2px 3px 5px rgba(0,0,0,.2); line-height: 1.4; background: #fefefe; color: #111; } .ace_dark.ace_editor.ace_autocomplete { border: 1px #484747 solid; box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51); line-height: 1.4; background: #25282c; color: #c1c1c1; } .ace_autocomplete .ace_text-layer { width: calc(100% - 8px); } .ace_autocomplete .ace_line { display: flex; align-items: center; } .ace_autocomplete .ace_line > * { min-width: 0; flex: 0 0 auto; } .ace_autocomplete .ace_line .ace_ { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; } .ace_autocomplete .ace_completion-spacer { flex: 1; } .ace_autocomplete.ace_loading:after { content: ""; position: absolute; top: 0px; height: 2px; width: 8%; background: blue; z-index: 100; animation: ace_progress 3s infinite linear; animation-delay: 300ms; transform: translateX(-100%) scaleX(1); } @keyframes ace_progress { 0% { transform: translateX(-100%) scaleX(1) } 50% { transform: translateX(625%) scaleX(2) } 100% { transform: translateX(1500%) scaleX(3) } } @media (prefers-reduced-motion) { .ace_autocomplete.ace_loading:after { transform: translateX(625%) scaleX(2); animation: none; } } `, "autocompletion.css", false); exports.AcePopup = AcePopup; exports.$singleLineEditor = $singleLineEditor; exports.getAriaId = getAriaId; ================================================ FILE: src/autocomplete/popup_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; var assert = require("../test/assertions"); var AcePopup = require("./popup").AcePopup; /**@type {AcePopup} */ var popup; var lineHeight = 14; var renderHeight = 8 * lineHeight; var renderWidth = 300; var iframe; var notEnoughSpaceOnRight = window.innerWidth - 50; var notEnoughSpaceOnBottom = window.innerHeight - 50; var originalDocument; var completions = []; for (var i = 0; i < 8; i++) { completions.push({ value: "foo" + i, caption: "foo" + i, name: "foo" + i, score: 4 }); } var tryShowAndRender = function(pos, lineHeight, anchor, forceShow) { var result = popup.tryShow(pos, lineHeight, anchor, forceShow); popup.renderer.updateFull(true); return result; }; var setupPopup = function() { popup = new AcePopup(document.body); // Mock the CSS behaviour popup.container.style.width = "300px"; popup.setData(completions, ""); }; var tearDown = function(done) { if (popup) { popup.destroy(); var el = popup.container; if (el && el.parentNode) el.parentNode.removeChild(el); } if (iframe) document.body.removeChild(iframe); if (originalDocument) { window.document = originalDocument; originalDocument = null; } done && done(); }; module.exports = { "test: verify width and height": function() { setupPopup(); tryShowAndRender({ top: 0, left: 0 }, lineHeight, "bottom"); renderHeight = popup.container.offsetHeight; assert.strictEqual(popup.isOpen, true); assert.strictEqual(renderHeight > 0, true); popup.hide(); assert.strictEqual(popup.isOpen, false); }, "test: tryShow does not display popup if there is not enough space on the anchor side": function() { setupPopup(); var result = tryShowAndRender({ top: notEnoughSpaceOnBottom, left: 0}, lineHeight, "bottom"); assert.strictEqual(result, false); assert.strictEqual(popup.isOpen, false); result = tryShowAndRender({ top: 50, left: 0}, lineHeight, "top"); assert.strictEqual(result, false); assert.strictEqual(popup.isOpen, false); }, "test: tryShow slides popup on the X axis if there are not enough space on the right": function() { setupPopup(); var result = tryShowAndRender({ top: 0, left: notEnoughSpaceOnRight }, lineHeight, "bottom"); assert.strictEqual(result, true); assert.strictEqual(popup.isOpen, true); assert.strictEqual(popup.container.getBoundingClientRect().right, window.innerWidth - (popup.renderer.scrollBar.width || 10)); assert.strictEqual(Math.abs(popup.container.getBoundingClientRect().width - renderWidth) < 5, true); popup.hide(); assert.strictEqual(popup.isOpen, false); result = tryShowAndRender({ top: notEnoughSpaceOnBottom, left: notEnoughSpaceOnRight }, lineHeight, "top"); assert.strictEqual(result, true); assert.strictEqual(popup.isOpen, true); assert.strictEqual(popup.container.getBoundingClientRect().right, window.innerWidth - (popup.renderer.scrollBar.width || 10)); assert.strictEqual(Math.abs(popup.container.getBoundingClientRect().width - renderWidth) < 5, true); popup.hide(); assert.strictEqual(popup.isOpen, false); }, "test: tryShow called with forceShow resizes popup height to fit popup": function() { setupPopup(); var result = tryShowAndRender({ top: notEnoughSpaceOnBottom, left: 0 }, lineHeight, "bottom", true); assert.strictEqual(result, true); assert.strictEqual(popup.isOpen, true); assert.notEqual(popup.container.style.display, "none"); assert.strictEqual(popup.container.getBoundingClientRect().height <= 50, true); assert.strictEqual(popup.container.getBoundingClientRect().top > notEnoughSpaceOnBottom + lineHeight, true); assert.strictEqual(Math.abs(popup.container.getBoundingClientRect().width - renderWidth) < 5, true); popup.hide(); assert.strictEqual(popup.isOpen, false); result = tryShowAndRender({ top: 50, left: 0 }, lineHeight, "top", true); assert.strictEqual(result, true); assert.strictEqual(popup.isOpen, true); assert.notEqual(popup.container.style.display, "none"); assert.strictEqual(popup.container.getBoundingClientRect().height <= 50, true); assert.strictEqual(popup.container.getBoundingClientRect().bottom <= 50, true); assert.strictEqual(Math.abs(popup.container.getBoundingClientRect().width - renderWidth) < 5, true); popup.hide(); assert.strictEqual(popup.isOpen, false); }, "test: show displays popup in all 4 corners correctly without topdownOnly specified": function() { setupPopup(); popup.show({ top: 50, left: 0 }, lineHeight); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.strictEqual(popup.container.getBoundingClientRect().height, renderHeight); assert.ok(popup.container.getBoundingClientRect().top >= 50 + lineHeight); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); popup.show({ top: notEnoughSpaceOnBottom, left: 0 }, lineHeight); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.strictEqual(popup.container.getBoundingClientRect().height, renderHeight); assert.ok(popup.container.getBoundingClientRect().bottom <= notEnoughSpaceOnBottom); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); popup.show({ top: 50, left: notEnoughSpaceOnRight }, lineHeight); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.strictEqual(popup.container.getBoundingClientRect().height, renderHeight); assert.ok(popup.container.getBoundingClientRect().top >= 50 + lineHeight); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); popup.show({ top: notEnoughSpaceOnBottom, left: notEnoughSpaceOnRight }, lineHeight); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.strictEqual(popup.container.getBoundingClientRect().height, renderHeight); assert.ok(popup.container.getBoundingClientRect().bottom <= notEnoughSpaceOnBottom); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); }, "test: show displays popup in all 4 corners correctly with topdownOnly specified": function() { setupPopup(); popup.show({ top: 50, left: 0 }, lineHeight, true); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.strictEqual(popup.container.getBoundingClientRect().height, renderHeight); assert.ok(popup.container.getBoundingClientRect().top >= 50 + lineHeight); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); popup.show({ top: 50, left: notEnoughSpaceOnRight }, lineHeight); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.strictEqual(popup.container.getBoundingClientRect().height, renderHeight); assert.ok(popup.container.getBoundingClientRect().top >= 50 + lineHeight); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); popup.show({ top: notEnoughSpaceOnBottom, left: 0 }, lineHeight, true); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.ok(popup.container.getBoundingClientRect().height <= 50); assert.ok(popup.container.getBoundingClientRect().top >= notEnoughSpaceOnBottom + lineHeight); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); popup.show({ top: notEnoughSpaceOnBottom, left: notEnoughSpaceOnRight }, lineHeight, true); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.ok(popup.container.getBoundingClientRect().height <= 50); assert.ok(popup.container.getBoundingClientRect().top >= notEnoughSpaceOnBottom + lineHeight); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); }, "test: resets popup size if space is available again": function() { setupPopup(); popup.show({ top: notEnoughSpaceOnBottom, left: notEnoughSpaceOnRight }, lineHeight, true); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.ok(popup.container.getBoundingClientRect().height <= 50); assert.ok(popup.container.getBoundingClientRect().top >= notEnoughSpaceOnBottom + lineHeight); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); popup.show({ top: 50, left: notEnoughSpaceOnRight }, lineHeight); popup.renderer.updateFull(true); assert.notEqual(popup.container.style.display, "none"); assert.ok(popup.container.getBoundingClientRect().height, renderHeight); assert.ok(popup.container.getBoundingClientRect().top >= 50 + lineHeight); popup.hide(); assert.strictEqual(popup.container.style.display, "none"); }, tearDown: tearDown }; require("../test/run")(module); ================================================ FILE: src/autocomplete/text_completer.js ================================================ 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.id = "textCompleter"; 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: src/autocomplete/util.js ================================================ "use strict"; /** * @typedef {import("../editor").Editor} Editor */ 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-\u2000\u2070-\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; }; /** * @param editor * @return {string} */ 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); }; /** * @param {Editor} editor * @param {string} [previousChar] if not provided, it falls back to the preceding character in the editor * @returns {boolean} whether autocomplete should be triggered */ exports.triggerAutocomplete = function (editor, previousChar) { var previousChar = previousChar == null ? editor.session.getPrecedingCharacter() : previousChar; return editor.completers.some((completer) => { if (completer.triggerCharacters && Array.isArray(completer.triggerCharacters)) { return completer.triggerCharacters.includes(previousChar); } }); }; ================================================ FILE: src/autocomplete.js ================================================ "use strict"; /** * @typedef {import("./editor").Editor} Editor * @typedef {import("../ace-internal").Ace.CompletionProviderOptions} CompletionProviderOptions * @typedef {import("../ace-internal").Ace.CompletionOptions} CompletionOptions * @typedef {import("../ace-internal").Ace.Position} Position */ var HashHandler = require("./keyboard/hash_handler").HashHandler; var AcePopup = require("./autocomplete/popup").AcePopup; var AceInline = require("./autocomplete/inline").AceInline; var getAriaId = require("./autocomplete/popup").getAriaId; var util = require("./autocomplete/util"); var lang = require("./lib/lang"); var dom = require("./lib/dom"); var snippetManager = require("./snippets").snippetManager; var config = require("./config"); var event = require("./lib/event"); var preventParentScroll = require("./lib/scroll").preventParentScroll; /** * @typedef BaseCompletion * @property {number} [score] - a numerical value that determines the order in which completions would be displayed. * A lower score means that the completion would be displayed further from the start * @property {string} [meta] - a short description of the completion * @property {string} [caption] - the text that would be displayed in the completion list. If omitted, value or snippet * would be shown instead. * @property {string} [docHTML] - an HTML string that would be displayed as an additional popup * @property {string} [docText] - a plain text that would be displayed as an additional popup. If `docHTML` exists, * it would be used instead of `docText`. * @property {string} [completerId] - the identifier of the completer * @property {boolean} [skipFilter] - a boolean value to decide if the popup item is going to skip the filtering process done using prefix text. * @property {import("../ace-internal").Ace.IRange} [range] - An object specifying the range of text to be replaced with the new completion value (experimental) * @property {any} [command] - A command to be executed after the completion is inserted (experimental) * @property {string} [snippet] - a text snippet that would be inserted when the completion is selected * @property {string} [value] - The text that would be inserted when selecting this completion. * @property {import("../ace-internal").Ace.Completer} [completer] * @property {boolean} [hideInlinePreview] * @export */ /** * @typedef {BaseCompletion & {snippet: string}} SnippetCompletion * @property {string} snippet * @property {string} [value] * @export */ /** * @typedef {BaseCompletion & {value: string}} ValueCompletion * @property {string} value * @property {string} [snippet] * @export */ /** * Represents a suggested text snippet intended to complete a user's input * @typedef Completion * @type {SnippetCompletion|ValueCompletion} * @export */ var destroyCompleter = function(e, editor) { editor.completer && editor.completer.destroy(); }; /** * This object controls the autocompletion components and their lifecycle. * There is an autocompletion popup, an optional inline ghost text renderer and a docuent tooltip popup inside. */ class Autocomplete { constructor() { this.autoInsert = false; this.autoSelect = true; this.autoShown = false; this.exactMatch = false; this.inlineEnabled = false; this.keyboardHandler = new HashHandler(); this.keyboardHandler.bindKeys(this.commands); this.parentNode = null; this.setSelectOnHover = false; /**@private*/ this.hasSeen = new Set(); /** * @property {Boolean} showLoadingState - A boolean indicating whether the loading states of the Autocompletion should be shown to the end-user. If enabled * it shows a loading indicator on the popup while autocomplete is loading. * * Experimental: This visualisation is not yet considered stable and might change in the future. */ this.showLoadingState = false; /** * @property {number} stickySelectionDelay - a numerical value that determines after how many ms the popup selection will become 'sticky'. * Normally, when new elements are added to an open popup, the selection is reset to the first row of the popup. If sticky, the focus will remain * on the currently selected item when new items are added to the popup. Set to a negative value to disable this feature and never set selection to sticky. */ this.stickySelectionDelay = 500; 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.onLayoutChange = this.onLayoutChange.bind(this); this.changeTimer = lang.delayedCall(function() { this.updateCompletions(true); }.bind(this)); this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50); this.popupTimer = lang.delayedCall(this.$updatePopupPosition.bind(this), 50); this.stickySelectionTimer = lang.delayedCall(function() { this.stickySelection = true; }.bind(this), this.stickySelectionDelay); this.$firstOpenTimer = lang.delayedCall(/**@this{Autocomplete}*/function() { var initialPosition = this.completionProvider && this.completionProvider.initialPosition; if (this.autoShown || (this.popup && this.popup.isOpen) || !initialPosition || this.editor.completers.length === 0) return; this.completions = new FilteredList(Autocomplete.completionsForLoading); this.openPopup(this.editor, initialPosition.prefix, false); this.popup.renderer.setStyle("ace_loading", true); }.bind(this), this.stickySelectionDelay); } static get completionsForLoading() { return [{ caption: config.nls("autocomplete.loading", "Loading..."), value: "" }]; } $init() { /**@type {AcePopup}**/ this.popup = new AcePopup(this.parentNode || 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.$onPopupShow.bind(this)); this.popup.on("hide", this.$onHidePopup.bind(this)); this.popup.on("select", this.$onPopupChange.bind(this)); event.addListener(this.popup.container, "mouseout", this.mouseOutListener.bind(this)); this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null)); this.popup.renderer.on("afterRender", this.$onPopupRender.bind(this)); return this.popup; } $initInline() { if (!this.inlineEnabled || this.inlineRenderer) return; this.inlineRenderer = new AceInline(); return this.inlineRenderer; } /** * @return {AcePopup} */ getPopup() { return this.popup || this.$init(); } $onHidePopup() { if (this.inlineRenderer) { this.inlineRenderer.hide(); } this.hideDocTooltip(); this.stickySelectionTimer.cancel(); this.popupTimer.cancel(); this.stickySelection = false; } $seen(completion) { if (!this.hasSeen.has(completion) && completion && completion.completer && completion.completer.onSeen && typeof completion.completer.onSeen === "function") { completion.completer.onSeen(this.editor, completion); this.hasSeen.add(completion); } } $onPopupChange(hide) { if (this.inlineRenderer && this.inlineEnabled) { var completion = hide ? null : this.popup.getData(this.popup.getRow()); this.$updateGhostText(completion); // If the mouse is over the tooltip, and we're changing selection on hover don't // move the tooltip while hovering over the popup. if (this.popup.isMouseOver && this.setSelectOnHover) { // @ts-expect-error TODO: potential wrong arguments this.tooltipTimer.call(null, null); return; } // Update the popup position after a short wait to account for potential scrolling this.popupTimer.schedule(); this.tooltipTimer.schedule(); } else { // @ts-expect-error TODO: potential wrong arguments this.popupTimer.call(null, null); // @ts-expect-error TODO: potential wrong arguments this.tooltipTimer.call(null, null); } } $updateGhostText(completion) { // Ghost text can include characters normally not part of the prefix (e.g. whitespace). // When typing ahead with ghost text however, we want to simply prefix with respect to the // base of the completion. var row = this.base.row; var column = this.base.column; var cursorColumn = this.editor.getCursorPosition().column; var prefix = this.editor.session.getLine(row).slice(column, cursorColumn); if (!this.inlineRenderer.show(this.editor, completion, prefix)) { this.inlineRenderer.hide(); } else { this.$seen(completion); } } $onPopupRender() { const inlineEnabled = this.inlineRenderer && this.inlineEnabled; if (this.completions && this.completions.filtered && this.completions.filtered.length > 0) { for (var i = this.popup.getFirstVisibleRow(); i <= this.popup.getLastVisibleRow(); i++) { var completion = this.popup.getData(i); if (completion && (!inlineEnabled || completion.hideInlinePreview)) { this.$seen(completion); } } } } $onPopupShow(hide) { this.$onPopupChange(hide); this.stickySelection = false; if (this.stickySelectionDelay >= 0) this.stickySelectionTimer.schedule(this.stickySelectionDelay); } observeLayoutChanges() { if (this.$elements || !this.editor) return; window.addEventListener("resize", this.onLayoutChange, {passive: true}); window.addEventListener("wheel", this.mousewheelListener); var el = this.editor.container.parentNode; var elements = []; while (el) { elements.push(el); el.addEventListener("scroll", this.onLayoutChange, {passive: true}); el = el.parentNode; } this.$elements = elements; } unObserveLayoutChanges() { // @ts-expect-error This is expected for some browsers window.removeEventListener("resize", this.onLayoutChange, {passive: true}); window.removeEventListener("wheel", this.mousewheelListener); this.$elements && this.$elements.forEach((el) => { // @ts-expect-error This is expected for some browsers el.removeEventListener("scroll", this.onLayoutChange, {passive: true}); }); this.$elements = null; } /** * @internal */ onLayoutChange() { if (!this.popup.isOpen) return this.unObserveLayoutChanges(); this.$updatePopupPosition(); this.updateDocTooltip(); } $updatePopupPosition() { var editor = this.editor; var renderer = editor.renderer; 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; var posGhostText = { top: pos.top, left: pos.left }; if (renderer.$ghostText && renderer.$ghostTextWidget) { if (this.base.row === renderer.$ghostText.position.row) { posGhostText.top += renderer.$ghostTextWidget.el.offsetHeight; } } // posGhostText can be below the editor rendering the popup away from the editor. // In this case, we want to render the popup such that the top aligns with the bottom of the editor. var editorContainerBottom = editor.container.getBoundingClientRect().bottom - lineHeight; var lowestPosition = editorContainerBottom < posGhostText.top ? {top: editorContainerBottom, left: posGhostText.left} : posGhostText; // Try to render below ghost text, then above ghost text, then over ghost text if (this.popup.tryShow(lowestPosition, lineHeight, "bottom")) { return; } if (this.popup.tryShow(pos, lineHeight, "top")) { return; } this.popup.show(pos, lineHeight); } /** * @param {Editor} editor * @param {string} prefix * @param {boolean} [keepPopupPosition] */ openPopup(editor, prefix, keepPopupPosition) { this.$firstOpenTimer.cancel(); if (!this.popup) this.$init(); if (this.inlineEnabled && !this.inlineRenderer) this.$initInline(); this.popup.autoSelect = this.autoSelect; this.popup.setSelectOnHover(this.setSelectOnHover); var oldRow = this.popup.getRow(); var previousSelectedItem = this.popup.data[oldRow]; this.popup.setData(this.completions.filtered, this.completions.filterText); if (this.editor.textInput.setAriaOptions) { this.editor.textInput.setAriaOptions({ activeDescendant: getAriaId(this.popup.getRow()), inline: this.inlineEnabled }); } editor.keyBinding.addKeyboardHandler(this.keyboardHandler); var newRow; if (this.stickySelection) newRow = this.popup.data.indexOf(previousSelectedItem); if (!newRow || newRow === -1) newRow = 0; this.popup.setRow(this.autoSelect ? newRow : -1); // If we stay on the same row, but the content is different, we want to update the popup. if (newRow === oldRow && previousSelectedItem !== this.completions.filtered[newRow]) this.$onPopupChange(); // If we stay on the same line and have inlinePreview enabled, we want to make sure the // ghost text remains up-to-date. const inlineEnabled = this.inlineRenderer && this.inlineEnabled; if (newRow === oldRow && inlineEnabled) { var completion = this.popup.getData(this.popup.getRow()); this.$updateGhostText(completion); } if (!keepPopupPosition) { this.popup.setTheme(editor.getTheme()); this.popup.setFontSize(editor.getFontSize()); this.$updatePopupPosition(); if (this.tooltipNode) { this.updateDocTooltip(); } } this.changeTimer.cancel(); this.observeLayoutChanges(); } /** * Detaches all elements from the editor, and cleans up the data for the session */ detach() { if (this.editor) { 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.$firstOpenTimer.cancel(); this.changeTimer.cancel(); this.hideDocTooltip(); if (this.completionProvider) { this.completionProvider.detach(); } if (this.popup && this.popup.isOpen) this.popup.hide(); if (this.popup && this.popup.renderer) { this.popup.renderer.off("afterRender", this.$onPopupRender); } if (this.base) this.base.detach(); this.activated = false; this.completionProvider = this.completions = this.base = null; this.unObserveLayoutChanges(); } changeListener(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(); } blurListener(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(); } } mousedownListener(e) { this.detach(); } mousewheelListener(e) { if (this.popup && !this.popup.isMouseOver) this.detach(); } mouseOutListener(e) { // Check whether the popup is still open after the mouseout event, // if so, attempt to move it to its desired position. if (this.popup.isOpen) this.$updatePopupPosition(); } goTo(where) { this.popup.goTo(where); } /** * @param {Completion} data * @param {undefined} [options] * @return {boolean | void} */ insertMatch(data, options) { if (!data) data = this.popup.getData(this.popup.getRow()); if (!data) return false; if (data.value === "") // Explicitly given nothing to insert, e.g. "No suggestion state" return this.detach(); var completions = this.completions; // @ts-expect-error TODO: potential wrong arguments var result = this.getCompletionProvider().insertMatch(this.editor, data, completions.filterText, options); // detach only if new popup was not opened while inserting match if (this.completions == completions) this.detach(); return result; } /** * This is the entry point for the autocompletion class, triggers the actions which collect and display suggestions * @param {Editor} editor * @param {CompletionOptions} [options] */ showPopup(editor, options) { 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(false, options); } /** * * @param {{pos: Position, prefix: string}} [initialPosition] * @return {CompletionProvider} */ getCompletionProvider(initialPosition) { if (!this.completionProvider) this.completionProvider = new CompletionProvider(initialPosition); return this.completionProvider; } /** * This method is deprecated, it is only kept for backwards compatibility. * Use the same method include CompletionProvider instead for the same functionality. * @deprecated */ gatherCompletions(editor, callback) { return this.getCompletionProvider().gatherCompletions(editor, callback); } /** * @param {boolean} keepPopupPosition * @param {CompletionOptions} [options] */ updateCompletions(keepPopupPosition, options) { 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; } if (options && options.matches) { var pos = this.editor.getSelectionRange().start; this.base = this.editor.session.doc.createAnchor(pos.row, pos.column); this.base.$insertRight = true; this.completions = new FilteredList(options.matches); this.getCompletionProvider().completions = this.completions; return this.openPopup(this.editor, "", keepPopupPosition); } var session = this.editor.getSession(); var pos = this.editor.getCursorPosition(); var prefix = util.getCompletionPrefix(this.editor); this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length); this.base.$insertRight = true; var completionOptions = { exactMatch: this.exactMatch, // @ts-expect-error TODO: couldn't find initializer ignoreCaption: this.ignoreCaption }; this.getCompletionProvider({ prefix, pos }).provideCompletions(this.editor, completionOptions, /** * @type {(err: any, completions: FilteredList, finished: boolean) => void | boolean} * @this {Autocomplete} */ function (err, completions, finished) { var filtered = completions.filtered; var prefix = util.getCompletionPrefix(this.editor); this.$firstOpenTimer.cancel(); if (finished) { // No results if (!filtered.length) { var emptyMessage = !this.autoShown && this.emptyMessage; if (typeof emptyMessage == "function") emptyMessage = this.emptyMessage(prefix); if (emptyMessage) { var completionsForEmpty = [{ caption: emptyMessage, value: "" } ]; this.completions = new FilteredList(completionsForEmpty); this.openPopup(this.editor, prefix, keepPopupPosition); this.popup.renderer.setStyle("ace_loading", false); this.popup.renderer.setStyle("ace_empty-message", true); return; } return this.detach(); } // One result equals to the prefix if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet) return this.detach(); // Autoinsert if one result if (this.autoInsert && !this.autoShown && filtered.length == 1) return this.insertMatch( filtered[0]); } // If showLoadingState is true and there is still a completer loading, show 'Loading...' // in the top row of the completer popup. this.completions = !finished && this.showLoadingState ? new FilteredList( Autocomplete.completionsForLoading.concat(filtered), completions.filterText ) : completions; this.openPopup(this.editor, prefix, keepPopupPosition); this.popup.renderer.setStyle("ace_empty-message", false); this.popup.renderer.setStyle("ace_loading", !finished); }.bind(this)); if (this.showLoadingState && !this.autoShown && !(this.popup && this.popup.isOpen)) { this.$firstOpenTimer.delay(this.stickySelectionDelay/2); } } cancelContextMenu() { this.editor.$mouseHandler.cancelContextMenu(); } updateDocTooltip() { var popup = this.popup; var all = this.completions && this.completions.filtered; var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]); var doc = null; if (!selected || !this.editor || !this.popup.isOpen) return this.hideDocTooltip(); var completersLength = this.editor.completers.length; for (var i = 0; i < completersLength; i++) { var completer = this.editor.completers[i]; if (completer.getDocTooltip && selected.completerId === completer.id) { doc = completer.getDocTooltip(selected); break; } } if (!doc && typeof selected != "string") doc = selected; if (typeof doc == "string") doc = {docText: doc}; if (!doc || !(doc.docHTML || doc.docText)) return this.hideDocTooltip(); this.showDocTooltip(doc); } showDocTooltip(item) { if (!this.tooltipNode) { this.tooltipNode = dom.createElement("div"); this.tooltipNode.style.margin = "0"; this.tooltipNode.style.pointerEvents = "auto"; this.tooltipNode.style.overscrollBehavior = "contain"; this.tooltipNode.tabIndex = -1; this.tooltipNode.onblur = this.blurListener.bind(this); this.tooltipNode.onclick = this.onTooltipClick.bind(this); this.tooltipNode.id = "doc-tooltip"; this.tooltipNode.setAttribute("role", "tooltip"); // prevent editor scroll if tooltip is inside an editor this.tooltipNode.addEventListener("wheel", preventParentScroll); } var theme = this.editor.renderer.theme; this.tooltipNode.className = "ace_tooltip ace_doc-tooltip " + (theme.isDark? "ace_dark " : "") + (theme.cssClass || ""); var tooltipNode = this.tooltipNode; if (item.docHTML) { tooltipNode.innerHTML = item.docHTML; } else if (item.docText) { tooltipNode.textContent = item.docText; } if (!tooltipNode.parentNode) this.popup.container.appendChild(this.tooltipNode); var popup = this.popup; var rect = popup.container.getBoundingClientRect(); var targetWidth = 400; var targetHeight = 300; var scrollBarSize = popup.renderer.scrollBar.width || 10; var leftSize = rect.left; var rightSize = window.innerWidth - rect.right - scrollBarSize; var topSize = popup.isTopdown ? window.innerHeight - scrollBarSize - rect.bottom : rect.top; var scores = [ Math.min(rightSize / targetWidth, 1), Math.min(leftSize / targetWidth, 1), Math.min(topSize / targetHeight, 1) * 0.9, ]; var max = Math.max.apply(Math, scores); var tooltipStyle = tooltipNode.style; tooltipStyle.display = "block"; if (max == scores[0] || scores[0] >= 1) { tooltipStyle.left = (rect.right + 1) + "px"; tooltipStyle.right = ""; tooltipStyle.maxWidth = targetWidth * max + "px"; tooltipStyle.top = rect.top + "px"; tooltipStyle.bottom = ""; tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px"; } else if (max == scores[1] || scores[1] >= 1) { tooltipStyle.right = window.innerWidth - rect.left + "px"; tooltipStyle.left = ""; tooltipStyle.maxWidth = targetWidth * max + "px"; tooltipStyle.top = rect.top + "px"; tooltipStyle.bottom = ""; tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px"; } else if (max == scores[2]) { tooltipStyle.left = rect.left + "px"; tooltipStyle.right = ""; tooltipStyle.maxWidth = Math.min(targetWidth, window.innerWidth - rect.left) + "px"; if (popup.isTopdown) { tooltipStyle.top = rect.bottom + "px"; tooltipStyle.bottom = ""; tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.bottom, targetHeight) + "px"; } else { tooltipStyle.top = ""; tooltipStyle.bottom = (window.innerHeight - rect.top) + "px"; tooltipStyle.maxHeight = Math.min(rect.top, targetHeight) + "px"; } } dom.$fixPositionBug(tooltipNode); } hideDocTooltip() { 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); } /** * @param e * @internal */ onTooltipClick(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; } } destroy() { this.detach(); if (this.popup) { this.popup.destroy(); var el = this.popup.container; if (el && el.parentNode) el.parentNode.removeChild(el); } if (this.editor && this.editor.completer == this) { this.editor.off("destroy", destroyCompleter); this.editor.completer = null; } this.inlineRenderer = this.popup = this.editor = null; } /** * @param {Editor} editor * @return {Autocomplete} */ static for(editor) { if (editor.completer instanceof Autocomplete) { return editor.completer; } if (editor.completer) { editor.completer.destroy(); editor.completer = null; } if (config.get("sharedPopups")) { if (!Autocomplete["$sharedInstance"]) Autocomplete["$sharedInstance"] = new Autocomplete(); editor.completer = Autocomplete["$sharedInstance"]; } else { editor.completer = new Autocomplete(); editor.once("destroy", destroyCompleter); } // @ts-expect-error return editor.completer; } } Autocomplete.prototype.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; }, "Backspace": function(editor) { editor.execCommand("backspace"); var prefix = util.getCompletionPrefix(editor); if (!prefix && editor.completer) editor.completer.detach(); }, "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); }, "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); } }; Autocomplete.startCommand = { name: "startAutocomplete", exec: function(editor, options) { var completer = Autocomplete.for(editor); completer.autoInsert = false; completer.autoSelect = true; completer.autoShown = false; completer.showPopup(editor, options); // prevent ctrl-space opening context menu on firefox on mac completer.cancelContextMenu(); }, bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space" }; /** * This class is responsible for providing completions and inserting them to the editor */ class CompletionProvider { /** * @param {{pos: Position, prefix: string}} [initialPosition] */ constructor(initialPosition) { this.initialPosition = initialPosition; this.active = true; } /** * @param {Editor} editor * @param {number} index * @param {CompletionProviderOptions} [options] * @returns {boolean} */ insertByIndex(editor, index, options) { if (!this.completions || !this.completions.filtered) { return false; } return this.insertMatch(editor, this.completions.filtered[index], options); } /** * @param {Editor} editor * @param {Completion} data * @param {CompletionProviderOptions} [options] * @returns {boolean} */ insertMatch(editor, data, options) { if (!data) return false; editor.startOperation({command: {name: "insertMatch"}}); if (data.completer && data.completer.insertMatch) { data.completer.insertMatch(editor, data); } else { // TODO add support for options.deleteSuffix if (!this.completions) return false; var replaceBefore = this.completions.filterText.length; var replaceAfter = 0; if (data.range && data.range.start.row === data.range.end.row) { replaceBefore -= this.initialPosition.prefix.length; replaceBefore += this.initialPosition.pos.column - data.range.start.column; replaceAfter += data.range.end.column - this.initialPosition.pos.column; } if (replaceBefore || replaceAfter) { var ranges; if (editor.selection.getAllRanges) { ranges = editor.selection.getAllRanges(); } else { ranges = [editor.getSelectionRange()]; } for (var i = 0, range; range = ranges[i]; i++) { range.start.column -= replaceBefore; range.end.column += replaceAfter; editor.session.remove(range); } } if (data.snippet) { snippetManager.insertSnippet(editor, data.snippet); } else { this.$insertString(editor, data); } if (data.completer && data.completer.onInsert && typeof data.completer.onInsert == "function") { data.completer.onInsert(editor, data); } if (data.command && data.command === "startAutocomplete") { editor.execCommand(data.command); } } editor.endOperation(); return true; } /** * @param {Editor} editor * @param {Completion} data */ $insertString(editor, data) { var text = data.value || data; editor.execCommand("insertstring", text); } /** * @param {Editor} editor * @param {import("../ace-internal").Ace.CompletionCallbackFunction} callback */ gatherCompletions(editor, callback) { var session = editor.getSession(); var pos = editor.getCursorPosition(); var prefix = util.getCompletionPrefix(editor); var matches = []; this.completers = editor.completers; var total = editor.completers.length; editor.completers.forEach(function(completer, i) { completer.getCompletions(editor, session, pos, prefix, function(err, results) { if (completer.hideInlinePreview) results = results.map((result) => { return Object.assign(result, {hideInlinePreview: completer.hideInlinePreview}); }); 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 is the entry point to the class, it gathers, then provides the completions asynchronously via callback. * The callback function may be called multiple times, the last invokation is marked with a `finished` flag * @param {Editor} editor * @param {CompletionProviderOptions} options * @param {(err: Error | undefined, completions: FilteredList | [], finished: boolean) => void} callback */ provideCompletions(editor, options, callback) { var processResults = function(results) { var prefix = results.prefix; var matches = results.matches; this.completions = new FilteredList(matches); if (options.exactMatch) this.completions.exactMatch = true; if (options.ignoreCaption) this.completions.ignoreCaption = true; this.completions.setFilter(prefix); if (results.finished || this.completions.filtered.length) callback(null, this.completions, results.finished); }.bind(this); var isImmediate = true; var immediateResults = null; this.gatherCompletions(editor, function(err, results) { if (!this.active) { return; } if (err) { callback(err, [], true); this.detach(); } var prefix = results.prefix; // Wrong prefix or wrong session -> ignore if (prefix.indexOf(results.prefix) !== 0) return; // If multiple completers return their results immediately, we want to process them together if (isImmediate) { immediateResults = results; return; } processResults(results); }.bind(this)); isImmediate = false; if (immediateResults) { var results = immediateResults; immediateResults = null; processResults(results); } } detach() { this.active = false; this.completers && this.completers.forEach(function(completer) { if (typeof completer.cancel === "function") { completer.cancel(); } }); } } class FilteredList { /** * @param {any} array * @param {string} [filterText] */ constructor(array, filterText) { this.all = array; this.filtered = array; this.filterText = filterText || ""; this.exactMatch = false; this.ignoreCaption = false; } setFilter(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 || (a.caption || a.value).localeCompare(b.caption || b.value); }); // 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; } filterCompletions(items, needle) { var results = []; var upper = needle.toUpperCase(); var lower = needle.toLowerCase(); loop: for (var i = 0, item; item = items[i]; i++) { if (item.skipFilter) { item.$score = item.score; results.push(item); continue; } var caption = (!this.ignoreCaption && item.caption) || item.value || 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 { /** * It is for situation then, for example, we find some like 'tab' in item.value="Check the table" * and want to see "Check the TABle" but see "Check The tABle". */ var fullMatchIndex = caption.toLowerCase().indexOf(lower); if (fullMatchIndex > -1) { penalty = fullMatchIndex; } 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 << j); } lastIndex = index; } } } item.matchMask = matchMask; item.exactMatch = penalty ? 0 : 1; item.$score = (item.score || 0) - penalty; results.push(item); } return results; } } exports.Autocomplete = Autocomplete; exports.CompletionProvider = CompletionProvider; exports.FilteredList = FilteredList; ================================================ FILE: src/autocomplete_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "use strict"; var sendKey = require("./test/user").type; var ace = require("./ace"); var assert = require("./test/assertions"); var user = require("./test/user"); var Range = require("./range").Range; var lang = require("./lib/lang"); require("./ext/language_tools"); var Autocomplete = require("./autocomplete").Autocomplete; var config = require("./config"); var MouseEvent = function(type, opts){ var e = document.createEvent("MouseEvents"); e.initMouseEvent(/click|wheel/.test(type) ? type : "mouse" + type, true, true, window, opts.detail, opts.x, opts.y, opts.x, opts.y, opts.ctrl, opts.alt, opts.shift, opts.meta, opts.button || 0, opts.relatedTarget); return e; }; var editor; function initEditor(value) { if (editor) { editor.destroy(); editor.container.remove(); editor = null; } editor = ace.edit(null, { value: value, minLines: 10, maxLines: 10, enableBasicAutocompletion: true, enableLiveAutocompletion: true }); document.body.appendChild(editor.container); editor.focus(); return editor; } var slowCompleter = { getCompletions: async function (editor, session, pos, prefix, callback) { var completions = [ { caption: "slow option 1", value: "s1", score: 3 }, { caption: "slow option 2", value: "s2", score: 0 } ]; await lang.sleep(200); callback(null, completions); } }; var fastCompleter = { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "fast option 1", value: "f1", score: 2 }, { caption: "fast option 2", value: "f2", score: 1 }, { caption: "fast option 3", value: "f3", score: 1 } ]; callback(null, completions); } }; module.exports = { tearDown: function() { if (editor) { editor.destroy(); editor.container.remove(); editor = null; } }, "test: highlighting in the popup": async function (done) { editor = initEditor("\narraysort alooooooooooooooooooooooooooooong_word"); assert.ok(!editor.container.querySelector("style")); sendKey("a"); await checkInnerHTML('arraysort localalooooooooooooooooooooooooooooong_word local'); sendKey("rr"); await checkInnerHTML('arraysort local'); sendKey("r"); await checkInnerHTML('arraysort local'); sendKey("Return"); assert.equal(editor.getValue(), "arraysort\narraysort alooooooooooooooooooooooooooooong_word"); editor.execCommand("insertstring", " looooooooooooooooooooooooooooong_"); await checkInnerHTML('alooooooooooooooooooooooooooooong_word local'); sendKey("Return"); var last; async function checkInnerHTML(expected) { var popup = editor.completer.popup; do { await popup.renderer.once("afterRender"); var innerHTML = popup.renderer.$textLayer.element.innerHTML .replace(/\s*style="[^"]+"|class=|(d)iv|(s)pan/g, "$1$2"); } while(innerHTML == last); assert.equal(innerHTML, expected); last = innerHTML; } done(); }, "test: completions range and command properties": async function (done) { editor = initEditor("goods "); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "will", snippet: "will: $1", meta: "snippet", command: "startAutocomplete", range: new Range(0, 4, 0, 7) }, { caption: "here", value: "-here", range: new Range(0, 8, 0, 10) } ]; callback(null, completions); } } ]; editor.moveCursorTo(0, 6); sendKey("w"); var popup = editor.completer.popup; await popup.renderer.once("afterRender"); assert.equal(popup.data.length, 1); editor.onCommandKey(null, 0, 13); assert.equal(popup.data.length, 2); assert.equal(editor.getValue(), "goodwill: "); await popup.renderer.once("afterRender"); editor.onCommandKey(null, 0, 13); assert.equal(editor.getValue(), "goodwill-here"); done(); }, "test: correct completion replacement range when completion prefix has more than one letter": async function (done) { editor = initEditor("<"); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "div", value: "div", range: new Range(0, 1, 0, 3) }, { caption: "dialog", value: "dialog", range: new Range(0, 1, 0, 3) } ]; callback(null, completions); } } ]; editor.moveCursorTo(0, 1); sendKey("di"); var popup = editor.completer.popup; await lang.sleep(10); assert.equal(popup.data.length, 2); editor.onCommandKey(null, 0, 13); await lang.sleep(10); assert.equal(editor.getValue(), "0 ' + '1 ' + '2 ' + '3 ' + '4 ' + '5 ' + '6 ' + '7 ' + '8 ' )); const prevSelected = popup.selectedNode; sendKey('Down'); await popup.renderer.once("afterRender"); assert.ok(checkAria( popup.selectedNode.outerHTML, '1 ' )); // check that the aria selected attributes have been removed from the previously selected element assert.ok(checkAria( prevSelected.outerHTML, '0 ' )); sendKey('Down'); await popup.renderer.once("afterRender"); assert.ok(checkAria( popup.selectedNode.outerHTML, '2 ' )); function checkAria(htmlElement, expected) { var actual = htmlElement.replace(/\s*style="[^"]+"|class="[^"]+"|(d)iv|(s)pan/g, "$1$2"); return actual === expected; } done(); }, "test: different completers tooltips": async function (done) { editor = initEditor(""); var firstDoc = "First"; var secondDoc = "Second"; editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "abc", snippet: "ab: $1", meta: "snippet", completerId: "firstCompleter" }, { caption: "cde", value: "cde", completerId: "firstCompleter" } ]; callback(null, completions); }, getDocTooltip: function (item) { if (!item.docHTML) { item.docHTML = firstDoc; } }, id: "firstCompleter" }, { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "abcd", snippet: "abcd: $1", meta: "snippet", completerId: "secondCompleter" }, { caption: "cdef", value: "cdef", completerId: "secondCompleter" } ]; callback(null, completions); }, getDocTooltip: function (item) { if (!item.docText) { item.docText = secondDoc; } }, id: "secondCompleter" } ]; sendKey("c"); var popup = editor.completer.popup; await lang.sleep(10); assert.equal(popup.data.length, 4); assert.equal(popup.container.lastChild.innerHTML, firstDoc); sendKey("Down"); await lang.sleep(10); assert.equal(popup.container.lastChild.innerHTML, secondDoc); sendKey("Down"); await lang.sleep(10); assert.equal(popup.container.lastChild.innerHTML, firstDoc); sendKey("Down"); await lang.sleep(10); assert.equal(popup.container.lastChild.innerHTML, secondDoc); done(); }, "test: completers tooltip filtering": async function (done) { editor = initEditor(""); var firstDoc = "First tooltip"; var secondDoc = "Second tooltip"; editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "case", value: "case" }, { caption: "catch", value: "catch" } ]; callback(null, completions); }, getDocTooltip: function (item) { if (item.value === 'case') { item.docHTML = firstDoc; } if (item.value === 'catch') { item.docHTML = secondDoc; } } } ]; sendKey("ca"); var popup = editor.completer.popup; await lang.sleep(10); assert.equal(popup.data.length, 2); assert.equal(popup.container.lastChild.innerHTML, firstDoc); sendKey("t"); await lang.sleep(10); assert.equal(popup.data.length, 1); assert.equal(popup.container.lastChild.innerHTML, secondDoc); done(); }, "test: slow and fast completers": async function(done) { var syncCompleter={ getCompletions: function(editor, session, pos, prefix, callback) { callback(null,[{ value: "test" }]); }, id: "asyncCompleter" }; var asyncCompleter = { getCompletions: async function(editor, session, pos, prefix, callback) { await lang.sleep(10); callback(null, [ { value: "some" } ]); }, id: "asyncCompleter" }; editor = initEditor(""); editor.completers=[ syncCompleter,asyncCompleter ]; editor.resize(true); editor.execCommand("insertstring", "o"); assert.notOk(!!editor.completer.popup); await lang.sleep(10); assert.ok(editor.completer.popup.isOpen); assert.equal(editor.completer.popup.renderer.scrollTop, 0); editor.completer.popup.renderer.$loop._flush(); assert.equal(editor.completer.popup.renderer.scrollTop, 0); assert.equal(editor.completer.popup.renderer.scroller.textContent, "some "); sendKey("Return"); assert.equal(editor.getValue(), "some"); sendKey(" "); assert.equal(editor.completer.popup.isOpen, false); sendKey("t"); assert.equal(editor.completer.popup.isOpen, true); sendKey("Return"); sendKey(" "); sendKey("q"); assert.equal(editor.completer.popup.isOpen, false); done(); }, "test: trigger autocomplete for specific characters": async function (done) { editor = initEditor("document"); var newLineCharacter = editor.session.doc.getNewLineCharacter(); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "append", value: "append" }, { caption: "all", value: "all" } ]; callback(null, completions); }, triggerCharacters: [".", newLineCharacter] } ]; editor.moveCursorTo(0, 8); user.type("."); var popup = editor.completer.popup; await popup.renderer.once("afterRender"); assert.equal(popup.data.length, 2); user.type("Return"); // Accept suggestion assert.equal(editor.getValue(), "document.all"); user.type(Array(4).fill("Backspace")); // Delete '.all' user.type("Return"); // Enter new line await popup.renderer.once("afterRender"); assert.equal(popup.data.length, 2); user.type("Return"); // Accept suggestion assert.equal(editor.getValue(), `document${newLineCharacter}all`); done(); }, "test: empty message if no suggestions available": function() { editor = initEditor(""); var emptyMessageText = "No suggestions."; var autocomplete = Autocomplete.for(editor); autocomplete.emptyMessage = () => emptyMessageText; user.type("thereisnoautosuggestionforthisword"); // Open autocompletion via key-binding and verify empty message user.type("Ctrl-Space"); assert.equal(editor.completer.popup.isOpen, true); assert.equal(editor.completer.popup.data[0].caption, emptyMessageText); assert.ok(editor.completer.popup.renderer.container.classList.contains("ace_empty-message")); user.type("Return"); assert.equal(editor.completer.popup.isOpen, false); }, "test: no empty message class if suggestions available": function() { editor = initEditor(""); var emptyMessageText = "No suggestions."; var autocomplete = Autocomplete.for(editor); autocomplete.emptyMessage = () => emptyMessageText; editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "append", value: "append" } ]; callback(null, completions); } } ]; user.type("b"); // Open autocompletion via key-binding and verify empty message class user.type("Ctrl-Space"); assert.equal(editor.completer.popup.isOpen, true); assert.equal(editor.completer.popup.data[0].caption, emptyMessageText); assert.ok(editor.completer.popup.renderer.container.classList.contains("ace_empty-message")); user.type("Backspace"); assert.equal(editor.completer.popup.isOpen, false); // Open autocompletion via key-binding and verify no empty message class user.type("Ctrl-Space"); assert.equal(editor.completer.popup.isOpen, true); assert.equal(editor.completer.popup.data[0].caption, "append"); assert.ok(!editor.completer.popup.renderer.container.classList.contains("ace_empty-message")); }, "test: liveAutocompleteDelay": async function(done) { editor = initEditor("hello world "); editor.setOptions({ liveAutocompletionDelay: 10, liveAutocompletionThreshold: 2 }); editor.completers = [{ getCompletions: function(editor, session, pos, prefix, callback) { callback(null,[{ value: "test" }]); } }, { getCompletions: function(editor, session, pos, prefix, callback) { this.timeout = setTimeout(() => { callback(null,[{ value: "slow test" }]); }, 50); }, cancel: function() { clearTimeout(this.timeout); this.timeout = null; } } ]; user.type(" "); user.type("t"); user.type("e"); var popup = editor.completer.popup; assert.ok(!popup || !popup.isOpen); await lang.sleep(11); assert.ok(editor.completer.popup.isOpen); assert.ok(editor.completers[1].timeout); user.type("Home"); await lang.sleep(0); assert.ok(editor.completer.popup.isOpen); assert.ok(editor.completers[1].timeout); user.type("Left"); await lang.sleep(0); assert.ok(!editor.completer.popup.isOpen); assert.ok(!editor.completers[1].timeout); done(); }, "test: scroll and resize": function() { editor = initEditor("hello world\n"); user.type("Ctrl-Space"); assert.equal(editor.completer.popup.isOpen, true); var called = false; editor.completer.$updatePopupPosition = function() { called = true; }; editor.container.parentNode.dispatchEvent(new CustomEvent("scroll")); assert.ok(called); editor.destroy(); editor.container.remove(); }, "test: selection should follow hovermarker if setSelectOnHover true": function() { editor = initEditor("hello world\n"); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "option 1", value: "one" }, { caption: "option 2", value: "two" }, { caption: "option 3", value: "three" } ]; callback(null, completions); } } ]; var completer = Autocomplete.for(editor); completer.setSelectOnHover = true; user.type("Ctrl-Space"); assert.equal(editor.completer.popup.isOpen, true); assert.equal(completer.popup.getRow(), 0); editor.completer.popup.renderer.$loop._flush(); var text = completer.popup.renderer.content.childNodes[2]; var rect = text.getBoundingClientRect(); // We need two mouse events to trigger the updating of the hover marker. text.dispatchEvent(new MouseEvent("move", {x: rect.left, y: rect.top})); // Hover over the second row. var lineHeight = completer.popup.renderer.lineHeight; text.dispatchEvent(new MouseEvent("move", {x: rect.left + 1, y: rect.top + 1.5 * lineHeight})); // Selected row should follow mouse. editor.completer.popup.renderer.$loop._flush(); assert.equal(completer.popup.getRow(), 1); }, "test: selection should not follow hovermarker if setSelectOnHover not set": function() { editor = initEditor("hello world\n"); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "option 1", value: "one" }, { caption: "option 2", value: "two" }, { caption: "option 3", value: "three" } ]; callback(null, completions); } } ]; var completer = Autocomplete.for(editor); user.type("Ctrl-Space"); assert.equal(editor.completer.popup.isOpen, true); assert.equal(completer.popup.getRow(), 0); var text = completer.popup.renderer.content.childNodes[2]; var rect = text.getBoundingClientRect(); // We need two mouse events to trigger the updating of the hover marker. text.dispatchEvent(new MouseEvent("move", {x: rect.left, y: rect.top})); // Hover over the second row. text.dispatchEvent(new MouseEvent("move", {x: rect.left + 1, y: rect.top + 20})); // Selected row should not follow mouse. editor.completer.popup.renderer.$loop._flush(); assert.equal(completer.popup.getRow(), 0); }, "test: should respect hideInlinePreview": function() { editor = initEditor("hello world\n"); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "option 1", value: "one", score: 3 } ]; callback(null, completions); }, hideInlinePreview: true }, { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "option 2", value: "two", score: 2 } ]; callback(null, completions); }, hideInlinePreview: false }, { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "option 3", value: "three", score: 1 } ]; callback(null, completions); } } ]; var completer = Autocomplete.for(editor); completer.inlineEnabled = true; user.type("Ctrl-Space"); var inline = completer.inlineRenderer; assert.equal(editor.completer.popup.isOpen, true); // Row 0, should hide inline preview. assert.equal(completer.popup.getRow(), 0); assert.strictEqual(inline.isOpen(), false); sendKey("Down"); // Row 1, should show inline preview. assert.equal(completer.popup.getRow(), 1); assert.strictEqual(inline.isOpen(), true); sendKey("Down"); // Row 2, should show inline preview. assert.equal(completer.popup.getRow(), 2); assert.strictEqual(inline.isOpen(), true); }, "test: should maintain selection on fast completer item when slow completer results come in": async function(done) { editor = initEditor("hello world\n"); editor.completers = [fastCompleter, slowCompleter]; var completer = Autocomplete.for(editor); completer.stickySelectionDelay = 100; user.type("Ctrl-Space"); assert.equal(completer.popup.isOpen, true); assert.equal(completer.popup.data.length, 3); assert.equal(completer.popup.getRow(), 0); await lang.sleep(300); completer.popup.renderer.$loop._flush(); assert.equal(completer.popup.data.length, 5); assert.equal(completer.popup.getRow(), 1); done(); }, "test: should not maintain selection on fast completer item when slow completer results come in when stickySelectionDelay negative": async function(done) { editor = initEditor("hello world\n"); var slowCompleter = { getCompletions: async function (editor, session, pos, prefix, callback) { var completions = [ { caption: "slow option 1", value: "s1", score: 3 }, { caption: "slow option 2", value: "s2", score: 0 } ]; await lang.sleep(200); callback(null, completions); } }; editor.completers = [fastCompleter, slowCompleter]; var completer = Autocomplete.for(editor); completer.stickySelectionDelay = -1; user.type("Ctrl-Space"); assert.equal(completer.popup.isOpen, true); assert.equal(completer.popup.data.length, 3); assert.equal(completer.popup.getRow(), 0); await lang.sleep(300); completer.popup.renderer.$loop._flush(); assert.equal(completer.popup.data.length, 5); assert.equal(completer.popup.getRow(), 0); done(); }, "test: should filter using caption if ignoreCaption false": function() { editor = initEditor("hello world\n"); var completer = { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "caption", value: "value" } ]; callback(null, completions); } }; editor.completers = [completer]; var completer = Autocomplete.for(editor); // Should filter using the caption if set to false. completer.ignoreCaption = false; user.type("cap"); assert.equal(completer.popup.isOpen, true); }, "test: should filter using value if ignoreCaption true": function() { editor = initEditor("hello world\n"); var completer = { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "caption", value: "value" } ]; callback(null, completions); } }; editor.completers = [completer]; var completer = Autocomplete.for(editor); // Should not filter using the caption if set to true. completer.ignoreCaption = true; user.type("cap"); assert.equal(completer.popup, undefined); // Should filter using the value instead. user.type(" value"); assert.equal(completer.popup.isOpen, true); }, "test: should skip filter if skipFilter flag is set to true in completion": function() { editor = initEditor("hello world\n"); var completer = { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { value: "example value", skipFilter: true } ]; callback(null, completions); } }; editor.completers = [completer]; var completer = Autocomplete.for(editor); // should not do filter out the completion item where skipFilter is true user.type("notMatchingText"); assert.equal(completer.popup.data.length, 1); assert.equal(completer.popup.isOpen, true); }, "test: should use filter if skipFilter flag is set to false in completion": function() { editor = initEditor("hello world\n"); var completer = { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { value: "example value", skipFilter: false } ]; callback(null, completions); } }; editor.completers = [completer]; var completer = Autocomplete.for(editor); // should do filter out the completion item where skipFilter is false user.type("notMatchingText"); assert.equal(completer.popup, undefined); // normal filtering mechanism should work fine user.type(" ex"); assert.equal(completer.popup.isOpen, true); assert.equal(completer.popup.data.length, 1); }, "test: should add inline preview content to aria-describedby": function() { editor = initEditor("fun"); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "function", value: "function\nthat does something\ncool" } ]; callback(null, completions); } } ]; var completer = Autocomplete.for(editor); completer.inlineEnabled = true; user.type("Ctrl-Space"); var inline = completer.inlineRenderer; // Popup should be open, with inline text renderered. assert.equal(completer.popup.isOpen, true); assert.equal(completer.popup.getRow(), 0); assert.strictEqual(inline.isOpen(), true); assert.strictEqual(editor.renderer.$ghostText.text, "function\nthat does something\ncool"); completer.popup.renderer.$loop._flush(); // aria-describedby of selected popup item should have aria-describedby set to the offscreen inline screen reader div and doc-tooltip. assert.strictEqual(completer.popup.selectedNode.getAttribute("aria-describedby"), "doc-tooltip ace-inline-screenreader-line-0 ace-inline-screenreader-line-1 ace-inline-screenreader-line-2 "); // The elements with these IDs should have the correct content. assert.strictEqual(document.getElementById("ace-inline-screenreader-line-0").textContent,"function"); assert.strictEqual(document.getElementById("ace-inline-screenreader-line-1").textContent,"that does something"); assert.strictEqual(document.getElementById("ace-inline-screenreader-line-2").textContent,"cool"); }, "test: update popup position only on mouse out when inline enabled and setSelectOnHover true": function() { editor = initEditor("fun"); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "functionshort", value: "function that does something uncool", score: 1 }, { caption: "functionlong", value: "function\nthat does something\ncool", score: 0 } ]; callback(null, completions); } } ]; var completer = Autocomplete.for(editor); completer.setSelectOnHover = true; completer.inlineEnabled = true; user.type("Ctrl-Space"); assert.equal(editor.completer.popup.isOpen, true); var called = false; editor.completer.$updatePopupPosition = function() { called = true; }; var inline = completer.inlineRenderer; assert.equal(completer.popup.getRow(), 0); assert.strictEqual(inline.isOpen(), true); assert.strictEqual(editor.renderer.$ghostText.text, "function that does something uncool"); var text = completer.popup.renderer.content.childNodes[2]; var rect = text.getBoundingClientRect(); // We need two mouse events to trigger the updating of the hover marker. text.dispatchEvent(new MouseEvent("move", {x: rect.left, y: rect.top})); // Hover over the second row. text.dispatchEvent(new MouseEvent("move", {x: rect.left + 1, y: rect.top + 20})); editor.completer.popup.renderer.$loop._flush(); // Check that the completion item changed to the longer item. assert.equal(completer.popup.getRow(), 1); assert.strictEqual(inline.isOpen(), true); assert.strictEqual(editor.renderer.$ghostText.text, "function\nthat does something\ncool"); // Check that position update of popup is not called. assert.ok(!called); text.dispatchEvent(new MouseEvent("out", {x: rect.left, y: rect.top})); editor.completer.popup.renderer.$loop._flush(); // Check that position update of popup is called after the mouseout. assert.ok(called); editor.destroy(); editor.container.remove(); }, "test: should display loading state": async function(done) { editor = initEditor("hello world\n"); editor.completers = [slowCompleter]; var completer = Autocomplete.for(editor); completer.stickySelectionDelay = 100; completer.showLoadingState = true; user.type("Ctrl-Space"); assert.ok(!(completer.popup && completer.popup.isOpen)); await lang.sleep(100); completer.popup.renderer.$loop._flush(); assert.equal(completer.popup.data.length, 1); assert.ok(isLoading()); await lang.sleep(150); assert.equal(completer.popup.data.length, 2); assert.ok(!isLoading()); user.type("Escape"); assert.ok(!(completer.popup && completer.popup.isOpen)); editor.completers = [fastCompleter, slowCompleter]; user.type("Ctrl-Space"); assert.equal(completer.popup.data.length, 4); // Should have top row saying 'Loading...' together with results. assert.ok(isLoading()); assert.equal(completer.popup.data[0].caption, "Loading..."); await lang.sleep(250); completer.popup.renderer.$loop._flush(); assert.equal(completer.popup.data.length, 5); assert.ok(!isLoading()); done(); function isLoading() { return completer.popup.renderer.container.classList.contains("ace_loading"); } }, "test: should not display loading state on no suggestion state": async function(done) { editor = initEditor("hello world\n"); editor.completers = [slowCompleter]; var completer = Autocomplete.for(editor); completer.stickySelectionDelay = 100; completer.emptyMessage = "no completions"; completer.showLoadingState = true; user.type("doesntmatchanything"); user.type("Ctrl-Space"); assert.ok(!(completer.popup && completer.popup.isOpen)); await lang.sleep(100); completer.popup.renderer.$loop._flush(); assert.equal(completer.popup.data.length, 1); assert.ok(isLoading()); await lang.sleep(150); // Should show no suggestions state without loading indicator assert.equal(completer.popup.data.length, 1); assert.equal(completer.popup.data[0].caption, "no completions"); assert.ok(!isLoading()); done(); function isLoading() { return completer.popup.renderer.container.classList.contains("ace_loading"); } }, "test: should display ghost text after loading state if inline preview enabled": async function(done) { editor = initEditor("hello world\n"); editor.completers = [slowCompleter]; var completer = Autocomplete.for(editor); completer.stickySelectionDelay = 100; completer.inlineEnabled = true; completer.showLoadingState = true; user.type("Ctrl-Space"); assert.ok(!(completer.popup && completer.popup.isOpen)); await lang.sleep(100); completer.popup.renderer.$loop._flush(); assert.equal(completer.popup.data.length, 1); assert.ok(isLoading()); await lang.sleep(150); assert.equal(completer.popup.data.length, 2); assert.ok(!isLoading()); assert.strictEqual(editor.renderer.$ghostText.text, "s1"); done(); function isLoading() { return completer.popup.renderer.container.classList.contains("ace_loading"); } }, "test: when completion gets inserted and call the onInsert method": function() { var isInserted = false; editor = initEditor("hello world"); var completer = { onInsert: function (_editor, el) { assert.ok(!isInserted, "should not have inserted something already"); isInserted = el.value === "one"; }, getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "option 1", value: "one", completer }, { caption: "option 2", value: "two", completer }, { caption: "option 3", value: "three", completer } ]; callback(null, completions); } }; editor.completers = [completer]; user.type("Ctrl-Space"); editor.completer.popup.renderer.$loop._flush(); assert.equal(editor.completer.popup.isOpen, true); assert.equal(editor.completer.popup.getRow(), 0); user.type("Return"); assert.ok(isInserted); }, "test: when completions get shown, call the onSeen method": function() { var seen = [false, false, false]; editor = initEditor("hello world"); var completer = { onSeen: function (_editor, el) { const index = ["one", "two", "three"].indexOf(el.value); if (index >= 0) { assert.ok(!seen[index], "should not be called double"); seen[index] = true; } }, getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "option 1", value: "one", completer }, { caption: "option 2", value: "two", completer }, { caption: "option 3", value: "three", completer } ]; callback(null, completions); } }; editor.completers = [ completer ]; Autocomplete.for(editor).inlineEnabled = true; user.type("Ctrl-Space"); editor.completer.popup.renderer.$loop._flush(); assert.equal(editor.completer.popup.isOpen, true); assert.equal(editor.completer.popup.getRow(), 0); assert.deepEqual(seen, [true, false, false]); }, "test: when inline completions get shown, call the onSeen method": function() { var seen = [false, false, false]; var calledDouble = false; editor = initEditor("hello world"); var completer = { onSeen: function (_editor, el) { const index = ["one", "two", "three"].indexOf(el.value); if (index >= 0) { if (seen[index]) calledDouble = true; seen[index] = true; } }, getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "option 1", value: "one", completer }, { caption: "option 2", value: "two", completer }, { caption: "option 3", value: "three", completer } ]; callback(null, completions); } }; editor.completers = [ completer ]; user.type("Ctrl-Space"); editor.completer.popup.renderer.$loop._flush(); assert.equal(editor.completer.popup.isOpen, true); assert.equal(editor.completer.popup.getRow(), 0); assert.deepEqual(seen, [true, true, true]); assert.ok(!calledDouble); }, "test: if there is very long ghost text, popup should be rendered at the bottom of the editor container": async function(done) { editor = initEditor("hello world\n"); // Give enough space for the popup to appear below the editor var initialDocumentHeight = document.body.style.height; document.body.style.height = editor.container.getBoundingClientRect().height + 200 + "px"; editor.renderer.$loop._flush(); var longCompleter = { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "loooooong", value: "line\n".repeat(20), score: 0 } ]; callback(null, completions); } }; editor.completers = [longCompleter]; var completer = Autocomplete.for(editor); completer.inlineEnabled = true; user.type("Ctrl-Space"); assert.ok(completer.popup && completer.popup.isOpen); // Wait to account for the renderer scrolling for the virtual renderer await lang.sleep(100); completer.popup.renderer.$loop._flush(); // Popup should start one pixel below the bottom of the editor container assert.equal( completer.popup.container.getBoundingClientRect().top, editor.container.getBoundingClientRect().bottom + 1 ); // Reset back to initial values document.body.style.height = initialDocumentHeight; editor.renderer.$loop._flush(); done(); }, "test: if there is ghost text, popup should be rendered at the bottom of the ghost text": async function(done) { editor = initEditor(""); var longCompleter = { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "loooooong", value: "line\n".repeat(5), score: 0 } ]; callback(null, completions); } }; editor.completers = [longCompleter]; var completer = Autocomplete.for(editor); completer.inlineEnabled = true; user.type("Ctrl-Space"); assert.ok(completer.popup && completer.popup.isOpen); // Wait to account for the renderer scrolling for the virtual renderer await lang.sleep(100); completer.popup.renderer.$loop._flush(); // Popup should start one pixel below the bottom of the ghost text assert.equal( completer.popup.container.getBoundingClientRect().top, editor.renderer.$ghostTextWidget.el.getBoundingClientRect().bottom + 1 ); done(); }, "test: should not show loading state when empty completer array is provided": function() { editor = initEditor(""); editor.completers = []; var completer = Autocomplete.for(editor); completer.showLoadingState = true; user.type("Ctrl-Space"); // Tooltip should not be open assert.ok(!(completer.popup && completer.popup.isOpen)); }, "test: should update inline preview when typing when it's the only item in the popup": async function(done) { editor = initEditor(""); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { caption: "function", value: "function\nthat does something\ncool" } ]; callback(null, completions); } } ]; var completer = Autocomplete.for(editor); completer.inlineEnabled = true; user.type("f"); var inline = completer.inlineRenderer; // Popup should be open, with inline text renderered. assert.equal(completer.popup.isOpen, true); assert.equal(completer.popup.getRow(), 0); assert.strictEqual(inline.isOpen(), true); assert.strictEqual(editor.renderer.$ghostText.text, "unction\nthat does something\ncool"); // when you keep typing, the ghost text should update accordingly user.type("unc"); await lang.sleep(100); assert.strictEqual(inline.isOpen(), true); assert.strictEqual(editor.renderer.$ghostText.text, "tion\nthat does something\ncool"); user.type("tio"); await lang.sleep(100); assert.strictEqual(inline.isOpen(), true); assert.strictEqual(editor.renderer.$ghostText.text, "n\nthat does something\ncool"); done(); }, "test: should keep showing ghost text when typing ahead with whitespace": async function(done) { editor = initEditor(""); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { value: "function that does something cool" } ]; callback(null, completions); } } ]; var completer = Autocomplete.for(editor); completer.inlineEnabled = true; user.type("f"); var inline = completer.inlineRenderer; // Popup should be open, with inline text renderered. assert.equal(completer.popup.isOpen, true); assert.equal(completer.popup.getRow(), 0); assert.strictEqual(inline.isOpen(), true); assert.strictEqual(editor.renderer.$ghostText.text, "unction that does something cool"); // when you keep typing, the ghost text should update accordingly user.type("unction th"); await lang.sleep(100); assert.strictEqual(inline.isOpen(), true); assert.strictEqual(editor.renderer.$ghostText.text, "at does something cool"); user.type("at do"); await lang.sleep(100); assert.strictEqual(inline.isOpen(), true); assert.strictEqual(editor.renderer.$ghostText.text, "es something cool"); done(); }, "test: passing matches from execCommand": function() { editor = initEditor(""); editor.execCommand('startAutocomplete', { matches: [ { value: 'example value' } ] }); user.type("\n"); assert.equal(editor.getValue(), "example value"); editor.resize(true); editor.insertSnippet("<$1-${1|a1,b2,c3|}>"); user.type("Down"); user.type("\n"); assert.equal(editor.getValue(), "example value"); }, "test: should close popup if backspacing until input is fully deleted": function() { editor = initEditor(""); editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = [ { value: "tabularhappiness" } ]; callback(null, completions); } } ]; var completer = Autocomplete.for(editor); completer.inlineEnabled = true; user.type("tab"); // Popup should be open assert.equal(completer.popup.isOpen, true); user.type("Backspace"); user.type("Backspace"); // Popup should still be open assert.equal(completer.popup.isOpen, true); user.type("Backspace"); // Popup should be closed now assert.equal(completer.popup.isOpen, false); }, "test: should set create shared Autocomplete with sharedPopups on": function() { assert.equal(Autocomplete.$sharedInstance == undefined, true); config.set("sharedPopups", true); var editor = initEditor(""); var completer = Autocomplete.for(editor); assert.equal(Autocomplete.$sharedInstance == undefined, false); config.set("sharedPopups", false); }, "test: changing completion should render scrollbars correctly": async function(done) { editor = initEditor("document"); var newLineCharacter = editor.session.doc.getNewLineCharacter(); var initialCompletions = [ { caption: "small", meta: "small", value: "small" } ]; var longCompletions = Array(10) .fill(null) .map((_, i) => ({ caption: `this is a really long string that I want to use for testing horizontal scroll ${i}`, meta: `meta ${i}`, value: `value ${i}` })); var currentCompletions = initialCompletions; editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { var completions = currentCompletions; callback(null, completions); }, triggerCharacters: [newLineCharacter] } ]; editor.moveCursorTo(0, 8); user.type("Return"); // Accept suggestion var popup = editor.completer.popup; await popup.renderer.once("afterRender"); assert.equal(popup.data.length, 1); assert.notOk(popup.renderer.scrollBar.isVisible); user.type("Return"); // Accept suggestion assert.equal(editor.getValue(), `document${newLineCharacter}small`); // change completion values currentCompletions = longCompletions; user.type("Return"); // Enter new line assert.equal(popup.renderer.layerConfig.height, popup.renderer.lineHeight * 1); assert.equal(popup.data.length, 10); await popup.renderer.once("afterRender"); assert.ok(popup.renderer.scrollBar.isVisible); assert.equal(popup.renderer.layerConfig.height, popup.renderer.lineHeight * 8); user.type("Return"); // Accept suggestion assert.equal(editor.getValue(), `document${newLineCharacter}small${newLineCharacter}value 0`); done(); }, "test: doc tooltip positioning": async function(done) { var editor = initEditor(""); var longDoc = "This is a very long documentation text that should wrap and test the tooltip width constraints."; editor.completers = [ { getCompletions: function (editor, session, pos, prefix, callback) { callback(null, [ { caption: "completion1", value: "completion1", docHTML: longDoc }, { caption: "completion2", value: "completion2" }, { caption: "completion3", value: "completion3" } ]); } } ]; editor.resize(); await editor.renderer.once("afterRender"); editor.completer.showPopup(editor); var popup = editor.completer.popup; var popupRect, tooltipRect; async function waitForDocTooltip() { editor.renderer.$loop._flush(); await lang.sleep(50); editor.completer.onLayoutChange(); var tooltipNode = editor.completer.tooltipNode; popupRect = popup.container.getBoundingClientRect(); tooltipRect = tooltipNode.getBoundingClientRect(); } // Mock the CSS behaviour popup.container.style.width = "300px"; popup.container.style.height = "300px"; var editorWidth = 400; editor.container.style.width = editorWidth + "px"; editor.container.style.height = "100px"; editor.container.style.left = "0px"; editor.container.style.top = "0px"; popup.container.style.positionHint = "fixed"; user.type("c"); await waitForDocTooltip(); assert.ok(tooltipRect.left > popupRect.right, "Tooltip should appear on the right"); editor.container.style.left = (window.innerWidth - editorWidth) + "px"; user.type("o"); await waitForDocTooltip(); assert.ok(tooltipRect.right <= popupRect.left, "Tooltip should appear on the left"); editor.container.style.left = "400px"; editor.container.style.top = "0px"; popup.container.style.width = (window.innerWidth - 100) + "px"; user.type("Escape"); user.type("Enter"); user.type("c"); await waitForDocTooltip(); assert.ok(tooltipRect.top >= popupRect.bottom, "Tooltip should appear below"); editor.container.style.top = (window.innerHeight - 100) + "px"; editor.container.style.left = "0px"; user.type("Escape"); user.type("Enter"); user.type("c"); await waitForDocTooltip(); assert.ok(tooltipRect.bottom <= popupRect.top, "Tooltip should appear above"); done(); }, }; require("./test/run")(module); ================================================ FILE: src/background_tokenizer.js ================================================ "use strict"; /** * @typedef {import("./document").Document} Document * @typedef {import("./edit_session").EditSession} EditSession * @typedef {import("./tokenizer").Tokenizer} Tokenizer */ 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 {EditSession} [session] The editor session to associate with **/ constructor(tokenizer, session) { /**@type {false | ReturnType}*/ this.running = false; this.lines = []; /**@type {string[]|string[][]}*/ 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 ++; // @ts-ignore 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); }; } /** * Sets a new tokenizer for this object. * @param {Tokenizer} tokenizer The new tokenizer to use **/ setTokenizer(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 **/ setDocument(doc) { this.doc = doc; this.lines = []; this.states = []; this.stop(); } /** * 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 **/ fireUpdateEvent(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 **/ start(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); } /** * Sets pretty long delay to prevent the tokenizer from interfering with the user */ scheduleStart() { if (!this.running) this.running = setTimeout(this.$worker, 700); } /** * @param {import("../ace-internal").Ace.Delta} delta */ $updateOnChange(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. **/ stop() { if (this.running) clearTimeout(this.running); this.running = false; } /** * Gives list of [[Token]]'s of the row. (tokens are cached) * @param {Number} row The row to get tokens at * @returns {import("../ace-internal").Ace.Token[]} **/ getTokens(row) { return this.lines[row] || this.$tokenizeRow(row); } /** * Returns the state of tokenization at the end of a row. * @param {Number} row The row to get state at * @returns {string | string[]} **/ getState(row) { if (this.currentLine == row) this.$tokenizeRow(row); return this.states[row] || "start"; } /** * @param {number} row */ $tokenizeRow(row) { var line = this.doc.getLine(row); var state = this.states[row - 1]; // @ts-expect-error TODO: potential wrong argument 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; } cleanup() { this.running = false; this.lines = []; this.states = []; this.currentLine = 0; this.removeAllListeners(); } } oop.implement(BackgroundTokenizer.prototype, EventEmitter); exports.BackgroundTokenizer = BackgroundTokenizer; ================================================ FILE: src/background_tokenizer_test.js ================================================ "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(); } }; require("./test/run")(module); ================================================ FILE: src/bidihandler.js ================================================ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession */ var bidiUtil = require("./lib/bidiutil"); var lang = require("./lib/lang"); var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/; /** * 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(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.$isRtl = false; this.line = ""; this.wrapIndent = 0; this.EOF = "\xB6"; this.RLE = "\u202B"; this.contentWidth = 0; this.fontMetrics = null; this.rtlLineOffset = 0; this.wrapOffset = 0; this.isMoveLeftOperation = false; this.seenBidi = bidiRE.test(session.getValue()); } /** * 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} screenRow the screen row to be checked * @param {Number} [docRow] the document row to be checked [optional] * @param {Number} [splitIndex] the wrapped screen line index [ optional] **/ isBidiRow(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; } /** * @param {import("../ace-internal").Ace.Delta} delta * @internal */ onChange(delta) { if (!this.seenBidi) { if (delta.action == "insert" && bidiRE.test(delta.lines.join("\n"))) { this.seenBidi = true; this.currentRow = null; } } else { this.currentRow = null; } } getDocumentRow() { 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; } getSplitIndex() { 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++; } } else { splitIndex = this.currentRow; } return splitIndex; } updateRowLine(docRow, splitIndex) { if (docRow === undefined) docRow = this.getDocumentRow(); var isLastRow = (docRow === this.session.getLength() - 1), endOfLine = isLastRow ? this.EOF : this.EOL; this.wrapIndent = 0; this.line = this.session.getLine(docRow); this.isRtlDir = this.$isRtl || this.line.charAt(0) === this.RLE; 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.wrapOffset = this.wrapIndent * this.charWidths[bidiUtil.L]; this.line = (splitIndex < splits.length) ? this.line.substring(splits[splitIndex - 1], splits[splitIndex]) : this.line.substring(splits[splits.length - 1]); } else { this.line = this.line.substring(0, splits[splitIndex]); } if (splitIndex == splits.length) { this.line += (this.showInvisibles) ? endOfLine : bidiUtil.DOT; } } } else { this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT; } /* 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; }); if (this.isRtlDir) { this.fontMetrics.$main.textContent = (this.line.charAt(this.line.length - 1) == bidiUtil.DOT) ? this.line.substr(0, this.line.length - 1) : this.line; this.rtlLineOffset = this.contentWidth - this.fontMetrics.$main.getBoundingClientRect().width; } } updateBidiMap() { var textCharTypes = []; if (bidiUtil.hasBidiCharacters(this.line, textCharTypes) || this.isRtlDir) { this.bidiMap = bidiUtil.doBidiReorder(this.line, textCharTypes, this.isRtlDir); } else { this.bidiMap = {}; } } /** * Resets stored info related to current screen row **/ markAsDirty() { this.currentRow = null; } /** * Updates array of character widths * @param {Object} fontMetrics metrics * **/ updateCharacterWidths(fontMetrics) { if (this.characterWidth === fontMetrics.$characterSize.width) return; this.fontMetrics = fontMetrics; 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] = bidiCharWidth * 0.45; this.charWidths[bidiUtil.B] = this.charWidths[bidiUtil.RLE] = 0; this.currentRow = null; } setShowInvisibles(showInvisibles) { this.showInvisibles = showInvisibles; this.currentRow = null; } setEolChar(eolChar) { this.EOL = eolChar; } setContentWidth(width) { this.contentWidth = width; } isRtlLine(row) { if (this.$isRtl) return true; if (row != undefined) return (this.session.getLine(row).charAt(0) == this.RLE); else return this.isRtlDir; } setRtlDirection(editor, isRtlDir) { var cursor = editor.getCursorPosition(); for (var row = editor.selection.getSelectionAnchor().row; row <= cursor.row; row++) { if (!isRtlDir && editor.session.getLine(row).charAt(0) === editor.session.$bidiHandler.RLE) editor.session.doc.removeInLine(row, 0, 1); else if (isRtlDir && editor.session.getLine(row).charAt(0) !== editor.session.$bidiHandler.RLE) editor.session.doc.insert({column: 0, row: row}, editor.session.$bidiHandler.RLE); } } /** * Returns offset of character at position defined by column. * @param {Number} col the screen column position * * @return {Number} horizontal pixel offset of given screen column **/ getPosLeft(col) { col -= this.wrapIndent; var leftBoundary = (this.line.charAt(0) === this.RLE) ? 1 : 0; var logicalIdx = (col > leftBoundary) ? (this.session.getOverwrite() ? col : col - 1) : leftBoundary; var visualIdx = bidiUtil.getVisualFromLogicalIdx(logicalIdx, this.bidiMap), levels = this.bidiMap.bidiLevels, left = 0; if (!this.session.getOverwrite() && col <= leftBoundary && levels[visualIdx] % 2 !== 0) visualIdx++; for (var i = 0; i < visualIdx; i++) { left += this.charWidths[levels[i]]; } if (!this.session.getOverwrite() && (col > leftBoundary) && (levels[visualIdx] % 2 === 0)) left += this.charWidths[levels[visualIdx]]; if (this.wrapIndent) left += this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset; if (this.isRtlDir) left += this.rtlLineOffset; return left; } /** * Returns 'selections' - array of objects defining set of selection rectangles * @param {Number} startCol the start column position * @param {Number} endCol the end column position * * @return {Object[]} Each object contains 'left' and 'width' values defining selection rectangle. **/ getSelections(startCol, endCol) { var map = this.bidiMap, levels = map.bidiLevels, level, selections = [], offset = 0, selColMin = Math.min(startCol, endCol) - this.wrapIndent, selColMax = Math.max(startCol, endCol) - this.wrapIndent, isSelected = false, isSelectedPrev = false, selectionStart = 0; if (this.wrapIndent) offset += this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset; 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}); } if(this.isRtlDir) { for (var i = 0; i < selections.length; i++) { selections[i].left += this.rtlLineOffset; } } return selections; } /** * Converts character coordinates on the screen to respective document column number * @param {Number} posX character horizontal offset * * @return {Number} screen column number corresponding to given pixel offset **/ offsetToCol(posX) { if(this.isRtlDir) posX -= this.rtlLineOffset; 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.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset; 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]; } if (logicalIdx === 0 && this.isRtlDir) logicalIdx++; return (logicalIdx + this.wrapIndent); } } exports.BidiHandler = BidiHandler; ================================================ FILE: src/clipboard.js ================================================ "use strict"; var $cancelT; module.exports = { /** @type {string|false} */ lineMode: false, pasteCancelled: function() { if ($cancelT && $cancelT > Date.now() - 50) return true; return $cancelT = false; }, cancel: function() { $cancelT = Date.now(); } }; ================================================ FILE: src/commands/command_manager.js ================================================ "use strict"; /** * * @typedef {import("../editor").Editor} Editor */ var oop = require("../lib/oop"); var MultiHashHandler = require("../keyboard/hash_handler").MultiHashHandler; var EventEmitter = require("../lib/event_emitter").EventEmitter; class CommandManager extends MultiHashHandler{ /** * new CommandManager(platform, commands) * @param {import("../keyboard/hash_handler").Platform} platform Identifier for the platform; must be either `"mac"` or `"win"` * @param {any[]} commands A list of commands **/ constructor(platform, commands) { super(commands, platform); this.byName = this.commands; this.setDefaultHandler("exec", function(e) { if (!e.args) { return e.command.exec(e.editor, {}, e.event, true); } return e.command.exec(e.editor, e.args, e.event, false); }); } /** * * @param {string | string[] | import("../../ace-internal").Ace.Command} command * @param {Editor} editor * @param {any} args * @returns {boolean} */ exec(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]; var e = {editor: editor, command: command, args: args}; if (!this.canExecute(command, editor)) { this._signal("commandUnavailable", e); return false; } e.returnValue = this._emit("exec", e); this._signal("afterExec", e); return e.returnValue === false ? false : true; } /** * * @param {string | import("../../ace-internal").Ace.Command} command * @param {Editor} editor * @returns {boolean} */ canExecute(command, editor) { if (typeof command === "string") command = this.commands[command]; if (!command) return false; if (editor && editor.$readOnly && !command.readOnly) return false; if (this.$checkCommandState != false && command.isAvailable && !command.isAvailable(editor)) return false; return true; } /** * @param {Editor} editor * @returns {boolean} */ toggleRecording(editor) { if (this.$inReplay) return; editor && editor._emit("changeStatus"); if (this.recording) { this.macro.pop(); this.off("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; } /** * @param {Editor} editor */ replay(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; } } trimMacro(m) { return m.map(function(x){ if (typeof x[0] != "string") x[0] = x[0].name; if (!x[1]) x = x[0]; return x; }); } } oop.implement(CommandManager.prototype, EventEmitter); exports.CommandManager = CommandManager; ================================================ FILE: src/commands/command_manager_test.js ================================================ "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); this.cm.$checkCommandState = 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"] + ""); } }; require("../test/run")(module); ================================================ FILE: src/commands/default_commands.js ================================================ "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" */ /**@type {import("../../ace-internal").Ace.Command[]} */ exports.commands = [{ name: "showSettingsMenu", description: "Show settings menu", bindKey: bindKey("Ctrl-,", "Command-,"), exec: function(editor) { config.loadModule("ace/ext/settings_menu", function(module) { module.init(editor); editor.showSettingsMenu(); }); }, readOnly: true }, { name: "goToNextError", description: "Go to next error", 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", description: "Go to previous error", 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", description: "Select all", bindKey: bindKey("Ctrl-A", "Command-A"), exec: function(editor) { editor.selectAll(); }, readOnly: true }, { name: "centerselection", description: "Center selection", bindKey: bindKey(null, "Ctrl-L"), exec: function(editor) { editor.centerSelection(); }, readOnly: true }, { name: "gotoline", description: "Go to line...", bindKey: bindKey("Ctrl-L", "Command-L"), exec: function(editor, line) { // backwards compatibility if (typeof line === "number" && !isNaN(line)) editor.gotoLine(line); editor.prompt({ $type: "gotoLine" }); }, 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", description: "Toggle fold widget", bindKey: bindKey("F2", "F2"), exec: function(editor) { editor.session.toggleFoldWidget(); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "toggleParentFoldWidget", description: "Toggle parent fold widget", bindKey: bindKey("Alt-F2", "Alt-F2"), exec: function(editor) { editor.session.toggleFoldWidget(true); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "foldall", description: "Fold all", bindKey: bindKey(null, "Ctrl-Command-Option-0"), exec: function(editor) { editor.session.foldAll(); }, scrollIntoView: "center", readOnly: true }, { name: "foldAllComments", description: "Fold all comments", bindKey: bindKey(null, "Ctrl-Command-Option-0"), exec: function(editor) { editor.session.foldAllComments(); }, scrollIntoView: "center", readOnly: true }, { name: "foldOther", description: "Fold other", 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", description: "Unfold all", bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"), exec: function(editor) { editor.session.unfold(); }, scrollIntoView: "center", readOnly: true }, { name: "findnext", description: "Find next", bindKey: bindKey("Ctrl-K", "Command-G"), exec: function(editor) { editor.findNext(); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "findprevious", description: "Find previous", bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"), exec: function(editor) { editor.findPrevious(); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "selectOrFindNext", description: "Select or find next", bindKey: bindKey("Alt-K", "Ctrl-G"), exec: function(editor) { if (editor.selection.isEmpty()) editor.selection.selectWord(); else editor.findNext(); }, readOnly: true }, { name: "selectOrFindPrevious", description: "Select or find previous", 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", description: "Find", bindKey: bindKey("Ctrl-F", "Command-F"), exec: function(editor) { config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor);}); }, readOnly: true }, { name: "overwrite", description: "Overwrite", bindKey: "Insert", exec: function(editor) { editor.toggleOverwrite(); }, readOnly: true }, { name: "selecttostart", description: "Select to start", 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", description: "Go to start", bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"), exec: function(editor) { editor.navigateFileStart(); }, multiSelectAction: "forEach", readOnly: true, scrollIntoView: "animate", aceCommandGroup: "fileJump" }, { name: "selectup", description: "Select up", bindKey: bindKey("Shift-Up", "Shift-Up|Ctrl-Shift-P"), exec: function(editor) { editor.getSelection().selectUp(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "golineup", description: "Go line up", bindKey: bindKey("Up", "Up|Ctrl-P"), exec: function(editor, args) { editor.navigateUp(args.times); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selecttoend", description: "Select to end", 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", description: "Go to end", bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"), exec: function(editor) { editor.navigateFileEnd(); }, multiSelectAction: "forEach", readOnly: true, scrollIntoView: "animate", aceCommandGroup: "fileJump" }, { name: "selectdown", description: "Select down", bindKey: bindKey("Shift-Down", "Shift-Down|Ctrl-Shift-N"), exec: function(editor) { editor.getSelection().selectDown(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "golinedown", description: "Go line down", bindKey: bindKey("Down", "Down|Ctrl-N"), exec: function(editor, args) { editor.navigateDown(args.times); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectwordleft", description: "Select word left", bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"), exec: function(editor) { editor.getSelection().selectWordLeft(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotowordleft", description: "Go to word left", bindKey: bindKey("Ctrl-Left", "Option-Left"), exec: function(editor) { editor.navigateWordLeft(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selecttolinestart", description: "Select to line start", 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", description: "Go to line start", bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"), exec: function(editor) { editor.navigateLineStart(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectleft", description: "Select left", bindKey: bindKey("Shift-Left", "Shift-Left|Ctrl-Shift-B"), exec: function(editor) { editor.getSelection().selectLeft(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotoleft", description: "Go to left", bindKey: bindKey("Left", "Left|Ctrl-B"), exec: function(editor, args) { editor.navigateLeft(args.times); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectwordright", description: "Select word right", bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"), exec: function(editor) { editor.getSelection().selectWordRight(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotowordright", description: "Go to word right", bindKey: bindKey("Ctrl-Right", "Option-Right"), exec: function(editor) { editor.navigateWordRight(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selecttolineend", description: "Select to line end", 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", description: "Go to line end", bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"), exec: function(editor) { editor.navigateLineEnd(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectright", description: "Select right", bindKey: bindKey("Shift-Right", "Shift-Right"), exec: function(editor) { editor.getSelection().selectRight(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotoright", description: "Go to right", bindKey: bindKey("Right", "Right|Ctrl-F"), exec: function(editor, args) { editor.navigateRight(args.times); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectpagedown", description: "Select page down", bindKey: "Shift-PageDown", exec: function(editor) { editor.selectPageDown(); }, readOnly: true }, { name: "pagedown", description: "Page down", bindKey: bindKey(null, "Option-PageDown"), exec: function(editor) { editor.scrollPageDown(); }, readOnly: true }, { name: "gotopagedown", description: "Go to page down", bindKey: bindKey("PageDown", "PageDown|Ctrl-V"), exec: function(editor) { editor.gotoPageDown(); }, readOnly: true }, { name: "selectpageup", description: "Select page up", bindKey: "Shift-PageUp", exec: function(editor) { editor.selectPageUp(); }, readOnly: true }, { name: "pageup", description: "Page up", bindKey: bindKey(null, "Option-PageUp"), exec: function(editor) { editor.scrollPageUp(); }, readOnly: true }, { name: "gotopageup", description: "Go to page up", bindKey: "PageUp", exec: function(editor) { editor.gotoPageUp(); }, readOnly: true }, { name: "scrollup", description: "Scroll up", bindKey: bindKey("Ctrl-Up", null), exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); }, readOnly: true }, { name: "scrolldown", description: "Scroll down", bindKey: bindKey("Ctrl-Down", null), exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); }, readOnly: true }, { name: "selectlinestart", description: "Select line start", bindKey: "Shift-Home", exec: function(editor) { editor.getSelection().selectLineStart(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectlineend", description: "Select line end", bindKey: "Shift-End", exec: function(editor) { editor.getSelection().selectLineEnd(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "togglerecording", description: "Toggle recording", bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"), exec: function(editor) { editor.commands.toggleRecording(editor); }, readOnly: true }, { name: "replaymacro", description: "Replay macro", bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"), exec: function(editor) { editor.commands.replay(editor); }, readOnly: true }, { name: "jumptomatching", description: "Jump to matching", bindKey: bindKey("Ctrl-\\|Ctrl-P", "Command-\\"), exec: function(editor) { editor.jumpToMatching(); }, multiSelectAction: "forEach", scrollIntoView: "animate", readOnly: true }, { name: "selecttomatching", description: "Select to matching", bindKey: bindKey("Ctrl-Shift-\\|Ctrl-Shift-P", "Command-Shift-\\"), exec: function(editor) { editor.jumpToMatching(true); }, multiSelectAction: "forEach", scrollIntoView: "animate", readOnly: true }, { name: "expandToMatching", description: "Expand to matching", bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"), exec: function(editor) { editor.jumpToMatching(true, true); }, multiSelectAction: "forEach", scrollIntoView: "animate", readOnly: true }, { name: "passKeysToBrowser", description: "Pass keys to browser", bindKey: bindKey(null, null), exec: function() {}, passEvent: true, readOnly: true }, { name: "copy", description: "Copy", exec: function(editor) { // placeholder for replay macro }, readOnly: true }, // commands disabled in readOnly mode { name: "cut", description: "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", description: "Paste", exec: function(editor, args) { editor.$handlePaste(args); }, scrollIntoView: "cursor" }, { name: "removeline", description: "Remove line", bindKey: bindKey("Ctrl-D", "Command-D"), exec: function(editor) { editor.removeLines(); }, scrollIntoView: "cursor", multiSelectAction: "forEachLine" }, { name: "duplicateSelection", description: "Duplicate selection", bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"), exec: function(editor) { editor.duplicateSelection(); }, scrollIntoView: "cursor", multiSelectAction: "forEach" }, { name: "sortlines", description: "Sort lines", bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"), exec: function(editor) { editor.sortLines(); }, scrollIntoView: "selection", multiSelectAction: "forEachLine" }, { name: "togglecomment", description: "Toggle comment", bindKey: bindKey("Ctrl-/", "Command-/"), exec: function(editor) { editor.toggleCommentLines(); }, multiSelectAction: "forEachLine", scrollIntoView: "selectionPart" }, { name: "toggleBlockComment", description: "Toggle block comment", bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"), exec: function(editor) { editor.toggleBlockComment(); }, multiSelectAction: "forEach", scrollIntoView: "selectionPart" }, { name: "modifyNumberUp", description: "Modify number up", bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"), exec: function(editor) { editor.modifyNumber(1); }, scrollIntoView: "cursor", multiSelectAction: "forEach" }, { name: "modifyNumberDown", description: "Modify number down", bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"), exec: function(editor) { editor.modifyNumber(-1); }, scrollIntoView: "cursor", multiSelectAction: "forEach" }, { name: "replace", description: "Replace", bindKey: bindKey("Ctrl-H", "Command-Option-F"), exec: function(editor) { config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true);}); } }, { name: "undo", description: "Undo", bindKey: bindKey("Ctrl-Z", "Command-Z"), exec: function(editor) { editor.undo(); } }, { name: "redo", description: "Redo", bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"), exec: function(editor) { editor.redo(); } }, { name: "copylinesup", description: "Copy lines up", bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"), exec: function(editor) { editor.copyLinesUp(); }, scrollIntoView: "cursor" }, { name: "movelinesup", description: "Move lines up", bindKey: bindKey("Alt-Up", "Option-Up"), exec: function(editor) { editor.moveLinesUp(); }, scrollIntoView: "cursor" }, { name: "copylinesdown", description: "Copy lines down", bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"), exec: function(editor) { editor.copyLinesDown(); }, scrollIntoView: "cursor" }, { name: "movelinesdown", description: "Move lines down", bindKey: bindKey("Alt-Down", "Option-Down"), exec: function(editor) { editor.moveLinesDown(); }, scrollIntoView: "cursor" }, { name: "del", description: "Delete", bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"), exec: function(editor) { editor.remove("right"); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "backspace", description: "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", description: "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", description: "Remove to line start", bindKey: bindKey("Alt-Backspace", "Command-Backspace"), exec: function(editor) { editor.removeToLineStart(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "removetolineend", description: "Remove to line end", bindKey: bindKey("Alt-Delete", "Ctrl-K|Command-Delete"), exec: function(editor) { editor.removeToLineEnd(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "removetolinestarthard", description: "Remove to line start hard", 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", description: "Remove to line end hard", 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", description: "Remove word left", bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"), exec: function(editor) { editor.removeWordLeft(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "removewordright", description: "Remove word right", bindKey: bindKey("Ctrl-Delete", "Alt-Delete"), exec: function(editor) { editor.removeWordRight(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "outdent", description: "Outdent", bindKey: bindKey("Shift-Tab", "Shift-Tab"), exec: function(editor) { editor.blockOutdent(); }, multiSelectAction: "forEach", scrollIntoView: "selectionPart" }, { name: "indent", description: "Indent", bindKey: bindKey("Tab", "Tab"), exec: function(editor) { editor.indent(); }, multiSelectAction: "forEach", scrollIntoView: "selectionPart" }, { name: "blockoutdent", description: "Block outdent", bindKey: bindKey("Ctrl-[", "Ctrl-["), exec: function(editor) { editor.blockOutdent(); }, multiSelectAction: "forEachLine", scrollIntoView: "selectionPart" }, { name: "blockindent", description: "Block indent", bindKey: bindKey("Ctrl-]", "Ctrl-]"), exec: function(editor) { editor.blockIndent(); }, multiSelectAction: "forEachLine", scrollIntoView: "selectionPart" }, { name: "insertstring", description: "Insert string", exec: function(editor, str) { editor.insert(str); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "inserttext", description: "Insert text", exec: function(editor, args) { editor.insert(lang.stringRepeat(args.text || "", args.times || 1)); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "splitline", description: "Split line", bindKey: bindKey(null, "Ctrl-O"), exec: function(editor) { editor.splitLine(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "transposeletters", description: "Transpose letters", bindKey: bindKey("Alt-Shift-X", "Ctrl-T"), exec: function(editor) { editor.transposeLetters(); }, multiSelectAction: function(editor) {editor.transposeSelections(1); }, scrollIntoView: "cursor" }, { name: "touppercase", description: "To uppercase", bindKey: bindKey("Ctrl-U", "Ctrl-U"), exec: function(editor) { editor.toUpperCase(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "tolowercase", description: "To lowercase", bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"), exec: function(editor) { editor.toLowerCase(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "autoindent", description: "Auto Indent", bindKey: bindKey(null, null), exec: function(editor) { editor.autoIndent(); }, scrollIntoView: "animate" }, { name: "expandtoline", description: "Expand to line", 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: "openlink", bindKey: bindKey("Ctrl+F3", "F3"), exec: function(editor) { editor.openLink(); } }, { name: "joinlines", description: "Join lines", 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", description: "Invert selection", 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" }, { name: "addLineAfter", description: "Add new line after the current line", exec: function(editor) { editor.selection.clearSelection(); editor.navigateLineEnd(); editor.insert("\n"); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "addLineBefore", description: "Add new line before the current line", exec: function(editor) { editor.selection.clearSelection(); var cursor = editor.getCursorPosition(); editor.selection.moveTo(cursor.row - 1, Number.MAX_VALUE); editor.insert("\n"); if (cursor.row === 0) editor.navigateUp(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "openCommandPallete", exec: function(editor) { console.warn("This is an obsolete command. Please use `openCommandPalette` instead."); editor.prompt({ $type: "commands" }); }, readOnly: true }, { name: "openCommandPalette", description: "Open command palette", bindKey: bindKey("F1", "F1"), exec: function(editor) { editor.prompt({ $type: "commands" }); }, readOnly: true }, { name: "modeSelect", description: "Change language mode...", bindKey: bindKey(null, null), exec: function(editor) { editor.prompt({ $type: "modes" }); }, readOnly: true }]; for (var i = 1; i < 9; i++) { exports.commands.push({ name: "foldToLevel" + i, description: "Fold To Level " + i, level: i, exec: function(editor) { editor.session.foldToLevel(this.level); }, scrollIntoView: "center", readOnly: true }); } ================================================ FILE: src/commands/incremental_search_commands.js ================================================ 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() { /** * @param editor * @this {IncrementalSearchKeyboardHandler & this & {$commandExecHandler}} */ this.attach = function(editor) { var iSearch = this.$iSearch; HashHandler.call(this, exports.iSearchCommands, editor.commands.platform); this.$commandExecHandler = editor.commands.on('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 {IncrementalSearchKeyboardHandler & this & {$commandExecHandler}} * @param editor */ this.detach = function(editor) { if (!this.$commandExecHandler) return; editor.commands.off('exec', this.$commandExecHandler); delete this.$commandExecHandler; }; var handleKeyboard$super = this.handleKeyboard; /** * @param data * @param hashId * @param key * @param keyCode * @this {IncrementalSearchKeyboardHandler & import("../keyboard/hash_handler").HashHandler} */ this.handleKeyboard = function(data, hashId, key, keyCode) { if (((hashId === 1/*ctrl*/ || hashId === 8/*command*/) && key === 'v') || (hashId === 1/*ctrl*/ && key === 'y')) return null; // @ts-ignore var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); if (cmd && 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: src/commands/multi_select_commands.js ================================================ /** * commands to enter multiselect mode * @type {import("../../ace-internal").Ace.Command[]} */ exports.defaultCommands = [{ name: "addCursorAbove", description: "Add cursor above", exec: function(editor) { editor.selectMoreLines(-1); }, bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"}, scrollIntoView: "cursor", readOnly: true }, { name: "addCursorBelow", description: "Add cursor below", exec: function(editor) { editor.selectMoreLines(1); }, bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"}, scrollIntoView: "cursor", readOnly: true }, { name: "addCursorAboveSkipCurrent", description: "Add cursor above (skip current)", exec: function(editor) { editor.selectMoreLines(-1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"}, scrollIntoView: "cursor", readOnly: true }, { name: "addCursorBelowSkipCurrent", description: "Add cursor below (skip current)", exec: function(editor) { editor.selectMoreLines(1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"}, scrollIntoView: "cursor", readOnly: true }, { name: "selectMoreBefore", description: "Select more before", exec: function(editor) { editor.selectMore(-1); }, bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"}, scrollIntoView: "cursor", readOnly: true }, { name: "selectMoreAfter", description: "Select more after", exec: function(editor) { editor.selectMore(1); }, bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"}, scrollIntoView: "cursor", readOnly: true }, { name: "selectNextBefore", description: "Select next before", exec: function(editor) { editor.selectMore(-1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"}, scrollIntoView: "cursor", readOnly: true }, { name: "selectNextAfter", description: "Select next after", exec: function(editor) { editor.selectMore(1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"}, scrollIntoView: "cursor", readOnly: true }, { name: "toggleSplitSelectionIntoLines", description: "Split selection into lines", exec: function(editor) { if (editor.multiSelect.rangeCount > 1) editor.multiSelect.joinSelections(); else editor.multiSelect.splitIntoLines(); }, bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"}, readOnly: true }, { name: "splitSelectionIntoLines", description: "Split into lines", exec: function(editor) { editor.multiSelect.splitIntoLines(); }, readOnly: true }, { name: "alignCursors", description: "Align cursors", exec: function(editor) { editor.alignCursors(); }, bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}, scrollIntoView: "cursor" }, { name: "findAll", description: "Find all", exec: function(editor) { editor.findAll(); }, bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"}, scrollIntoView: "cursor", readOnly: true }]; /** * commands active only in multiselect mode * @type {import("../../ace-internal").Ace.Command[]} */ exports.multiSelectCommands = [{ name: "singleSelection", description: "Single selection", 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: src/commands/occur_commands.js ================================================ 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) { // @ts-ignore 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: src/config.js ================================================ "no use strict"; var lang = require("./lib/lang"); var net = require("./lib/net"); var dom = require("./lib/dom"); var AppConfig = require("./lib/app_config").AppConfig; module.exports = exports = new AppConfig(); /** @type {import("../ace-internal").Ace.ConfigOptions} */ var options = { packaged: false, workerPath: null, modePath: null, themePath: null, basePath: "", suffix: ".js", $moduleUrls: {}, loadWorkerFromBlob: true, sharedPopups: false, useStrictCSP: null }; /** * @template {keyof import("../ace-internal").Ace.ConfigOptions} K * @param {K} key - The key of the config option to retrieve. * @returns {import("../ace-internal").Ace.ConfigOptions[K]} - The value of the config option. */ exports.get = function(key) { if (!options.hasOwnProperty(key)) throw new Error("Unknown config key: " + key); return options[key]; }; /** * @template {keyof import("../ace-internal").Ace.ConfigOptions} K * @param {K} key * @param {import("../ace-internal").Ace.ConfigOptions[K]} value */ exports.set = function(key, value) { if (options.hasOwnProperty(key)) options[key] = value; else if (this.setDefaultValue("", key, value) == false) throw new Error("Unknown config key: " + key); if (key == "useStrictCSP") dom.useStrictCSP(value); }; /** * @return {import("../ace-internal").Ace.ConfigOptions} */ exports.all = function() { return lang.copyObject(options); }; exports.$modes = {}; /** * module loading * @param {string} name * @param {string} [component] * @returns {string} */ 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"); }; /** * @param {string} name * @param {string} subst * @returns {string} */ exports.setModuleUrl = function(name, subst) { return options.$moduleUrls[name] = subst; }; var loader = function(moduleName, cb) { if (moduleName === "ace/theme/textmate" || moduleName === "./theme/textmate") return cb(null, require("./theme/textmate")); if (customLoader) return customLoader(moduleName, cb); console.error("loader is not configured"); }; var customLoader; /** @arg {(name: string, callback: (error: any, module: any) => void) => void} cb */ exports.setLoader = function(cb) { customLoader = cb; }; exports.dynamicModules = Object.create(null); exports.$loading = {}; exports.$loaded = {}; /** * @param {string | [string, string]} moduleId * @param {(module: any) => void} onLoad */ exports.loadModule = function(moduleId, onLoad) { var loadedModule; if (Array.isArray(moduleId)) { var moduleType = moduleId[0]; var moduleName = moduleId[1]; } else if (typeof moduleId == "string") { var moduleName = moduleId; } var load = function (module) { // 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() { loader(moduleName, function(err, module) { if (module) exports.$loaded[moduleName] = 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); reportErrorIfPathIsNotConfigured(); }; if (exports.dynamicModules[moduleName]) { exports.dynamicModules[moduleName]().then(function (module) { if (module.default) { load(module.default); } else { load(module); } }); } else { // backwards compatibility for node and packaged version try { loadedModule = this.$require(moduleName); } catch (e) {} load(loadedModule || exports.$loaded[moduleName]); } }; exports.$require = function(moduleName) { if (typeof module["require"] == "function") { var req = "require"; return module[req](moduleName); } }; exports.setModuleLoader = function (moduleName, onLoad) { exports.dynamicModules[moduleName] = onLoad; }; var reportErrorIfPathIsNotConfigured = function() { if ( !options.basePath && !options.workerPath && !options.modePath && !options.themePath && !Object.keys(options.$moduleUrls).length ) { console.error( "Unable to infer path to ace from script src,", "use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes", "or with webpack use ace/webpack-resolver" ); reportErrorIfPathIsNotConfigured = function() {}; } }; exports.version = "1.43.6"; ================================================ FILE: src/config_test.js ================================================ "use strict"; var config = require("./config"); var assert = require("./test/assertions"); var {defaultEnglishMessages} = require("./lib/default_english_messages"); module.exports = { tearDown: function() { config.setMessages(defaultEnglishMessages); }, "test: path resolution" : function(done) { config.set("packaged", true); var url = config.moduleUrl("kr_theme", "theme"); assert.equal(url, "theme-kr_theme.js"); config.set("basePath", "a/b"); url = config.moduleUrl("m/theme", "theme"); assert.equal(url, "a/b/theme-m.js"); url = config.moduleUrl("m/theme", "ext"); assert.equal(url, "a/b/ext-theme.js"); config.set("workerPath", "c/"); url = config.moduleUrl("foo/1", "worker"); assert.equal(url, "c/worker-1.js"); config.setModuleUrl("foo/1", "a/b1.js"); url = config.moduleUrl("foo/1", "theme"); assert.equal(url, "a/b1.js"); url = config.moduleUrl("snippets/js"); assert.equal(url, "a/b/snippets/js.js"); config.setModuleUrl("snippets/js", "_.js"); url = config.moduleUrl("snippets/js"); assert.equal(url, "_.js"); url = config.moduleUrl("ace/ext/textarea"); assert.equal(url, "a/b/ext-textarea.js"); config.set("packaged", false); /* global Promise*/ var callback = () => Promise.resolve("success"); config.setModuleLoader("ace/test-module", callback); assert.equal(config.dynamicModules["ace/test-module"], callback); config.loadModule("ace/test-module", (module) => { assert.equal(module, "success"); done(); }); }, "test: nls": function() { var nls = config.nls; config.setMessages({ foo: "hello world of $1", test_key: "hello world for test key" }); assert.equal(nls("untranslated_key","bar $1"), "bar $1"); assert.equal(nls("untranslated_key", "bar"), "bar"); assert.equal(nls("untranslated_key_but_translated_default_string", "foo"), "hello world of $1"); assert.equal(nls("untranslated_key_but_translated_default_string", "foo", {1: "goo"}), "hello world of goo"); assert.equal(nls("untranslated_key", "$0B is $1$$", [0.11, 22]), "0.11B is 22$"); assert.equal(nls("untranslated_key_but_translated_default_string", "foo", {1: "goo"}), "hello world of goo"); assert.equal(nls("test_key", "this text should not appear"), "hello world for test key"); }, "test: nls setting nlsPlaceholders": function() { var nls = config.nls; // Should default to using dollar signs config.setMessages({ test_with_curly_brackets: "hello world $0 of {0} and $1 to the {1} degree" }); assert.equal(nls("test_with_curly_brackets", "hello world $0 of {1} and $1 to the {1} degree", ["bar", "third"]), "hello world bar of {0} and third to the {1} degree"); config.setMessages({ test_with_curly_brackets: "hello world $0 of {0} and $1 to the {1} degree" }, {placeholders: "curlyBrackets"}); assert.equal(nls("test_with_curly_brackets", "hello world $0 of {1} and $1 to the {1} degree", ["bar", "third"]), "hello world $0 of bar and $1 to the third degree"); config.setMessages({ test_with_curly_brackets: "hello world $0 of {0} and $1 to the {1} degree" }, {placeholders: "dollarSigns"}); assert.equal(nls("test_with_curly_brackets", "hello world $0 of {1} and $1 to the {1} degree", ["bar", "third"]), "hello world bar of {0} and third to the {1} degree"); }, "test: define options" : function() { var o = {}; config.defineOptions(o, "test_object", { opt1: { set: function(val) { this.x = val; }, value: 7 }, initialValue: { set: function(val) { this.x = val; }, initialValue: 8 }, opt2: { get: function(val) { return this.x; } }, forwarded: "model" }); o.model = {}; config.defineOptions(o.model, "model", { forwarded: {value: 1} }); config.resetOptions(o); config.resetOptions(o.model); assert.equal(o.getOption("opt1"), 7); assert.equal(o.getOption("opt2"), 7); o.setOption("opt1", 8); assert.equal(o.getOption("opt1"), 8); assert.equal(o.getOption("opt2"), 8); assert.equal(o.getOption("forwarded"), 1); assert.equal(o.getOption("new"), undefined); o.setOption("new", 0); assert.equal(o.getOption("new"), undefined); assert.equal(o.getOption("initialValue"), 8); o.setOption("initialValue", 7); assert.equal(o.getOption("opt2"), 7); config.setDefaultValues("test_object", { opt1: 1, forwarded: 2 }); config.resetOptions(o); assert.equal(o.getOption("opt1"), 1); assert.equal(o.getOption("forwarded"), 2); } }; require("./test/run")(module); ================================================ FILE: src/css/editor-css.js ================================================ /* 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< .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons { padding-right: 13px; } .ace_fold-widget, .ace_custom-widget { 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; pointer-events: auto; } .ace_custom-widget { background: none; } .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_inline_button { border: 1px solid lightgray; display: inline-block; margin: -1px 8px; padding: 0 5px; pointer-events: auto; cursor: pointer; } .ace_inline_button:hover { border-color: gray; background: rgba(200,200,200,0.2); display: inline-block; pointer-events: auto; } .ace_fold-widget.ace_invalid { background-color: #FFB4B4; border-color: #DE5555; } .ace_fade-fold-widgets .ace_fold-widget { transition: opacity 0.4s ease 0.05s; opacity: 0; } .ace_fade-fold-widgets:hover .ace_fold-widget { 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; } .ace_mobile-menu { position: absolute; line-height: 1.5; border-radius: 4px; -ms-user-select: none; -moz-user-select: none; -webkit-user-select: none; user-select: none; background: white; box-shadow: 1px 3px 2px grey; border: 1px solid #dcdcdc; color: black; } .ace_dark > .ace_mobile-menu { background: #333; color: #ccc; box-shadow: 1px 3px 2px grey; border: 1px solid #444; } .ace_mobile-button { padding: 2px; cursor: pointer; overflow: hidden; } .ace_mobile-button:hover { background-color: #eee; opacity:1; } .ace_mobile-button:active { background-color: #ddd; } .ace_placeholder { position: relative; font-family: arial; transform: scale(0.9); transform-origin: left; white-space: pre; opacity: 0.7; margin: 0 10px; z-index: 1; } .ace_ghost_text { opacity: 0.5; font-style: italic; } .ace_ghost_text_container > div { white-space: pre; } .ghost_text_line_wrapped::after { content: "↩"; position: absolute; } .ace_lineWidgetContainer.ace_ghost_text { margin: 0px 4px } .ace_screenreader-only { position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden; } .ace_hidden_token { display: none; }`; ================================================ FILE: src/document.js ================================================ "use strict"; /** * @typedef {import("../ace-internal").Ace.Delta} Delta * @typedef {import("../ace-internal").Ace.Point} Point * @typedef {import("../ace-internal").Ace.IRange} IRange * @typedef {import("../ace-internal").Ace.NewLineMode} NewLineMode */ var oop = require("./lib/oop"); var applyDelta = require("./apply_delta").applyDelta; var EventEmitter = require("./lib/event_emitter").EventEmitter; var Range = require("./range").Range; var Anchor = require("./anchor").Anchor; /** * Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s. * At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index. **/ class Document { /** * * Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty. * @param {String | String[]} textOrLines text The starting text **/ constructor(textOrLines) { /**@type {string[]}*/ this.$lines = [""]; // There has to be one line at least in the document. If you pass an empty // string to the insert function, nothing will happen. Workaround. if (textOrLines.length === 0) { this.$lines = [""]; } else if (Array.isArray(textOrLines)) { this.insertMergedLines({row: 0, column: 0}, textOrLines); } else { this.insert({row: 0, column:0}, textOrLines); } } /** * Replaces all the lines in the current `Document` with the value of `text`. * * @param {String} text The text to use **/ setValue(text) { var len = this.getLength() - 1; this.remove(new Range(0, 0, len, this.getLine(len).length)); this.insert({row: 0, column: 0}, text || ""); } /** * Returns all the lines in the document as a single string, joined by the new line character. * @returns {String} **/ getValue() { return this.getAllLines().join(this.getNewLineCharacter()); } /** * Creates a new `Anchor` to define a floating point in the document. * @param {Number} row The row number to use * @param {Number} column The column number to use * @returns {Anchor} **/ createAnchor(row, column) { return new Anchor(this, row, column); } /** * @param {string} text */ $detectNewLine(text) { var match = text.match(/^.*?(\r\n|\r|\n)/m); this.$autoNewLine = match ? match[1] : "\n"; this._signal("changeNewLineMode"); } /** * Returns the newline character that's being used, depending on the value of `newLineMode`. * @returns {String} If `newLineMode == windows`, `\r\n` is returned. * If `newLineMode == unix`, `\n` is returned. * If `newLineMode == auto`, the value of `autoNewLine` is returned. * **/ getNewLineCharacter() { switch (this.$newLineMode) { case "windows": return "\r\n"; case "unix": return "\n"; default: return this.$autoNewLine || "\n"; } } /** * [Sets the new line mode.]{: #Document.setNewLineMode.desc} * @param {NewLineMode} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`] **/ setNewLineMode(newLineMode) { if (this.$newLineMode === newLineMode) return; this.$newLineMode = newLineMode; this._signal("changeNewLineMode"); } /** * Returns the type of newlines being used; either `windows`, `unix`, or `auto` * @returns {NewLineMode} **/ getNewLineMode() { return this.$newLineMode; } /** * Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`). * @param {String} text The text to check * @returns {boolean} **/ isNewLine(text) { return (text == "\r\n" || text == "\r" || text == "\n"); } /** * Returns a verbatim copy of the given line as it is in the document * @param {Number} row The row index to retrieve * @returns {string} **/ getLine(row) { return this.$lines[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[]} **/ getLines(firstRow, lastRow) { return this.$lines.slice(firstRow, lastRow + 1); } /** * Returns all lines in the document as string array. * @returns {string[]} **/ getAllLines() { return this.getLines(0, this.getLength()); } /** * Returns the number of rows in the document. * @returns {Number} **/ getLength() { return this.$lines.length; } /** * Returns all the text within `range` as a single string. * @param {IRange} range The range to work with. * * @returns {String} **/ getTextRange(range) { return this.getLinesForRange(range).join(this.getNewLineCharacter()); } /** * Returns all the text within `range` as an array of lines. * @param {IRange} range The range to work with. * * @returns {string[]} **/ getLinesForRange(range) { var lines; if (range.start.row === range.end.row) { // Handle a single-line range. lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)]; } else { // Handle a multi-line range. lines = this.getLines(range.start.row, range.end.row); lines[0] = (lines[0] || "").substring(range.start.column); var l = lines.length - 1; if (range.end.row - range.start.row == l) lines[l] = lines[l].substring(0, range.end.column); } return lines; } // Deprecated methods retained for backwards compatibility. /** * @param row * @param lines * @deprecated */ insertLines(row, lines) { console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."); return this.insertFullLines(row, lines); } /** * @param firstRow * @param lastRow * @returns {String[]} * @deprecated */ removeLines(firstRow, lastRow) { console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."); return this.removeFullLines(firstRow, lastRow); } /** * @param position * @returns {Point} * @deprecated */ insertNewLine(position) { console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."); return this.insertMergedLines(position, ["", ""]); } /** * Inserts a block of `text` at the indicated `position`. * @param {Point} position The position to start inserting at; it's an object that looks like `{ row: row, column: column}` * @param {String} text A chunk of text to insert * @returns {Point} The position ({row, column}) of the last line of `text`. If the length of `text` is 0, this function simply returns `position`. **/ insert(position, text) { // Only detect new lines if the document has no line break yet. if (this.getLength() <= 1) this.$detectNewLine(text); return this.insertMergedLines(position, this.$split(text)); } /** * Inserts `text` into the `position` at the current row. This method also triggers the `"change"` event. * * This differs from the `insert` method in two ways: * 1. This does NOT handle newline characters (single-line text only). * 2. This is faster than the `insert` method for single-line text insertions. * * @param {Point} position The position to insert at; it's an object that looks like `{ row: row, column: column}` * @param {String} text A chunk of text without new lines * @returns {Point} Returns the position of the end of the inserted text **/ insertInLine(position, text) { var start = this.clippedPos(position.row, position.column); var end = this.pos(position.row, position.column + text.length); this.applyDelta({ start: start, end: end, action: "insert", lines: [text] }, true); return this.clonePos(end); } /** * * @param {number} row * @param {number} column * @return {Point} */ clippedPos(row, column) { var length = this.getLength(); if (row === undefined) { row = length; } else if (row < 0) { row = 0; } else if (row >= 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}; } /** * @param {Point} pos * @return {Point} */ clonePos(pos) { return {row: pos.row, column: pos.column}; } /** * @param {number} row * @param {number} column * @return {Point} */ pos(row, column) { return {row: row, column: column}; } /** * @param {Point} position * @return {Point} * @private */ $clipPosition(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; } /** * 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 {string[]} lines An array of strings **/ insertFullLines(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 {Point} position * @param {string[]} lines An array of strings * @returns {Point} 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} * ``` **/ insertMergedLines(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 {IRange} range A specified Range to remove * @returns {Point} 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`. **/ remove(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 {Point} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.
    If `startColumn` is equal to `endColumn`, this function returns nothing. **/ removeInLine(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. **/ removeFullLines(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 * **/ removeNewLine(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 | IRange} range A specified Range to replace * @param {String} text The new text to use as a replacement * @returns {Point} 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. * **/ replace(range, text) { if (!(range instanceof Range)) range = Range.fromPoints(range.start, range.end); // @ts-expect-error 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 {Delta[]} deltas An array of delta objects (can include "insert" and "remove" actions) **/ applyDeltas(deltas) { for (var i=0; i=0; i--) { this.revertDelta(deltas[i]); } } /** * Applies `delta` to the document. * @param {Delta} delta A delta object (can include "insert" and "remove" actions) * @param {boolean} [doNotValidate] **/ applyDelta(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); } else { applyDelta(this.$lines, delta, doNotValidate); this._signal("change", delta); } } /** * @param {Delta} delta */ $safeApplyDelta(delta) { var docLength = this.$lines.length; // verify that delta is in the document to prevent applyDelta from corrupting lines array if ( delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength || delta.action == "insert" && delta.start.row <= docLength ) { this.applyDelta(delta); } } /** * * @param {Delta} delta * @param {number} MAX */ $splitAndapplyLargeDelta(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 - MAX + 1; var row = delta.start.row; var column = delta.start.column; for (var from = 0, to = 0; from < l; from = to) { to += MAX - 1; var chunk = lines.slice(from, to); chunk.push(""); this.applyDelta({ start: this.pos(row + from, column), end: this.pos(row + to, column = 0), action: delta.action, lines: chunk }, true); } // Update remaining delta. delta.lines = lines.slice(from); delta.start.row = row + from; delta.start.column = column; this.applyDelta(delta, true); } /** * Reverts `delta` from the document. * @param {Delta} delta A delta object (can include "insert" and "remove" actions) **/ revertDelta(delta) { this.$safeApplyDelta({ 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 {Point} A `{row, column}` object of the `index` position */ indexToPosition(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: index + lines[l-1].length + newlineLength}; } /** * 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 {Point} 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 */ positionToIndex(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; } /** * Splits a string of text on any newline (`\n`) or carriage-return (`\r`) characters. * * @method $split * @param {String} text The text to work with * @returns {String[]} A String array, with each index containing a piece of the original `text` string. * **/ $split(text) { return text.split(/\r\n|\r|\n/); } } Document.prototype.$autoNewLine = ""; Document.prototype.$newLineMode = "auto"; oop.implement(Document.prototype, EventEmitter); exports.Document = Document; ================================================ FILE: src/document_test.js ================================================ "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: insertInLine" : function() { var doc = new Document(["12", "34"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.insertInLine({row: 0, column: 1}, "a"); assert.equal(doc.getValue(), ["1a2", "34"].join("\n")); doc.insertInLine({row: 10, column: Infinity}, "b"); assert.equal(doc.getValue(), ["1a2", "34b"].join("\n")); doc.insertInLine({row: undefined, column: Infinity}, "x"); assert.equal(doc.getValue(), ["1a2", "34b", "x"].join("\n")); doc.insertInLine({row: -1, column: Infinity}, "z"); assert.equal(doc.getValue(), ["1a2z", "34b", "x"].join("\n")); doc.removeInLine(0, 1, 2); assert.equal(doc.getValue(), ["12z", "34b", "x"].join("\n")); doc.removeInLine(0, 2, 10); assert.equal(doc.getValue(), ["12", "34b", "x"].join("\n")); doc.removeNewLine(1); assert.equal(doc.getValue(), ["12", "34bx"].join("\n")); doc.removeNewLine(1); assert.equal(doc.getValue(), ["12", "34bx"].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")); assert.equal(doc.getNewLineMode(), "unix"); assert.ok(doc.isNewLine("\r")); assert.ok(doc.isNewLine("\n")); assert.ok(doc.isNewLine("\r\n")); assert.notOk(doc.isNewLine("\n\r")); }, "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 = 20000 - 1; for (var i = 0; i < 4 * MAX; i++) { val += i + "\n"; } var changeCount = 0; function testDelta(delta) { changeCount++; assert.equal(delta.lines.length, MAX + 1); } doc.on("change", testDelta); doc.setValue(val); doc.off("change", testDelta); assert.equal(changeCount, 4); assert.equal(doc.getValue(), val); for (var i = 2 * MAX + 20; i >= 2 * MAX - 20; 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"); } }, "test: indexToPosition": function() { function test(value) { var doc = new Document(value); var secondLine = value.indexOf("|"); for (var i = -2; i < value.length + 4; i++) { if (value[i - 1] == "\r") continue; var pos = doc.indexToPosition(i); var text = doc.getTextRange({start: {row: 0, column: 0}, end: pos}); assert.equal(text, value.substring(0, i)); assert.equal(doc.positionToIndex(pos), i); if (i >= secondLine) { assert.deepEqual(doc.indexToPosition(i - secondLine, 1), pos); assert.equal(doc.positionToIndex(pos, 1), i - secondLine); } } } test("abc\n|defx\ngh"); test("abc\r\n|defx\r\ngh"); } }; require("./test/run")(module); ================================================ FILE: src/edit_session/bracket_match.js ================================================ "use strict"; /** * @typedef {import("../edit_session").EditSession} EditSession * @typedef {import("../edit_session").Point} Point */ var TokenIterator = require("../token_iterator").TokenIterator; var Range = require("../range").Range; function BracketMatch() { /** * * @param {Point} position * @param {string} [chr] * @this {EditSession} */ 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); }; /** * @param {Point} pos * @return {null|Range} * @this {EditSession} */ 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; }; /** * Returns: * * null if there is no any bracket at `pos`; * * two Ranges if there is opening and closing brackets; * * one Range if there is only one bracket * * @param {Point} pos * @param {boolean} [isBackwards] * @returns {null|Range[]} * @this {EditSession} */ this.getMatchingBracketRanges = function(pos, isBackwards) { var line = this.getLine(pos.row); var bracketsRegExp = /([\(\[\{])|([\)\]\}])/; var chr = !isBackwards && line.charAt(pos.column - 1); var match = chr && chr.match(bracketsRegExp); if (!match) { chr = (isBackwards === undefined || isBackwards) && line.charAt(pos.column); pos = { row: pos.row, column: pos.column + 1 }; match = chr && chr.match(bracketsRegExp); } if (!match) return null; var startRange = new Range(pos.row, pos.column - 1, pos.row, pos.column); var bracketPos = match[1] ? this.$findClosingBracket(match[1], pos) : this.$findOpeningBracket(match[2], pos); if (!bracketPos) return [startRange]; var endRange = new Range(bracketPos.row, bracketPos.column, bracketPos.row, bracketPos.column + 1); return [startRange, endRange]; }; this.$brackets = { ")": "(", "(": ")", "]": "[", "[": "]", "{": "}", "}": "{", "<": ">", ">": "<" }; /** * * @param {string} bracket * @param {Point} position * @param {RegExp} [typeRe] * @return {Point|null} * @this {EditSession} */ 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)") .replace(/-close\b/, "-(close|open)") + ")+" ); } // 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; }; /** * * @param {string} bracket * @param {Point} position * @param {RegExp} [typeRe] * @return {Point|null} * @this {EditSession} */ 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)") .replace(/-open\b/, "-(close|open)") + ")+" ); } // 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; }; /** * Returns [[Range]]'s for matching tags and tag names, if there are any * @param {Point} pos * @returns {{closeTag: Range, closeTagName: Range, openTag: Range, openTagName: Range} | undefined} * @this {EditSession} */ this.getMatchingTags = function (pos) { var iterator = new TokenIterator(this, pos.row, pos.column); var token = this.$findTagName(iterator); if (!token) return; var prevToken = iterator.stepBackward(); if (prevToken.value === '<') { return this.$findClosingTag(iterator, token); } else { return this.$findOpeningTag(iterator, token); } }; this.$findTagName = function (iterator) { var token = iterator.getCurrentToken(); var found = false; var backward = false; if (token && token.type.indexOf('tag-name') === -1) { do { if (backward) token = iterator.stepBackward(); else token = iterator.stepForward(); if (token) { if (token.value === "/>") { //changing iterator direction for self-closing tags, when cursor is in between tag //name and tag closing backward = true; } else if (token.type.indexOf('tag-name') !== -1) { found = true; } } } while (token && !found); } return token; }; this.$findClosingTag = function (iterator, token) { var prevToken; var currentTag = token.value; var tag = token.value; var depth = 0; var openTagStart = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1 ); token = iterator.stepForward(); var openTagName = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + token.value.length ); var foundOpenTagEnd = false; do { prevToken = token; if (prevToken.type.indexOf('tag-close') !== -1 && !foundOpenTagEnd) { var openTagEnd = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1 ); //Range for `>` foundOpenTagEnd = true; } token = iterator.stepForward(); if (token) { if (token.value === '>' && !foundOpenTagEnd) { var openTagEnd = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1 ); //Range for `>` foundOpenTagEnd = true; } if (token.type.indexOf('tag-name') !== -1) { currentTag = token.value; if (tag === currentTag) { if (prevToken.value === '<') { depth++; } else if (prevToken.value === '') { var closeTagEnd = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1 ); //Range for > } else { return; } } } } } else if (tag === currentTag && token.value === '/>') { // self-closing tag depth--; if (depth < 0) {//found self-closing tag end //Example: //`` - closing part of tag consist of `closeTagStart`, `closeTagName` and `closeTagEnd` var closeTagStart = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 2 ); var closeTagName = closeTagStart; var closeTagEnd = closeTagName; var openTagEnd = new Range(openTagName.end.row, openTagName.end.column, openTagName.end.row, openTagName.end.column + 1 ); } } } } while (token && depth >= 0); if (openTagStart && openTagEnd && closeTagStart && closeTagEnd && openTagName && closeTagName) { return { openTag: new Range(openTagStart.start.row, openTagStart.start.column, openTagEnd.end.row, openTagEnd.end.column ), closeTag: new Range(closeTagStart.start.row, closeTagStart.start.column, closeTagEnd.end.row, closeTagEnd.end.column ), openTagName: openTagName, closeTagName: closeTagName }; } }; this.$findOpeningTag = function (iterator, token) { var prevToken = iterator.getCurrentToken(); var tag = token.value; var depth = 0; var startRow = iterator.getCurrentTokenRow(); var startColumn = iterator.getCurrentTokenColumn(); var endColumn = startColumn + 2; //closing tag var closeTagStart = new Range(startRow, startColumn, startRow, endColumn); //Range for ") return; var closeTagEnd = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1 ); //Range for > iterator.stepBackward(); iterator.stepBackward(); do { token = prevToken; startRow = iterator.getCurrentTokenRow(); startColumn = iterator.getCurrentTokenColumn(); endColumn = startColumn + token.value.length; prevToken = iterator.stepBackward(); if (token) { if (token.type.indexOf('tag-name') !== -1) { if (tag === token.value) { if (prevToken.value === '<') { depth++; if (depth > 0) {//found opening tag var openTagName = new Range(startRow, startColumn, startRow, endColumn); var openTagStart = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1 ); //Range for < do { token = iterator.stepForward(); } while (token && token.value !== '>'); var openTagEnd = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1 ); //Range for > } } else if (prevToken.value === '') { // self-closing tag var stepCount = 0; var tmpToken = prevToken; while (tmpToken) { if (tmpToken.type.indexOf('tag-name') !== -1 && tmpToken.value === tag) { depth--; break; } else if (tmpToken.value === '<') { break; } tmpToken = iterator.stepBackward(); stepCount++; } for (var i = 0; i < stepCount; i++) { iterator.stepForward(); } } } } while (prevToken && depth <= 0); if (openTagStart && openTagEnd && closeTagStart && closeTagEnd && openTagName && closeTagName) { return { openTag: new Range(openTagStart.start.row, openTagStart.start.column, openTagEnd.end.row, openTagEnd.end.column ), closeTag: new Range(closeTagStart.start.row, closeTagStart.start.column, closeTagEnd.end.row, closeTagEnd.end.column ), openTagName: openTagName, closeTagName: closeTagName }; } }; } exports.BracketMatch = BracketMatch; ================================================ FILE: src/edit_session/fold.js ================================================ "use strict"; /** * @typedef {import("./fold_line").FoldLine} FoldLine * @typedef {import("../range").Range} Range * @typedef {import("../../ace-internal").Ace.Point} Point * @typedef {import("../../ace-internal").Ace.IRange} IRange */ var RangeList = require("../range_list").RangeList; /* * Simple fold-data struct. **/ class Fold extends RangeList { /** * @param {Range} range * @param {any} placeholder */ constructor(range, placeholder) { super(); 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; /**@type {Fold[]}*/ this.subFolds = this.ranges = []; } toString() { return '"' + this.placeholder + '" ' + this.range.toString(); } /** * @param {FoldLine} foldLine */ setFoldLine(foldLine) { this.foldLine = foldLine; this.subFolds.forEach(function(fold) { fold.setFoldLine(foldLine); }); } clone() { 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; } /** * @param {Fold} fold */ addSubFold(fold) { if (this.range.isEqual(fold)) return; // 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]; var firstConsumed = 0; if (cmp == 0) { if (afterStart.range.containsRange(fold)) return afterStart.addSubFold(fold); else firstConsumed = 1; } // 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; } if (cmp == 0) j++; var consumedFolds = this.subFolds.splice(i, j - i, fold); var last = cmp == 0 ? consumedFolds.length - 1 : consumedFolds.length; for (var k = firstConsumed; k < last; k++) { fold.addSubFold(consumedFolds[k]); } fold.setFoldLine(this.foldLine); return fold; } /** * @param {IRange} range */ restoreRange(range) { return restoreRange(range, this.start); } } /** * @param {Point} point * @param {Point} anchor */ function consumePoint(point, anchor) { point.row -= anchor.row; if (point.row == 0) point.column -= anchor.column; } /** * @param {IRange} range * @param {Point} anchor */ function consumeRange(range, anchor) { consumePoint(range.start, anchor); consumePoint(range.end, anchor); } /** * @param {Point} point * @param {Point} anchor */ function restorePoint(point, anchor) { if (point.row == 0) point.column += anchor.column; point.row += anchor.row; } /** * @param {IRange} range * @param {Point} anchor */ function restoreRange(range, anchor) { restorePoint(range.start, anchor); restorePoint(range.end, anchor); } exports.Fold = Fold; ================================================ FILE: src/edit_session/fold_line.js ================================================ "use strict"; /** * @typedef {import("./fold").Fold} Fold */ var Range = require("../range").Range; class FoldLine { /** * If an array is passed in, the folds are expected to be sorted already. * @param {FoldLine[]} foldData * @param {Fold[]|Fold} folds */ constructor(foldData, folds) { this.foldData = foldData; if (Array.isArray(folds)) { /**@type {Fold[]} */ 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); } /** * Note: This doesn't update wrapData! * @param {number} shift */ shiftRow(shift) { this.start.row += shift; this.end.row += shift; this.folds.forEach(function(fold) { fold.start.row += shift; fold.end.row += shift; }); } /** * @param {Fold} fold */ addFold(fold) { if (fold.sameRow) { // @ts-expect-error TODO: startRow, endRow are missing in Fold and FoldLine 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; } /** * @param {number} row */ containsRow(row) { return row >= this.start.row && row <= this.end.row; } /** * @param {Function} callback * @param {number} endRow * @param {number} endColumn */ walk(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); } /** * @param {number} row * @param {number} column * @return {{ fold: Fold, kind: string } | null} */ getNextFoldTo(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; } /** * @param {number} row * @param {number} column * @param {number} len */ addRemoveChars(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; } } } /** * @param {number} row * @param {number} column * @return {FoldLine | null} */ split(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; } /** * @param {FoldLine} foldLineNext */ merge(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); } toString() { var ret = [this.range.toString() + ": [" ]; this.folds.forEach(function(fold) { ret.push(" " + fold.toString()); }); ret.push("]"); return ret.join("\n"); } /** * @param {number} idx * @return {import("../../ace-internal").Ace.Point} */ idxToPosition(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 }; } } exports.FoldLine = FoldLine; ================================================ FILE: src/edit_session/folding.js ================================================ // @ts-nocheck "use strict"; var Range = require("../range").Range; var FoldLine = require("./fold_line").FoldLine; var Fold = require("./fold").Fold; var TokenIterator = require("../token_iterator").TokenIterator; var MouseEvent = require("../mouse/mouse_event").MouseEvent; /** * @typedef {import("../edit_session").EditSession & import("../../ace-internal").Ace.Folding} IFolding * @typedef {import("../../ace-internal").Ace.Delta } Delta */ /** * @this {IFolding} * @type {IFolding} */ 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 * @param {number} row * @param {number} column * @param {number} [side] * @return {Fold} **/ 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 range = folds[i].range; if (range.contains(row, column)) { if (side == 1 && range.isEnd(row, column) && !range.isEmpty()) { continue; } else if (side == -1 && range.isStart(row, column) && !range.isEmpty()) { continue; } return folds[i]; } } }; /** * Returns all folds in the given range. Note, that this will return folds * @param {Range| Delta} range * @returns {Fold[]} **/ 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; }; /** * * @param {Range[]|Range}ranges * @returns {Fold[]} */ this.getFoldsInRangeList = function(ranges) { if (Array.isArray(ranges)) { /**@type {Fold[]} */ 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 * @returns {Fold[]} */ 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" * @param {number} row * @param {number} column * @param {number} [trim] * @param {FoldLine} [foldLine] * @returns {string | null} */ 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; }; /** * * @param {number} docRow * @param {FoldLine} [startFoldLine] * @returns {null|FoldLine} */ 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 * @param {number} docRow * @param {FoldLine} [startFoldLine] * @returns {null|FoldLine} */ 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; }; /** * * @param {number} first * @param {number} last * @return {number} */ 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; }; /** * * @param {FoldLine}foldLine * @return {FoldLine} */ 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. * * @param {Fold|string} placeholder * @param {Range} [range] * @returns {Fold} * The new created Fold object or an existing fold object in case the * passed in range fits an existing fold exactly. * @this {IFolding} */ this.addFold = function(placeholder, range) { var foldData = this.$foldData; var added = false; /**@type {Fold}*/ var fold; if (placeholder instanceof Fold) fold = placeholder; else { fold = new Fold(range, placeholder); // @ts-ignore 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; 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. if (!fold.collapseChildren) { 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; }; /** * @param {Fold[]} folds */ this.addFolds = function(folds) { folds.forEach(function(fold) { this.addFold(fold); }, this); }; /** * * @param {Fold} fold */ 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" }); }; /** * * @param {Fold[]} folds */ 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; }; /** * @param {Fold} fold */ 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 = []; }; /** * @param {Fold[]}folds */ this.expandFolds = function(folds) { folds.forEach(function(fold) { this.expandFold(fold); }, this); }; /** * * @param {number|null|import("../../ace-internal").Ace.Point|Range|Range[]} [location] * @param {boolean} [expandInner] * @return {Fold[]| undefined} */ this.unfold = function(location, expandInner) { var range, folds; if (location == null) { range = new Range(0, 0, this.getLength(), 0); if (expandInner == null) 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 if (Array.isArray(location)) { folds = []; location.forEach(function(range) { folds = folds.concat(this.unfold(range)); }, this); return folds; } else { range = location; } folds = this.getFoldsInRangeList(range); var outermostFolds = folds; // if range itself is in a fold, expand that fold instead of removing, // to not accidentally remove sibling folds while ( folds.length == 1 && Range.comparePoints(folds[0].start, range.start) < 0 && Range.comparePoints(folds[0].end, range.end) > 0 ) { this.expandFolds(folds); folds = this.getFoldsInRangeList(range); } if (expandInner != false) { this.removeFolds(folds); } else { this.expandFolds(folds); } if (outermostFolds.length) return outermostFolds; }; /** * 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. * @param {number} docRow * @param {FoldLine} [startFoldRow] * @returns {boolean} **/ this.isRowFolded = function(docRow, startFoldRow) { return !!this.getFoldLine(docRow, startFoldRow); }; /** * * @param {number} docRow * @param {FoldLine} [startFoldRow] * @return {number} */ this.getRowFoldEnd = function(docRow, startFoldRow) { var foldLine = this.getFoldLine(docRow, startFoldRow); return foldLine ? foldLine.end.row : docRow; }; /** * * @param {number} docRow * @param {FoldLine} [startFoldRow] * @returns {number} */ this.getRowFoldStart = function(docRow, startFoldRow) { var foldLine = this.getFoldLine(docRow, startFoldRow); return foldLine ? foldLine.start.row : docRow; }; /** * * @param {FoldLine} foldLine * @param {number | null} [endRow] * @param {number | null} [endColumn] * @param {number | null} [startRow] * @param {number | null} [startColumn] * @return {string} */ 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; }; /** * * @param {number} row * @param {number | null} endColumn * @param {number | null} startRow * @param {number | null} startColumn * @return {string} */ 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); } }; /** * @return {FoldLine[]} */ 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; }; /** * @param {boolean} [tryToUnfold] */ 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 (tryToUnfold) { var foldLine = this.getFoldLine(cursor.row); if (foldLine) this.expandFolds(foldLine.folds); 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); }; /** * * @param {number} row * @param {number} column * @param {number} [dir] * @return {Range | undefined} */ this.getCommentFoldRange = function(row, column, dir) { var iterator = new TokenIterator(this, row, column); var token = iterator.getCurrentToken(); var type = token && token.type; if (token && /^comment|string/.test(type)) { type = type.match(/comment|string/)[0]; if (type == "comment") type += "|doc-start|\\.doc"; var re = new RegExp(type); var range = new Range(); if (dir != 1) { do { token = iterator.stepBackward(); } while (token && re.test(token.type)); token = iterator.stepForward(); } range.start.row = iterator.getCurrentTokenRow(); range.start.column = iterator.getCurrentTokenColumn() + token.value.length; iterator = new TokenIterator(this, row, column); var initState = this.getState(iterator.$row); if (dir != -1) { var lastRow = -1; do { token = iterator.stepForward(); if (lastRow == -1) { var state = this.getState(iterator.$row); if (initState.toString() !== state.toString()) 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(); if (range.start.row == range.end.row && range.start.column > range.end.column) return; return range; } }; /** * * @param {number | null} [startRow] * @param {number | null} [endRow] * @param {number | null} [depth] * @param {Function} [test] */ this.foldAll = function(startRow, endRow, depth, test) { 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; if (test && !test(row)) continue; var range = this.getFoldWidgetRange(row); if (range && range.isMultiLine() && range.end.row <= endRow && range.start.row >= startRow ) { row = range.end.row; range.collapseChildren = depth; // addFold can change the range this.addFold("...", range); } } }; /** * * @param {number} level */ this.foldToLevel = function(level) { this.foldAll(); while (level-- > 0) this.unfold(null, false); }; /** * */ this.foldAllComments = function() { var session = this; this.foldAll(null, null, null, function(row) { var tokens = session.getTokens(row); for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; if (token.type == "text" && /^\s+$/.test(token.value)) continue; if (/comment/.test(token.type)) return true; return false; } }); }; // structured folding this.$foldStyles = { "manual": 1, "markbegin": 1, "markbeginend": 1 }; this.$foldStyle = "markbegin"; /** * @param {string} style */ 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); }; /** * @param {import("../../ace-internal").Ace.FoldMode} foldMode */ 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); }; /** * @param {number} row * @param {boolean} [ignoreCurrent] * @return {{range?: Range, firstRange?: Range}} */ 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 }; }; /** * * @param {number} row * @param {any} e */ this.onFoldWidgetClick = function(row, e) { if (e instanceof MouseEvent) 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"; } }; /** * * @param {number} row * @param options * @return {Fold|*} */ 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; }; /** * * @param {boolean} [toggleParent] */ 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); } } }; /** * @param {Delta} delta */ 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); } }; /** * @param e */ 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: src/edit_session.js ================================================ "use strict"; /** * @typedef {import("./layer/font_metrics").FontMetrics} FontMetrics * @typedef {import("./edit_session/fold_line").FoldLine} FoldLine * @typedef {import("../ace-internal").Ace.Point} Point * @typedef {import("../ace-internal").Ace.Delta} Delta * @typedef {import("../ace-internal").Ace.IRange} IRange * @typedef {import("../ace-internal").Ace.SyntaxMode} SyntaxMode * @typedef {import("../ace-internal").Ace.LineWidget} LineWidget */ 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 LineWidgets = require("./line_widgets").LineWidgets; var Document = require("./document").Document; var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer; var SearchHighlight = require("./search_highlight").SearchHighlight; var UndoManager = require("./undomanager").UndoManager; /** * @typedef TextMode * @type {SyntaxMode} */ /** * 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 { /** * Sets up a new `EditSession` and associates it with the given `Document` and `Mode`. * @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 {SyntaxMode | string} [mode] [The initial language mode to use for the document]{: #modeParam} **/ constructor(text, mode) { /**@type {Document}*/this.doc; this.$breakpoints = []; this.$decorations = []; this.$frontMarkers = {}; this.$backMarkers = {}; this.$markerId = 1; this.$undoSelect = true; this.$editor = null; this.prevOp = {}; /** @type {FoldLine[]} */ this.$foldData = []; this.id = "session" + (++EditSession.$uid); this.$foldData.toString = function() { return this.join("\n"); }; // @experimental this.$gutterCustomWidgets = {}; // Set default background tokenizer with Text mode until editor session mode is set this.bgTokenizer = new BackgroundTokenizer((new TextMode()).getTokenizer(), this); var _self = this; this.bgTokenizer.on("update", function(e) { _self._signal("tokenizerUpdate", e); }); this.on("changeFold", this.onChangeFold.bind(this)); this.$onChange = this.onChange.bind(this); if (typeof text != "object" || !text.getLine) text = new Document(/**@type{string}*/(text)); this.setDocument(text); this.selection = new Selection(this); this.$onSelectionChange = this.onSelectionChange.bind(this); this.selection.on("changeSelection", this.$onSelectionChange); this.selection.on("changeCursor", this.$onSelectionChange); this.$bidiHandler = new BidiHandler(this); config.resetOptions(this); this.setMode(mode); config._signal("session", this); this.destroyed = false; this.$initOperationListeners(); } $initOperationListeners() { /**@type {import("../ace-internal").Ace.Operation | null}*/ this.curOp = null; this.on("change", () => { if (!this.curOp) { this.startOperation(); this.curOp.selectionBefore = this.$lastSel; } this.curOp.docChanged = true; }, true); this.on("changeSelection", () => { if (!this.curOp) { this.startOperation(); this.curOp.selectionBefore = this.$lastSel; } this.curOp.selectionChanged = true; }, true); // Fallback mechanism in case current operation doesn't finish more explicitly. // Triggered, for example, when a consumer makes programmatic changes without invoking endOperation afterwards. this.$operationResetTimer = lang.delayedCall(this.endOperation.bind(this, true)); } /** * Start an Ace operation, which will then batch all the subsequent changes (to either content or selection) under a single atomic operation. * @param {{command?: {name?: string}, args?: any}|undefined} [commandEvent] Optional name for the operation */ startOperation(commandEvent) { if (this.curOp) { if (!commandEvent || this.curOp.command) { return; } this.prevOp = this.curOp; } if (!commandEvent) { commandEvent = {}; } this.$operationResetTimer.schedule(); this.curOp = { command: commandEvent.command || {}, args: commandEvent.args }; this.curOp.selectionBefore = this.selection.toJSON(); this._signal("startOperation", commandEvent); } /** * End current Ace operation. * Emits "beforeEndOperation" event just before clearing everything, where the current operation can be accessed through `curOp` property. * @param {any} [e] */ endOperation(e) { if (this.curOp) { if (e && e.returnValue === false) { this.curOp = null; this._signal("endOperation", e); return; } if (e == true && this.curOp.command && this.curOp.command.name == "mouse") { // When current operation is mousedown, we wait for the mouseup to end the operation. // So during a user selection, we would only end the operation when the final selection is known. return; } const currentSelection = this.selection.toJSON(); this.curOp.selectionAfter = currentSelection; this.$lastSel = this.selection.toJSON(); this.getUndoManager().addSelection(currentSelection); this._signal("beforeEndOperation"); this.prevOp = this.curOp; this.curOp = null; this._signal("endOperation", e); } } /** * 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 * **/ setDocument(doc) { if (this.doc) this.doc.off("change", this.$onChange); this.doc = doc; doc.on("change", this.$onChange, true); this.bgTokenizer.setDocument(this.getDocument()); this.resetCaches(); } /** * Returns the `Document` associated with this session. * @return {Document} **/ getDocument() { return this.doc; } /** * Get "widgetManager" from EditSession * * @returns {LineWidgets} object */ get widgetManager() { const widgetManager = new LineWidgets(this); // todo remove the widgetManger assignement from lineWidgets constructor when introducing breaking changes this.widgetManager = widgetManager; if (this.$editor) widgetManager.attach(this.$editor); return widgetManager; } /** * Set "widgetManager" in EditSession * * @returns void */ set widgetManager(value) { Object.defineProperty(this, "widgetManager", { writable: true, enumerable: true, configurable: true, value: value, }); } /** * @param {Number} docRow The row to work with * **/ $resetRowCache(docRow) { if (!docRow) { /** @type {number[]} */ this.$docRowCache = []; /** @type {number[]} */ 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); } } $getRowCacheIndex(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; } resetCaches() { this.$modified = true; this.$wrapData = []; this.$rowLengthCache = []; this.$resetRowCache(0); if (!this.destroyed) this.bgTokenizer.start(0); } /** * @param e * @internal */ onChangeFold(e) { var fold = e.data; this.$resetRowCache(fold.start.row); } /** * * @param {Delta} delta * @internal */ onChange(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({ // @ts-expect-error TODO: this action type is missing in the types action: "removeFolds", folds: removedFolds }, this.mergeUndoDeltas); this.mergeUndoDeltas = true; } this.$undoManager.add(delta, this.mergeUndoDeltas); this.mergeUndoDeltas = true; this.$informUndoManager.schedule(); } this.bgTokenizer.$updateOnChange(delta); this._signal("change", delta); } onSelectionChange() { this._signal("changeSelection"); } /** * Sets the session text. * @param {String} text The new text to place **/ setValue(text) { this.doc.setValue(text); this.selection.moveTo(0, 0); this.$resetRowCache(0); this.setUndoManager(this.$undoManager); this.getUndoManager().reset(); } /** * Returns a new instance of EditSession with state from JSON. * @method fromJSON * @param {string|object} session The EditSession state. * @returns {EditSession} */ static fromJSON(session) { if (typeof session == "string") session = JSON.parse(session); const undoManager = new UndoManager(); undoManager.$undoStack = session.history.$undoStack; undoManager.$redoStack = session.history.$redoStack; undoManager.mark = session.history.mark; undoManager.$rev = session.history.rev; const editSession = new EditSession(session.value); session.folds.forEach(function(fold) { editSession.addFold("...", Range.fromPoints(fold.start, fold.end)); }); editSession.setAnnotations(session.annotations); editSession.setBreakpoints(session.breakpoints); editSession.setMode(session.mode); editSession.setScrollLeft(session.scrollLeft); editSession.setScrollTop(session.scrollTop); editSession.setUndoManager(undoManager); editSession.selection.fromJSON(session.selection); return editSession; } /** * Returns the current edit session. * @method toJSON * @returns {Object} */ toJSON() { return { annotations: this.$annotations, breakpoints: this.$breakpoints, folds: this.getAllFolds().map(function(fold) { return fold.range; }), history: this.getUndoManager(), mode: this.$mode.$id, scrollLeft: this.$scrollLeft, scrollTop: this.$scrollTop, selection: this.selection.toJSON(), value: this.doc.getValue() }; } /** * Returns the current [[Document `Document`]] as a string. * @method toString * @returns {String} * @alias EditSession.getValue * **/ toString() { return this.doc.getValue(); } /** * Returns selection object. * @returns {Selection} **/ getSelection() { return this.selection; } /** * {:BackgroundTokenizer.getState} * @param {Number} row The row to start at * @returns {string | string[]} * @related BackgroundTokenizer.getState **/ getState(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 * @returns {import("../ace-internal").Ace.Token[]} **/ getTokens(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 * @returns {import("../ace-internal").Ace.Token} * **/ getTokenAt(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 **/ setUndoManager(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 **/ markUndoGroup() { if (this.$syncInformUndoManager) this.$syncInformUndoManager(); } /** * Returns the current undo manager. * @returns {UndoManager} **/ getUndoManager() { // @ts-ignore 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'`. * @returns {String} **/ getTabString() { 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} val Value indicating whether or not to use soft tabs **/ setUseSoftTabs(val) { this.setOption("useSoftTabs", val); } /** * Returns `true` if soft tabs are being used, `false` otherwise. * @returns {Boolean} **/ getUseSoftTabs() { // 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 **/ setTabSize(tabSize) { this.setOption("tabSize", tabSize); } /** * Returns the current tab size. * @return {number} **/ getTabSize() { return this.$tabSize; } /** * Returns `true` if the character at the position is a soft tab. * @param {Point} position The position to check **/ isTabStop(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 **/ setNavigateWithinSoftTabs(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} **/ getNavigateWithinSoftTabs() { return this.$navigateWithinSoftTabs; } /** * 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 * **/ setOverwrite(overwrite) { this.setOption("overwrite", overwrite); } /** * Returns `true` if overwrites are enabled; `false` otherwise. **/ getOverwrite() { return this.$overwrite; } /** * Sets the value of overwrite to the opposite of whatever it currently is. **/ toggleOverwrite() { 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 **/ addGutterDecoration(row, className) { if (!this.$decorations[row]) this.$decorations[row] = ""; this.$decorations[row] += " " + className; this._signal("changeBreakpoint", {}); } /** * Replaces the custom icon with the fold widget if present from a specific row in the gutter * @param {number} row The row number for which to hide the custom icon * @experimental */ removeGutterCustomWidget(row) { if(this.$editor) { this.$editor.renderer.$gutterLayer.$removeCustomWidget(row); } } /** * Replaces the fold widget if present with the custom icon from a specific row in the gutter * @param {number} row - The row number where the widget will be displayed * @param {Object} attributes - Configuration attributes for the widget * @param {string} attributes.className - CSS class name for styling the widget * @param {string} attributes.label - Text label to display in the widget * @param {string} attributes.title - Tooltip text for the widget * @param {Object} attributes.callbacks - Event callback functions for the widget e.g onClick; * @returns {void} * @experimental */ addGutterCustomWidget(row,attributes) { if(this.$editor) { this.$editor.renderer.$gutterLayer.$addCustomWidget(row,attributes); } } /** * Removes `className` from the `row`. * @param {Number} row The row number * @param {String} className The class to add **/ removeGutterDecoration(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[]} **/ getBreakpoints() { return this.$breakpoints; } /** * Sets a breakpoint on every row number given by `rows`. This function also emites the `'changeBreakpoint'` event. * @param {number[]} rows An array of row indices **/ setBreakpoints(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} **/ getAWordRange(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 {import("../ace-internal").Ace.NewLineMode} newLineMode {:Document.setNewLineMode.param} * * * @related Document.setNewLineMode **/ setNewLineMode(newLineMode) { this.doc.setNewLineMode(newLineMode); } /** * * Returns the current new line mode. * @returns {import("../ace-internal").Ace.NewLineMode} * @related Document.getNewLineMode **/ getNewLineMode() { 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 **/ setUseWorker(useWorker) { this.setOption("useWorker", useWorker); } /** * Returns `true` if workers are being used. **/ getUseWorker() { 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. * @internal **/ onReloadTokenizer(e) { var rows = e.data; this.bgTokenizer.start(rows.first); this._signal("tokenizerUpdate", e); } /** * 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 {SyntaxMode | string} mode Set a new text mode * @param {() => void} [cb] optional callback **/ setMode(mode, cb) { if (mode && typeof mode === "object") { if (mode.getTokenizer) return this.$onChangeMode(mode); var options = mode; var path = options.path; } else { path = /**@type{string}*/(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.destroyed) { return; } 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); } /** * @param mode * @param [$isPlaceholder] */ $onChangeMode(mode, $isPlaceholder) { if (!$isPlaceholder) this.$modeId = mode.$id; if (this.$mode === mode) return; var oldMode = this.$mode; this.$mode = mode; this.$stopWorker(); if (this.$useWorker) this.$startWorker(); var tokenizer = mode.getTokenizer(); if(tokenizer.on !== undefined) { var onReloadTokenizer = this.onReloadTokenizer.bind(this); tokenizer.on("update", onReloadTokenizer); } this.bgTokenizer.setTokenizer(tokenizer); this.bgTokenizer.setDocument(this.getDocument()); /**@type {RegExp}*/ this.tokenRe = mode.tokenRe; /**@type {RegExp}*/ 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", {oldMode: oldMode, mode: mode}); } } $stopWorker() { if (this.$worker) { this.$worker.terminate(); this.$worker = null; } } $startWorker() { 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 **/ getMode() { return this.$mode; } /** * This function sets the scroll top value. It also emits the `'changeScrollTop'` event. * @param {Number} scrollTop The new scroll top value **/ setScrollTop(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} **/ getScrollTop() { return this.$scrollTop; } /** * [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft} * @param {number} scrollLeft */ setScrollLeft(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} **/ getScrollLeft() { return this.$scrollLeft; } /** * Returns the width of the screen. * @returns {Number} **/ getScreenWidth() { this.$computeWidth(); if (this.lineWidgets) return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth); return this.screenWidth; } /** * @return {number} */ getLineWidgetMaxWidth() { 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; } /** * @param {boolean} [force] */ $computeWidth(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} **/ getLine(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[]} * **/ getLines(firstRow, lastRow) { return this.doc.getLines(firstRow, lastRow); } /** * Returns the number of rows in the document. * @returns {Number} **/ getLength() { return this.doc.getLength(); } /** * {:Document.getTextRange.desc} * @param {IRange} [range] The range to work with * * @returns {String} **/ getTextRange(range) { return this.doc.getTextRange(range || this.selection.getRange()); } /** * Inserts a block of `text` and the indicated `position`. * @param {Point} position The position {row, column} to start inserting at * @param {String} text A chunk of text to insert * @returns {Point} The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`. **/ insert(position, text) { return this.doc.insert(position, text); } /** * Removes the `range` from the document. * @param {IRange} range A specified Range to remove * @returns {Point} 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`. **/ remove(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 * **/ removeFullLines(firstRow, lastRow){ return this.doc.removeFullLines(firstRow, lastRow); } /** * Reverts previous changes to your document. * @param {Delta[]} deltas An array of previous changes * @param {Boolean} [dontSelect] If `true`, doesn't select the range of where the change occured **/ undoChanges(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) { //@ts-expect-error TODO: potential wrong property if (deltas.selectionBefore) //@ts-expect-error TODO: potential wrong property 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 {Delta[]} deltas An array of previous changes * @param {Boolean} [dontSelect] {:dontSelect} **/ redoChanges(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.$safeApplyDelta(delta); } } if (!dontSelect && this.$undoSelect) { //@ts-expect-error TODO: potential wrong property if (deltas.selectionAfter) //@ts-expect-error TODO: potential wrong property 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 * **/ setUndoSelect(enable) { this.$undoSelect = enable; } /** * * @param {Delta[]} deltas * @param {boolean} [isUndo] * @return {Range} */ $getUndoSelection(deltas, isUndo) { function isInsert(delta) { return isUndo ? delta.action !== "insert" : delta.action === "insert"; } var range, point; 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); } else { range = Range.fromPoints(delta.start, delta.start); } 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); } } else { point = delta.start; if (range.compare(point.row, point.column) == -1) { range = Range.fromPoints(delta.start, delta.start); } } } return range; } /** * Replaces a range in the document with the new `text`. * * @param {IRange} range A specified Range to replace * @param {String} text The new text to use as a replacement * @returns {Point} 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 **/ replace(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 {Point} toPosition The location (row and column) where you want to move the text to * @param {boolean} [copy] * @returns {Range} The new range where the text was moved to. **/ moveText(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 **/ indentRows(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 **/ outdentRows(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); } } /** * * @param {number} firstRow * @param {number} lastRow * @param [dir] * @returns {number} */ $moveLines(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. **/ moveLinesUp(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. **/ moveLinesDown(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`. **/ duplicateLines(firstRow, lastRow) { return this.$moveLines(firstRow, lastRow, 0); } /** * @param {number} row * @returns {number} */ $clipRowToDocument(row) { return Math.max(0, Math.min(row, this.doc.getLength()-1)); } /** * @param {number} row * @param {number} column * @returns {number} */ $clipColumnToRow(row, column) { if (column < 0) return 0; return Math.min(this.doc.getLine(row).length, column); } /** * @param {number} row * @param {number} column * @returns {Point} */ $clipPositionToDocument(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 }; } /** * @param {Range} range * @returns {Range} */ $clipRangeToDocument(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; } /** * 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 **/ setUseWrapMode(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} **/ getUseWrapMode() { 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) **/ setWrapLimitRange(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 * @param [$printMargin] * @returns {Boolean} **/ adjustWrapLimit(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; } /** * * @param {number} wrapLimit * @param {number} [min] * @param {number} [max] * @returns {number} */ $constrainWrapLimit(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. **/ getWrapLimit() { 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. */ setWrapLimit(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 {{ min: number, max: number }} **/ getWrapLimitRange() { // Avoid unexpected mutation by returning a copy return { min : this.$wrapLimitRange.min, max : this.$wrapLimitRange.max }; } /** * @param {Delta} delta */ $updateInternalDataOnChange(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; } /** * @param {number} firstRow * @param {number} lastRow */ $updateRowLengthCache(firstRow, lastRow) { this.$rowLengthCache[firstRow] = null; this.$rowLengthCache[lastRow] = null; } /** * @param {number} firstRow * @param {number} lastRow */ $updateWrapData(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; } } } /** * @param {number[]}tokens * @param {number} wrapLimit * @param {number} tabSize * @returns {*[]} */ $computeWrapSplits(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) { // The document size is the current size - the extra width for tabs // and multipleWidth characters. var len = screenPos - lastSplit; for (var i = lastSplit; i < screenPos; i++) { var ch = tokens[i]; if (ch === 12 || ch === 2) len -= 1; } if (!splits.length) { indent = getWrapIndent(); //@ts-expect-error TODO: potential wrong property 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 * @returns {number[]} **/ $getDisplayTokens(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. **/ $getStringScreenWidth(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]; } /** * Returns number of screenrows in a wrapped line. * @param {Number} row The row number to check * @returns {Number} **/ getRowLength(row) { var h = 1; if (this.lineWidgets) h += this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0; if (!this.$useWrapMode || !this.$wrapData[row]) return h; else return this.$wrapData[row].length + h; } /** * @param {Number} row * @returns {Number} **/ getRowLineCount(row) { if (!this.$useWrapMode || !this.$wrapData[row]) { return 1; } else { return this.$wrapData[row].length + 1; } } /** * @param {Number} screenRow * @returns {Number} **/ getRowWrapIndent(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 **/ getScreenLastRowColumn(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 * @returns {number} **/ getDocumentLastRowColumn(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 * @returns {Point} **/ getDocumentLastRowColumnPosition(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. * @param {number} row * @returns {String | undefined} */ getRowSplitData(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} **/ getScreenTabSize(screenColumn) { return this.$tabSize - (screenColumn % this.$tabSize | 0); } /** * @param {number} screenRow * @param {number} screenColumn * @returns {number} */ screenToDocumentRow(screenRow, screenColumn) { return this.screenToDocumentPosition(screenRow, screenColumn).row; } /** * @param {number} screenRow * @param {number} screenColumn * @returns {number} */ screenToDocumentColumn(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 {Number} [offsetX] screen character x-offset [optional] * * @returns {Point} The object returned has two properties: `row` and `column`. * * @related EditSession.documentToScreenPosition **/ screenToDocumentPosition(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|Point} docRow The document row to check * @param {Number|undefined} [docColumn] The document column to check * @returns {Point} The object returned by this method has two properties: `row` and `column`. * * @related EditSession.screenToDocumentPosition **/ documentToScreenPosition(docRow, docColumn) { // Normalize the passed in arguments. if (typeof docColumn === "undefined") var pos = this.$clipPositionToDocument(/**@type{Point}*/(docRow).row, /**@type{Point}*/(docRow).column); else pos = this.$clipPositionToDocument(/**@type{number}*/(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; } } if (this.lineWidgets && this.lineWidgets[row] && this.lineWidgets[row].rowsAbove) screenRow += this.lineWidgets[row].rowsAbove; return { row: screenRow, column: wrapIndent + this.$getStringScreenWidth(textLine)[0] }; } /** * For the given document row and column, returns the screen column. * @param {Number|Point} row * @param {Number} [docColumn] * @returns {Number} **/ documentToScreenColumn(row, docColumn) { return this.documentToScreenPosition(row, docColumn).column; } /** * For the given document row and column, returns the screen row. * @param {Number|Point} docRow * @param {Number} [docColumn] * @returns {number} **/ documentToScreenRow(docRow, docColumn) { return this.documentToScreenPosition(docRow, docColumn).row; } /** * Returns the length of the screen. * @returns {Number} **/ getScreenLength() { var screenRows = 0; /**@type {FoldLine}*/ 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; } /** * @param {FontMetrics} fm */ $setFontMetrics(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]; }; } /** * @returns {string} the last character preceding the cursor in the editor */ getPrecedingCharacter() { var pos = this.selection.getCursor(); if (pos.column === 0) { return pos.row === 0 ? "" : this.doc.getNewLineCharacter(); } var currentLine = this.getLine(pos.row); return currentLine[pos.column - 1]; } destroy() { if (!this.destroyed) { this.bgTokenizer.setDocument(null); this.bgTokenizer.cleanup(); this.destroyed = true; } this.endOperation(); this.$stopWorker(); this.removeAllListeners(); if (this.doc) { this.doc.off("change", this.$onChange); } if (this.selection) { this.selection.off("changeCursor", this.$onSelectionChange); this.selection.off("changeSelection", this.$onSelectionChange); } this.selection.detach(); } } EditSession.$uid = 0; EditSession.prototype.$modes = config.$modes; /** * Returns the current [[Document `Document`]] as a string. * @method getValue * @returns {String} * @alias EditSession.toString **/ EditSession.prototype.getValue = EditSession.prototype.toString; EditSession.prototype.$defaultUndoManager = { undo: function() {}, redo: function() {}, hasUndo: function() {}, hasRedo: function() {}, reset: function() {}, add: function() {}, addSelection: function() {}, startNewGroup: function() {}, addSession: function() {} }; EditSession.prototype.$overwrite = false; EditSession.prototype.$mode = null; EditSession.prototype.$modeId = null; EditSession.prototype.$scrollTop = 0; EditSession.prototype.$scrollLeft = 0; // WRAPMODE EditSession.prototype.$wrapLimit = 80; EditSession.prototype.$useWrapMode = false; EditSession.prototype.$wrapLimitRange = { min : null, max : null }; /** * * @type {null | import("../ace-internal").Ace.LineWidget[]} */ EditSession.prototype.lineWidgets = null; EditSession.prototype.isFullWidth = isFullWidth; oop.implement(EditSession.prototype, EventEmitter); // "Tokens" var CHAR = 1, CHAR_EXT = 2, PLACEHOLDER_START = 3, PLACEHOLDER_BODY = 4, PUNCTUATION = 9, SPACE = 10, TAB = 11, TAB_SPACE = 12; // 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; } require("./edit_session/folding").Folding.call(EditSession.prototype); require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype); config.defineOptions(EditSession.prototype, "session", { wrap: { /** * @param {string | boolean | number} value * @this {EditSession} */ 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: { /** * @param {"code"|"text"|"auto"|boolean} val * @this{EditSession} */ set: function(val) { val = val == "auto" ? this.$mode.type != "text" : val != "text"; if (val != this.$wrapAsCode) { this.$wrapAsCode = val; if (this.$useWrapMode) { this.$useWrapMode = false; this.setUseWrapMode(true); } } }, initialValue: "auto" }, indentedSoftWrap: { /** * @this{EditSession} */ set: function() { if (this.$useWrapMode) { this.$useWrapMode = false; this.setUseWrapMode(true); } }, initialValue: true }, firstLineNumber: { set: function() {this._signal("changeBreakpoint");}, initialValue: 1 }, useWorker: { /** * @param {boolean} useWorker * @this{EditSession} */ set: function(useWorker) { this.$useWorker = useWorker; this.$stopWorker(); if (useWorker) this.$startWorker(); }, initialValue: true }, useSoftTabs: {initialValue: true}, tabSize: { /** * @param tabSize * @this{EditSession} */ set: function(tabSize) { tabSize = parseInt(tabSize); if (tabSize > 0 && this.$tabSize !== tabSize) { this.$modified = true; this.$rowLengthCache = []; this.$tabSize = tabSize; this._signal("changeTabSize"); } }, initialValue: 4, handlesSet: true }, navigateWithinSoftTabs: {initialValue: false}, foldStyle: { set: function(val) {this.setFoldStyle(val);}, handlesSet: true }, 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; }, handlesSet: true } }); exports.EditSession = EditSession; ================================================ FILE: src/edit_session_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "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; var lang = require("./lib/lang"); require("./multi_select"); 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); 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 foldAll": function() { var session = createFoldTestSession(); var editor = new Editor(new MockRenderer(), session); var value = " /*\n*comment\n*/\n" + editor.getValue() + "\n"; editor.setValue(value + value, 1); editor.setOption("mode", new JavaScriptMode()); editor.execCommand("foldToLevel1"); assert.equal(session.$foldData.length, 2); editor.execCommand("foldAllComments"); assert.equal(session.$foldData.length, 4); editor.execCommand("foldall"); assert.equal(session.$foldData.length, 4); assert.equal(session.$foldData[1].range.start.row, 3); assert.equal(session.$foldData[3].range.start.row, 11); editor.execCommand("golineup"); editor.execCommand("gotolineend"); editor.execCommand("unfold"); assert.equal(session.$foldData.length, 4); assert.equal(session.$foldData[3].range.start.row, 12); editor.execCommand("unfoldall"); assert.equal(session.$foldData.length, 0); editor.execCommand("foldall"); assert.equal(session.$foldData.length, 4); assert.equal(session.$foldData[1].range.start.row, 3); // fold function arguments editor.selection.moveTo(3, 13); editor.execCommand("fold"); assert.equal(editor.session.getAllFolds().length, 5); assert.equal(session.$foldData[1].range.start.row, 3); // unfold function arguments editor.execCommand("unfold"); assert.equal(editor.session.getAllFolds().length, 4); assert.equal(session.$foldData[1].range.start.row, 3); // unfold function editor.execCommand("unfold"); assert.equal(session.$foldData.length, 4); assert.equal(session.$foldData[1].range.start.row, 4); // check that calling unfold without folds does not add folds editor.execCommand("unfold"); assert.equal(session.$foldData.length, 4); assert.equal(session.$foldData[1].range.start.row, 4); }, "test setting undefined value": function() { var session = createFoldTestSession(); var editor = new Editor(new MockRenderer(), session); editor.setOption("mode", new JavaScriptMode()); editor.setValue("test"); assert.equal(session.getValue(), "test"); editor.setValue(undefined); assert.equal(session.getValue(), ""); editor.setValue("test"); assert.equal(session.getValue(), "test"); }, "test foldOther": function() { var session = new EditSession("{\n\t1{\n\t\t\n\t\t1.1 {\n\t\t}\n\t}\n\t2 {\n\t\t2.1 {\n\t\t\t2.2 {\n\t\t\t}\n\t\t\t2.3 {\n\t\t\t}\n\t\t}\n\t}\n}\n\n{\n}"); var editor = new Editor(new MockRenderer(), session); editor.setOption("mode", new JavaScriptMode()); editor.gotoLine(3, 2); editor.execCommand("foldOther"); assert.equal(foldRows(), "3,6,16"); editor.find("2.2"); assert.equal(foldRows(), "3,8,10,16"); var removedFolds = session.unfold(); assert.equal(removedFolds.length, 4); assert.equal(foldRows(), ""); editor.session.addFold("xxx", new Range(1, 0, 7, 0)); assert.equal(foldRows(), "1"); editor.session.foldAll(); assert.equal(foldRows(), "0,16"); removedFolds = editor.session.unfold(editor.selection.getAllRanges()); assert.equal(removedFolds.length, 1); assert.equal(foldRows(), "1,8,10,16"); function foldRows() { return session.$foldData.map(function(x) {return x.start.row;}).join(","); } }, "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 addFold(placeholder, range) { fold = session.addFold(placeholder, range); } addFold("foo", new Range(0, 13, 0, 17)); addFold("foo", new Range(0, 14, 0, 18)); addFold("foo", new Range(0, 13, 0, 18)); assert.equal(session.$foldData[0].folds.length, 1); addFold("f", new Range(0, 13, 0, 18)); addFold("foo", new Range(0, 18, 0, 21)); assert.equal(session.$foldData[0].folds.length, 2); session.removeFold(fold); addFold("foo", new Range(0, 18, 0, 22)); addFold("foo", new Range(0, 18, 0, 19)); addFold("foo", new Range(0, 22, 1, 10)); session.unfold(); addFold("x", new Range(1, 9, 3, 15)); addFold("x", new Range(2, 9, 2, 15)); addFold("x", new Range(2, 10, 2, 18)); addFold("x", new Range(2, 10, 2, 18)); addFold("x", new Range(2, 25, 2, 27)); addFold("x", new Range(2, 28, 2, 30)); addFold("x", new Range(2, 7, 2, 29)); var folds = session.getFoldsInRange(new Range(0,0,100,100)); assert.equal(folds.length, 1); session.expandFolds(folds); folds = session.getFoldsInRange(new Range(0,0,100,100)); assert.equal(folds.length, 1); session.expandFolds(folds); folds = session.getFoldsInRange(new Range(0,0,100,100)); assert.equal(folds.length, 2); session.expandFolds(folds); folds = session.getFoldsInRange(new Range(0,0,100,100)); assert.equal(folds.length, 0); }, "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" : async function(next) { delete EditSession.prototype.$modes["ace/mode/javascript"]; delete EditSession.prototype.$modes["ace/mode/css"]; delete EditSession.prototype.$modes["ace/mode/sh"]; require("./config").setLoader(function(name, onLoad) { if (name == "ace/mode/javascript") { return onLoad(null, require("./mode/javascript")); } if (name == "ace/mode/sh") { return setTimeout(function() { return onLoad(null, require("./mode/sh")); }); } if (name == "ace/mode/css") { return setTimeout(function() { return onLoad(null, require("./mode/css")); }); } }); var session = new EditSession([]); var onChangeModeCallCount = 0; var originalOnChangeMode = session.$onChangeMode; // Create spy session.$onChangeMode = function(...arguments) { onChangeModeCallCount++; originalOnChangeMode.apply(this, arguments); }; session.setMode("ace/mode/javascript"); assert.equal(session.$modeId, "ace/mode/javascript"); var modeChangeCallbacks = 0; session.once("changeMode", function() { assert.equal(session.$modeId, "ace/mode/sh"); modeChangeCallbacks++; }); session.setMode("ace/mode/sh", function() { assert.equal(session.$mode.$id, "ace/mode/sh"); modeChangeCallbacks++; }); assert.equal(session.$modeId, "ace/mode/sh"); assert.equal(session.$mode.$id, "ace/mode/javascript"); await lang.sleep(0); assert.equal(modeChangeCallbacks, 2); session.setMode("ace/mode/javascript"); assert.equal(session.$mode.$id, "ace/mode/javascript"); session.setMode("ace/mode/sh"); assert.equal(session.$mode.$id, "ace/mode/sh"); session.setMode("ace/mode/css"); assert.equal(session.$mode.$id, "ace/mode/sh"); // destory session to check if the last mode which is being loaded is aborted or not session.destroy(); await lang.sleep(0); // check if last setmode is aborted due to destroy assert.equal(onChangeModeCallCount, 4); session.$onChangeMode = originalOnChangeMode; next(); }, "test: sets destroyed flag when destroy called and tokenizer is never null": function() { var session = new EditSession(["foo bar foo bar"]); assert.notEqual(session.bgTokenizer, null); assert.equal(session.destroyed, false); session.destroy(); assert.equal(session.destroyed, true); assert.notEqual(session.bgTokenizer, null); }, "test: JSON serialization": function() { var session = new EditSession(["Hello world!"]); session.setAnnotations([{row: 0, column: 0, text: "error test", type: "error"}]); session.setMode("ace/mode/javascript"); session = EditSession.fromJSON(JSON.stringify(session)); assert.equal(session.getAnnotations().length, 1); assert.equal(session.getMode().$id, "ace/mode/javascript"); assert.equal(session.getScrollLeft(), 0); assert.equal(session.getScrollTop(), 0); assert.equal(session.getValue(), "Hello world!"); }, "test: JSON serialization preserves undo/redo history": function() { var session = new EditSession(["Hello world!"]); session.setUndoManager(new UndoManager()); var document = session.getDocument(); insert(0, 12, " test1", session); insert(0, 18, " test2", session); insert(0, 24, " test3", session); assert.equal(session.getValue(), "Hello world! test1 test2 test3"); session.getUndoManager().undo(session); assert.equal(session.getValue(), "Hello world! test1 test2"); var serialized = JSON.stringify(session); session = EditSession.fromJSON(serialized); assert.equal(session.getValue(), "Hello world! test1 test2"); // Test undo stack works session.getUndoManager().undo(session); assert.equal(session.getValue(), "Hello world! test1"); session.getUndoManager().undo(session); assert.equal(session.getValue(), "Hello world!"); // Test redo stack works session.getUndoManager().redo(session); assert.equal(session.getValue(), "Hello world! test1"); session.getUndoManager().redo(session); assert.equal(session.getValue(), "Hello world! test1 test2"); }, "test: operation handling : when session it not attached to an editor": async function(done) { const session = new EditSession("Hello world!"); const beforeEndOperationSpy = []; session.on("beforeEndOperation", () => { beforeEndOperationSpy.push(session.curOp); }); // When both start and end operation are invoked by the consumer session.startOperation({command: {name: "inserting-both"}}); session.insert({row: 0, column : 0}, "both"); session.endOperation(); assert.equal(beforeEndOperationSpy.length, 1); assert.equal(beforeEndOperationSpy[0].command.name, "inserting-both"); assert.equal(beforeEndOperationSpy[0].docChanged, true); assert.equal(beforeEndOperationSpy[0].selectionChanged, true); // When only start operation is invoked session.startOperation({command: {name: "inserting-start"}}); session.insert({row: 0, column : 0}, "start"); await lang.sleep(10); assert.equal(beforeEndOperationSpy.length, 2); assert.equal(beforeEndOperationSpy[1].command.name, "inserting-start"); assert.equal(beforeEndOperationSpy[1].docChanged, true); assert.equal(beforeEndOperationSpy[1].selectionChanged, true); // When only end operation is invoked session.insert({row: 0, column : 0}, "end"); session.endOperation(); assert.equal(beforeEndOperationSpy.length, 3); assert.deepEqual(beforeEndOperationSpy[2].command, {}); assert.equal(beforeEndOperationSpy[2].docChanged, true); assert.equal(beforeEndOperationSpy[2].selectionChanged, true); // When nothing is invoked session.insert({row: 0, column : 0}, "none"); await lang.sleep(10); assert.equal(beforeEndOperationSpy.length, 4); assert.deepEqual(beforeEndOperationSpy[3].command, {}); assert.equal(beforeEndOperationSpy[3].docChanged, true); assert.equal(beforeEndOperationSpy[3].selectionChanged, true); done(); }, "test: operation handling : when session is attached to an editor": async function(done) { const session = new EditSession("Hello world!"); const editor = new Editor(new MockRenderer(), session); const beforeEndOperationSpySession = []; session.on("beforeEndOperation", () => { beforeEndOperationSpySession.push(session.curOp); }); const beforeEndOperationSpyEditor = []; editor.on("beforeEndOperation", () => { beforeEndOperationSpyEditor.push(editor.curOp); }); // Imperative update from editor editor.startOperation({command: {name: "imperative-update"}}); editor.insert("update"); editor.endOperation(); for (const beforeEndOperationSpy of [beforeEndOperationSpySession, beforeEndOperationSpyEditor ]) { assert.equal(beforeEndOperationSpy.length, 1); assert.equal(beforeEndOperationSpy[0].command.name, "imperative-update"); assert.equal(beforeEndOperationSpy[0].docChanged, true); assert.equal(beforeEndOperationSpy[0].selectionChanged, true); assert.equal(!!beforeEndOperationSpy[0].selectionBefore, true); } // Imperative update from session session.startOperation({command: {name: "session-update"}}); session.insert({row: 0, column : 0},"update"); session.endOperation(); for (const beforeEndOperationSpy of [beforeEndOperationSpySession, beforeEndOperationSpyEditor ]) { assert.equal(beforeEndOperationSpy.length, 2); assert.equal(beforeEndOperationSpy[1].command.name, "session-update"); assert.equal(beforeEndOperationSpy[1].docChanged, true); assert.equal(beforeEndOperationSpy[1].selectionChanged, true); assert.equal(!!beforeEndOperationSpy[1].selectionBefore, true); } // Command update editor.execCommand(editor.commands.byName.indent); for (const beforeEndOperationSpy of [beforeEndOperationSpySession, beforeEndOperationSpyEditor ]) { assert.equal(beforeEndOperationSpy.length, 3); assert.equal(beforeEndOperationSpy[2].command.name, "indent"); assert.equal(beforeEndOperationSpy[2].docChanged, true); assert.equal(beforeEndOperationSpy[2].selectionChanged, true); assert.equal(!!beforeEndOperationSpy[2].selectionBefore, true); } // Session cleanup logic const newSession = new EditSession("Hello again!"); editor.setSession(newSession); const beforeEndOperationSpyNewSession = []; newSession.on("beforeEndOperation", () => { beforeEndOperationSpyNewSession.push(newSession.curOp); }); editor.execCommand(editor.commands.byName.indent); assert.equal(beforeEndOperationSpyEditor.length, 4); assert.equal(beforeEndOperationSpyNewSession.length, 1); assert.equal(beforeEndOperationSpySession.length, 3); // Imperative implicit update from editor editor.insert("update"); await lang.sleep(10); assert.equal(beforeEndOperationSpyEditor.length, 5); assert.equal(beforeEndOperationSpyNewSession.length, 2); done(); } }; require("./test/run")(module); ================================================ FILE: src/editor.js ================================================ "use strict"; /** * @typedef {import("./virtual_renderer").VirtualRenderer} VirtualRenderer * @typedef {import("./selection").Selection} Selection * @typedef {import("../ace-internal").Ace.Point} Point * @typedef {import("../ace-internal").Ace.SearchOptions} SearchOptions */ 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 GutterKeyboardHandler = require("./keyboard/gutter_handler").GutterKeyboardHandler; var nls = require("./config").nls; var clipboard = require("./clipboard"); var keys = require('./lib/keys'); var event = require("./lib/event"); var HoverTooltip = require("./tooltip").HoverTooltip; /** * 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 * @param {Partial} [options] The default options **/ constructor(renderer, session, options) { /**@type {string}*/ this.id = "editor" + (++Editor.$uid); /**@type{EditSession}*/this.session; this.$toDestroy = []; var container = renderer.getContainerElement(); /**@type {HTMLElement & {env?:any, value?:any}}*/ this.container = container; /**@type {VirtualRenderer}*/ this.renderer = renderer; 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 /**@type {MouseHandler}*/ this.$mouseHandler = new MouseHandler(this); new FoldHandler(this); } /**@type {KeyBinding}*/ this.keyBinding = new KeyBinding(this); /**@type {Search}*/ 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.destroyed) this.session.bgTokenizer.scheduleStart(); }.bind(this)); this.on("change", function(_, _self) { _self._$emitInputEvent.schedule(31); }); this.setSession(session || options && options.session || new EditSession("")); config.resetOptions(this); if (options) this.setOptions(options); config._signal("editor", this); } $initOperationListeners() { this.commands.on("exec", this.startOperation.bind(this), true); this.commands.on("afterExec", this.endOperation.bind(this), true); } startOperation(commandEvent) { this.session.startOperation(commandEvent); } /** * @arg e */ endOperation(e) { this.session.endOperation(e); } onStartOperation(commandEvent) { this.curOp = this.session.curOp; this.curOp.scrollTop = this.renderer.scrollTop; this.prevOp = this.session.prevOp; if (!commandEvent) { this.previousCommand = null; } } /** * @arg e */ onEndOperation(e) { if (this.curOp && this.session) { if (e && e.returnValue === false) { this.curOp = null; return; } this._signal("beforeEndOperation"); if (!this.curOp) return; 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); } this.$lastSel = this.session.selection.toJSON(); this.prevOp = this.curOp; this.curOp = null; } } /** * @param e */ $historyTracker(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 | import("../ace-internal").Ace.KeyboardHandler | null} keyboardHandler The new key handler * @param {() => void} [cb] **/ setKeyboardHandler(keyboardHandler, cb) { if (keyboardHandler && typeof keyboardHandler === "string" && keyboardHandler != "ace") { 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; // @ts-ignore this.keyBinding.setKeyboardHandler(keyboardHandler); cb && cb(); } } /** * Returns the keyboard handler, such as "vim" or "windows". * @returns {Object} **/ getKeyboardHandler() { return this.keyBinding.getKeyboardHandler(); } /** * Sets a new editsession to use. This method also emits the `'changeSession'` event. * @param {EditSession|null} [session] The new session to use **/ setSession(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); this.session.off("startOperation", this.$onStartOperation); this.session.off("endOperation", this.$onEndOperation); 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.$onStartOperation = this.onStartOperation.bind(this); this.session.on("startOperation", this.$onStartOperation); this.$onEndOperation = this.onEndOperation.bind(this); this.session.on("endOperation", this.$onEndOperation); 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}); if (oldSession) oldSession.$editor = null; session && session._signal("changeEditor", {editor: this}); if (session) session.$editor = this; if (session && !session.destroyed) session.bgTokenizer.scheduleStart(); } /** * Returns the current session being used. * @returns {EditSession} **/ getSession() { 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 **/ setValue(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 **/ getValue() { return this.session.getValue(); } /** * * Returns the currently highlighted selection. * @returns {Selection} The selection object **/ getSelection() { 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 **/ resize(force) { this.renderer.onResize(force); } /** * {:VirtualRenderer.setTheme} * @param {string | import("../ace-internal").Ace.Theme} theme The path to a theme * @param {() => void} [cb] optional callback called when theme is loaded **/ setTheme(theme, cb) { this.renderer.setTheme(theme, cb); } /** * {:VirtualRenderer.getTheme} * * @returns {String} The set theme * @related VirtualRenderer.getTheme **/ getTheme() { return this.renderer.getTheme(); } /** * {:VirtualRenderer.setStyle} * @param {String} style A class name * @param {boolean} [incluude] pass false to remove the class name * @related VirtualRenderer.setStyle **/ setStyle(style, incluude) { this.renderer.setStyle(style, incluude); } /** * {:VirtualRenderer.unsetStyle} * @related VirtualRenderer.unsetStyle * @param {string} style */ unsetStyle(style) { this.renderer.unsetStyle(style); } /** * Gets the current font size of the editor text. * @return {string | number} */ getFontSize() { return this.getOption("fontSize") || dom.computedStyle(this.container).fontSize; } /** * Set a new font size (in pixels) for the editor text. * @param {String | number} size A font size ( _e.g._ "12px") **/ setFontSize(size) { this.setOption("fontSize", size); } $highlightBrackets() { 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.destroyed) return; if (session.$bracketHighlight) { session.$bracketHighlight.markerIds.forEach(function(id) { session.removeMarker(id); }); session.$bracketHighlight = null; } var pos = self.getCursorPosition(); var handler = self.getKeyboardHandler(); var isBackwards = handler && handler.$getDirectionForHighlight && handler.$getDirectionForHighlight(self); var ranges = session.getMatchingBracketRanges(pos, isBackwards); if (!ranges) { var iterator = new TokenIterator(session, pos.row, pos.column); var token = iterator.getCurrentToken(); if (token && /\b(?:tag-open|tag-name)/.test(token.type)) { var tagNamesRanges = session.getMatchingTags(pos); if (tagNamesRanges) { ranges = [ tagNamesRanges.openTagName.isEmpty() ? tagNamesRanges.openTag : tagNamesRanges.openTagName, tagNamesRanges.closeTagName.isEmpty() ? tagNamesRanges.closeTag : tagNamesRanges.closeTagName ]; } } } if (!ranges && session.$mode.getMatching) ranges = session.$mode.getMatching(self.session); if (!ranges) { if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide(); return; } var markerType = "ace_bracket"; if (!Array.isArray(ranges)) { ranges = [ranges]; } else if (ranges.length == 1) { markerType = "ace_error_bracket"; } // show adjacent ranges as one if (ranges.length == 2) { if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0) ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)]; else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0) ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)]; } session.$bracketHighlight = { ranges: ranges, markerIds: ranges.map(function(range) { return session.addMarker(range, markerType, "text"); }) }; if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide(); }, 50); } /** * * Brings the current `textInput` into focus. **/ focus() { this.textInput.focus(); } /** * Returns `true` if the current `textInput` is in focus. * @return {Boolean} **/ isFocused() { return this.textInput.isFocused(); } /** * * Blurs the current `textInput`. **/ blur() { this.textInput.blur(); } /** * Emitted once the editor comes into focus. * @internal **/ onFocus(e) { if (this.$isFocused) return; this.$isFocused = true; this.renderer.showCursor(); this.renderer.visualizeFocus(); this._emit("focus", e); } /** * Emitted once the editor has been blurred. * @internal **/ onBlur(e) { if (!this.$isFocused) return; this.$isFocused = false; this.renderer.hideCursor(); this.renderer.visualizeBlur(); this._emit("blur", e); } /** */ $cursorChange() { this.renderer.updateCursor(); this.$highlightBrackets(); this.$updateHighlightActiveLine(); } /** * Emitted whenever the document is changed. * @param {import("../ace-internal").Ace.Delta} delta Contains a single property, `data`, which has the delta of changes * @internal **/ onDocumentChange(delta) { // Rerender and emit "change" event. var wrap = this.session.$useWrapMode; var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity); this.renderer.updateLines(delta.start.row, lastRow, wrap); this._signal("change", delta); // Update cursor because tab characters can influence the cursor position. this.$cursorChange(); } /** * @internal */ onTokenizerUpdate(e) { var rows = e.data; this.renderer.updateLines(rows.first, rows.last); } /** * @internal */ onScrollTopChange() { this.renderer.scrollToY(this.session.getScrollTop()); } /** * @internal */ onScrollLeftChange() { this.renderer.scrollToX(this.session.getScrollLeft()); } /** * Emitted when the selection changes. * @internal **/ onCursorChange() { this.$cursorChange(); this._signal("changeSelection"); } /** */ $updateHighlightActiveLine() { var session = this.getSession(); /**@type {Point|false}*/ var highlight; if (this.$highlightActiveLine) { if (this.$selectionStyle != "line" || !this.selection.isMultiLine()) highlight = this.getCursorPosition(); if (this.renderer.theme && this.renderer.theme.$selectionColorConflict && !this.selection.isEmpty()) highlight = false; if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 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"); } } /** * @param e * @internal */ onSelectionChange(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"); } $getSelectionHighLightRegexp() { 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); // maximum allowed size for regular expressions in 32000, // but getting close to it has significant impact on the performance if (needle.length > 5000 || !/[\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; } /** * @internal */ onChangeFrontMarker() { this.renderer.updateFrontMarkers(); } /** * @internal */ onChangeBackMarker() { this.renderer.updateBackMarkers(); } /** * @internal */ onChangeBreakpoint() { this.renderer.updateBreakpoints(); } /** * @internal */ onChangeAnnotation() { this.renderer.setAnnotations(this.session.getAnnotations()); } /** * @param e * @internal */ onChangeMode (e) { this.renderer.updateText(); this._emit("changeMode", e); } /** * @internal */ onChangeWrapLimit() { this.renderer.updateFull(); } /** * @internal */ onChangeWrapMode() { this.renderer.onResize(true); } /** * @internal */ onChangeFold() { // 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} **/ getSelectedText() { return this.session.getTextRange(this.getSelectionRange()); } /** * Returns the string of text currently highlighted. * @returns {String} **/ getCopyText () { 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 : false; return e.text; } /** * Called whenever a text "copy" happens. * @internal **/ onCopy() { this.commands.exec("copy", this); } /** * Called whenever a text "cut" happens. * @internal **/ onCut() { this.commands.exec("cut", this); } /** * Called whenever a text "paste" happens. * @param {String} text The pasted text * @param {ClipboardEvent} [event] * @internal **/ onPaste(text, event) { var e = {text: text, event: event}; this.commands.exec("paste", this, e); } /** * * @param {string | {text: string, event?: ClipboardEvent}} e * @returns {boolean} */ $handlePaste(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; var isFullLine = lines.length == 2 && (!lines[0] || !lines[1]); if (lines.length != ranges.length || isFullLine) 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]); } } } /** * * @param {string | string[] | import("../ace-internal").Ace.Command} command * @param [args] * @return {boolean} */ execCommand(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 * @param {boolean} [pasted] **/ insert(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 = 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); 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 (this.$enableAutoIndent) { 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); } } autoIndent() { var session = this.session; var mode = session.getMode(); var ranges = this.selection.isEmpty() ? [new Range(0, 0, session.doc.getLength() - 1, 0)] : this.selection.getAllRanges(); /**@type{string|string[]}*/ var prevLineState = ""; var prevLine = ""; var lineIndent = ""; var tab = session.getTabString(); for (var i = 0; i < ranges.length; i++) { var startRow = ranges[i].start.row; var endRow = ranges[i].end.row; for (var row = startRow; row <= endRow; row++) { if (row > 0) { prevLineState = session.getState(row - 1); prevLine = session.getLine(row - 1); lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab); } var line = session.getLine(row); var currIndent = mode.$getIndent(line); if (lineIndent !== currIndent) { if (currIndent.length > 0) { var range = new Range(row, 0, row, currIndent.length); session.remove(range); } if (lineIndent.length > 0) { session.insert({row: row, column: 0}, lineIndent); } } mode.autoOutdent(prevLineState, session, row); } } } /** * * @param text * @param composition * @returns {*} * @internal */ onTextInput(text, composition) { if (!composition) return this.keyBinding.onTextInput(text); this.startOperation({command: { name: "insertstring" }}); var applyComposition = this.applyComposition.bind(this, text, composition); if (this.selection.rangeCount) this.forEachSelection(applyComposition); else applyComposition(); this.endOperation(); } /** * @param {string} [text] * @param {any} [composition] */ applyComposition(text, composition) { if (composition.extendLeft || composition.extendRight) { var r = this.selection.getRange(); r.start.column -= composition.extendLeft; r.end.column += composition.extendRight; if (r.start.column < 0) { r.start.row--; r.start.column += this.session.getLine(r.start.row).length + 1; } this.selection.setRange(r); if (!text && !r.isEmpty()) this.remove(); } if (text || !this.selection.isEmpty()) this.insert(text, true); if (composition.restoreStart || composition.restoreEnd) { var r = this.selection.getRange(); r.start.column -= composition.restoreStart; r.end.column -= composition.restoreEnd; this.selection.setRange(r); } } /** * @internal */ onCommandKey(e, hashId, keyCode) { return 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 **/ setOverwrite(overwrite) { this.session.setOverwrite(overwrite); } /** * Returns `true` if overwrites are enabled; `false` otherwise. * @returns {Boolean} * @related EditSession.getOverwrite **/ getOverwrite() { return this.session.getOverwrite(); } /** * Sets the value of overwrite to the opposite of whatever it currently is. * @related EditSession.toggleOverwrite **/ toggleOverwrite() { this.session.toggleOverwrite(); } /** * Sets how fast the mouse scrolling should do. * @param {Number} speed A value indicating the new speed (in milliseconds) **/ setScrollSpeed(speed) { this.setOption("scrollSpeed", speed); } /** * Returns the value indicating how fast the mouse scroll speed is (in milliseconds). * @returns {Number} **/ getScrollSpeed() { return this.getOption("scrollSpeed"); } /** * Sets the delay (in milliseconds) of the mouse drag. * @param {Number} dragDelay A value indicating the new delay **/ setDragDelay(dragDelay) { this.setOption("dragDelay", dragDelay); } /** * Returns the current mouse drag delay. * @returns {Number} **/ getDragDelay() { return this.getOption("dragDelay"); } /** * Draw selection markers spanning whole line, or only over selected text. Default value is "line" * @param {"fullLine" | "screenLine" | "text" | "line"} val The new selection style "line"|"text" **/ setSelectionStyle(val) { this.setOption("selectionStyle", val); } /** * Returns the current selection style. * @returns {import("../ace-internal").Ace.EditorOptions["selectionStyle"]} **/ getSelectionStyle() { 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 **/ setHighlightActiveLine(shouldHighlight) { this.setOption("highlightActiveLine", shouldHighlight); } /** * Returns `true` if current lines are always highlighted. * @return {Boolean} **/ getHighlightActiveLine() { return this.getOption("highlightActiveLine"); } /** * @param {boolean} shouldHighlight */ setHighlightGutterLine(shouldHighlight) { this.setOption("highlightGutterLine", shouldHighlight); } /** * @returns {Boolean} */ getHighlightGutterLine() { 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 **/ setHighlightSelectedWord(shouldHighlight) { this.setOption("highlightSelectedWord", shouldHighlight); } /** * Returns `true` if currently highlighted words are to be highlighted. * @returns {Boolean} **/ getHighlightSelectedWord() { return this.$highlightSelectedWord; } /** * @param {boolean} shouldAnimate */ setAnimatedScroll(shouldAnimate){ this.renderer.setAnimatedScroll(shouldAnimate); } /** * @return {boolean} */ getAnimatedScroll(){ 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 **/ setShowInvisibles(showInvisibles) { this.renderer.setShowInvisibles(showInvisibles); } /** * Returns `true` if invisible characters are being shown. * @returns {Boolean} **/ getShowInvisibles() { return this.renderer.getShowInvisibles(); } /** * @param {boolean} display */ setDisplayIndentGuides(display) { this.renderer.setDisplayIndentGuides(display); } /** * @return {boolean} */ getDisplayIndentGuides() { return this.renderer.getDisplayIndentGuides(); } /** * @param {boolean} highlight */ setHighlightIndentGuides(highlight) { this.renderer.setHighlightIndentGuides(highlight); } /** * @return {boolean} */ getHighlightIndentGuides() { return this.renderer.getHighlightIndentGuides(); } /** * 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 * **/ setShowPrintMargin(showPrintMargin) { this.renderer.setShowPrintMargin(showPrintMargin); } /** * Returns `true` if the print margin is being shown. * @returns {Boolean} **/ getShowPrintMargin() { return this.renderer.getShowPrintMargin(); } /** * Sets the column defining where the print margin should be. * @param {Number} showPrintMargin Specifies the new print margin * **/ setPrintMarginColumn(showPrintMargin) { this.renderer.setPrintMarginColumn(showPrintMargin); } /** * Returns the column number of where the print margin is. * @returns {Number} **/ getPrintMarginColumn() { 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 **/ setReadOnly(readOnly) { this.setOption("readOnly", readOnly); } /** * Returns `true` if the editor is set to read-only mode. * @returns {Boolean} **/ getReadOnly() { 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 **/ setBehavioursEnabled(enabled) { this.setOption("behavioursEnabled", enabled); } /** * Returns `true` if the behaviors are currently enabled. {:BehaviorsDef} * @returns {Boolean} **/ getBehavioursEnabled() { 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 **/ setWrapBehavioursEnabled(enabled) { this.setOption("wrapBehavioursEnabled", enabled); } /** * Returns `true` if the wrapping behaviors are currently enabled. * @returns {boolean} **/ getWrapBehavioursEnabled() { return this.getOption("wrapBehavioursEnabled"); } /** * Indicates whether the fold widgets should be shown or not. * @param {Boolean} show Specifies whether the fold widgets are shown **/ setShowFoldWidgets(show) { this.setOption("showFoldWidgets", show); } /** * Returns `true` if the fold widgets are shown. * @return {Boolean} **/ getShowFoldWidgets() { return this.getOption("showFoldWidgets"); } /** * @param {boolean} fade */ setFadeFoldWidgets(fade) { this.setOption("fadeFoldWidgets", fade); } /** * @returns {boolean} */ getFadeFoldWidgets() { return this.getOption("fadeFoldWidgets"); } /** * Removes the current selection or one character. * @param {'left' | 'right'} [dir] The direction of the deletion to occur, either "left" or "right" **/ remove(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) // @ts-expect-error TODO: possible bug, new_range could be not a Range range = new_range; } this.session.remove(range); this.clearSelection(); } /** * Removes the word directly to the right of the current selection. **/ removeWordRight() { 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. **/ removeWordLeft() { 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. **/ removeToLineStart() { if (this.selection.isEmpty()) this.selection.selectLineStart(); if (this.selection.isEmpty()) this.selection.selectLeft(); this.session.remove(this.getSelectionRange()); this.clearSelection(); } /** * Removes all the words to the right of the current selection, until the end of the line. **/ removeToLineEnd() { 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'`). **/ splitLine() { if (!this.selection.isEmpty()) { this.session.remove(this.getSelectionRange()); this.clearSelection(); } var cursor = this.getCursorPosition(); this.insert("\n"); this.moveCursorToPosition(cursor); } /** * Set the "ghost" text in provided position. "Ghost" text is a kind of * preview text inside the editor which can be used to preview some code * inline in the editor such as, for example, code completions. * * @param {String} text Text to be inserted as "ghost" text * @param {Point} [position] Position to insert text to */ setGhostText(text, position) { this.renderer.setGhostText(text, position); } /** * Removes "ghost" text currently displayed in the editor. */ removeGhostText() { this.renderer.removeGhostText(); } /** * Transposes current line. **/ transposeLetters() { 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. **/ toLowerCase() { 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. **/ toUpperCase() { 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 **/ indent() { 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 **/ blockIndent() { var rows = this.$getSelectedRows(); this.session.indentRows(rows.first, rows.last, "\t"); } /** * Outdents the current line. * @related EditSession.outdentRows **/ blockOutdent() { var selection = this.session.getSelection(); this.session.outdentRows(selection.getRange()); } // TODO: move out of core when we have good mechanism for managing extensions sortLines() { 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. **/ toggleCommentLines() { var state = this.session.getState(this.getCursorPosition().row); var rows = this.$getSelectedRows(); this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last); } toggleBlockComment() { 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 {any} **/ getNumberAt(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) **/ modifyNumber(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 // @ts-ignore 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)); } } else { this.toggleWord(); } } /** */ toggleWord() { var row = this.selection.getCursor().row; var column = this.selection.getCursor().column; this.selection.selectWord(); var currentState = this.getSelectedText(); var currWordStart = this.selection.getWordRange().start.column; var wordParts = currentState.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g, '$1 ').split(/\s/); var delta = column - currWordStart - 1; if (delta < 0) delta = 0; var curLength = 0, itLength = 0; var that = this; if (currentState.match(/[A-Za-z0-9_]+/)) { wordParts.forEach(function (item, i) { itLength = curLength + item.length; if (delta >= curLength && delta <= itLength) { currentState = item; that.selection.clearSelection(); that.moveCursorTo(row, curLength + currWordStart); that.selection.selectTo(row, itLength + currWordStart); } curLength = itLength; }); } var wordPairs = this.$toggleWordPairs; var reg; for (var i = 0; i < wordPairs.length; i++) { var item = wordPairs[i]; for (var j = 0; j <= 1; j++) { var negate = +!j; var firstCondition = currentState.match(new RegExp('^\\s?_?(' + lang.escapeRegExp(item[j]) + ')\\s?$', 'i')); if (firstCondition) { var secondCondition = currentState.match(new RegExp('([_]|^|\\s)(' + lang.escapeRegExp(firstCondition[1]) + ')($|\\s)', 'g')); if (secondCondition) { reg = currentState.replace(new RegExp(lang.escapeRegExp(item[j]), 'i'), function (result) { var res = item[negate]; if (result.toUpperCase() == result) { res = res.toUpperCase(); } else if (result.charAt(0).toUpperCase() == result.charAt(0)) { res = res.substr(0, 0) + item[negate].charAt(0).toUpperCase() + res.substr(1); } return res; }); this.insert(reg); reg = ""; } } } } } /** * Finds link at defined {row} and {column} * @returns {String} **/ findLinkAt(row, column) { var line = this.session.getLine(row); var wordParts = line.split(/((?:https?|ftp):\/\/[\S]+)/); var columnPosition = column; if (columnPosition < 0) columnPosition = 0; var previousPosition = 0, currentPosition = 0, match; for (let item of wordParts) { currentPosition = previousPosition + item.length; if (columnPosition >= previousPosition && columnPosition <= currentPosition) { if (item.match(/((?:https?|ftp):\/\/[\S]+)/)) { match = item.replace(/[\s:.,'";}\]]+$/, ""); break; } } previousPosition = currentPosition; } return match; } /** * Open valid url under cursor in another tab * @returns {Boolean} **/ openLink() { var cursor = this.selection.getCursor(); var url = this.findLinkAt(cursor.row, cursor.column); if (url) window.open(url, '_blank'); return url != null; } /** * Removes all the lines in the current selection * @related EditSession.remove **/ removeLines() { var rows = this.$getSelectedRows(); this.session.removeFullLines(rows.first, rows.last); this.clearSelection(); } duplicateSelection() { 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)); range.start = point; range.end = endPoint; sel.setSelectionRange(range, reverse); } } /** * Shifts all the selected lines down one row. * * @related EditSession.moveLinesUp **/ moveLinesDown() { this.$moveLines(1, false); } /** * Shifts all the selected lines up one row. * @related EditSession.moveLinesDown **/ moveLinesUp() { 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} range The range of text you want moved within the document * @param {Point} toPosition The location (row and column) where you want to move the text to * @param {boolean} [copy] * * @returns {Range} The new range where the text was moved to. * @related EditSession.moveText **/ moveText(range, toPosition, copy) { return this.session.moveText(range, toPosition, copy); } /** * Copies all the selected lines up one row. * **/ copyLinesUp() { this.$moveLines(-1, true); } /** * Copies all the selected lines down one row. * @related EditSession.duplicateLines * **/ copyLinesDown() { this.$moveLines(1, true); } /** * for internal use * @ignore * **/ $moveLines(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; // @ts-expect-error TODO: possible bug, no args in parameters 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} **/ $getSelectedRows(range) { range = (range || this.getSelectionRange()).collapseRows(); return { first: this.session.getRowFoldStart(range.start.row), last: this.session.getRowFoldEnd(range.end.row) }; } /** * @internal */ onCompositionStart(compositionState) { this.renderer.showComposition(compositionState); } /** * @internal */ onCompositionUpdate(text) { this.renderer.setCompositionText(text); } /** * @internal */ onCompositionEnd() { this.renderer.hideComposition(); } /** * {:VirtualRenderer.getFirstVisibleRow} * * @returns {Number} * @related VirtualRenderer.getFirstVisibleRow **/ getFirstVisibleRow() { return this.renderer.getFirstVisibleRow(); } /** * {:VirtualRenderer.getLastVisibleRow} * * @returns {Number} * @related VirtualRenderer.getLastVisibleRow **/ getLastVisibleRow() { return this.renderer.getLastVisibleRow(); } /** * Indicates if the row is currently visible on the screen. * @param {Number} row The row to check * * @returns {Boolean} **/ isRowVisible(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} **/ isRowFullyVisible(row) { return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow()); } /** * Returns the number of currently visible rows. * @returns {Number} **/ $getVisibleRowCount() { return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1; } $moveByPage(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. **/ selectPageDown() { this.$moveByPage(1, true); } /** * Selects the text from the current position of the document until where a "page up" finishes. **/ selectPageUp() { this.$moveByPage(-1, true); } /** * Shifts the document to wherever "page down" is, as well as moving the cursor position. **/ gotoPageDown() { this.$moveByPage(1, false); } /** * Shifts the document to wherever "page up" is, as well as moving the cursor position. **/ gotoPageUp() { this.$moveByPage(-1, false); } /** * Scrolls the document to wherever "page down" is, without changing the cursor position. **/ scrollPageDown() { this.$moveByPage(1); } /** * Scrolls the document to wherever "page up" is, without changing the cursor position. **/ scrollPageUp() { this.$moveByPage(-1); } /** * Moves the editor to the specified row. * @related VirtualRenderer.scrollToRow * @param {number} row */ scrollToRow(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 {() => void} [callback] Function to be called when the animation has finished * * @related VirtualRenderer.scrollToLine **/ scrollToLine(line, center, animate, callback) { this.renderer.scrollToLine(line, center, animate, callback); } /** * Attempts to center the current selection on the screen. **/ centerSelection() { 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 {Point} An object that looks something like this: * * ```json * { row: currRow, column: currCol } * ``` * * @related Selection.getCursor **/ getCursorPosition() { return this.selection.getCursor(); } /** * Returns the screen position of the cursor. * @returns {Point} * @related EditSession.documentToScreenPosition **/ getCursorPositionScreen() { return this.session.documentToScreenPosition(this.getCursorPosition()); } /** * {:Selection.getRange} * @returns {Range} * @related Selection.getRange **/ getSelectionRange() { return this.selection.getRange(); } /** * Selects all the text in editor. * @related Selection.selectAll **/ selectAll() { this.selection.selectAll(); } /** * {:Selection.clearSelection} * @related Selection.clearSelection **/ clearSelection() { 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 **/ moveCursorTo(row, column) { this.selection.moveCursorTo(row, column); } /** * Moves the cursor to the position indicated by `pos.row` and `pos.column`. * @param {Point} pos An object with two properties, row and column * @related Selection.moveCursorToPosition **/ moveCursorToPosition(pos) { this.selection.moveCursorToPosition(pos); } /** * Moves the cursor's row and column to the next matching bracket or HTML tag. * @param {boolean} [select] * @param {boolean} [expand] */ jumpToMatching(select, expand) { var cursor = this.getCursorPosition(); var iterator = new TokenIterator(this.session, cursor.row, cursor.column); var prevToken = iterator.getCurrentToken(); var tokenCount = 0; if (prevToken && prevToken.type.indexOf('tag-name') !== -1) { prevToken = iterator.stepBackward(); } 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 === '<' && tokenCount > 1) { depth[token.value]++; } else if (prevToken.value === '} [options] The [[Search `Search`]] options to use * @return {number} **/ replace(replacement, options) { if (options) this.$search.set(options); var range = this.$search.find(this.session); var replaced = 0; if (!range) return replaced; if (this.$tryReplace(range, replacement)) { replaced = 1; } this.selection.setSelectionRange(range); this.renderer.scrollSelectionIntoView(range.start, range.end); return replaced; } /** * Replaces all occurrences of `options.needle` with the value in `replacement`. * @param {String} [replacement] The text to replace with * @param {Partial} [options] The [[Search `Search`]] options to use * @return {number} **/ replaceAll(replacement, options) { if (options) { this.$search.set(options); } var ranges = this.$search.findAll(this.session); var replaced = 0; if (!ranges.length) return replaced; var selection = this.getSelectionRange(); this.selection.moveTo(0, 0); for (var i = ranges.length - 1; i >= 0; --i) { if(this.$tryReplace(ranges[i], replacement)) { replaced++; } } this.selection.setSelectionRange(selection); return replaced; } /** * @param {import("../ace-internal").Ace.IRange} range * @param {string} [replacement] */ $tryReplace(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 {Partial} **/ getLastSearchOptions() { return this.$search.getOptions(); } /** * Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]]. * @param {String|RegExp|Object} needle The text to search for (optional) * @param {Partial} [options] An object defining various search properties * @param {Boolean} [animate] If `true` animate scrolling * @related Search.find **/ find(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 {Partial} [options] search options * @param {Boolean} [animate] If `true` animate scrolling * * @related Editor.find **/ findNext(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 {Partial} [options] search options * @param {Boolean} [animate] If `true` animate scrolling * * @related Editor.find **/ findPrevious(options, animate) { this.find(options, {skipCurrent: true, backwards: true}, animate); } /** * * @param {Range} range * @param {boolean} [animate] */ revealRange(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 **/ undo() { this.session.getUndoManager().undo(this.session); this.renderer.scrollCursorIntoView(null, 0.5); } /** * {:UndoManager.redo} * @related UndoManager.redo **/ redo() { this.session.getUndoManager().redo(this.session); this.renderer.scrollCursorIntoView(null, 0.5); } /** * * Cleans up the entire editor. **/ destroy() { /** true if editor is destroyed */ this.destroyed = true; if (this.$toDestroy) { this.$toDestroy.forEach(function(el) { el.destroy(); }); this.$toDestroy = []; } if (this.$mouseHandler) this.$mouseHandler.destroy(); this.renderer.destroy(); this._signal("destroy", this); if (this.session) this.session.destroy(); if (this._$emitInputEvent) this._$emitInputEvent.cancel(); this.removeAllListeners(); } /** * Enables automatic scrolling of the cursor into view when editor itself is inside scrollable element * @param {Boolean} enable default true **/ setAutoScrollEditorIntoView(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); }; } $resetCursorStyle() { 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)); } /** * opens a prompt displaying message **/ prompt(message, options, callback) { var editor = this; config.loadModule("ace/ext/prompt", function (module) { module.prompt(editor, message, options, callback); }); } get hoverTooltip() { return this.$hoverTooltip || (this.$hoverTooltip = new HoverTooltip(this.container)); } set hoverTooltip(value) { if (this.$hoverTooltip) this.$hoverTooltip.destroy(); this.$hoverTooltip = value; } } Editor.$uid = 0; Editor.prototype.curOp = null; Editor.prototype.prevOp = {}; // TODO use property on commands instead of this Editor.prototype.$mergeableCommands = ["backspace", "del", "insertstring"]; Editor.prototype.$toggleWordPairs = [ ["first", "last"], ["true", "false"], ["yes", "no"], ["width", "height"], ["top", "bottom"], ["right", "left"], ["on", "off"], ["x", "y"], ["get", "set"], ["max", "min"], ["horizontal", "vertical"], ["show", "hide"], ["add", "remove"], ["up", "down"], ["before", "after"], ["even", "odd"], ["in", "out"], ["inside", "outside"], ["next", "previous"], ["increase", "decrease"], ["attach", "detach"], ["&&", "||"], ["==", "!="] ]; oop.implement(Editor.prototype, EventEmitter); 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(/**@type{boolean}*/readOnly) { this.textInput.setReadOnly(readOnly); if (this.destroyed) return; this.$resetCursorStyle(); if (!this.$readOnlyCallback) { this.$readOnlyCallback = (e) => { var shouldShow = false; if (e && e.type == "keydown") { if (e && e.key && !e.ctrlKey && !e.metaKey) { if (e.key == " ") e.preventDefault(); shouldShow = e.key.length == 1; } if (!shouldShow) return; } else if (e && e.type !== "exec") { shouldShow = true; } if (shouldShow) { var domNode = dom.createElement("div"); domNode.textContent = nls("editor.tooltip.disable-editing", "Editing is disabled"); if (!this.hoverTooltip.isOpen) { this.hoverTooltip.showForRange(this, this.getSelectionRange(), domNode); } } else if (this.hoverTooltip && this.hoverTooltip.isOpen) { this.hoverTooltip.hide(); } }; } var textArea = this.textInput.getElement(); if (readOnly) { event.addListener(textArea, "keydown", this.$readOnlyCallback, this); this.commands.on("exec", this.$readOnlyCallback); this.commands.on("commandUnavailable", this.$readOnlyCallback); } else { event.removeListener(textArea, "keydown", this.$readOnlyCallback); this.commands.off("exec", this.$readOnlyCallback); this.commands.off("commandUnavailable", this.$readOnlyCallback); } }, 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}, enableAutoIndent: {initialValue: true}, autoScrollEditorIntoView: { set: function(val) {this.setAutoScrollEditorIntoView(val);} }, keyboardHandler: { set: function(val) { this.setKeyboardHandler(val); }, get: function() { return this.$keybindingId; }, handlesSet: true }, value: { set: function(val) { this.session.setValue(val); }, get: function() { return this.getValue(); }, handlesSet: true, hidden: true }, session: { set: function(val) { this.setSession(val); }, get: function() { return this.session; }, handlesSet: true, hidden: true }, showLineNumbers: { set: function(show) { this.renderer.$gutterLayer.setShowLineNumbers(show); this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER); if (show && this.$relativeLineNumbers) relativeNumberRenderer.attach(this); else relativeNumberRenderer.detach(this); }, initialValue: true }, relativeLineNumbers: { set: function(value) { if (this.$showLineNumbers && value) relativeNumberRenderer.attach(this); else relativeNumberRenderer.detach(this); } }, placeholder: { /** * @param message */ set: function(message) { if (!this.$updatePlaceholder) { this.$updatePlaceholder = function() { var hasValue = this.session && (this.renderer.$composition || this.session.getLength() > 1 || this.session.getLine(0).length > 0); if (hasValue && this.renderer.placeholderNode) { this.renderer.off("afterRender", this.$updatePlaceholder); dom.removeCssClass(this.container, "ace_hasPlaceholder"); this.renderer.placeholderNode.remove(); this.renderer.placeholderNode = null; } else if (!hasValue && !this.renderer.placeholderNode) { this.renderer.on("afterRender", this.$updatePlaceholder); dom.addCssClass(this.container, "ace_hasPlaceholder"); var el = dom.createElement("div"); el.className = "ace_placeholder"; el.textContent = this.$placeholder || ""; this.renderer.placeholderNode = el; this.renderer.content.appendChild(this.renderer.placeholderNode); } else if (!hasValue && this.renderer.placeholderNode) { this.renderer.placeholderNode.textContent = this.$placeholder || ""; } }.bind(this); // @ts-ignore this.on("input", this.$updatePlaceholder); } this.$updatePlaceholder(); } }, enableKeyboardAccessibility: { set: function(value) { var blurCommand = { name: "blurTextInput", description: "Set focus to the editor content div to allow tabbing through the page", bindKey: "Esc", exec: function(editor) { editor.blur(); editor.renderer.scroller.focus(); }, readOnly: true }; var focusOnEnterKeyup = function (e) { if (e.target == this.renderer.scroller && e.keyCode === keys['enter']){ e.preventDefault(); var row = this.getCursorPosition().row; if (!this.isRowVisible(row)) this.scrollToLine(row, true, true); this.focus(); } }; /**@type {GutterKeyboardHandler}*/ var gutterKeyboardHandler; // If keyboard a11y mode is enabled we: // - Enable keyboard operability gutter. // - Prevent tab-trapping. // - Hide irrelevant elements from assistive technology. // - On Windows, set more lines to the textarea. // - set aria-label to the text input. if (value){ this.renderer.enableKeyboardAccessibility = true; this.renderer.keyboardFocusClassName = "ace_keyboard-focus"; this.textInput.getElement().setAttribute("tabindex", -1); // VoiceOver on Mac OS works best with single line in the textarea, the screen readers on // Windows work best with multiple lines in the textarea. this.textInput.setNumberOfExtraLines(useragent.isWin ? 3 : 0); this.renderer.scroller.setAttribute("tabindex", 0); this.renderer.scroller.setAttribute("role", "group"); this.renderer.scroller.setAttribute("aria-roledescription", nls("editor.scroller.aria-roledescription", "editor")); this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName); this.renderer.scroller.setAttribute("aria-label", nls("editor.scroller.aria-label", "Editor content, press Enter to start editing, press Escape to exit") ); this.renderer.scroller.addEventListener("keyup", focusOnEnterKeyup.bind(this)); this.commands.addCommand(blurCommand); this.renderer.$gutter.setAttribute("tabindex", 0); this.renderer.$gutter.setAttribute("aria-hidden", false); this.renderer.$gutter.setAttribute("role", "group"); this.renderer.$gutter.setAttribute("aria-roledescription", nls("editor.gutter.aria-roledescription", "editor gutter")); this.renderer.$gutter.setAttribute("aria-label", nls("editor.gutter.aria-label", "Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit") ); this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName); this.renderer.content.setAttribute("aria-hidden", true); if (!gutterKeyboardHandler) gutterKeyboardHandler = new GutterKeyboardHandler(this); gutterKeyboardHandler.addListener(); this.textInput.setAriaOptions({ setLabel: true }); } else { this.renderer.enableKeyboardAccessibility = false; this.textInput.getElement().setAttribute("tabindex", 0); this.textInput.setNumberOfExtraLines(0); this.renderer.scroller.setAttribute("tabindex", -1); this.renderer.scroller.removeAttribute("role"); this.renderer.scroller.removeAttribute("aria-roledescription"); this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName); this.renderer.scroller.removeAttribute("aria-label"); this.renderer.scroller.removeEventListener("keyup", focusOnEnterKeyup.bind(this)); this.commands.removeCommand(blurCommand); this.renderer.content.removeAttribute("aria-hidden"); this.renderer.$gutter.setAttribute("tabindex", -1); this.renderer.$gutter.setAttribute("aria-hidden", true); this.renderer.$gutter.removeAttribute("role"); this.renderer.$gutter.removeAttribute("aria-roledescription"); this.renderer.$gutter.removeAttribute("aria-label"); this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName); if (gutterKeyboardHandler) gutterKeyboardHandler.removeListener(); } }, initialValue: false }, textInputAriaLabel: { set: function(val) { this.$textInputAriaLabel = val; }, initialValue: "" }, enableMobileMenu: { /** * @param {boolean} val */ set: function(val) { this.$enableMobileMenu = val; }, initialValue: true }, customScrollbar: "renderer", hScrollBarAlwaysVisible: "renderer", vScrollBarAlwaysVisible: "renderer", highlightGutterLine: "renderer", animatedScroll: "renderer", showInvisibles: "renderer", showPrintMargin: "renderer", printMarginColumn: "renderer", printMargin: "renderer", fadeFoldWidgets: "renderer", showFoldWidgets: "renderer", displayIndentGuides: "renderer", highlightIndentGuides: "renderer", showGutter: "renderer", fontSize: "renderer", fontFamily: "renderer", maxLines: "renderer", minLines: "renderer", scrollPastEnd: "renderer", fixedWidthGutter: "renderer", theme: "renderer", hasCssTransforms: "renderer", maxPixelHeight: "renderer", useTextareaForIME: "renderer", useResizeObserver: "renderer", useSvgGutterIcons: "renderer", showFoldedAnnotations: "renderer", scrollSpeed: "$mouseHandler", dragDelay: "$mouseHandler", dragEnabled: "$mouseHandler", focusTimeout: "$mouseHandler", firstLineNumber: "session", overwrite: "session", newLineMode: "session", useWorker: "session", useSoftTabs: "session", navigateWithinSoftTabs: "session", tabSize: "session", wrap: "session", indentedSoftWrap: "session", foldStyle: "session", mode: "session" }); var relativeNumberRenderer = { getText: function(/**@type{EditSession}*/session, /**@type{number}*/row) { return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9 ? "\xb7" : ""))) + ""; }, getWidth: function(session, /**@type{number}*/lastLineNumber, config) { return Math.max( lastLineNumber.toString().length, (config.lastRow + 1).toString().length, 2 ) * config.characterWidth; }, update: function(e, /**@type{Editor}*/editor) { editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER); }, attach: function(/**@type{Editor}*/editor) { editor.renderer.$gutterLayer.$renderer = this; editor.on("changeSelection", this.update); this.update(null, editor); }, detach: function(/**@type{Editor}*/editor) { if (editor.renderer.$gutterLayer.$renderer == this) editor.renderer.$gutterLayer.$renderer = null; editor.off("changeSelection", this.update); this.update(null, editor); } }; exports.Editor = Editor; ================================================ FILE: src/editor_change_document_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "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"); var lang = require("./lib/lang"); module.exports = { setUp : function() { this.session1 = new EditSession(["abc", "def"]); this.session2 = new EditSession(["ghi", "jkl"]); this.editor = new Editor(new MockRenderer()); }, "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" : async 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}, ""); await lang.sleep(600); assert.equal(Object.keys(self.session1.getAnnotations()).length, 0); next(); } }; require("./test/run")(module); ================================================ FILE: src/editor_commands_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "use strict"; var Editor = require("./editor").Editor; var UndoManager = require("./undomanager").UndoManager; var MockRenderer = require("./test/mockrenderer").MockRenderer; var JavaScriptMode = require("./mode/javascript").Mode; var HTMLMode = require("./mode/html").Mode; var assert = require("./test/assertions"); var lang = require("./lib/lang"); require("./multi_select"); var editor; var exec = function(name, times, args) { do { editor.commands.exec(name, editor, args); } while(times --> 1); }; module.exports = { "test highlightmatching": async function(done) { editor = new Editor(new MockRenderer()); editor.session.setMode(new HTMLMode); editor.setValue(" abcd", 1); exec("gotostart", 1); exec("gotoright", 3); assert.equal(editor.$highlightPending, true); await lang.sleep(51); assert.equal(editor.$highlightPending, false); assert.ok(editor.session.$bracketHighlight); assert.equal( editor.session.$bracketHighlight.ranges + "", "Range: [0/1] -> [0/5],Range: [0/26] -> [0/30]" ); exec("gotoend", 1); exec("gotoleft", 3); assert.equal(editor.$highlightPending, true); await lang.sleep(51); assert.equal(editor.$highlightPending, false); editor.setValue("{}"); exec("gotostart", 1); await lang.sleep(51); assert.equal(editor.session.$bracketHighlight.ranges + "", 'Range: [0/0] -> [0/2]'); exec("gotoend", 1); await lang.sleep(51); assert.equal(editor.session.$bracketHighlight.ranges + "", 'Range: [0/0] -> [0/2]'); done(); }, "test modifyNumber": function() { editor = new Editor(new MockRenderer()); editor.setValue("999"); editor.execCommand(editor.commands.byName.modifyNumberUp); assert.equal(editor.getValue(), "1000"); editor.setValue("999f"); editor.execCommand(editor.commands.byName.modifyNumberUp); assert.equal(editor.getValue(), "999f"); editor.setValue("1000"); editor.execCommand(editor.commands.byName.modifyNumberDown); assert.equal(editor.getValue(), "999"); editor.setValue("1000.1"); editor.execCommand(editor.commands.byName.modifyNumberDown); assert.equal(editor.getValue(), "1000.0"); editor.setValue("123.3", 1); exec("gotoleft", 2); editor.execCommand(editor.commands.byName.modifyNumberDown); assert.equal(editor.getValue(), "122.3"); }, "test duplicateSelection": function() { editor = new Editor(new MockRenderer()); editor.setValue("123.3", 1); exec("selectleft", 2); editor.execCommand(editor.commands.byName.duplicateSelection); assert.equal(editor.getValue(), "123.3.3"); editor.setValue("124.3", 1); exec("gotoleft", 3); exec("selectright", 2); editor.execCommand(editor.commands.byName.duplicateSelection); assert.equal(editor.getValue(), "124.4.3"); editor.clearSelection(); editor.execCommand(editor.commands.byName.duplicateSelection); assert.equal(editor.getValue(), "124.4.3\n124.4.3"); }, "test editor find": function() { editor = new Editor(new MockRenderer()); editor.setValue("for for foo", 1); exec("gotoleft", 8); exec("selectleft", 3); editor.execCommand(editor.commands.byName.findnext); assert.range(editor.selection.getRange(), 0, 4, 0, 7); editor.setValue("for for for foo", 1); exec("gotoleft", 8); exec("selectleft", 3); editor.execCommand(editor.commands.byName.findprevious); assert.range(editor.selection.getRange(), 0, 0, 0, 3); editor.setValue("foo for foo foo", 1); exec("gotoleft", 8); editor.execCommand(editor.commands.byName.selectOrFindNext); assert.range(editor.selection.getRange(), 0, 4, 0, 7); editor.setValue("foo for foo foo", 1); exec("gotoleft", 7); exec("selectright", 3); editor.execCommand(editor.commands.byName.selectOrFindNext); assert.range(editor.selection.getRange(), 0, 12, 0, 15); editor.setValue("foo for foo foo", 1); exec("gotoleft", 8); editor.execCommand(editor.commands.byName.selectOrFindPrevious); assert.range(editor.selection.getRange(), 0, 4, 0, 7); editor.setValue("foo for foo foo", 1); exec("gotoleft", 7); exec("selectright", 3); editor.execCommand(editor.commands.byName.selectOrFindPrevious); assert.range(editor.selection.getRange(), 0, 0, 0, 3); }, "test overwrite": function() { editor = new Editor(new MockRenderer()); editor.setValue("foo for foo foo", 1); exec("gotoleft", 7); editor.execCommand(editor.commands.byName.overwrite); exec("insertstring", 1, "b"); assert.equal(editor.getValue(),"foo for boo foo"); }, "test selections": function() { editor = new Editor(new MockRenderer(5)); editor.setValue("foo for foo foo\nfoo for foo foo", 1); exec("gotoleft", 7); editor.execCommand(editor.commands.byName.selecttostart); assert.range(editor.selection.getRange(), 0, 0, 1, 8); editor.setValue("foo for foo foo\nfsdfsd232", 1); exec("gotoleft", 3); editor.execCommand(editor.commands.byName.selectup); assert.range(editor.selection.getRange(), 0, 6, 1, 6); editor.setValue("foo for foo foo\nfsdfsd232", 1); exec("gotoleft", 9); editor.execCommand(editor.commands.byName.selecttoend); assert.range(editor.selection.getRange(), 1, 0, 1, 9); editor.setValue("foo for foo foo\nfsdfsd232", 1); exec("gotostart", 1); exec("gotoright", 3); editor.execCommand(editor.commands.byName.selectdown); assert.range(editor.selection.getRange(), 0, 3, 1, 3); editor.setValue("foo for foo foo\nfsdfsd232", 1); exec("gotoleft", 4); editor.execCommand(editor.commands.byName.selecttolinestart); assert.range(editor.selection.getRange(), 1, 0, 1, 5); editor.setValue("foo for foo foo", 1); exec("gotoleft", 7); editor.execCommand(editor.commands.byName.selectwordright); assert.range(editor.selection.getRange(), 0, 8, 0, 11); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("gotoright", 2); exec("selectright", 2); editor.execCommand(editor.commands.byName.selecttolineend); assert.range(editor.selection.getRange(), 0, 2, 0, 15); // dublicate command editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("gotoright", 2); exec("selectright", 2); editor.execCommand(editor.commands.byName.selectlineend); assert.range(editor.selection.getRange(), 0, 2, 0, 15); editor.setValue("foo for foo foo", 1); exec("gotoleft", 2); editor.execCommand(editor.commands.byName.selectlinestart); assert.range(editor.selection.getRange(), 0, 0, 0, 13); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("gotoright", 3); exec("selectright", 3); editor.execCommand(editor.commands.byName.invertSelection); assert.range(editor.selection.getAllRanges()[0], 0, 0, 0, 3); assert.range(editor.selection.getAllRanges()[1], 0, 6, 0, 15); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("selectright", 3); editor.execCommand(editor.commands.byName.invertSelection); assert.range(editor.selection.getRange(), 0, 3, 0, 15); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); editor.execCommand(editor.commands.byName.invertSelection); assert.range(editor.selection.getRange(), 0, 0, 0, 15); editor.setValue("foo for foo foo"); editor.execCommand(editor.commands.byName.invertSelection); assert.range(editor.selection.getRange(), 0, 15, 0, 15); // ToDO: plenty of matching tests editor.session.setMode(new HTMLMode); editor.setValue(" abcd", 1); exec("gotostart", 1); exec("gotoright", 3); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 3, 0, 24); editor.setValue("
    abcd
    ", 1); exec("gotostart", 1); exec("gotoright", 11); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 11, 0, 26); editor.setValue("
    abcd
    ", 1); exec("gotostart", 1); exec("gotoright", 22); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 20, 0, 22); editor.setValue("abcd
    ", 1); exec("gotostart", 1); exec("gotoright", 15); editor.execCommand(editor.commands.byName.selecttomatching); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 10, 0, 15); editor.setValue("abcd
    ", 1); exec("gotostart", 1); exec("gotoright", 21); editor.execCommand(editor.commands.byName.selecttomatching); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 16, 0, 21); editor.setValue("", 1); exec("gotostart", 1); exec("gotoright", 3); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 0, 0, 0); editor.session.setMode(new JavaScriptMode); editor.setValue("if (state == 1) {alert(1);}", -1); exec("gotowordright", 9); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 17, 0, 26); editor.setValue("if (state == 1) {}", 1); exec("gotoleft", 1); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 17, 0, 17); editor.setValue("if (state == 1) {alert(1);}", 1); editor.selection.moveTo(0, 16); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 16, 0, 16); editor.setValue("if (state == 1) {alert(1);}", 1); exec("gotostart", 1); exec("gotoright", 16); exec("selectright", 10); editor.execCommand(editor.commands.byName.selecttomatching); assert.range(editor.selection.getRange(), 0, 16, 0, 17); editor.setValue("abcd", 1); exec("gotostart", 1); exec("gotoright", 6); editor.execCommand(editor.commands.byName.selecttomatching); // TODO: assert.range should return selection until the instead of editor.setValue("abcd\n", 1); exec("gotostart", 1); exec("gotoright", 6); editor.execCommand(editor.commands.byName.expandtoline); editor.execCommand(editor.commands.byName.expandtoline); assert.range(editor.selection.getRange(), 0, 0, 1, 13); }, "test goto": function() { editor = new Editor(new MockRenderer()); editor.setValue("foo for foo foo\nfsdfsd232", 1); editor.execCommand(editor.commands.byName.golineup); assert.position(editor.getCursorPosition(), 0, 9); editor.setValue("foo for foo foo\nfsdfsd232\ndfsf", 1); exec("gotostart", 1); exec("selectdown", 1); editor.execCommand(editor.commands.byName.golineup); assert.position(editor.getCursorPosition(), 0, 0); editor.setValue("foo for foo foo\nfsdfsd232\ndfsf", 1); exec("selectup", 1); editor.execCommand(editor.commands.byName.golinedown); assert.position(editor.getCursorPosition(), 2, 4); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("selectright", 2); editor.execCommand(editor.commands.byName.gotoright); assert.position(editor.getCursorPosition(), 0, 2); editor.setValue("foo for foo foo", 1); editor.execCommand(editor.commands.byName.gotowordleft); assert.position(editor.getCursorPosition(), 0, 12); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); editor.execCommand(editor.commands.byName.gotowordright); assert.position(editor.getCursorPosition(), 0, 3); }, "test cut/cut_or_delete": function() { editor = new Editor(new MockRenderer()); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("selectright", 3); editor.execCommand(editor.commands.byName.cut); assert.equal(editor.getValue(), " for foo foo"); editor.setValue("foo for foo foo\nfoo", 1); //exec("gotostart", 1); exec("selectall", 1); editor.execCommand(editor.commands.byName.cut); assert.equal(editor.getValue(), ""); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); editor.execCommand(editor.commands.byName.cut); assert.equal(editor.getValue(), "foo for foo foo"); editor.setValue("foo for foo foo", 1); editor.execCommand(editor.commands.byName.cut_or_delete); assert.equal(editor.getValue(), "foo for foo fo"); editor.session.setMode(new JavaScriptMode); editor.setValue("foo for foo foo", 1); exec("selectleft", 2); assert.ok(editor.execCommand("cut_or_delete") == false); }, "test sortlines": function() { editor = new Editor(new MockRenderer()); editor.setValue("def\nabd\nacde", 1); exec("selectall", 1); editor.execCommand(editor.commands.byName.sortlines); assert.equal(editor.getValue(), "abd\nacde\ndef"); editor.setValue("def\nabd\nabd", 1); exec("selectall", 1); editor.execCommand(editor.commands.byName.sortlines); assert.equal(editor.getValue(), "abd\nabd\ndef"); }, "test togglecomments/blockcomments": function() { editor = new Editor(new MockRenderer()); editor.session.setMode(new JavaScriptMode); editor.setValue("def\nabd\nabd"); editor.execCommand(editor.commands.byName.togglecomment); assert.equal(editor.getValue(), "// def\n// abd\n// abd"); editor.setValue("def\nabd\nabd"); editor.execCommand(editor.commands.byName.toggleBlockComment); assert.equal(editor.getValue(), "/*def\nabd\nabd*/"); }, "test redo without undoManager": function() { editor = new Editor(new MockRenderer()); editor.session.setValue("def\nabd\nabd"); exec("selectall", 1); exec("backspace", 1); exec("undo", 1); assert.equal(editor.getValue(), ""); editor.execCommand(editor.commands.byName.redo); assert.equal(editor.getValue(), ""); }, "test redo": function() { editor = new Editor(new MockRenderer()); editor.session.setUndoManager(new UndoManager()); editor.session.setValue("def\nabd\nabd"); exec("selectall", 1); exec("backspace", 1); exec("undo", 1); assert.equal(editor.getValue(), "def\nabd\nabd"); editor.execCommand(editor.commands.byName.redo); assert.equal(editor.getValue(), ""); }, "test removetoline": function() { editor = new Editor(new MockRenderer()); editor.setValue("foo for foo foo", 1); exec("gotoleft", 3); editor.execCommand(editor.commands.byName.removetolinestart); assert.equal(editor.getValue(), "foo"); editor.setValue("foo for foo foo", 1); exec("selectleft", 3); editor.execCommand(editor.commands.byName.removetolinestart); assert.equal(editor.getValue(), "foo for foo "); editor.setValue("foo for foo foo", 1); exec("gotoleft", 3); editor.execCommand(editor.commands.byName.removetolinestarthard); assert.equal(editor.getValue(), "foo"); editor.setValue("foo for foo foo", 1); exec("gotoleft", 3); exec("selectleft", 3); editor.execCommand(editor.commands.byName.removetolinestarthard); assert.equal(editor.getValue(), "foo"); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("gotoright", 2); editor.execCommand(editor.commands.byName.removetolineend); assert.equal(editor.getValue(), "fo"); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("selectright", 2); editor.execCommand(editor.commands.byName.removetolineend); assert.equal(editor.getValue(), "o for foo foo"); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("gotoright", 2); editor.execCommand(editor.commands.byName.removetolineendhard); assert.equal(editor.getValue(), "fo"); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("gotoright", 2); exec("selectright", 2); editor.execCommand(editor.commands.byName.removetolineendhard); assert.equal(editor.getValue(), "fo"); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); editor.execCommand(editor.commands.byName.removewordright); assert.equal(editor.getValue(), " for foo foo"); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("selectright", 1); editor.execCommand(editor.commands.byName.removewordright); assert.equal(editor.getValue(), "oo for foo foo"); }, "test indent/outdent": function() { editor = new Editor(new MockRenderer()); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); editor.execCommand(editor.commands.byName.indent); assert.equal(editor.getValue()," foo for foo foo"); // TODO: buggy behaviour with autocompletion. For example, when cursor after f in the middle of the word. editor.setValue("foo for foo foo\nfoo for foo foo", 1); exec("gotoleft", 3); exec("selecttostart", 1); editor.execCommand(editor.commands.byName.indent); assert.equal(editor.getValue(), " foo for foo foo\n foo for foo foo"); editor.setValue("foo for foo foo\nfoo for foo foo"); editor.execCommand(editor.commands.byName.indent); assert.equal(editor.getValue(), " foo for foo foo\n foo for foo foo"); editor.setValue("foo for foo foo\nfoo for foo foo", 1); exec("gotoleft", 3); exec("selectleft", 2); editor.execCommand(editor.commands.byName.indent); assert.equal(editor.getValue(), "foo for foo foo\n foo for foo foo"); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("indent", 1); editor.execCommand(editor.commands.byName.outdent); assert.equal(editor.getValue(), "foo for foo foo"); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); exec("indent", 1); editor.execCommand(editor.commands.byName.blockoutdent); assert.equal(editor.getValue(), "foo for foo foo"); editor.setValue("foo for foo foo", 1); exec("gotostart", 1); editor.execCommand(editor.commands.byName.blockindent); assert.equal(editor.getValue()," foo for foo foo"); }, "test splitline": function() { editor = new Editor(new MockRenderer()); editor.setValue("foo for foo foo", 1); exec("gotoleft", 3); editor.execCommand(editor.commands.byName.splitline); assert.equal(editor.getValue(), "foo for foo \nfoo"); editor.setValue("foo for foo foo", 1); exec("selectleft", 3); editor.execCommand(editor.commands.byName.splitline); assert.equal(editor.getValue(), "foo for foo \n"); }, "test touppercase/tolowercase": function() { editor = new Editor(new MockRenderer()); editor.setValue("foo for foo foo"); editor.execCommand(editor.commands.byName.touppercase); assert.equal(editor.getValue(), "FOO FOR FOO FOO"); editor.setValue("FOO for FOO FOO"); editor.execCommand(editor.commands.byName.tolowercase); assert.equal(editor.getValue(), "foo for foo foo"); }, "test joinlines": function() { editor = new Editor(new MockRenderer()); editor.setValue("foo for foo foo\nfoo for foo foo"); editor.execCommand(editor.commands.byName.joinlines); assert.equal(editor.getValue(), "foo for foo foo foo for foo foo"); editor.setValue("foo for foo foo\nfoo for foo foo\nfoo for foo foo", 1); editor.execCommand(editor.commands.byName.joinlines); assert.equal(editor.getValue(), "foo for foo foo\nfoo for foo foo\nfoo for foo foo"); editor.setValue("foo for foo foo\nfoo for foo foo\nfoo for foo foo", 1); exec("gotostart", 1); exec("selectlineend", 1); editor.execCommand(editor.commands.byName.joinlines); assert.equal(editor.getValue(), "foo for foo foo foo for foo foo\nfoo for foo foo"); }, "test findlink": function() { editor = new Editor(new MockRenderer()); editor.setValue("foo for foo foo\nhttps://www.google.com/", 1); var url = editor.findLinkAt(0, 1); assert.equal(url, null); url = editor.findLinkAt(1, 5); assert.equal(url, "https://www.google.com/"); }, "test handle events without deprecated keyCode property": function() { editor = new Editor(new MockRenderer()); var e = new CustomEvent("keydown"); e.code = "KeyA"; if (editor.commands.platform === "mac") { e.metaKey = true; } else { e.ctrlKey = true; } editor.session.setValue("123"); assert.equal(editor.getSelectedText(), ""); editor.textInput.getElement().dispatchEvent(e); assert.equal(editor.getSelectedText(), "123"); }, "test fold": function() { editor = new Editor(new MockRenderer()); editor.session.setMode(new JavaScriptMode); editor.session.setValue('"string"'); editor.execCommand("fold"); assert.equal(editor.session.getFoldLine(0), undefined); editor.session.setValue('"string\\\nsecondline"'); editor.execCommand("fold"); assert.equal(editor.session.getFoldLine(0).end.row, 1); editor.execCommand("unfold"); assert.equal(editor.session.getFoldLine(0), undefined); } }; require("./test/run")(module); ================================================ FILE: src/editor_highlight_selected_word_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "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() { this.session = new EditSession(lipsum); this.editor = new Editor(new MockRenderer(), this.session); this.selection = this.session.getSelection(); this.search = this.editor.$search; }, "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() { var range = this.selection.getWordRange(0, 14); range.start.column++; this.selection.setRange(range); 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); } }; require("./test/run")(module); ================================================ FILE: src/editor_navigation_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "use strict"; var EditSession = require("./edit_session").EditSession; var Editor = require("./editor").Editor; var MockRenderer = require("./test/mockrenderer").MockRenderer; var VirtualRenderer = require("./virtual_renderer").VirtualRenderer; var assert = require("./test/assertions"); var keys = require('./lib/keys'); function emit(keyCode) { var data = {bubbles: true, keyCode}; var event = new KeyboardEvent("keyup", data); var el = document.activeElement; el.dispatchEvent(event); } 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); }, "test: should allow to toggle between keyboard trapping modes": function() { var editor = new Editor(new VirtualRenderer(), new EditSession(["1234", "1234567890"])); // Should not trap focus editor.setOption('enableKeyboardAccessibility', true); // Focus on editor editor.focus(); // Focus should be on textInput assert.equal(document.activeElement, editor.textInput.getElement()); assert.notEqual(document.activeElement, editor.renderer.scroller); editor.onCommandKey({}, 0, keys["escape"]); // Focus should be on the content div after pressing Esc assert.equal(document.activeElement, editor.renderer.scroller); assert.notEqual(document.activeElement, editor.textInput.getElement()); // Should trap focus editor.setOption('enableKeyboardAccessibility', false); // Focus on editor editor.focus(); // Focus should be on textInput assert.equal(document.activeElement, editor.textInput.getElement()); assert.notEqual(document.activeElement, editor.renderer.scroller); editor.onCommandKey({}, 0, keys["escape"]); // Focus should still be on the textInput assert.equal(document.activeElement, editor.textInput.getElement()); assert.notEqual(document.activeElement, editor.renderer.scroller); }, "test: should allow to focus on textInput using keyboard in non-trapping mode": function() { var editor = new Editor(new VirtualRenderer(), new EditSession(["1234", "1234567890"])); // Set to not trap focus mode editor.setOption('enableKeyboardAccessibility', true); // Focus on editor editor.renderer.scroller.focus(); // Focus should be on scroller assert.equal(document.activeElement, editor.renderer.scroller); assert.notEqual(document.activeElement, editor.textInput.getElement()); // Press enter to give focus to the textinput emit(keys["enter"]); // Focus should be on the textinput assert.equal(document.activeElement, editor.textInput.getElement()); assert.notEqual(document.activeElement, editor.renderer.scroller); } }; require("./test/run")(module); ================================================ FILE: src/editor_options_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "use strict"; var assert = require("./test/assertions"); var sendKey = require("./test/user").type; var ace = require("./ace"); var lang = require("./lib/lang"); var editor; function mouse(type, pos, properties) { var target = editor.renderer.getMouseEventTarget(); var event = new CustomEvent("mouse" + type, {bubbles: true}); if ("row" in pos) { var pagePos = editor.renderer.textToScreenCoordinates(pos.row, pos.column); event.clientX = pagePos.pageX; event.clientY = pagePos.pageY; } else { target = pos; var rect = target.getBoundingClientRect(); event.clientX = rect.left + rect.width / 2; event.clientY = rect.top + rect.height / 2; } Object.assign(event, properties); target.dispatchEvent(event); } module.exports = { setUp: function () { editor = ace.edit(null, { value: "999" }); document.body.appendChild(editor.container); editor.container.style.height = "200px"; editor.container.style.width = "300px"; editor.focus(); }, tearDown: function () { editor.destroy(); editor = null; }, "test readOnly Option": async function (done) { Array.from(document.querySelectorAll(".ace_editor")).forEach(function (el) { if (el != editor.container) el.remove(); }); var nodes = document.querySelectorAll(".ace_tooltip"); assert.equal(nodes.length, 1); let readOnly = editor.getOption("readOnly"); assert.equal(editor.$hoverTooltip, null); assert.equal(readOnly, false); editor.setOption("readOnly", true); readOnly = editor.getOption("readOnly"); assert.equal(readOnly, true); sendKey("a"); await lang.sleep(6); assert.equal(editor.getValue(), "999"); assert.ok(editor.hoverTooltip != null); var nodes = document.querySelectorAll(".ace_tooltip"); assert.equal(nodes.length, 2); assert.equal(editor.hoverTooltip.isOpen, true); mouse("down", editor.container, {button: 0}); await lang.sleep(6); assert.equal(editor.hoverTooltip.isOpen, false); editor.setOption("readOnly", false); sendKey("a"); await lang.sleep(6); assert.equal(editor.getValue(), "a999"); var nodes = document.querySelectorAll(".ace_tooltip"); assert.equal(nodes.length, 2); editor.destroy(); editor.container.remove(); var nodes = document.querySelectorAll(".ace_tooltip"); assert.equal(nodes.length, 0); done(); } }; require("./test/run")(module); ================================================ FILE: src/editor_text_edit_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "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); } }; require("./test/run")(module); ================================================ FILE: src/ext/beautify.js ================================================ /** * ## Code beautification and formatting extension. * * **This extension is considered outdated.** For better formatting support with modern language servers * and advanced formatting capabilities, consider using [ace-linters](https://github.com/mkslanc/ace-linters) * which provides comprehensive language support including formatting, linting, and IntelliSense features. * * This legacy extension provides basic formatting for HTML, CSS, JavaScript, and PHP code with support for * proper indentation, whitespace management, line breaks, and bracket alignment. It handles various language * constructs including HTML tags, CSS selectors, JavaScript operators, control structures, and maintains * consistent code style throughout the document. * * @module */ "use strict"; var TokenIterator = require("../token_iterator").TokenIterator; function is(token, type) { return token.type.lastIndexOf(type + ".xml") > -1; } /** * List of HTML singleton (self-closing) tags that do not require additional indentation. * These tags are typically void elements that cannot have child content and are closed within themselves. * * @type {string[]} * @exports */ exports.singletonTags = ["area", "base", "br", "col", "command", "embed", "hr", "html", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]; /** * List of HTML block-level tags that typically require line breaks after their opening and closing tags. * These tags represent structural elements that usually contain other content and are rendered as block-level elements. * * @type {string[]} */ exports.blockTags = ["article", "aside", "blockquote", "body", "div", "dl", "fieldset", "footer", "form", "head", "header", "html", "nav", "ol", "p", "script", "section", "style", "table", "tbody", "tfoot", "thead", "ul"]; /** * Configuration options for code formatting behavior. * Controls various formatting rules such as line break placement and spacing preferences. * * @type {{lineBreaksAfterCommasInCurlyBlock?: boolean}} */ exports.formatOptions = { lineBreaksAfterCommasInCurlyBlock: true }; /** * Formats and beautifies code in the editor session with intelligent indentation, whitespace management, and bracket alignment. * Supports HTML, CSS, JavaScript, and PHP with configurable formatting options and language-specific rules. * * @param {import("../edit_session").EditSession} session - The editor session containing the code to format */ exports.beautify = function(session) { var iterator = new TokenIterator(session, 0, 0); var token = iterator.getCurrentToken(); var tabString = session.getTabString(); var singletonTags = exports.singletonTags; var blockTags = exports.blockTags; var formatOptions = exports.formatOptions || {}; var nextToken; var breakBefore = false; var spaceBefore = false; var spaceAfter = false; var code = ""; var value = ""; var tagName = ""; var depth = 0; var lastDepth = 0; var lastIndent = 0; var indent = 0; var unindent = 0; var roundDepth = 0; var curlyDepth = 0; var row; var curRow = 0; var rowsToAdd = 0; var rowTokens = []; var abort = false; var i; var indentNextLine = false; var inTag = false; var inCSS = false; var inBlock = false; var levels = {0: 0}; var parents = []; var caseBody = false; var trimNext = function() { if (nextToken && nextToken.value && nextToken.type !== 'string.regexp') nextToken.value = nextToken.value.replace(/^\s*/, ""); }; var trimLine = function() { var end = code.length - 1; while (true) { if (end == 0) break; if (code[end] !== " ") break; end = end - 1; } code = code.slice(0, end + 1); }; var trimCode = function() { code = code.trimRight(); breakBefore = false; }; while (token !== null) { curRow = iterator.getCurrentTokenRow(); rowTokens = iterator.$rowTokens; nextToken = iterator.stepForward(); if (typeof token !== "undefined") { value = token.value; unindent = 0; // mode inCSS = (tagName === "style" || session.$modeId === "ace/mode/css"); // in tag if (is(token, "tag-open")) { inTag = true; // are we in a block tag if (nextToken) inBlock = (blockTags.indexOf(nextToken.value) !== -1); // html indentation if (value === " 0; rowsToAdd--) code += "\n"; breakBefore = true; // trim value if not in a comment or string if (!is(token, "comment") && !token.type.match(/^(comment|string)$/)) value = value.trimLeft(); } if (value) { // whitespace if (token.type === "keyword" && value.match(/^(if|else|elseif|for|foreach|while|switch)$/)) { parents[depth] = value; trimNext(); spaceAfter = true; // space before else, elseif if (value.match(/^(else|elseif)$/)) { if (code.match(/\}[\s]*$/)) { trimCode(); spaceBefore = true; } } // trim value after opening paren } else if (token.type === "paren.lparen") { trimNext(); // whitespace after { if (value.substr(-1) === "{") { spaceAfter = true; indentNextLine = false; if(!inTag) rowsToAdd = 1; } // ensure curly brace is preceeded by whitespace if (value.substr(0, 1) === "{") { spaceBefore = true; // collapse square and curly brackets together if (code.substr(-1) !== '[' && code.trimRight().substr(-1) === '[') { trimCode(); spaceBefore = false; } else if (code.trimRight().substr(-1) === ')') { trimCode(); } else { trimLine(); } } // remove space before closing paren } else if (token.type === "paren.rparen") { unindent = 1; // ensure curly brace is preceeded by whitespace if (value.substr(0, 1) === "}") { if (parents[depth-1] === 'case') unindent++; if (code.trimRight().substr(-1) === '{') { trimCode(); } else { spaceBefore = true; if (inCSS) rowsToAdd+=2; } } // collapse square and curly brackets together if (value.substr(0, 1) === "]") { if (code.substr(-1) !== '}' && code.trimRight().substr(-1) === '}') { spaceBefore = false; indent++; trimCode(); } } // collapse round brackets together if (value.substr(0, 1) === ")") { if (code.substr(-1) !== '(' && code.trimRight().substr(-1) === '(') { spaceBefore = false; indent++; trimCode(); } } trimLine(); // add spaces around conditional operators } else if ((token.type === "keyword.operator" || token.type === "keyword") && value.match(/^(=|==|===|!=|!==|&&|\|\||and|or|xor|\+=|.=|>|>=|<|<=|=>)$/)) { trimCode(); trimNext(); spaceBefore = true; spaceAfter = true; // remove space before semicolon } else if (token.type === "punctuation.operator" && value === ';') { trimCode(); trimNext(); spaceAfter = true; if (inCSS) rowsToAdd++; // space after colon or comma } else if (token.type === "punctuation.operator" && value.match(/^(:|,)$/)) { trimCode(); trimNext(); // line break after commas in curly block if (value.match(/^(,)$/) && curlyDepth>0 && roundDepth===0 && formatOptions.lineBreaksAfterCommasInCurlyBlock) { rowsToAdd++; } else { spaceAfter = true; breakBefore = false; } // ensure space before php closing tag } else if (token.type === "support.php_tag" && value === "?>" && !breakBefore) { trimCode(); spaceBefore = true; // remove excess space before HTML attribute } else if (is(token, "attribute-name") && code.substr(-1).match(/^\s$/)) { spaceBefore = true; // remove space around attribute equals } else if (is(token, "attribute-equals")) { trimLine(); trimNext(); // remove space before HTML closing tag } else if (is(token, "tag-close")) { trimLine(); if(value === "/>") spaceBefore = true; } else if (token.type === "keyword" && value.match(/^(case|default)$/)) { if (caseBody) unindent = 1; } // add indent to code unless multiline string or comment if (breakBefore && !(token.type.match(/^(comment)$/) && !value.substr(0, 1).match(/^[/#]$/)) && !(token.type.match(/^(string)$/) && !value.substr(0, 1).match(/^['"@]$/))) { indent = lastIndent; if(depth > lastDepth) { indent++; for (i=depth; i > lastDepth; i--) levels[i] = indent; } else if(depth < lastDepth) indent = levels[depth]; lastDepth = depth; lastIndent = indent; if(unindent) indent -= unindent; if (indentNextLine && !roundDepth) { indent++; indentNextLine = false; } for (i = 0; i < indent; i++) code += tabString; } if (token.type === "keyword" && value.match(/^(case|default)$/)) { if (caseBody === false) { parents[depth] = value; depth++; caseBody = true; } } else if (token.type === "keyword" && value.match(/^(break)$/)) { if(parents[depth-1] && parents[depth-1].match(/^(case|default)$/)) { depth--; caseBody = false; } } // indent one line after if or else if (token.type === "paren.lparen") { roundDepth += (value.match(/\(/g) || []).length; curlyDepth += (value.match(/\{/g) || []).length; depth += value.length; } if (token.type === "keyword" && value.match(/^(if|else|elseif|for|while)$/)) { indentNextLine = true; roundDepth = 0; } else if (!roundDepth && value.trim() && token.type !== "comment") indentNextLine = false; if (token.type === "paren.rparen") { roundDepth -= (value.match(/\)/g) || []).length; curlyDepth -= (value.match(/\}/g) || []).length; for (i = 0; i < value.length; i++) { depth--; if(value.substr(i, 1)==='}' && parents[depth]==='case') { depth--; } } } if (token.type == "text") value = value.replace(/\s+$/, " "); // add to code if (spaceBefore && !breakBefore) { trimLine(); if (code.substr(-1) !== "\n") code += " "; } code += value; if (spaceAfter) code += " "; breakBefore = false; spaceBefore = false; spaceAfter = false; // line break after block tag or doctype if ((is(token, "tag-close") && (inBlock || blockTags.indexOf(tagName) !== -1)) || (is(token, "doctype") && value === ">")) { // undo linebreak if tag is immediately closed if (inBlock && nextToken && nextToken.value === ""){ depth--; } } if (is(token, "tag-name")) { tagName = value; } row = curRow; } } token = nextToken; } code = code.trim(); session.doc.setValue(code); }; /** * Array of command definitions for the beautify extension. * Contains the main beautify command with keyboard shortcut and execution handler. * * @type {import("../../ace-internal").Ace.Command[]} */ exports.commands = [{ name: "beautify", description: "Format selection (Beautify)", exec: function(editor) { exports.beautify(editor.session); }, bindKey: "Ctrl-Shift-B" }]; ================================================ FILE: src/ext/beautify_test.js ================================================ "use strict"; var assert = require("assert"); var EditSession = require("../edit_session").EditSession; var beautify = require("./beautify"); var PHPMode = require("../mode/php").Mode; var CSSMode = require("../mode/css").Mode; // Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite module.exports = { timeout: 10000, "test beautify first line empty": function() { var s = new EditSession([ "", "hello world" ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "hello world"); }, "test beautify block tag indentation": function() { var s = new EditSession([ "
    ", "

    hello

    ", "world
    " ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "
    \n" + "\t

    hello

    \n" + "\tworld\n" + "
    "); }, "test beautify block tag line breaks and indentation": function() { var s = new EditSession([ "
    " ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "\n" + "\n" + "\t
    \n" + "\n" + ""); }, "test beautify empty block tag": function() { var s = new EditSession([ "\t
    " ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "
    "); }, "test beautify inline tag indentation": function() { var s = new EditSession([ "
    ", "hello world", "
    " ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "
    \n" + "\thello world\n" + "
    "); }, "test beautify multiline inline tag indentation": function() { var s = new EditSession([ "
    ", "", "hello world", "", "
    " ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "
    \n" + "\t\n" + "\t\thello world\n" + "\t\n" + "
    "); }, "test beautify singleton tag indentation": function() { var s = new EditSession([ "
    ", "hello
    ", "world", "
    " ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "
    \n" + "\thello
    \n" + "\tworld\n" + "
    "); }, "test beautify unknown singleton indentation": function() { var s = new EditSession([ "
    ", "hello", "world", "
    " ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "
    \n" + "\thello\n" + "\tworld\n" + "
    "); }, "test beautify curly indentation": function() { var s = new EditSession([ "", "\n" + "", "\t
    ", "" ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "
    \n" + "\t
    \n" + "
    "); }, "test beautify css in php": function() { var s = new EditSession([ "" ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), ""); }, "test beautify css": function() { var s = new EditSession("", new CSSMode()); s.setUseSoftTabs(true); s.setValue(".x y:h{ animation: appear 1.5s ease-in-out ease-in-out; border: solid red;}"); beautify.beautify(s); assert.equal(s.getValue(), ".x y:h {\n" + " animation: appear 1.5s ease-in-out ease-in-out;\n" + " border: solid red;\n" + "}"); }, "test beautify comments": function() { var s = new EditSession([ "\n", "" ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), "\n" + ""); }, "test beautify js array of objects": function() { var s = new EditSession([ "" ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), ""); }, "test beautify js object": function() { var s = new EditSession([ '' ], new PHPMode()); s.setUseSoftTabs(false); beautify.beautify(s); assert.equal(s.getValue(), ""); }, "test beautify php default behaviour with line breaks after comma": function() { var s = new EditSession([ " 2 * j - 1) lensContainer.lastChild.remove(); var top = renderer.$cursorLayer.getPixelPosition({ row: row, column: 0 }, true).top - config.lineHeight * widget.rowsAbove - config.offset; lensContainer.style.top = top + "px"; var left = renderer.gutterWidth; var indent = session.getLine(row).search(/\S|$/); if (indent == -1) indent = 0; left += indent * config.characterWidth; lensContainer.style.paddingLeft = padding + left + "px"; } while (index < lensElements.length) lensElements.pop().remove(); } /** * Clears all code lens widgets from the session * @param {EditSession} session The session to clear code lens widgets from */ function clearCodeLensWidgets(session) { if (!session.lineWidgets) return; var widgetManager = session.widgetManager; session.lineWidgets.forEach(function(widget) { if (widget && widget.lenses) widgetManager.removeLineWidget(widget); }); } /** * Sets code lenses for the given session * @param {EditSession} session The session to set code lenses for * @param {import("../../ace-internal").Ace.CodeLense[]} lenses Array of code lenses to set * @return {number} The row of the first code lens or Number.MAX_VALUE if no lenses */ exports.setLenses = function(session, lenses) { var firstRow = Number.MAX_VALUE; clearCodeLensWidgets(session); lenses && lenses.forEach(function(lens) { var row = lens.start.row; var column = lens.start.column; var widget = session.lineWidgets && session.lineWidgets[row]; if (!widget || !widget.lenses) { widget = session.widgetManager.$registerLineWidget({ rowCount: 1, rowsAbove: 1, row: row, column: column, lenses: [] }); } widget.lenses.push(lens.command); if (row < firstRow) firstRow = row; }); session._emit("changeFold", {data: {start: {row: firstRow}}}); return firstRow; }; /** * Attaches code lens functionality to an editor * @param {import("../editor").Editor} editor The editor to attach to */ function attachToEditor(editor) { editor.codeLensProviders = []; editor.renderer.on("afterRender", renderWidgets); if (!editor.$codeLensClickHandler) { editor.$codeLensClickHandler = function(e) { /** @type {CodeLenseCommand} */ var command = e.target.lensCommand; if (!command) return; editor.execCommand(command.id, command.arguments); editor._emit("codeLensClick", e); }; event.addListener(editor.container, "click", editor.$codeLensClickHandler, editor); } editor.$updateLenses = function() { var session = editor.session; if (!session) return; var providersToWaitNum = editor.codeLensProviders.length; var lenses = []; editor.codeLensProviders.forEach(function(provider) { provider.provideCodeLenses(session, function(err, payload) { if (err) return; payload.forEach(function(lens) { lenses.push(lens); }); providersToWaitNum--; if (providersToWaitNum == 0) { applyLenses(); } }); }); function applyLenses() { var cursor = session.selection.cursor; var oldRow = session.documentToScreenRow(cursor); var scrollTop = session.getScrollTop(); var firstRow = exports.setLenses(session, lenses); var lastDelta = session.$undoManager && session.$undoManager.$lastDelta; if (lastDelta && lastDelta.action == "remove" && lastDelta.lines.length > 1) return; var row = session.documentToScreenRow(cursor); var lineHeight = editor.renderer.layerConfig.lineHeight; var top = session.getScrollTop() + (row - oldRow) * lineHeight; // special case for the lens on line 0, because it can't be scrolled into view with keyboard if (firstRow == 0 && scrollTop < lineHeight /4 && scrollTop > -lineHeight/4) { top = -lineHeight; } session.setScrollTop(top); } }; var updateLenses = lang.delayedCall(editor.$updateLenses); editor.$updateLensesOnInput = function() { updateLenses.delay(250); }; editor.on("input", editor.$updateLensesOnInput); } /** * Detaches code lens functionality from an editor * @param {import("../editor").Editor} editor The editor to detach from */ function detachFromEditor(editor) { editor.off("input", editor.$updateLensesOnInput); editor.renderer.off("afterRender", renderWidgets); if (editor.$codeLensClickHandler) editor.container.removeEventListener("click", editor.$codeLensClickHandler); } /** * Registers a code lens provider with an editor * @param {import("../editor").Editor} editor The editor to register the provider with * @param {import("../../ace-internal").Ace.CodeLenseProvider} codeLensProvider The provider to register */ exports.registerCodeLensProvider = function(editor, codeLensProvider) { editor.setOption("enableCodeLens", true); editor.codeLensProviders.push(codeLensProvider); editor.$updateLensesOnInput(); }; /** * Clears all code lenses from the session * @param {EditSession} session The session to clear code lenses from */ exports.clear = function(session) { exports.setLenses(session, null); }; var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { enableCodeLens: { set: function(val) { if (val) { attachToEditor(this); } else { detachFromEditor(this); } } } }); dom.importCssString(` .ace_codeLens { position: absolute; color: #aaa; font-size: 88%; background: inherit; width: 100%; display: flex; align-items: flex-end; pointer-events: none; } .ace_codeLens > a { cursor: pointer; pointer-events: auto; } .ace_codeLens > a:hover { color: #0000ff; text-decoration: underline; } .ace_dark > .ace_codeLens > a:hover { color: #4e94ce; } `, "codelense.css", false); ================================================ FILE: src/ext/code_lens_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; var ace = require("../ace"); var codeLens = require("./code_lens"); var assert = require("../test/assertions"); var lang = require("../lib/lang"); require("./error_marker"); function click(node) { node.dispatchEvent(new window.CustomEvent("click", {bubbles: true})); } var editor = null; module.exports = { setUp: function() { if (editor) editor.destroy(); var el = document.createElement("div"); el.style.left = "20px"; el.style.top = "30px"; el.style.width = "300px"; el.style.height = "100px"; document.body.appendChild(el); editor = ace.edit(el); editor.on("destroy", function() { document.body.removeChild(el); }); }, tearDown: function() { editor && editor.destroy(); editor = null; }, "test code lens": function() { editor.session.setValue("a\nb|c\nd" + "\n".repeat(100) + "\txxx"); var commandId = "codeLensAction"; var called = null; editor.commands.addCommand({ name: commandId, exec: function(editor, args) { called = args; } }); codeLens.registerCodeLensProvider(editor, { provideCodeLenses: function(session, callback) { callback(null, [{ start: { row: 1 }, command: { id: commandId, title: "1", arguments: "line" } }, { start: { row: 1 }, command: { id: commandId, title: "2", arguments: "column" } }, { start: { row: session.getLength() - 1 }, command: { id: commandId, title: "last", arguments: "last" } }]); } }); editor.$updateLenses(); editor.renderer.$loop._flush(); var lens = editor.container.querySelector(".ace_codeLens"); assert.equal(lens.textContent, "1\xa0|\xa02"); assert.equal(lens.childNodes.length, 3); click(lens.childNodes[0]); assert.equal(called, "line"); click(lens.childNodes[2]); assert.equal(called, "column"); // Scroll down so that first lines go beyond the viewport editor.gotoLine(10); editor.renderer.$loop._flush(); lens = editor.container.querySelector(".ace_codeLens"); assert.ok(!lens); editor.gotoLine(200); editor.renderer.$loop._flush(); lens = editor.container.querySelector(".ace_codeLens"); assert.equal(lens.textContent, "last"); editor.setSession(ace.createEditSession("\n".repeat(100))); editor.renderer.$loop._flush(); lens = editor.container.querySelector(".ace_codeLens"); assert.ok(!lens); }, "test async code lens": async function(next) { editor.session.setValue("a\nb\nc"); codeLens.registerCodeLensProvider(editor, { provideCodeLenses: async function (session, callback) { await lang.sleep(0); callback(null, [ { start: {row: 1}, command: {title: "code lens"} } ]); } }); editor.$updateLenses(); await lang.sleep(0); editor.renderer.$loop._flush(); var lens = editor.container.querySelector(".ace_codeLens"); assert.equal(lens.textContent, "code lens"); next(); }, "test multiple code lens providers": async function(next) { editor.session.setValue("a\nb\nc\nd"); codeLens.registerCodeLensProvider(editor, { provideCodeLenses: function (session, callback) { callback(null, [ { start: {row: 1}, command: {title: "1"} } ]); } }); codeLens.registerCodeLensProvider(editor, { provideCodeLenses: async function (session, callback) { await lang.sleep(0); callback(null, [ { start: {row: 2}, command: {title: "2"} } ]); } }); editor.$updateLenses(); await lang.sleep(0); editor.renderer.$loop._flush(); var lens = editor.container.querySelectorAll(".ace_codeLens"); assert.equal(lens[0].textContent, "1"); assert.equal(lens[1].textContent, "2"); next(); }, "test multiple code lens providers on the same line": function() { editor.session.setValue("a\nb\nc"); codeLens.registerCodeLensProvider(editor, { provideCodeLenses: function(session, callback) { callback(null, [{ start: { row: 1 }, command: { title: "1" } }]); } }); codeLens.registerCodeLensProvider(editor, { provideCodeLenses: function(session, callback) { callback(null, [{ start: { row: 1 }, command: { title: "2" } }]); } }); editor.$updateLenses(); editor.renderer.$loop._flush(); var lens = editor.container.querySelector(".ace_codeLens"); assert.equal(lens.textContent, "1\xa0|\xa02"); }, "test code lens behavior with multiple sessions": function() { editor.session.setValue("a\nb"); codeLens.registerCodeLensProvider(editor, { provideCodeLenses: function(session, callback) { callback(null, [{ start: { row: 1 }, command: { title: session.doc.$lines[0] } }]); } }); editor.$updateLenses(); editor.renderer.$loop._flush(); var lens = editor.container.querySelector(".ace_codeLens"); assert.equal(lens.textContent, "a"); editor.setSession(ace.createEditSession("c\nd")); editor.$updateLenses(); editor.renderer.$loop._flush(); var lens = editor.container.querySelector(".ace_codeLens"); assert.equal(lens.textContent, "c"); } }; require("../test/run")(module); ================================================ FILE: src/ext/command_bar.js ================================================ /** * ## Command Bar extension. * * Provides an interactive command bar tooltip that displays above the editor's active line. The extension enables * clickable commands with keyboard shortcuts, icons, and various button types including standard buttons, checkboxes, * and text elements. Supports overflow handling with a secondary tooltip for additional commands when space is limited. * The tooltip can be configured to always show or display only on mouse hover over the active line. * * @module */ /** * @typedef {import("../editor").Editor} Editor * @typedef {import("../../ace-internal").Ace.TooltipCommand} TooltipCommand */ var Tooltip = require("../tooltip").Tooltip; var EventEmitter = require("../lib/event_emitter").EventEmitter; var lang = require("../lib/lang"); var dom = require("../lib/dom"); var oop = require("../lib/oop"); var useragent = require("../lib/useragent"); var BUTTON_CLASS_NAME = 'command_bar_tooltip_button'; var VALUE_CLASS_NAME = 'command_bar_button_value'; var CAPTION_CLASS_NAME = 'command_bar_button_caption'; var KEYBINDING_CLASS_NAME = 'command_bar_keybinding'; var TOOLTIP_CLASS_NAME = 'command_bar_tooltip'; var MORE_OPTIONS_BUTTON_ID = 'MoreOptionsButton'; var defaultDelay = 100; var defaultMaxElements = 4; var minPosition = function (posA, posB) { if (posB.row > posA.row) { return posA; } else if (posB.row === posA.row && posB.column > posA.column) { return posA; } return posB; }; var keyDisplayMap = { "Ctrl": { mac: "^"}, "Option": { mac: "⌥"}, "Command": { mac: "⌘"}, "Cmd": { mac: "⌘"}, "Shift": "⇧", "Left": "←", "Right": "→", "Up": "↑", "Down": "↓" }; /** * Displays a command tooltip above the currently active line selection, with clickable elements. * * Internally it is a composite of two tooltips, one for the main tooltip and one for the * overflowing commands. * The commands are added sequentially in registration order. * When attached to an editor, it is either always shown or only when the active line is hovered * with mouse, depending on the alwaysShow property. */ class CommandBarTooltip { /** * @param {HTMLElement} parentNode * @param {Partial} [options] */ constructor(parentNode, options) { options = options || {}; this.parentNode = parentNode; this.tooltip = new Tooltip(this.parentNode); this.moreOptions = new Tooltip(this.parentNode); this.maxElementsOnTooltip = options.maxElementsOnTooltip || defaultMaxElements; this.$alwaysShow = options.alwaysShow || false; this.eventListeners = {}; this.elements = {}; this.commands = {}; this.tooltipEl = dom.buildDom(['div', { class: TOOLTIP_CLASS_NAME }], this.tooltip.getElement()); this.moreOptionsEl = dom.buildDom(['div', { class: TOOLTIP_CLASS_NAME + " tooltip_more_options" }], this.moreOptions.getElement()); this.$showTooltipTimer = lang.delayedCall(this.$showTooltip.bind(this), options.showDelay || defaultDelay); this.$hideTooltipTimer = lang.delayedCall(this.$hideTooltip.bind(this), options.hideDelay || defaultDelay); this.$tooltipEnter = this.$tooltipEnter.bind(this); this.$onMouseMove = this.$onMouseMove.bind(this); this.$onChangeScroll = this.$onChangeScroll.bind(this); this.$onEditorChangeSession = this.$onEditorChangeSession.bind(this); this.$scheduleTooltipForHide = this.$scheduleTooltipForHide.bind(this); this.$preventMouseEvent = this.$preventMouseEvent.bind(this); for (var event of ["mousedown", "mouseup", "click"]) { this.tooltip.getElement().addEventListener(event, this.$preventMouseEvent); this.moreOptions.getElement().addEventListener(event, this.$preventMouseEvent); } } /** * Registers a command on the command bar tooltip. * * The commands are added in sequential order. If there is not enough space on the main * toolbar, the remaining elements are added to the overflow menu. * * @param {string} id * @param {TooltipCommand} command */ registerCommand(id, command) { var registerForMainTooltip = Object.keys(this.commands).length < this.maxElementsOnTooltip; if (!registerForMainTooltip && !this.elements[MORE_OPTIONS_BUTTON_ID]) { this.$createCommand(MORE_OPTIONS_BUTTON_ID, { name: "···", exec: /** * @this {CommandBarTooltip} */ function() { this.$shouldHideMoreOptions = false; this.$setMoreOptionsVisibility(!this.isMoreOptionsShown()); }.bind(this), type: "checkbox", getValue: function() { return this.isMoreOptionsShown(); }.bind(this), enabled: true }, true); } this.$createCommand(id, command, registerForMainTooltip); if (this.isShown()) { this.updatePosition(); } } isShown() { return !!this.tooltip && this.tooltip.isOpen; } isMoreOptionsShown() { return !!this.moreOptions && this.moreOptions.isOpen; } getAlwaysShow() { return this.$alwaysShow; } /** * Sets the display mode of the tooltip * * When true, the tooltip is always displayed while it is attached to an editor. * When false, the tooltip is displayed only when the mouse hovers over the active editor line. * * @param {boolean} alwaysShow */ setAlwaysShow(alwaysShow) { this.$alwaysShow = alwaysShow; this.$updateOnHoverHandlers(!this.$alwaysShow); this._signal("alwaysShow", this.$alwaysShow); } /** * Attaches the clickable command bar tooltip to an editor * * Depending on the alwaysShow parameter it either displays the tooltip immediately, * or subscribes to the necessary events to display the tooltip on hover. * * @param {Editor} editor */ attach(editor) { if (!editor || (this.isShown() && this.editor === editor)) { return; } this.detach(); this.editor = editor; this.editor.on("changeSession", this.$onEditorChangeSession); if (this.editor.session) { this.editor.session.on("changeScrollLeft", this.$onChangeScroll); this.editor.session.on("changeScrollTop", this.$onChangeScroll); } if (this.getAlwaysShow()) { this.$showTooltip(); } else { this.$updateOnHoverHandlers(true); } } /** * Updates the position of the command bar tooltip. It aligns itself above the active line in the editor. */ updatePosition() { if (!this.editor) { return; } var renderer = this.editor.renderer; var ranges; if (this.editor.selection.getAllRanges) { ranges = this.editor.selection.getAllRanges(); } else { ranges = [this.editor.getSelectionRange()]; } if (!ranges.length) { return; } var minPos = minPosition(ranges[0].start, ranges[0].end); for (var i = 0, range; range = ranges[i]; i++) { minPos = minPosition(minPos, minPosition(range.start, range.end)); } var pos = renderer.$cursorLayer.getPixelPosition(minPos, true); var tooltipEl = this.tooltip.getElement(); var screenWidth = window.innerWidth; var screenHeight = window.innerHeight; var rect = this.editor.container.getBoundingClientRect(); pos.top += rect.top - renderer.layerConfig.offset; pos.left += rect.left + renderer.gutterWidth - renderer.scrollLeft; var cursorVisible = pos.top >= rect.top && pos.top <= rect.bottom && pos.left >= rect.left + renderer.gutterWidth && pos.left <= rect.right; if (!cursorVisible && this.isShown()) { this.$hideTooltip(); return; } else if (cursorVisible && !this.isShown() && this.getAlwaysShow()) { this.$showTooltip(); return; } var top = pos.top - tooltipEl.offsetHeight; var left = Math.min(screenWidth - tooltipEl.offsetWidth, pos.left); var tooltipFits = top >= 0 && top + tooltipEl.offsetHeight <= screenHeight && left >= 0 && left + tooltipEl.offsetWidth <= screenWidth; if (!tooltipFits) { this.$hideTooltip(); return; } this.tooltip.setPosition(left, top); if (this.isMoreOptionsShown()) { top = top + tooltipEl.offsetHeight; left = this.elements[MORE_OPTIONS_BUTTON_ID].getBoundingClientRect().left; var moreOptionsEl = this.moreOptions.getElement(); var screenHeight = window.innerHeight; if (top + moreOptionsEl.offsetHeight > screenHeight) { top -= tooltipEl.offsetHeight + moreOptionsEl.offsetHeight; } if (left + moreOptionsEl.offsetWidth > screenWidth) { left = screenWidth - moreOptionsEl.offsetWidth; } this.moreOptions.setPosition(left, top); } } /** * Updates each command element in the tooltip. * * This is automatically called on certain events, but can be called manually as well. */ update() { Object.keys(this.elements).forEach(this.$updateElement.bind(this)); } /** * Detaches the tooltip from the editor. */ detach() { this.tooltip.hide(); this.moreOptions.hide(); this.$updateOnHoverHandlers(false); if (this.editor) { this.editor.off("changeSession", this.$onEditorChangeSession); if (this.editor.session) { this.editor.session.off("changeScrollLeft", this.$onChangeScroll); this.editor.session.off("changeScrollTop", this.$onChangeScroll); } } this.$mouseInTooltip = false; this.editor = null; } destroy() { if (this.tooltip && this.moreOptions) { this.detach(); this.tooltip.destroy(); this.moreOptions.destroy(); } this.eventListeners = {}; this.commands = {}; this.elements = {}; this.tooltip = this.moreOptions = this.parentNode = null; } /** * @param {string} id * @param {TooltipCommand} command * @param {boolean} forMainTooltip */ $createCommand(id, command, forMainTooltip) { var parentEl = forMainTooltip ? this.tooltipEl : this.moreOptionsEl; var keyParts = []; var bindKey = command.bindKey; if (bindKey) { if (typeof bindKey === 'object') { bindKey = useragent.isMac ? bindKey.mac : bindKey.win; } bindKey = bindKey.split("|")[0]; keyParts = bindKey.split("-"); keyParts = keyParts.map(function(key) { if (keyDisplayMap[key]) { if (typeof keyDisplayMap[key] === 'string') { return keyDisplayMap[key]; } else if (useragent.isMac && keyDisplayMap[key].mac) { return keyDisplayMap[key].mac; } } return key; }); } /**@type {any[]} */ var buttonNode; if (forMainTooltip && command.iconCssClass) { //Only support icon button for main tooltip, otherwise fall back to text button buttonNode = [ 'div', { class: ["ace_icon_svg", command.iconCssClass].join(" "), "aria-label": command.name + " (" + command.bindKey + ")" } ]; } else { buttonNode = [ ['div', { class: VALUE_CLASS_NAME }], ['div', { class: CAPTION_CLASS_NAME }, command.name] ]; if (keyParts.length) { buttonNode.push( [ 'div', { class: KEYBINDING_CLASS_NAME }, keyParts.map(function(keyPart) { return ['div', keyPart]; }) ] ); } } // @ts-ignore dom.buildDom(['div', { class: [BUTTON_CLASS_NAME, command.cssClass || ""].join(" "), ref: id }, buttonNode], parentEl, this.elements); this.commands[id] = command; var eventListener = /** * @this {CommandBarTooltip} */ function(e) { if (this.editor) { this.editor.focus(); } // Internal variable to properly handle when the more options button is clicked this.$shouldHideMoreOptions = this.isMoreOptionsShown(); if (!this.elements[id].disabled && command.exec) { command.exec(this.editor); } if (this.$shouldHideMoreOptions) { this.$setMoreOptionsVisibility(false); } this.update(); e.preventDefault(); }.bind(this); this.eventListeners[id] = eventListener; this.elements[id].addEventListener('click', eventListener.bind(this)); this.$updateElement(id); } /** * @param {boolean} visible */ $setMoreOptionsVisibility(visible) { if (visible) { this.moreOptions.setTheme(this.editor.renderer.theme); this.moreOptions.setClassName(TOOLTIP_CLASS_NAME + "_wrapper"); this.moreOptions.show(); this.update(); this.updatePosition(); } else { this.moreOptions.hide(); } } $onEditorChangeSession(e) { if (e.oldSession) { e.oldSession.off("changeScrollTop", this.$onChangeScroll); e.oldSession.off("changeScrollLeft", this.$onChangeScroll); } this.detach(); } $onChangeScroll() { if (this.editor.renderer && (this.isShown() || this.getAlwaysShow())) { this.editor.renderer.once("afterRender", this.updatePosition.bind(this)); } } $onMouseMove(e) { if (this.$mouseInTooltip) { return; } var cursorPosition = this.editor.getCursorPosition(); var cursorScreenPosition = this.editor.renderer.textToScreenCoordinates(cursorPosition.row, cursorPosition.column); var lineHeight = this.editor.renderer.lineHeight; var isInCurrentLine = e.clientY >= cursorScreenPosition.pageY && e.clientY < cursorScreenPosition.pageY + lineHeight; if (isInCurrentLine) { if (!this.isShown() && !this.$showTooltipTimer.isPending()) { this.$showTooltipTimer.delay(); } if (this.$hideTooltipTimer.isPending()) { this.$hideTooltipTimer.cancel(); } } else { if (this.isShown() && !this.$hideTooltipTimer.isPending()) { this.$hideTooltipTimer.delay(); } if (this.$showTooltipTimer.isPending()) { this.$showTooltipTimer.cancel(); } } } $preventMouseEvent(e) { if (this.editor) { this.editor.focus(); } e.preventDefault(); } $scheduleTooltipForHide() { this.$mouseInTooltip = false; this.$showTooltipTimer.cancel(); this.$hideTooltipTimer.delay(); } $tooltipEnter() { this.$mouseInTooltip = true; if (this.$showTooltipTimer.isPending()) { this.$showTooltipTimer.cancel(); } if (this.$hideTooltipTimer.isPending()) { this.$hideTooltipTimer.cancel(); } } /** * @param {boolean} [enableHover] */ $updateOnHoverHandlers(enableHover) { var tooltipEl = this.tooltip.getElement(); var moreOptionsEl = this.moreOptions.getElement(); if (enableHover) { if (this.editor) { this.editor.on("mousemove", this.$onMouseMove); this.editor.renderer.getMouseEventTarget().addEventListener("mouseout", this.$scheduleTooltipForHide, true); } tooltipEl.addEventListener('mouseenter', this.$tooltipEnter); tooltipEl.addEventListener('mouseleave', this.$scheduleTooltipForHide); moreOptionsEl.addEventListener('mouseenter', this.$tooltipEnter); moreOptionsEl.addEventListener('mouseleave', this.$scheduleTooltipForHide); } else { if (this.editor) { this.editor.off("mousemove", this.$onMouseMove); this.editor.renderer.getMouseEventTarget().removeEventListener("mouseout", this.$scheduleTooltipForHide, true); } tooltipEl.removeEventListener('mouseenter', this.$tooltipEnter); tooltipEl.removeEventListener('mouseleave', this.$scheduleTooltipForHide); moreOptionsEl.removeEventListener('mouseenter', this.$tooltipEnter); moreOptionsEl.removeEventListener('mouseleave', this.$scheduleTooltipForHide); } } $showTooltip() { if (this.isShown()) { return; } this.tooltip.setTheme(this.editor.renderer.theme); this.tooltip.setClassName(TOOLTIP_CLASS_NAME + "_wrapper"); this.tooltip.show(); this.update(); this.updatePosition(); this._signal("show"); } $hideTooltip() { this.$mouseInTooltip = false; if (!this.isShown()) { return; } this.moreOptions.hide(); this.tooltip.hide(); this._signal("hide"); } /** * @param {string} id */ $updateElement(id) { var command = this.commands[id]; if (!command) { return; } var el = this.elements[id]; var commandEnabled = command.enabled; if (typeof commandEnabled === 'function') { commandEnabled = commandEnabled(this.editor); } if (typeof command.getValue === 'function') { var value = command.getValue(this.editor); if (command.type === 'text') { el.textContent = value; } else if (command.type === 'checkbox') { var domCssFn = value ? dom.addCssClass : dom.removeCssClass; var isOnTooltip = el.parentElement === this.tooltipEl; el.ariaChecked = value; if (isOnTooltip) { domCssFn(el, "ace_selected"); } else { el = el.querySelector("." + VALUE_CLASS_NAME); domCssFn(el, "ace_checkmark"); } } } if (commandEnabled && el.disabled) { dom.removeCssClass(el, "ace_disabled"); el.ariaDisabled = el.disabled = false; el.removeAttribute("disabled"); } else if (!commandEnabled && !el.disabled) { dom.addCssClass(el, "ace_disabled"); el.ariaDisabled = el.disabled = true; el.setAttribute("disabled", ""); } } } oop.implement(CommandBarTooltip.prototype, EventEmitter); dom.importCssString(` .ace_tooltip.${TOOLTIP_CLASS_NAME}_wrapper { padding: 0; } .ace_tooltip .${TOOLTIP_CLASS_NAME} { padding: 1px 5px; display: flex; pointer-events: auto; } .ace_tooltip .${TOOLTIP_CLASS_NAME}.tooltip_more_options { padding: 1px; flex-direction: column; } div.${BUTTON_CLASS_NAME} { display: inline-flex; cursor: pointer; margin: 1px; border-radius: 2px; padding: 2px 5px; align-items: center; } div.${BUTTON_CLASS_NAME}.ace_selected, div.${BUTTON_CLASS_NAME}:hover:not(.ace_disabled) { background-color: rgba(0, 0, 0, 0.1); } div.${BUTTON_CLASS_NAME}.ace_disabled { color: #777; pointer-events: none; } div.${BUTTON_CLASS_NAME} .ace_icon_svg { height: 12px; background-color: #000; } div.${BUTTON_CLASS_NAME}.ace_disabled .ace_icon_svg { background-color: #777; } .${TOOLTIP_CLASS_NAME}.tooltip_more_options .${BUTTON_CLASS_NAME} { display: flex; } .${TOOLTIP_CLASS_NAME}.${VALUE_CLASS_NAME} { display: none; } .${TOOLTIP_CLASS_NAME}.tooltip_more_options .${VALUE_CLASS_NAME} { display: inline-block; width: 12px; } .${CAPTION_CLASS_NAME} { display: inline-block; } .${KEYBINDING_CLASS_NAME} { margin: 0 2px; display: inline-block; font-size: 8px; } .${TOOLTIP_CLASS_NAME}.tooltip_more_options .${KEYBINDING_CLASS_NAME} { margin-left: auto; } .${KEYBINDING_CLASS_NAME} div { display: inline-block; min-width: 8px; padding: 2px; margin: 0 1px; border-radius: 2px; background-color: #ccc; text-align: center; } .ace_dark.ace_tooltip .${TOOLTIP_CLASS_NAME} { background-color: #373737; color: #eee; } .ace_dark div.${BUTTON_CLASS_NAME}.ace_disabled { color: #979797; } .ace_dark div.${BUTTON_CLASS_NAME}.ace_selected, .ace_dark div.${BUTTON_CLASS_NAME}:hover:not(.ace_disabled) { background-color: rgba(255, 255, 255, 0.1); } .ace_dark div.${BUTTON_CLASS_NAME} .ace_icon_svg { background-color: #eee; } .ace_dark div.${BUTTON_CLASS_NAME}.ace_disabled .ace_icon_svg { background-color: #979797; } .ace_dark .${BUTTON_CLASS_NAME}.ace_disabled { color: #979797; } .ace_dark .${KEYBINDING_CLASS_NAME} div { background-color: #575757; } .ace_checkmark::before { content: '✓'; } `, "commandbar.css", false); exports.CommandBarTooltip = CommandBarTooltip; exports.TOOLTIP_CLASS_NAME = TOOLTIP_CLASS_NAME; exports.BUTTON_CLASS_NAME = BUTTON_CLASS_NAME; ================================================ FILE: src/ext/command_bar_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; var TOOLTIP_CLASS_NAME = require("./command_bar").TOOLTIP_CLASS_NAME; var BUTTON_CLASS_NAME = require("./command_bar").BUTTON_CLASS_NAME; var CommandBarTooltip = require("./command_bar").CommandBarTooltip; var Editor = require("../ace").Editor; var EditSession = require("../ace").EditSession; var VirtualRenderer = require("../ace").VirtualRenderer; var assert = require("../test/assertions"); var useragent = require("../lib/useragent"); var lang = require("../lib/lang"); function simulateClick(node) { node.dispatchEvent(new window.CustomEvent("click", { bubbles: true })); } function simulateMouseEvent(type, opts, node) { var target = node || editor.renderer.getMouseEventTarget(); var e = new window.CustomEvent("mouse" + type, {bubbles: true, cancelable: true}); Object.defineProperties(e, Object.getOwnPropertyDescriptors(opts)); target.dispatchEvent(e); } var editor; var counters = {}; var commandBarTooltip; var testValues = {}; var wrapperEl; var editorPx = 500; function getActiveLinePosition() { var cursorPosition = editor.getCursorPosition(); return editor.renderer.textToScreenCoordinates(cursorPosition.row, cursorPosition.column); } var testFunction = function(name, defaultValue) { return function(editor) { if (!editor) { return; } if (!counters[name]) { counters[name] = 0; } counters[name]++; return testValues[name] === undefined ? defaultValue : testValues[name]; }; }; var commands = { "testCommand1": { name: "testCommand1", bindKey: { win: "Alt-K", mac: "Cmd-K" }, exec: testFunction("testCommand1"), enabled: testFunction("testEnabled1", true), type: "button" }, "testCommand2": { name: "testCommand2", bindKey: "Ctrl-L", exec: testFunction("testCommand2"), enabled: testFunction("testEnabled2", true), type: "button" } }; var createTooltip = function(options, additionalCommands) { commandBarTooltip = new CommandBarTooltip(document.body, options); Object.keys(commands).forEach(function(key) { commandBarTooltip.registerCommand(key, commands[key]); }); (additionalCommands || []).forEach(function(commandEntry) { commandBarTooltip.registerCommand(commandEntry[0], commandEntry[1]); }); commandBarTooltip.setAlwaysShow(true); // Workaround: non-standard width and height hints for mock dom (which does not work well with flex elements) // When running in the browser, these are ignored commandBarTooltip.tooltip.getElement().style.widthHint = 150; commandBarTooltip.tooltip.getElement().style.heightHint = editor.renderer.lineHeight * 2; commandBarTooltip.moreOptions.getElement().style.widthHint = 150; commandBarTooltip.moreOptions.getElement().style.heightHint = editor.renderer.lineHeight * 2;commandBarTooltip.moreOptions.getElement().style.heightHint = editor.renderer.lineHeight * 2;commandBarTooltip.moreOptions.getElement().style.heightHint = editor.renderer.lineHeight * 2;commandBarTooltip.moreOptions.getElement().style.heightHint = editor.renderer.lineHeight * 2;commandBarTooltip.moreOptions.getElement().style.heightHint = editor.renderer.lineHeight * 2; }; var isElementVisible = function(elem) { return !((elem.position !== "fixed" && elem.offsetParent === null) || window.getComputedStyle(elem).display === 'none' || elem.clientHeight === 0); }; var tooltipVisibilityCheck = function(tooltipVisible = false, moreOptionsVisible = false) { moreOptionsVisible = tooltipVisible && moreOptionsVisible; assert.strictEqual(commandBarTooltip.isShown(), tooltipVisible); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), moreOptionsVisible); var tooltipDomElements = document.querySelectorAll("." + TOOLTIP_CLASS_NAME); assert.strictEqual(tooltipDomElements.length, 2); assert.strictEqual(isElementVisible(tooltipDomElements[0]), tooltipVisible); assert.strictEqual(isElementVisible(tooltipDomElements[1]), moreOptionsVisible); }; module.exports = { setUp: function() { wrapperEl = document.createElement("div"); wrapperEl.style.position = "fixed"; wrapperEl.style.left = "400px"; wrapperEl.style.top = "100px"; wrapperEl.style.width = editorPx + "px"; wrapperEl.style.height = editorPx + "px"; document.body.appendChild(wrapperEl); var renderer = new VirtualRenderer(wrapperEl); var session = new EditSession("abc123\n\nfunc"); editor = new Editor(renderer, session); counters = {}; testValues = {}; editor.getSelection().moveCursorFileEnd(); editor.renderer.$loop._flush(); }, "test: displays command bar tooltip above cursor with commands immediately in 'always show' mode": function() { createTooltip(); tooltipVisibilityCheck(false, false); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true, false); }, "test: commands are disabled when enable check is falsy": function() { createTooltip(); commandBarTooltip.attach(editor); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); var disabledButtonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME + ".ace_disabled")); assert.strictEqual(buttonElements.length, 2); assert.strictEqual(disabledButtonElements.length, 0); assert.strictEqual(buttonElements.filter(function (button) { return !button.disabled; }).length, 2); assert.strictEqual(counters["testEnabled1"], 1); assert.strictEqual(counters["testEnabled2"], 1); testValues.testEnabled2 = false; commandBarTooltip.update(); buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); disabledButtonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME + ".ace_disabled")); assert.strictEqual(buttonElements.length, 2); assert.strictEqual(disabledButtonElements.length, 1); assert.strictEqual(disabledButtonElements.filter(function (button) { return button.disabled; }).length, 1); assert.strictEqual(buttonElements.filter(function (button) { return !button.disabled; }).length, 1); assert.strictEqual(counters["testEnabled1"], 2); assert.strictEqual(counters["testEnabled2"], 2); }, "test: enabled commands are clickable": function() { createTooltip(); commandBarTooltip.attach(editor); assert.strictEqual(commandBarTooltip.isShown(), true); assert.strictEqual(counters["testCommand1"], undefined); assert.strictEqual(counters["testCommand2"], undefined); testValues.testEnabled2 = false; commandBarTooltip.update(); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 2); var disabledButtonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME + ".ace_disabled")); assert.strictEqual(disabledButtonElements.length, 1); simulateClick(buttonElements[0]); simulateClick(buttonElements[1]); simulateClick(disabledButtonElements[0]); assert.strictEqual(counters["testCommand1"], 1); assert.strictEqual(counters["testCommand2"], undefined); }, "test: tooltip is displayed on hover with the tooltip delay": async function(done) { var delay = 10; createTooltip({ showDelay: delay, hideDelay: delay, maxElementsOnTooltip: 1 }); commandBarTooltip.setAlwaysShow(false); editor.getSelection().moveCursorTo(1, 1); editor.renderer.$loop._flush(); var activeLinePos = getActiveLinePosition(); var mainTooltipEl = commandBarTooltip.tooltip.getElement(); var moreOptionsEl = commandBarTooltip.moreOptions.getElement(); var moveToActiveLineCursor = { clientX: activeLinePos.pageX + 1, clientY: activeLinePos.pageY + 1 }; var moveAway = { clientX: activeLinePos.pageX + 1, clientY: activeLinePos.pageY + 100 }; commandBarTooltip.attach(editor); simulateMouseEvent("move", moveToActiveLineCursor); tooltipVisibilityCheck(false); await lang.sleep(delay); tooltipVisibilityCheck(true, false); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 3); var moreOptionsButton = buttonElements[1]; var moveToMoreOptionsButton = { clientX: moreOptionsButton.left + 1, clientY: moreOptionsButton.right + 1 }; simulateMouseEvent("move", moveToMoreOptionsButton); simulateMouseEvent("enter", moveToMoreOptionsButton, mainTooltipEl); simulateClick(moreOptionsButton); tooltipVisibilityCheck(true, true); var leaveMainTooltip = { clientX: mainTooltipEl.right + 10, clientY: mainTooltipEl.top - 10 }; simulateMouseEvent("move", leaveMainTooltip); simulateMouseEvent("leave", leaveMainTooltip, mainTooltipEl); await lang.sleep(delay / 2); var moreOptionsRect = moreOptionsEl.getBoundingClientRect(); var enterMoreOptions = { clientX: moreOptionsRect.left + 1, clientY: moreOptionsRect.top + 1 }; simulateMouseEvent("move", enterMoreOptions); simulateMouseEvent("enter", enterMoreOptions, moreOptionsEl); await lang.sleep(delay); tooltipVisibilityCheck(true, true); var moreOptionsRect = moreOptionsEl.getBoundingClientRect(); var leaveWholeTooltip = { clientX: moreOptionsRect.right + 10, clientY: moreOptionsRect.top - 10 }; simulateMouseEvent("move", leaveWholeTooltip); simulateMouseEvent("leave", leaveWholeTooltip, mainTooltipEl); await lang.sleep(delay / 2); simulateMouseEvent("move", moveToActiveLineCursor); await lang.sleep(delay); tooltipVisibilityCheck(true, true); simulateMouseEvent("move", moveAway); await lang.sleep(delay); tooltipVisibilityCheck(false); simulateMouseEvent("move", moveToActiveLineCursor); await lang.sleep(delay); tooltipVisibilityCheck(true); done(); }, "test: tooltip supports checkbox buttons": function() { createTooltip(); testValues.testCheckboxValue1 = true; commandBarTooltip.registerCommand("testCheckbox1", { name: "testCheckbox1", bindKey: "Alt-C", exec: function() { testValues.testCheckboxValue1 = !testValues.testCheckboxValue1; }, enabled: testFunction("testCheckboxEnabled1", true), getValue: testFunction("testCheckboxValue1"), type: "checkbox" }); commandBarTooltip.attach(editor); assert.strictEqual(commandBarTooltip.isShown(), true); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 3); var checkboxElement = buttonElements[2]; assert.strictEqual(checkboxElement.classList.contains("ace_selected"), true); assert.strictEqual(checkboxElement.ariaChecked.toString(), "true"); testValues.testCheckboxValue1 = false; commandBarTooltip.update(); assert.strictEqual(checkboxElement.classList.contains("ace_selected"), false); assert.strictEqual(checkboxElement.ariaChecked.toString(), "false"); simulateClick(checkboxElement); assert.strictEqual(checkboxElement.classList.contains("ace_selected"), true); assert.strictEqual(checkboxElement.ariaChecked.toString(), "true"); }, "test: tooltip supports checkbox menu items": function() { createTooltip({ maxElementsOnTooltip: 2 }); testValues.testCheckboxValue1 = true; commandBarTooltip.registerCommand("testCheckbox1", { name: "testCheckbox1", bindKey: "Alt-C", exec: function() { testValues.testCheckboxValue1 = !testValues.testCheckboxValue1; }, enabled: testFunction("testCheckboxEnabled1", true), getValue: testFunction("testCheckboxValue1"), type: "checkbox" }); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); commandBarTooltip.attach(editor); assert.strictEqual(commandBarTooltip.isShown(), true); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 4); var moreOptionsElement = buttonElements[2]; var checkboxElement = buttonElements[3]; assert.strictEqual(checkboxElement.parentElement, commandBarTooltip.moreOptionsEl); assert.strictEqual(checkboxElement.firstChild.classList.contains("ace_checkmark"), true); assert.strictEqual(checkboxElement.ariaChecked.toString(), "true"); testValues.testCheckboxValue1 = false; commandBarTooltip.update(); assert.strictEqual(checkboxElement.firstChild.classList.contains("ace_checkmark"), false); assert.strictEqual(checkboxElement.ariaChecked.toString(), "false"); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), false); simulateClick(moreOptionsElement); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), true); simulateClick(checkboxElement); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), false); assert.strictEqual(checkboxElement.firstChild.classList.contains("ace_checkmark"), true); assert.strictEqual(checkboxElement.ariaChecked.toString(), "true"); }, "test: tooltip supports icon buttons": function() { createTooltip(); commandBarTooltip.registerCommand("testIcon1", { name: "testIcon1", bindKey: "Alt-I", exec: testFunction("testIcon1"), enabled: testFunction("testIconEnabled1", true), iconCssClass: "ace_info", type: "button" }); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); commandBarTooltip.attach(editor); assert.strictEqual(commandBarTooltip.isShown(), true); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 3); var iconButtonElement = buttonElements[2]; assert.strictEqual(iconButtonElement.firstChild.classList.contains("ace_info"), true); assert.strictEqual(iconButtonElement.firstChild.classList.contains("ace_icon_svg"), true); assert.strictEqual(counters["testIcon1"], undefined); simulateClick(iconButtonElement); assert.strictEqual(counters["testIcon1"], 1); }, "test: tooltip supports text elements": function() { createTooltip(); testValues.testTextValue1 = "test"; commandBarTooltip.registerCommand("testText1", { name: "testText1", bindKey: "Alt-I", enabled: testFunction("testTextEnabled1", true), getValue: testFunction("testTextValue1"), type: "text" }); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); commandBarTooltip.attach(editor); assert.strictEqual(commandBarTooltip.isShown(), true); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 3); var textButtonElement = buttonElements[2]; assert.strictEqual(textButtonElement.textContent, "test"); assert.strictEqual(counters["testText1"], undefined); simulateClick(textButtonElement); assert.strictEqual(textButtonElement.textContent, "test"); assert.strictEqual(counters["testText1"], undefined); testValues.testTextValue1 = "updatedTest"; commandBarTooltip.update(); assert.strictEqual(textButtonElement.textContent, "updatedTest"); assert.strictEqual(counters["testText1"], undefined); }, "test: tooltip creates more options menu for overflow options": function() { createTooltip({ maxElementsOnTooltip: 2 }); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 2); assert.strictEqual(buttonElements[0].parentElement, commandBarTooltip.tooltipEl); assert.strictEqual(buttonElements[1].parentElement, commandBarTooltip.tooltipEl); commandBarTooltip.attach(editor); commandBarTooltip.registerCommand("testText1", { name: "testText1", enabled: testFunction("testTextEnabled1", true), getValue: testFunction("testTextValue1"), type: "text" }); buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 4); assert.strictEqual(buttonElements[2].parentElement, commandBarTooltip.tooltipEl); assert.strictEqual(buttonElements[3].parentElement, commandBarTooltip.moreOptionsEl); var moreOptionsButton = buttonElements[2]; assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), false); simulateClick(moreOptionsButton); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), true); simulateClick(moreOptionsButton); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), false); simulateClick(moreOptionsButton); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), true); simulateClick(buttonElements[3]); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), false); }, "test: more options opens below main tooltip, above only if there is no space below": function() { createTooltip({ maxElementsOnTooltip: 1 }); wrapperEl.style.top = (window.innerHeight - editorPx) + "px"; wrapperEl.style.left = (window.innerWidth - editorPx) + "px"; var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 3); var moreOptionsButton = buttonElements[1]; var tooltipEl = commandBarTooltip.tooltip.getElement(); var moreOptionsEl = commandBarTooltip.moreOptions.getElement(); var charWidth = editor.renderer.$textLayer.getCharacterWidth(); var testString = "\n".repeat(editorPx / editor.renderer.lineHeight + 3) + "b".repeat(editorPx / charWidth); editor.execCommand("insertstring", testString); editor.getSelection().moveCursorFileStart(); editor.renderer.scrollTo(0,0); editor.renderer.$loop._flush(); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); simulateClick(moreOptionsButton); tooltipVisibilityCheck(true, true); assert.ok(tooltipEl.getBoundingClientRect().top < moreOptionsEl.getBoundingClientRect().top); commandBarTooltip.detach(); editor.getSelection().moveCursorFileEnd(); editor.renderer.scrollCursorIntoView(editor.getCursorPosition()); editor.renderer.$loop._flush(); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); simulateClick(moreOptionsButton); tooltipVisibilityCheck(true, true); assert.ok(tooltipEl.getBoundingClientRect().top > moreOptionsEl.getBoundingClientRect().top); }, "test: keeps the editor in focus after the tooltip is clicked": function() { createTooltip({ maxElementsOnTooltip: 1 }); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 3); var moreOptionsButton = buttonElements[1]; var tooltipEl = commandBarTooltip.tooltip.getElement(); var moreOptionsEl = commandBarTooltip.moreOptions.getElement(); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); simulateClick(tooltipEl); assert.strictEqual(editor.isFocused(), true); simulateClick(moreOptionsButton); assert.strictEqual(editor.isFocused(), true); tooltipVisibilityCheck(true, true); simulateClick(moreOptionsEl); assert.strictEqual(editor.isFocused(), true); simulateClick(buttonElements[2]); assert.strictEqual(editor.isFocused(), true); commandBarTooltip.detach(); assert.strictEqual(editor.isFocused(), true); }, "test: shows windows keybindings when available": function() { var origIsWin = useragent.isWin; var origIsMac = useragent.isMac; try { useragent.isWin = true; useragent.isMac = false; createTooltip({ maxElementsOnTooltip: 1 }); commandBarTooltip.registerCommand("testButton3", { name: "testButton", bindKey: { win: "Shift-Right", mac: "Option-Right" }, exec: testFunction("testButton3"), enabled: testFunction("testButtonEnabled3", true), type: "button" }); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 4); var extractTextContent = function(el) { return el.textContent; }; var keyBindings1 = Array.from(buttonElements[0].lastChild.childNodes).map(extractTextContent); var keyBindings2 = Array.from(buttonElements[2].lastChild.childNodes).map(extractTextContent); var keyBindings3 = Array.from(buttonElements[3].lastChild.childNodes).map(extractTextContent); assert.deepEqual(keyBindings1, ["Alt", "K"]); assert.deepEqual(keyBindings2, ["Ctrl", "L"]); assert.deepEqual(keyBindings3, ["⇧", "→"]); } finally { useragent.isWin = origIsWin; useragent.isMac = origIsMac; } }, "test: shows mac keybindings when available": function() { var origIsWin = useragent.isWin; var origIsMac = useragent.isMac; try { useragent.isWin = false; useragent.isMac = true; createTooltip({ maxElementsOnTooltip: 1 }); commandBarTooltip.registerCommand("testButton3", { name: "testButton", bindKey: { win: "Shift-Right", mac: "Option-Right" }, exec: testFunction("testButton3"), enabled: testFunction("testButtonEnabled3", true), type: "button" }); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); assert.strictEqual(buttonElements.length, 4); var extractTextContent = function(el) { return el.textContent; }; var keyBindings1 = Array.from(buttonElements[0].lastChild.childNodes).map(extractTextContent); var keyBindings2 = Array.from(buttonElements[2].lastChild.childNodes).map(extractTextContent); var keyBindings3 = Array.from(buttonElements[3].lastChild.childNodes).map(extractTextContent); assert.deepEqual(keyBindings1, ["⌘", "K"]); assert.deepEqual(keyBindings2, ["^", "L"]); assert.deepEqual(keyBindings3, ["⌥", "→"]); } finally { useragent.isWin = origIsWin; useragent.isMac = origIsMac; } }, "test: does not display if the editor cursor is not visible": function() { createTooltip(); var charWidth = editor.renderer.$textLayer.getCharacterWidth(); var testString = "a".repeat(100) + "\n".repeat(editorPx / editor.renderer.lineHeight + 3) + "b".repeat(100); editor.execCommand("insertstring", testString); editor.renderer.$loop._flush(); editor.getSelection().moveCursorFileStart(); editor.renderer.scrollTo(0,0); editor.renderer.$loop._flush(); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); editor.renderer.scrollToLine(1); editor.renderer.$loop._flush(); tooltipVisibilityCheck(false); editor.renderer.scrollToLine(0); editor.renderer.$loop._flush(); tooltipVisibilityCheck(true); editor.renderer.scrollBy(charWidth * 2); editor.renderer.$loop._flush(); tooltipVisibilityCheck(false); editor.renderer.scrollBy(-charWidth * 2); editor.renderer.$loop._flush(); tooltipVisibilityCheck(true); commandBarTooltip.detach(); editor.getSelection().moveCursorFileEnd(); editor.renderer.scrollCursorIntoView(editor.getCursorPosition()); editor.renderer.$loop._flush(); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); editor.renderer.scrollToLine(editor.renderer.getScrollTopRow() - 2); editor.renderer.$loop._flush(); tooltipVisibilityCheck(false); editor.renderer.scrollToLine(editor.renderer.getScrollTopRow() + 2); editor.renderer.$loop._flush(); tooltipVisibilityCheck(true); editor.renderer.scrollBy(-charWidth * 10); editor.renderer.$loop._flush(); tooltipVisibilityCheck(false); editor.renderer.scrollBy(charWidth * 10); editor.renderer.$loop._flush(); tooltipVisibilityCheck(true); commandBarTooltip.detach(); }, "test: does not display if the tooltip does not fit into the screen": async function() { await lang.sleep(0); createTooltip(); var testString = "a".repeat(100) + "\n".repeat(editorPx / editor.renderer.lineHeight + 3) + "b".repeat(100); editor.execCommand("insertstring", testString); editor.renderer.$loop._flush(); wrapperEl.style.top = "10px"; commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); commandBarTooltip.detach(); tooltipVisibilityCheck(false); editor.getSelection().moveCursorFileStart(); editor.renderer.scrollCursorIntoView(editor.getCursorPosition()); editor.renderer.$loop._flush(); commandBarTooltip.attach(editor); tooltipVisibilityCheck(false); }, "test: detaches when session changes": function() { createTooltip(); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); var currentSession = editor.getSession(); editor.setSession(null); tooltipVisibilityCheck(false); editor.setSession(currentSession); tooltipVisibilityCheck(false); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); }, "test: verify detach": function() { createTooltip(); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); commandBarTooltip.detach(); tooltipVisibilityCheck(false); commandBarTooltip.detach(); tooltipVisibilityCheck(false); }, "test: verify destroy": function() { createTooltip(); commandBarTooltip.attach(editor); tooltipVisibilityCheck(true); commandBarTooltip.destroy(); assert.strictEqual(commandBarTooltip.isShown(), false); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), false); var tooltipDomElements = document.querySelectorAll("." + TOOLTIP_CLASS_NAME); assert.strictEqual(tooltipDomElements.length, 0); // Intentionally called twice commandBarTooltip.destroy(); assert.strictEqual(commandBarTooltip.isShown(), false); assert.strictEqual(commandBarTooltip.isMoreOptionsShown(), false); tooltipDomElements = document.querySelectorAll("." + TOOLTIP_CLASS_NAME); assert.strictEqual(tooltipDomElements.length, 0); }, tearDown: function() { commandBarTooltip.destroy(); editor.destroy(); wrapperEl.parentElement.removeChild(wrapperEl); } }; require("../test/run")(module); ================================================ FILE: src/ext/diff/base_diff_view.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Range = require("../../range").Range; var dom = require("../../lib/dom"); var config = require("../../config"); var LineWidgets = require("../../line_widgets").LineWidgets; var ScrollDiffDecorator = require("./scroll_diff_decorator").ScrollDiffDecorator; // @ts-ignore var css = require("./styles-css.js").cssText; var Editor = require("../../editor").Editor; var Renderer = require("../../virtual_renderer").VirtualRenderer; var UndoManager = require("../../undomanager").UndoManager; var Decorator = require("../../layer/decorators").Decorator; require("../../theme/textmate"); // enable multiselect require("../../multi_select"); var EditSession = require("../../edit_session").EditSession; var MinimalGutterDiffDecorator = require("./gutter_decorator").MinimalGutterDiffDecorator; var dummyDiffProvider = { compute: function(val1, val2, options) { return []; } }; dom.importCssString(css, "diffview.css", false); class BaseDiffView { /** * Constructs a new base DiffView instance. * @param {boolean} [inlineDiffEditor] - Whether to use an inline diff editor. * @param {HTMLElement} [container] - optional container element for the DiffView. */ constructor(inlineDiffEditor, container) { this.onChangeTheme = this.onChangeTheme.bind(this); this.onInput = this.onInput.bind(this); this.onChangeFold = this.onChangeFold.bind(this); this.realign = this.realign.bind(this); this.onSelect = this.onSelect.bind(this); this.onChangeWrapLimit = this.onChangeWrapLimit.bind(this); this.realignPending = false; /**@type{{sessionA: EditSession, sessionB: EditSession, chunks: DiffChunk[]}}*/this.diffSession; /**@type DiffChunk[]*/this.chunks; this.inlineDiffEditor = inlineDiffEditor || false; this.currentDiffIndex = 0; this.diffProvider = dummyDiffProvider; if (container) { this.container = container; } this.$ignoreTrimWhitespace = false; this.$maxDiffs = 5000; this.$maxComputationTimeMs = 150; this.$syncSelections = false; this.$foldUnchangedOnInput = false; this.markerB = new DiffHighlight(this, 1); this.markerA = new DiffHighlight(this, -1); } /** * @param {import("../diff").DiffModel} [diffModel] - The model for the diff view. */ $setupModels(diffModel) { if (diffModel.diffProvider) { this.setProvider(diffModel.diffProvider); } this.showSideA = diffModel.inline == undefined ? true : diffModel.inline === "a"; var diffEditorOptions = /**@type {Partial}*/({ scrollPastEnd: 0.5, highlightActiveLine: false, highlightGutterLine: false, animatedScroll: true, customScrollbar: true, vScrollBarAlwaysVisible: true, fadeFoldWidgets: true, showFoldWidgets: true, selectionStyle: "text", }); this.savedOptionsA = diffModel.editorA && diffModel.editorA.getOptions(diffEditorOptions); this.savedOptionsB = diffModel.editorB && diffModel.editorB.getOptions(diffEditorOptions); if (!this.inlineDiffEditor || diffModel.inline === "a") { this.editorA = diffModel.editorA || this.$setupModel(diffModel.sessionA, diffModel.valueA); this.container && this.container.appendChild(this.editorA.container); this.editorA.setOptions(diffEditorOptions); } if (!this.inlineDiffEditor || diffModel.inline === "b") { this.editorB = diffModel.editorB || this.$setupModel(diffModel.sessionB, diffModel.valueB); this.container && this.container.appendChild(this.editorB.container); this.editorB.setOptions(diffEditorOptions); } if (this.inlineDiffEditor) { this.activeEditor = this.showSideA ? this.editorA : this.editorB; this.otherSession = this.showSideA ? this.sessionB : this.sessionA; var cloneOptions = this.activeEditor.getOptions(); cloneOptions.readOnly = true; delete cloneOptions.mode; this.otherEditor = new Editor(new Renderer(null), undefined, cloneOptions); if (this.showSideA) { this.editorB = this.otherEditor; } else { this.editorA = this.otherEditor; } } this.setDiffSession({ sessionA: diffModel.sessionA || (diffModel.editorA ? diffModel.editorA.session : new EditSession( diffModel.valueA || "")), sessionB: diffModel.sessionB || (diffModel.editorB ? diffModel.editorB.session : new EditSession( diffModel.valueB || "")), chunks: [] }); if (this.otherEditor && this.activeEditor) { this.otherSession.setOption("wrap", this.activeEditor.getOption("wrap")); } this.setupScrollbars(); } addGutterDecorators() { if (!this.gutterDecoratorA) this.gutterDecoratorA = new MinimalGutterDiffDecorator(this.editorA, -1); if (!this.gutterDecoratorB) this.gutterDecoratorB = new MinimalGutterDiffDecorator(this.editorB, 1); } /** * @param {EditSession} [session] * @param {string} [value] */ $setupModel(session, value) { var editor = new Editor(new Renderer(), session); editor.session.setUndoManager(new UndoManager()); if (value != undefined) { editor.setValue(value, -1); } return editor; } foldUnchanged() { var chunks = this.chunks; var placeholder = "-".repeat(120); var prev = { old: new Range(0, 0, 0, 0), new: new Range(0, 0, 0, 0) }; var foldsChanged = false; for (var i = 0; i < chunks.length + 1; i++) { let current = chunks[i] || { old: new Range(this.sessionA.getLength(), 0, this.sessionA.getLength(), 0), new: new Range(this.sessionB.getLength(), 0, this.sessionB.getLength(), 0) }; var l = current.new.start.row - prev.new.end.row - 5; if (l > 2) { var s = prev.old.end.row + 2; var fold1 = this.sessionA.addFold(placeholder, new Range(s, 0, s + l, Number.MAX_VALUE)); s = prev.new.end.row + 2; var fold2 = this.sessionB.addFold(placeholder, new Range(s, 0, s + l, Number.MAX_VALUE)); if (fold1 || fold2) foldsChanged = true; if (fold2 && fold1) { fold1["other"] = fold2; fold2["other"] = fold1; } } prev = current; } return foldsChanged; } unfoldUnchanged() { var folds = this.sessionA.getAllFolds(); for (var i = folds.length - 1; i >= 0; i--) { var fold = folds[i]; if (fold.placeholder.length == 120) { this.sessionA.removeFold(fold); } } } toggleFoldUnchanged() { if (!this.foldUnchanged()) { this.unfoldUnchanged(); } } /** * @param {{ sessionA: any; sessionB: EditSession; chunks: DiffChunk[] }} session */ setDiffSession(session) { if (this.diffSession) { this.$detachSessionsEventHandlers(); this.clearSelectionMarkers(); } this.diffSession = session; this.sessionA = this.sessionB = null; if (this.diffSession) { this.chunks = this.diffSession.chunks || []; this.editorA && this.editorA.setSession(session.sessionA); this.editorB && this.editorB.setSession(session.sessionB); this.sessionA = this.diffSession.sessionA; this.sessionB = this.diffSession.sessionB; this.$attachSessionsEventHandlers(); this.initSelectionMarkers(); } this.otherSession = this.showSideA ? this.sessionB : this.sessionA; } /** * @abstract */ $attachSessionsEventHandlers() { } /** * @abstract */ $detachSessionsEventHandlers() { } getDiffSession() { return this.diffSession; } setTheme(theme) { this.editorA && this.editorA.setTheme(theme); this.editorB && this.editorB.setTheme(theme); } getTheme() { return (this.editorA || this.editorB).getTheme(); } onChangeTheme(e) { var theme = e && e.theme || this.getTheme(); if (this.editorA && this.editorA.getTheme() !== theme) { this.editorA.setTheme(theme); } if (this.editorB && this.editorB.getTheme() !== theme) { this.editorB.setTheme(theme); } } resize(force) { this.editorA && this.editorA.resize(force); this.editorB && this.editorB.resize(force); } scheduleOnInput() { if (this.$onInputTimer) return; this.$onInputTimer = setTimeout(() => { this.$onInputTimer = null; this.onInput(); }); } onInput() { if (this.$onInputTimer) clearTimeout(this.$onInputTimer); var val1 = this.sessionA.doc.getAllLines(); var val2 = this.sessionB.doc.getAllLines(); this.selectionRangeA = null; this.selectionRangeB = null; var chunks = this.$diffLines(val1, val2); this.diffSession.chunks = this.chunks = chunks; this.gutterDecoratorA && this.gutterDecoratorA.setDecorations(chunks); this.gutterDecoratorB && this.gutterDecoratorB.setDecorations(chunks); // if we"re dealing with too many chunks, fail silently if (this.chunks && this.chunks.length > this.$maxDiffs) { return; } this.align(); this.editorA && this.editorA.renderer.updateBackMarkers(); this.editorB && this.editorB.renderer.updateBackMarkers(); setTimeout(() => { this.updateScrollBarDecorators(); }, 0); if (this.$foldUnchangedOnInput) { this.foldUnchanged(); } } setupScrollbars() { /** * @param {Renderer & {$scrollDecorator: ScrollDiffDecorator}} renderer */ const setupScrollBar = (renderer) => { setTimeout(() => { this.$setScrollBarDecorators(renderer); this.updateScrollBarDecorators(); }, 0); }; if (this.inlineDiffEditor) { setupScrollBar(this.activeEditor.renderer); } else { setupScrollBar(this.editorA.renderer); setupScrollBar(this.editorB.renderer); } } $setScrollBarDecorators(renderer) { if (renderer.$scrollDecorator) { renderer.$scrollDecorator.destroy(); } renderer.$scrollDecorator = new ScrollDiffDecorator(renderer.scrollBarV, renderer, this.inlineDiffEditor); renderer.$scrollDecorator.setSessions(this.sessionA, this.sessionB); renderer.scrollBarV.setVisible(true); renderer.scrollBarV.element.style.bottom = renderer.scrollBarH.getHeight() + "px"; } $resetDecorators(renderer) { if (renderer.$scrollDecorator) { renderer.$scrollDecorator.destroy(); } renderer.$scrollDecorator = new Decorator(renderer.scrollBarV, renderer); } updateScrollBarDecorators() { if (this.inlineDiffEditor) { if (!this.activeEditor) { return; } this.activeEditor.renderer.$scrollDecorator.$zones = []; } else { if (!this.editorA || !this.editorB) { return; } this.editorA.renderer.$scrollDecorator.$zones = []; this.editorB.renderer.$scrollDecorator.$zones = []; } /** * @param {DiffChunk} change */ const updateDecorators = (editor, change) => { if (!editor) { return; } if (typeof editor.renderer.$scrollDecorator.addZone !== "function") { return; } if (change.old.start.row != change.old.end.row) { editor.renderer.$scrollDecorator.addZone(change.old.start.row, change.old.end.row - 1, "delete"); } if (change.new.start.row != change.new.end.row) { editor.renderer.$scrollDecorator.addZone(change.new.start.row, change.new.end.row - 1, "insert"); } }; if (this.inlineDiffEditor) { this.chunks && this.chunks.forEach((lineChange) => { updateDecorators(this.activeEditor, lineChange); }); this.activeEditor.renderer.$scrollDecorator.$updateDecorators(this.activeEditor.renderer.layerConfig); } else { this.chunks && this.chunks.forEach((lineChange) => { updateDecorators(this.editorA, lineChange); updateDecorators(this.editorB, lineChange); }); this.editorA.renderer.$scrollDecorator.$updateDecorators(this.editorA.renderer.layerConfig); this.editorB.renderer.$scrollDecorator.$updateDecorators(this.editorB.renderer.layerConfig); } } /** * * @param {string[]} val1 * @param {string[]} val2 * @return {DiffChunk[]} */ $diffLines(val1, val2) { return this.diffProvider.compute(val1, val2, { ignoreTrimWhitespace: this.$ignoreTrimWhitespace, maxComputationTimeMs: this.$maxComputationTimeMs }); } /** * @param {import("./providers/default").DiffProvider} provider */ setProvider(provider) { this.diffProvider = provider; } /** * @param {EditSession} session * @param {{ rowCount: number; rowsAbove: number; row: number; }} w */ $addWidget(session, w) { let lineWidget = session.lineWidgets[w.row]; if (lineWidget) { w.rowsAbove += lineWidget.rowsAbove > w.rowsAbove ? lineWidget.rowsAbove : w.rowsAbove; w.rowCount += lineWidget.rowCount; } session.lineWidgets[w.row] = w; session.widgetManager.lineWidgets[w.row] = w; session.$resetRowCache(w.row); var fold = session.getFoldAt(w.row, 0); if (fold) { session.widgetManager.updateOnFold({ data: fold, action: "add", }, session); } } /** * @param {Editor} editor */ $initWidgets(editor) { var session = editor.session; if (!session) return; if (!session.widgetManager) { session.widgetManager = new LineWidgets(session); session.widgetManager.attach(editor); } session.lineWidgets = []; session.widgetManager.lineWidgets = []; session.$resetRowCache(0); } /** * @param {import("../../../ace-internal").Ace.Point} pos * @param {EditSession} session */ $screenRow(pos, session) { var row = session.documentToScreenPosition(pos).row; var afterEnd = pos.row - session.getLength() + 1; if (afterEnd > 0) { row += afterEnd; } return row; } /** * scroll locking * @abstract **/ align() {} onChangeWrapLimit(e, session) {} onSelect(e, selection) { this.searchHighlight(selection); this.syncSelect(selection); } syncSelect(selection) { if (this.$updatingSelection) return; var isOld = selection.session === this.sessionA; var selectionRange = selection.getRange(); var currSelectionRange = isOld ? this.selectionRangeA : this.selectionRangeB; if (currSelectionRange && selectionRange.isEqual(currSelectionRange)) return; if (isOld) { this.selectionRangeA = selectionRange; } else { this.selectionRangeB = selectionRange; } this.$updatingSelection = true; var newRange = this.transformRange(selectionRange, isOld); if (this.$syncSelections) { (isOld ? this.editorB : this.editorA).session.selection.setSelectionRange(newRange); } this.$updatingSelection = false; if (isOld) { this.selectionRangeA = selectionRange; this.selectionRangeB = newRange; } else { this.selectionRangeA = newRange; this.selectionRangeB = selectionRange; } this.updateSelectionMarker(this.syncSelectionMarkerA, this.sessionA, this.selectionRangeA); this.updateSelectionMarker(this.syncSelectionMarkerB, this.sessionB, this.selectionRangeB); } updateSelectionMarker(marker, session, range) { marker.setRange(range); session._signal("changeFrontMarker"); } /** * @param ev * @param {EditSession} session */ onChangeFold(ev, session) { var fold = ev.data; if (this.$syncingFold || !fold || !ev.action) return; this.scheduleRealign(); const isOrig = session === this.sessionA; const other = isOrig ? this.sessionB : this.sessionA; if (ev.action === "remove") { if (fold.other) { fold.other.other = null; other.removeFold(fold.other); } else if (fold.lineWidget) { other.widgetManager.addLineWidget(fold.lineWidget); fold.lineWidget = null; if (other["$editor"]) { other["$editor"].renderer.updateBackMarkers(); } } } if (ev.action === "add") { const range = this.transformRange(fold.range, isOrig); if (range.isEmpty()) { const row = range.start.row + 1; if (other.lineWidgets[row]) { fold.lineWidget = other.lineWidgets[row]; other.widgetManager.removeLineWidget(fold.lineWidget); if (other["$editor"]) { other["$editor"].renderer.updateBackMarkers(); } } } else { this.$syncingFold = true; fold.other = other.addFold(fold.placeholder, range); if (fold.other) { fold.other.other = fold; } this.$syncingFold = false; } } } scheduleRealign() { if (!this.realignPending) { this.realignPending = true; this.editorA.renderer.on("beforeRender", this.realign); this.editorB.renderer.on("beforeRender", this.realign); } } realign() { this.realignPending = true; this.editorA.renderer.off("beforeRender", this.realign); this.editorB.renderer.off("beforeRender", this.realign); this.align(); this.realignPending = false; } detach() { if (!this.editorA || !this.editorB) return; if (this.savedOptionsA) this.editorA.setOptions(this.savedOptionsA); if (this.savedOptionsB) this.editorB.setOptions(this.savedOptionsB); this.editorA.renderer.off("beforeRender", this.realign); this.editorB.renderer.off("beforeRender", this.realign); this.$detachEventHandlers(); this.$removeLineWidgets(this.sessionA); this.$removeLineWidgets(this.sessionB); this.gutterDecoratorA && this.gutterDecoratorA.dispose(); this.gutterDecoratorB && this.gutterDecoratorB.dispose(); this.sessionA.selection.clearSelection(); this.sessionB.selection.clearSelection(); if (this.savedOptionsA && this.savedOptionsA.customScrollbar) { this.$resetDecorators(this.editorA.renderer); } if (this.savedOptionsB &&this.savedOptionsB.customScrollbar) { this.$resetDecorators(this.editorB.renderer); } clearTimeout(this.$onInputTimer); } $removeLineWidgets(session) { // TODO remove only our widgets // session.widgetManager.removeLineWidget session.lineWidgets = []; session.widgetManager.lineWidgets = []; session._signal("changeFold", {data: {start: {row: 0}}}); } /** * @abstract */ $detachEventHandlers() { } destroy() { this.detach(); this.editorA && this.editorA.destroy(); this.editorB && this.editorB.destroy(); this.editorA = this.editorB = null; } gotoNext(dir) { var ace = this.activeEditor || this.editorA; if (this.inlineDiffEditor) { ace = this.editorA; } var sideA = ace == this.editorA; var row = ace.selection.lead.row; var i = this.findChunkIndex(this.chunks, row, sideA); var chunk = this.chunks[i + dir] || this.chunks[i]; var scrollTop = ace.session.getScrollTop(); if (chunk) { var range = chunk[sideA ? "old" : "new"]; var line = Math.max(range.start.row, range.end.row - 1); ace.selection.setRange(new Range(line, 0, line, 0)); } ace.renderer.scrollSelectionIntoView(ace.selection.lead, ace.selection.anchor, 0.5); ace.renderer.animateScrolling(scrollTop); } firstDiffSelected() { return this.currentDiffIndex <= 1; } lastDiffSelected() { return this.currentDiffIndex > this.chunks.length - 1; } /** * @param {Range} range * @param {boolean} isOriginal */ transformRange(range, isOriginal) { return Range.fromPoints(this.transformPosition(range.start, isOriginal), this.transformPosition(range.end, isOriginal)); } /** * @param {import("ace-code").Ace.Point} pos * @param {boolean} isOriginal * @return {import("ace-code").Ace.Point} */ transformPosition(pos, isOriginal) { var chunkIndex = this.findChunkIndex(this.chunks, pos.row, isOriginal); var chunk = this.chunks[chunkIndex]; var clonePos = this.sessionB.doc.clonePos; var result = clonePos(pos); var [from, to] = isOriginal ? ["old", "new"] : ["new", "old"]; var deltaChar = 0; var ignoreIndent = false; if (chunk) { if (chunk[from].end.row <= pos.row) { result.row -= chunk[from].end.row - chunk[to].end.row; } else if (chunk.charChanges) { for (let i = 0; i < chunk.charChanges.length; i++) { let change = chunk.charChanges[i]; let fromRange = change[from]; let toRange = change[to]; if (fromRange.end.row < pos.row) continue; if (fromRange.start.row > pos.row) break; if (fromRange.isMultiLine() && fromRange.contains(pos.row, pos.column)) { result.row = toRange.start.row + pos.row - fromRange.start.row; var maxRow = toRange.end.row; if (toRange.end.column === 0) maxRow--; if (result.row > maxRow) { result.row = maxRow; result.column = (isOriginal ? this.sessionB : this.sessionA).getLine(maxRow).length; ignoreIndent = true; } result.row = Math.min(result.row, maxRow); } else { result.row = toRange.start.row; if (fromRange.start.column > pos.column) break; ignoreIndent = true; if (!fromRange.isEmpty() && fromRange.contains(pos.row, pos.column)) { result.column = toRange.start.column; deltaChar = pos.column - fromRange.start.column; deltaChar = Math.min(deltaChar, toRange.end.column - toRange.start.column); } else { result = clonePos(toRange.end); deltaChar = pos.column - fromRange.end.column; } } } } else if (chunk[from].start.row <= pos.row) { result.row += chunk[to].start.row - chunk[from].start.row; if (result.row >= chunk[to].end.row) { result.row = chunk[to].end.row - 1; result.column = (isOriginal ? this.sessionB : this.sessionA).getLine(result.row).length; } } } if (!ignoreIndent) { //TODO: var [fromEditSession, toEditSession] = isOriginal ? [this.sessionA, this.sessionB] : [ this.sessionB, this.sessionA ]; deltaChar -= this.$getDeltaIndent(fromEditSession, toEditSession, pos.row, result.row); } result.column += deltaChar; return result; } /** * @param {EditSession} fromEditSession * @param {EditSession} toEditSession * @param {number} fromLine * @param {number} toLine */ $getDeltaIndent(fromEditSession, toEditSession, fromLine, toLine) { let origIndent = this.$getIndent(fromEditSession, fromLine); let editIndent = this.$getIndent(toEditSession, toLine); return origIndent - editIndent; } /** * @param {EditSession} editSession * @param {number} line */ $getIndent(editSession, line) { return editSession.getLine(line).match(/^\s*/)[0].length; } printDiffs() { this.chunks.forEach((diff) => { console.log(diff.toString()); }); } /** * * @param {DiffChunk[]} chunks * @param {number} row * @param {boolean} isOriginal * @return {number} */ findChunkIndex(chunks, row, isOriginal) { for (var i = 0; i < chunks.length; i++) { var ch = chunks[i]; var chunk = isOriginal ? ch.old : ch.new; if (chunk.end.row < row) continue; if (chunk.start.row > row) break; } this.currentDiffIndex = i; return i - 1; } searchHighlight(selection) { if (this.$syncSelections || this.inlineDiffEditor) { return; } let currSession = selection.session; let otherSession = currSession === this.sessionA ? this.sessionB : this.sessionA; otherSession.highlight(currSession.$searchHighlight.regExp); otherSession._signal("changeBackMarker"); } initSelectionMarkers() { this.syncSelectionMarkerA = new SyncSelectionMarker(); this.syncSelectionMarkerB = new SyncSelectionMarker(); this.sessionA.addDynamicMarker(this.syncSelectionMarkerA, true); this.sessionB.addDynamicMarker(this.syncSelectionMarkerB, true); } clearSelectionMarkers() { this.sessionA.removeMarker(this.syncSelectionMarkerA.id); this.sessionB.removeMarker(this.syncSelectionMarkerB.id); } } /*** options ***/ config.defineOptions(BaseDiffView.prototype, "DiffView", { showOtherLineNumbers: { set: function(value) { if (this.gutterLayer) { this.gutterLayer.$renderer = value ? null : emptyGutterRenderer; this.editorA.renderer.updateFull(); } }, initialValue: true }, folding: { set: function(value) { this.editorA.setOption("showFoldWidgets", value); this.editorB.setOption("showFoldWidgets", value); if (!value) { var posA = []; var posB = []; if (this.chunks) { this.chunks.forEach(x=>{ posA.push(x.old.start, x.old.end); posB.push(x.new.start, x.new.end); }); } this.sessionA.unfold(posA); this.sessionB.unfold(posB); } } }, syncSelections: { set: function(value) { }, }, ignoreTrimWhitespace: { set: function(value) { this.scheduleOnInput(); }, }, wrap: { set: function(value) { this.sessionA.setOption("wrap", value); this.sessionB.setOption("wrap", value); } }, maxDiffs: { value: 5000, }, theme: { set: function(value) { this.setTheme(value); }, get: function() { return this.editorA.getTheme(); } }, }); var emptyGutterRenderer = { getText: function name(params) { return ""; }, getWidth() { return 0; } }; exports.BaseDiffView = BaseDiffView; class DiffChunk { /** * @param {Range} originalRange * @param {Range} modifiedRange * @param {{originalStartLineNumber: number, originalStartColumn: number, * originalEndLineNumber: number, originalEndColumn: number, modifiedStartLineNumber: number, * modifiedStartColumn: number, modifiedEndLineNumber: number, modifiedEndColumn: number}[]} [charChanges] */ constructor(originalRange, modifiedRange, charChanges) { this.old = originalRange; this.new = modifiedRange; this.charChanges = charChanges && charChanges.map(m => new DiffChunk( new Range(m.originalStartLineNumber, m.originalStartColumn, m.originalEndLineNumber, m.originalEndColumn ), new Range(m.modifiedStartLineNumber, m.modifiedStartColumn, m.modifiedEndLineNumber, m.modifiedEndColumn ))); } } class DiffHighlight { /** * @param {import("./base_diff_view").BaseDiffView} diffView * @param type */ constructor(diffView, type) { /**@type{number}*/this.id; this.diffView = diffView; this.type = type; } update(html, markerLayer, session, config) { let dir, operation, opOperation; var diffView = this.diffView; if (this.type === -1) {// original editor dir = "old"; operation = "delete"; opOperation = "insert"; } else { //modified editor dir = "new"; operation = "insert"; opOperation = "delete"; } var ignoreTrimWhitespace = diffView.$ignoreTrimWhitespace; var lineChanges = diffView.chunks; if (session.lineWidgets && !diffView.inlineDiffEditor) { for (var row = config.firstRow; row <= config.lastRow; row++) { var lineWidget = session.lineWidgets[row]; if (!lineWidget || lineWidget.hidden) continue; let start = session.documentToScreenRow(row, 0); if (lineWidget.rowsAbove > 0) { var range = new Range(start - lineWidget.rowsAbove, 0, start - 1, Number.MAX_VALUE); markerLayer.drawFullLineMarker(html, range, "ace_diff aligned_diff", config); } let end = start + lineWidget.rowCount - (lineWidget.rowsAbove || 0); var range = new Range(start + 1, 0, end, Number.MAX_VALUE); markerLayer.drawFullLineMarker(html, range, "ace_diff aligned_diff", config); } } lineChanges.forEach((lineChange) => { let startRow = lineChange[dir].start.row; let endRow = lineChange[dir].end.row; if (endRow < config.firstRow || startRow > config.lastRow) return; let range = new Range(startRow, 0, endRow - 1, 1 << 30); if (startRow !== endRow) { range = range.toScreenRange(session); markerLayer.drawFullLineMarker(html, range, "ace_diff " + operation, config); } if (lineChange.charChanges) { for (var i = 0; i < lineChange.charChanges.length; i++) { var changeRange = lineChange.charChanges[i][dir]; if (changeRange.end.column == 0 && changeRange.end.row > changeRange.start.row && changeRange.end.row == lineChange[dir].end.row ) { changeRange.end.row --; changeRange.end.column = Number.MAX_VALUE; } if (ignoreTrimWhitespace) { for (let lineNumber = changeRange.start.row; lineNumber <= changeRange.end.row; lineNumber++) { let startColumn; let endColumn; let sessionLineStart = session.getLine(lineNumber).match(/^\s*/)[0].length; let sessionLineEnd = session.getLine(lineNumber).length; if (lineNumber === changeRange.start.row) { startColumn = changeRange.start.column; } else { startColumn = sessionLineStart; } if (lineNumber === changeRange.end.row) { endColumn = changeRange.end.column; } else { endColumn = sessionLineEnd; } let range = new Range(lineNumber, startColumn, lineNumber, endColumn); var screenRange = range.toScreenRange(session); if (sessionLineStart === startColumn && sessionLineEnd === endColumn) { continue; } let cssClass = "inline " + operation; if (range.isEmpty() && startColumn !== 0) { cssClass = "inline " + opOperation + " empty"; } markerLayer.drawSingleLineMarker(html, screenRange, "ace_diff " + cssClass, config); } } else { let range = new Range(changeRange.start.row, changeRange.start.column, changeRange.end.row, changeRange.end.column ); var screenRange = range.toScreenRange(session); let cssClass = "inline " + operation; if (range.isEmpty() && changeRange.start.column !== 0) { cssClass = "inline empty " + opOperation; } if (screenRange.isMultiLine()) { markerLayer.drawTextMarker(html, screenRange, "ace_diff " + cssClass, config); } else { markerLayer.drawSingleLineMarker(html, screenRange, "ace_diff " + cssClass, config); } } } } }); } } class SyncSelectionMarker { constructor() { /**@type{number}*/this.id; this.type = "fullLine"; this.clazz = "ace_diff-active-line"; } update(html, markerLayer, session, config) { } /** * @param {Range} range */ setRange(range) {//TODO var newRange = range.clone(); newRange.end.column++; this.range = newRange; } } exports.DiffChunk = DiffChunk; exports.DiffHighlight = DiffHighlight; ================================================ FILE: src/ext/diff/diff_test.js ================================================ "use strict"; var assert = require("../../test/assertions"); require("../../test/mockdom"); var {InlineDiffView} = require("./inline_diff_view"); var {SplitDiffView} = require("./split_diff_view"); var {DiffProvider} = require("./providers/default"); var ace = require("../../ace"); var Range = require("../../range").Range; var editorA, editorB, diffView; const {Decorator} = require("../../layer/decorators"); const {ScrollDiffDecorator} = require("./scroll_diff_decorator"); var lang = require("../../lib/lang"); var DEBUG = false; function createEditor() { var editor = ace.edit(null); document.body.appendChild(editor.container); setEditorPosition(editor); return editor; } function setEditorPosition(editor) { editor.container.style.height = "200px"; editor.container.style.width = "300px"; editor.container.style.position = "absolute"; editor.container.style.outline = "solid"; } function getValueA(lines) { return lines.map(function(v) { return v[0]; }).filter(function(x) { return x != null; }).join("\n"); } function getValueB(lines) { return lines.map(function(v) { return v.length == 2 ? v[1] : v[0]; }).filter(function(x) { return x != null; }).join("\n"); } var simpleDiff = [ ["a"], ["b"], ["c"], [null, "inserted1"], [null, "inserted2"], ["e"], ["f"], ["g", "edited g"], ["h"], ["i"], ]; var diffAtEnds = [ [null, "only new"], [null, "only new"], ["a"], ["b"], ["c"], ["d"], ["e"], ["f"], ["g"], ["h"], ["i"], ["j"], ["k"], ["only old", null], ["only old2", null], ]; var longLinesDiff = [ [null, "0"], ["a"], ["b"], ["c", "edited c ".repeat(100)], ["e long ".repeat(100)], ["f"], ["g " + "to delete ".repeat(100), "edited g"], ["h"], ["i"], ]; module.exports = { setUpSuite: function() { ace.config.setLoader(function(moduleName, cb) { if (moduleName == "ace/ext/error_marker") return cb(null, require("../error_marker")); if (moduleName == "ace/theme/cloud_editor") return cb(null, require("../../theme/cloud_editor")); }); editorA = createEditor(); editorB = createEditor(); editorB.container.style.left = "301px"; editorA.focus(); }, tearDownSuite: function() { if (DEBUG) return; [editorA, editorB].forEach(function(editor) { if (editor) { editor.destroy(); editor.container.remove(); editor = null; } }); }, tearDown: function() { if (DEBUG) return; if (diffView) { diffView.detach(); diffView = null; } }, "test: clean detach": function() { var diffProvider = new DiffProvider(); editorA.session.setValue(getValueA(simpleDiff)); editorB.session.setValue(getValueB(simpleDiff)); assert.ok(!!editorA.session.widgetManager); assert.ok(!!editorB.session.widgetManager); var uid = 0; var saved = {}; function saveEventRegistry(object) { var id = object.id; if (!id) { id = object.id = "unknown" + (uid++); } var eventRegistry = {}; for (var key in object._eventRegistry) { var handlers = object._eventRegistry[key]; eventRegistry[key] = handlers.slice(0); } saved[id] = {eventRegistry, object}; if (/session/.test(id)) { saved[id].$frontMarkers = Object.keys(object.$frontMarkers); } } function checkEventRegistry() { for (var id in saved) { var object = saved[id].object; var eventRegistry = saved[id].eventRegistry; for (var eventName in object._eventRegistry) { var handlers = object._eventRegistry[eventName]; var savedHandlers = eventRegistry[eventName] || []; assert.notEqual(handlers, savedHandlers); assert.equal(handlers.length, savedHandlers.length, id + ":" + eventName); for (var j = 0; j < handlers.length; j++) { assert.equal(handlers[j], eventRegistry[eventName][j], id + ":" + eventName); } } if (saved[id].$frontMarkers) { var frontMarkers = Object.keys(object.$frontMarkers); assert.equal(frontMarkers + "", saved[id].$frontMarkers + "", id); } } } saveEventRegistry(editorA); saveEventRegistry(editorB); saveEventRegistry(editorA.session); saveEventRegistry(editorB.session); saveEventRegistry(editorA.renderer); saveEventRegistry(editorB.renderer); var diffView = new InlineDiffView({ editorA, editorB, inline: "a", diffProvider, }); editorA.session.addFold("---", new Range(0, 0, 2, 0)); diffView.onInput(); diffView.resize(true); assert.equal(editorA.session.$foldData.length, 1); assert.equal(editorB.session.$foldData.length, 1); diffView.detach(); var sessionB = editorB.session; sessionB.widgetManager.attach(editorB); checkEventRegistry(); diffView = new SplitDiffView({editorA, editorB, diffProvider}); editorB.session.addFold("---", new Range(5, 0, 7, 0)); editorB.renderer.$loop._flush(); editorA.renderer.$loop._flush(); assert.equal(editorA.session.$foldData.length, 2); assert.equal(editorB.session.$foldData.length, 2); diffView.onInput(); diffView.resize(true); diffView.setTheme("ace/theme/cloud_editor"); assert.equal(diffView.editorA.getTheme(), "ace/theme/cloud_editor"); assert.equal(diffView.editorB.getTheme(), "ace/theme/cloud_editor"); diffView.editorB.setTheme("ace/theme/textmate"); assert.equal(diffView.editorA.getTheme(), "ace/theme/textmate"); assert.equal(diffView.editorB.getTheme(), "ace/theme/textmate"); diffView.detach(); checkEventRegistry(); var diffView = new InlineDiffView({ editorB, valueA: editorA.getValue(), inline: "b", diffProvider, }); diffView.onInput(); diffView.resize(true); diffView.detach(); checkEventRegistry(); }, "test: diff at ends": function() { var diffProvider = new DiffProvider(); var valueA = getValueA(diffAtEnds); var valueB = getValueB(diffAtEnds); diffView = new InlineDiffView({ valueA, valueB, inline: "a", diffProvider, }, document.body); setEditorPosition(diffView.editorA); diffView.onInput(); diffView.resize(true); var lineHeight = diffView.editorA.renderer.lineHeight; assert.ok(diffView.editorA.renderer.lineHeight > 0); assert.equal(diffView.chunks.length, 2); assert.equal(diffView.editorA.renderer.layerConfig.offset, 0); diffView.sessionA.setScrollTop(lineHeight * 1.5); diffView.resize(true); assert.equal(diffView.editorA.renderer.layerConfig.offset, 0.5 * lineHeight); diffView.detach(); diffView = new SplitDiffView({ valueA, valueB, diffProvider, }, document.body); setEditorPosition(diffView.editorA); setEditorPosition(diffView.editorB); diffView.onInput(); diffView.resize(true); assert.equal(diffView.chunks.length, 2); diffView.detach(); diffView = new InlineDiffView({ valueA, valueB, inline: "b", }, document.body); setEditorPosition(diffView.editorB); diffView.onInput(); diffView.resize(true); assert.equal(diffView.chunks.length, 0); diffView.detach(); }, "test scroll": function() { var diffProvider = new DiffProvider(); var valueA = getValueA(diffAtEnds); var valueB = getValueB(diffAtEnds); editorA.session.setValue(valueA); editorB.session.setValue(valueB); diffView = new SplitDiffView({ editorA, editorB, diffProvider, }); diffView.onInput(); diffView.resize(true); assert.equal(diffView.chunks.length, 2); diffView.setDiffSession({ sessionA: ace.createEditSession(valueA.repeat(20)), sessionB: ace.createEditSession(valueB.repeat(20)), }); diffView.onInput(); diffView.resize(true); assert.equal(diffView.chunks.length, 21); diffView.editorA.setOption("animatedScroll", false); diffView.editorB.setOption("animatedScroll", false); diffView.editorA.execCommand("gotoend"); diffView.editorB.renderer.$loop._flush(); diffView.editorA.renderer.$loop._flush(); assert.ok(diffView.sessionB.$scrollTop > 100); assert.ok(diffView.sessionA.$scrollTop == diffView.sessionB.$scrollTop); diffView.toggleFoldUnchanged(); assert.equal(diffView.sessionA.$foldData.length, 20); assert.equal(diffView.sessionA.$foldData.length, 20); diffView.toggleFoldUnchanged(); assert.equal(diffView.sessionA.$foldData.length, 0); assert.equal(diffView.sessionA.$foldData.length, 0); }, "test line widget at both sides of line": function() { var diffProvider = new DiffProvider(); editorA.session.setValue("a\n"); editorB.session.setValue("\n\na\n\n"); diffView = new SplitDiffView({ editorA, editorB, diffProvider, }); diffView.onInput(); diffView.resize(true); var markers = diffView.editorA.renderer.$markerBack.element.childNodes; assert.equal(markers[0].className, "ace_diff aligned_diff"); assert.equal(markers[1].className, "ace_diff aligned_diff"); assert.equal(markers.length, 4); }, "test: toggle wrap": function() { var diffProvider = new DiffProvider(); editorA.session.setValue(getValueA(longLinesDiff)); editorB.session.setValue(getValueB(longLinesDiff)); diffView = new SplitDiffView({ editorA, editorB, diffProvider, }); diffView.onInput(); diffView.setOptions({ wrap: 20, syncSelections: true, }); diffView.resize(true); diffView.gotoNext(1); diffView.gotoNext(1); var posA = diffView.sessionA.documentToScreenPosition(diffView.editorA.getCursorPosition()); var posB = diffView.sessionB.documentToScreenPosition(diffView.editorB.getCursorPosition()); assert.equal(posA.row, posB.row); }, "test: restore options": function() { var diffProvider = new DiffProvider(); editorA.session.setValue(getValueA(simpleDiff)); editorB.session.setValue(getValueB(simpleDiff)); editorA.setOption("customScrollbar", true); diffView = new InlineDiffView({ editorA, editorB, inline: "a", diffProvider, }); diffView.onInput(); diffView.setOptions({ wrap: true, folding: false, showOtherLineNumbers: false, }); diffView.resize(true); assert.equal(diffView.chunks.length, 2); assert.equal(editorA.getOption("wrap"), "free"); assert.equal(diffView.editorB.getOption("wrap"), "free"); assert.equal(editorA.getOption("fadeFoldWidgets"), true); assert.equal(diffView.editorB.getOption("fadeFoldWidgets"), true); assert.equal(diffView.editorA.getOption("showFoldWidgets"), false); assert.equal(diffView.editorB.getOption("showFoldWidgets"), false); assert.ok(!!diffView.editorB.renderer.$gutterLayer.$renderer); assert.ok(editorA.renderer.$scrollDecorator instanceof ScrollDiffDecorator); diffView.detach(); assert.equal(editorA.getOption("wrap"), "free"); assert.equal(editorA.getOption("fadeFoldWidgets"), false); assert.equal(editorA.getOption("showFoldWidgets"), true); assert.equal(editorB.getOption("wrap"), "free"); assert.equal(editorB.getOption("fadeFoldWidgets"), false); assert.equal(editorB.getOption("showFoldWidgets"), true); assert.ok(!editorB.renderer.$gutterLayer.$renderer); assert.ok(editorA.renderer.$scrollDecorator instanceof Decorator); }, "test split diff scroll decorators": async function(done) { editorA.session.setValue(["a", "b", "c"].join("\n")); editorB.session.setValue(["a", "c", "X"].join("\n")); diffView = new SplitDiffView({ editorA, editorB }); diffView.setProvider(new DiffProvider()); diffView.onInput(); editorA.renderer.$loop._flush(); editorB.renderer.$loop._flush(); await lang.sleep(0); assertDecoratorsPlacement(editorA, false); done(); }, "test inline diff scroll decorators": async function(done) { editorA.session.setValue(["a", "b", "c"].join("\n")); editorB.session.setValue(["a", "c", "X"].join("\n")); diffView = new InlineDiffView({ editorA, editorB, inline: "a" }); diffView.setProvider(new DiffProvider()); diffView.onInput(); editorA.renderer.$loop._flush(); await lang.sleep(0); assertDecoratorsPlacement(editorA, true); done(); }, "test: second editor destroyed on detach in inline diff view": function() { editorA.setOption("wrap", "free"); diffView = new InlineDiffView({ editorA, inline: "a" }); assert.equal(diffView.editorB.getOption("wrap"), "free"); assert.ok(!diffView.otherEditor.destroyed); diffView.detach(); assert.ok(diffView.otherEditor.destroyed); }, "test: wrap stays in sync": function() { editorA.setOption("wrap", "off"); diffView = new InlineDiffView({ editorA, inline: "a" }); assert.equal(diffView.editorB.getOption("wrap"), "off"); assert.equal(diffView.editorA.getOption("wrap"), "off"); editorA.setOption("wrap", "free"); assert.equal(diffView.editorB.getOption("wrap"), "free"); assert.equal(diffView.editorA.getOption("wrap"), "free"); diffView.detach(); editorB.setOption("wrap", 40); diffView = new InlineDiffView({ editorB, inline: "b" }); assert.equal(diffView.editorB.getOption("wrap"), 40); assert.equal(diffView.editorA.getOption("wrap"), 40); editorB.setOption("wrap", "free"); assert.equal(diffView.editorB.getOption("wrap"), "free"); assert.equal(diffView.editorA.getOption("wrap"), "free"); editorB.setOption("wrap", 50); assert.equal(diffView.editorB.getOption("wrap"), 50); assert.equal(diffView.editorA.getOption("wrap"), 50); diffView.detach(); } }; function findPointFillStyle(imageData, y) { const data = imageData.slice(4 * y, 4 * (y + 1)); const a = Math.round(data[3] / 256 * 100); if (a === 100) return "rgb(" + data.slice(0, 3).join(",") + ")"; return "rgba(" + data.slice(0, 3).join(",") + "," + (a / 100) + ")"; } function assertDecoratorsPlacement(editor, inlineDiff) { const decoA = editor.renderer.$scrollDecorator; const ctxA = decoA.canvas.getContext("2d"); const delRow = 1; const offA = decoA.sessionA.documentToScreenRow(delRow, 0) * decoA.lineHeight; const centerA = offA + decoA.lineHeight / 2; const yA = Math.round(decoA.heightRatio * centerA); let imgA = ctxA.getImageData(decoA.oneZoneWidth, 0, 1, decoA.canvasHeight).data; assert.equal(findPointFillStyle(imgA, yA), decoA.colors.light.delete); if (inlineDiff) { //make sure that in inline diff, markers fills the whole line (except error decorators part) imgA = ctxA.getImageData(decoA.canvasWidth - 1, 0, 1, decoA.canvasHeight).data; assert.equal(findPointFillStyle(imgA, yA), decoA.colors.light.delete); } const xB = decoA.oneZoneWidth * 2; const imgB = ctxA.getImageData(xB, 0, 1, decoA.canvasHeight).data; const insRow = 2; const offB = decoA.sessionB.documentToScreenRow(insRow, 0) * decoA.lineHeight; const centerB = offB + decoA.lineHeight / 2; const yB = Math.round(decoA.heightRatio * centerB); assert.equal(findPointFillStyle(imgB, yB), decoA.colors.light.insert); } require("../../test/run")(module); ================================================ FILE: src/ext/diff/gutter_decorator.js ================================================ var dom = require("../../lib/dom"); class MinimalGutterDiffDecorator { /** * @param {import("../../editor").Editor} editor * @param {number} type */ constructor(editor, type) { this.gutterClass ="ace_mini-diff_gutter-enabled"; this.gutterCellsClasses = { add: "mini-diff-added", delete: "mini-diff-deleted", }; this.editor = editor; this.type = type; this.chunks = []; this.attachToEditor(); } attachToEditor() { this.renderGutters = this.renderGutters.bind(this); dom.addCssClass( this.editor.renderer.$gutterLayer.element, this.gutterClass ); this.editor.renderer.$gutterLayer.on( "afterRender", this.renderGutters ); } renderGutters(e, gutterLayer) { const cells = this.editor.renderer.$gutterLayer.$lines.cells; cells.forEach((cell) => { cell.element.classList.remove(Object.values(this.gutterCellsClasses)); }); const dir = this.type === -1 ? "old" : "new"; const diffClass = this.type === -1 ? this.gutterCellsClasses.delete : this.gutterCellsClasses.add; this.chunks.forEach((lineChange) => { let startRow = lineChange[dir].start.row; let endRow = lineChange[dir].end.row - 1; cells.forEach((cell) => { if (cell.row >= startRow && cell.row <= endRow) { cell.element.classList.add(diffClass); } }); }); } setDecorations(changes) { this.chunks = changes; this.renderGutters(); } dispose() { dom.removeCssClass( this.editor.renderer.$gutterLayer.element, this.gutterClass ); this.editor.renderer.$gutterLayer.off( "afterRender", this.renderGutters ); } } exports.MinimalGutterDiffDecorator = MinimalGutterDiffDecorator; ================================================ FILE: src/ext/diff/inline_diff_view.js ================================================ "use strict"; const BaseDiffView = require("./base_diff_view").BaseDiffView; const Renderer = require("../../virtual_renderer").VirtualRenderer; const config = require("../../config"); class InlineDiffView extends BaseDiffView { /** * Constructs a new inline DiffView instance. * @param {import("../diff").DiffModel} [diffModel] - The model for the diff view. * @param {HTMLElement} [container] - optional container element for the DiffView. */ constructor(diffModel, container) { diffModel = diffModel || {}; diffModel.inline = diffModel.inline || "a"; super( true, container); this.init(diffModel); } init(diffModel) { this.onSelect = this.onSelect.bind(this); this.onAfterRender = this.onAfterRender.bind(this); this.$setupModels(diffModel); this.onChangeTheme(); config.resetOptions(this); config["_signal"]("diffView", this); var padding = this.activeEditor.renderer.$padding; this.addGutterDecorators(); this.otherEditor.renderer.setPadding(padding); this.textLayer = this.otherEditor.renderer.$textLayer; this.markerLayer = this.otherEditor.renderer.$markerBack; this.gutterLayer = this.otherEditor.renderer.$gutterLayer; this.cursorLayer = this.otherEditor.renderer.$cursorLayer; this.otherEditor.renderer.$updateCachedSize = function() { }; var textLayerElement = this.activeEditor.renderer.$textLayer.element; textLayerElement.parentNode.insertBefore( this.textLayer.element, textLayerElement ); var markerLayerElement = this.activeEditor.renderer.$markerBack.element; markerLayerElement.parentNode.insertBefore( this.markerLayer.element, markerLayerElement.nextSibling ); var gutterLayerElement = this.activeEditor.renderer.$gutterLayer.element; gutterLayerElement.parentNode.insertBefore( this.gutterLayer.element, gutterLayerElement.nextSibling ); gutterLayerElement.style.position = "absolute"; this.gutterLayer.element.style.position = "absolute"; this.gutterLayer.element.style.width = "100%"; this.gutterLayer.element.classList.add("ace_mini-diff_gutter_other"); this.gutterLayer.$updateGutterWidth = function() {}; this.initMouse(); this.initTextInput(); this.initTextLayer(); this.initRenderer(); this.$attachEventHandlers(); this.selectEditor(this.activeEditor); } initRenderer(restore) { if (restore) { delete this.activeEditor.renderer.$getLongestLine; } else { this.editorA.renderer.$getLongestLine = this.editorB.renderer.$getLongestLine = () => { var getLongestLine = Renderer.prototype.$getLongestLine; return Math.max( getLongestLine.call(this.editorA.renderer), getLongestLine.call(this.editorB.renderer) ); }; } } initTextLayer() { var renderLine = this.textLayer.$renderLine; var diffView = this; this.otherEditor.renderer.$textLayer.$renderLine = function(parent, row, foldLIne) { if (isVisibleRow(diffView.chunks, row)) { renderLine.call(this, parent, row, foldLIne); } }; var side = this.showSideA ? "new" : "old"; function isVisibleRow(chunks, row) { var min = 0; var max = chunks.length - 1; var result = -1; while (min < max) { var mid = Math.floor((min + max) / 2); var chunkStart = chunks[mid][side].start.row; if (chunkStart < row) { result = mid; min = mid + 1; } else if (chunkStart > row) { max = mid - 1; } else { result = mid; break; } } if (chunks[result + 1] && chunks[result + 1][side].start.row <= row) { result++; } var range = chunks[result] && chunks[result][side]; if (range && range.end.row > row) { return true; } return false; } } initTextInput(restore) { if (restore) { this.otherEditor.textInput = this.othertextInput; this.otherEditor.container = this.otherEditorContainer; } else { this.othertextInput = this.otherEditor.textInput; this.otherEditor.textInput = this.activeEditor.textInput; this.otherEditorContainer = this.otherEditor.container; this.otherEditor.container = this.activeEditor.container; } } selectEditor(editor) { if (editor == this.activeEditor) { this.otherEditor.selection && this.otherEditor.selection.clearSelection(); this.activeEditor.textInput.setHost(this.activeEditor); this.activeEditor.setStyle("ace_diff_other", false); this.cursorLayer.element.remove(); this.activeEditor.renderer.$cursorLayer.element.style.display = "block"; if (this.showSideA) { this.sessionA.removeMarker(this.syncSelectionMarkerA.id); this.sessionA.addDynamicMarker(this.syncSelectionMarkerA, true); } this.markerLayer.element.classList.add("ace_hidden_marker-layer"); this.activeEditor.renderer.$markerBack.element.classList.remove("ace_hidden_marker-layer"); this.removeBracketHighlight(this.otherEditor); } else { this.activeEditor.selection && this.activeEditor.selection.clearSelection(); this.activeEditor.textInput.setHost(this.otherEditor); this.activeEditor.setStyle("ace_diff_other"); this.activeEditor.renderer.$cursorLayer.element.parentNode.appendChild( this.cursorLayer.element ); this.activeEditor.renderer.$cursorLayer.element.style.display = "none"; if (this.activeEditor.$isFocused) { this.otherEditor.onFocus(); } if (this.showSideA) { this.sessionA.removeMarker(this.syncSelectionMarkerA.id); } this.markerLayer.element.classList.remove("ace_hidden_marker-layer"); this.activeEditor.renderer.$markerBack.element.classList.add("ace_hidden_marker-layer"); this.removeBracketHighlight(this.activeEditor); } } removeBracketHighlight(editor) { var session = editor.session; if (session && session.$bracketHighlight) { session.$bracketHighlight.markerIds.forEach(function(id) { session.removeMarker(id); }); session.$bracketHighlight = null; } } initMouse() { this.otherEditor.renderer.$loop = this.activeEditor.renderer.$loop; this.otherEditor.renderer.scroller = { getBoundingClientRect: () => { return this.activeEditor.renderer.scroller.getBoundingClientRect(); }, style: this.activeEditor.renderer.scroller.style, }; var forwardEvent = (ev) => { if (!ev.domEvent) return; var screenPos = ev.editor.renderer.pixelToScreenCoordinates(ev.clientX, ev.clientY); var sessionA = this.activeEditor.session; var sessionB = this.otherEditor.session; var posA = sessionA.screenToDocumentPosition(screenPos.row, screenPos.column, screenPos.offsetX); var posB = sessionB.screenToDocumentPosition(screenPos.row, screenPos.column, screenPos.offsetX); var posAx = sessionA.documentToScreenPosition(posA); var posBx = sessionB.documentToScreenPosition(posB); if (ev.editor == this.activeEditor) { if (posBx.row == screenPos.row && posAx.row != screenPos.row) { if (ev.type == "mousedown") { this.selectEditor(this.otherEditor); } ev.propagationStopped = true; ev.defaultPrevented = true; this.otherEditor.$mouseHandler.onMouseEvent(ev.type, ev.domEvent); } else if (ev.type == "mousedown") { this.selectEditor(this.activeEditor); } } }; var events = [ "mousedown", "click", "mouseup", "dblclick", "tripleclick", "quadclick", ]; events.forEach((event) => { this.activeEditor.on(event, forwardEvent, true); this.activeEditor.on("gutter" + event, forwardEvent, true); }); var onFocus = (e) => { this.activeEditor.onFocus(e); }; var onBlur = (e) => { this.activeEditor.onBlur(e); }; this.otherEditor.on("focus", onFocus); this.otherEditor.on("blur", onBlur); this.onMouseDetach = () => { events.forEach((event) => { this.activeEditor.off(event, forwardEvent, true); this.activeEditor.off("gutter" + event, forwardEvent, true); }); this.otherEditor.off("focus", onFocus); this.otherEditor.off("blur", onBlur); }; } align() { var diffView = this; this.$initWidgets(diffView.editorA); this.$initWidgets(diffView.editorB); diffView.chunks.forEach(function (ch) { var diff1 = diffView.$screenRow(ch.old.end, diffView.sessionA) - diffView.$screenRow(ch.old.start, diffView.sessionA); var diff2 = diffView.$screenRow(ch.new.end, diffView.sessionB) - diffView.$screenRow(ch.new.start, diffView.sessionB); diffView.$addWidget(diffView.sessionA, { rowCount: diff2, rowsAbove: ch.old.end.row === 0 ? diff2 : 0, row: ch.old.end.row === 0 ? 0 : ch.old.end.row - 1 }); diffView.$addWidget(diffView.sessionB, { rowCount: diff1, rowsAbove: diff1, row: ch.new.start.row, }); }); diffView.sessionA["_emit"]("changeFold", {data: {start: {row: 0}}}); diffView.sessionB["_emit"]("changeFold", {data: {start: {row: 0}}}); } onChangeWrapLimit(e, session) { this.otherSession.setOption("wrap", session.getOption("wrap")); this.otherSession.adjustWrapLimit(session.$wrapLimit); this.scheduleRealign(); // todo, this is needed because editor.onChangeWrapMode // calls resize(true) instead of waiting for the renderloop this.activeEditor.renderer.updateFull(); } $attachSessionsEventHandlers() { this.$attachSessionEventHandlers(this.editorA, this.markerA); this.$attachSessionEventHandlers(this.editorB, this.markerB); var session = this.activeEditor.session; session.on("changeWrapLimit", this.onChangeWrapLimit); session.on("changeWrapMode", this.onChangeWrapLimit); } $attachSessionEventHandlers(editor, marker) { editor.session.on("changeFold", this.onChangeFold); editor.session.addDynamicMarker(marker); editor.selection.on("changeCursor", this.onSelect); editor.selection.on("changeSelection", this.onSelect); } $detachSessionsEventHandlers() { this.$detachSessionHandlers(this.editorA, this.markerA); this.$detachSessionHandlers(this.editorB, this.markerB); this.otherSession.bgTokenizer.lines.fill(undefined); var session = this.activeEditor.session; session.off("changeWrapLimit", this.onChangeWrapLimit); session.off("changeWrapMode", this.onChangeWrapLimit); } $detachSessionHandlers(editor, marker) { if (!editor.session) return; editor.session.removeMarker(marker.id); editor.selection.off("changeCursor", this.onSelect); editor.selection.off("changeSelection", this.onSelect); editor.session.off("changeFold", this.onChangeFold); } $attachEventHandlers() { this.activeEditor.on("input", this.onInput); this.activeEditor.renderer.on("afterRender", this.onAfterRender); this.otherSession.on("change", this.onInput); } $detachEventHandlers() { this.$detachSessionsEventHandlers(); this.activeEditor.off("input", this.onInput); this.activeEditor.renderer.off("afterRender", this.onAfterRender); this.otherSession.off("change", this.onInput); this.textLayer.element.textContent = ""; this.textLayer.element.remove(); this.gutterLayer.element.textContent = ""; this.gutterLayer.element.remove(); this.markerLayer.element.textContent = ""; this.markerLayer.element.remove(); this.onMouseDetach(); this.selectEditor(this.activeEditor); this.clearSelectionMarkers(); this.otherEditor.setSession(null); this.otherEditor.renderer.$loop = null; this.initTextInput(true); this.initRenderer(true); this.otherEditor.destroy(); } /** * @param {number} changes * @param {import("ace-code").VirtualRenderer} renderer */ onAfterRender(changes, renderer) { var config = renderer.layerConfig; var session = this.otherSession; var cloneRenderer = this.otherEditor.renderer; session.$scrollTop = renderer.scrollTop; session.$scrollLeft = renderer.scrollLeft; [ "characterWidth", "lineHeight", "scrollTop", "scrollLeft", "scrollMargin", "$padding", "$size", "layerConfig", "$horizScroll", "$vScroll", ]. forEach(function(prop) { cloneRenderer[prop] = renderer[prop]; }); cloneRenderer.$computeLayerConfig(); var newConfig = cloneRenderer.layerConfig; this.gutterLayer.update(newConfig); newConfig.firstRowScreen = config.firstRowScreen; cloneRenderer.$cursorLayer.config = newConfig; cloneRenderer.$cursorLayer.update(newConfig); if (changes & cloneRenderer.CHANGE_LINES || changes & cloneRenderer.CHANGE_FULL || changes & cloneRenderer.CHANGE_SCROLL || changes & cloneRenderer.CHANGE_TEXT ) this.textLayer.update(newConfig); this.markerLayer.setMarkers(this.otherSession.getMarkers()); this.markerLayer.update(newConfig); } detach() { super.detach(); this.otherEditor && this.otherEditor.destroy(); } } exports.InlineDiffView = InlineDiffView; ================================================ FILE: src/ext/diff/providers/default.js ================================================ 'use strict'; function equals(one, other, itemEquals = (a, b) => a === b) { if (one === other) { return true; } if (!one || !other) { return false; } if (one.length !== other.length) { return false; } for (let i = 0, len = one.length; i < len; i++) { if (!itemEquals(one[i], other[i])) { return false; } } return true; } function* groupAdjacentBy(items, shouldBeGrouped) { let currentGroup; let last; for (const item of items) { if (last !== undefined && shouldBeGrouped(last, item)) { currentGroup.push(item); } else { if (currentGroup) { yield currentGroup; } currentGroup = [item]; } last = item; } if (currentGroup) { yield currentGroup; } } function forEachAdjacent(arr, f) { for (let i = 0; i <= arr.length; i++) { f(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]); } } function forEachWithNeighbors(arr, f) { for (let i = 0; i < arr.length; i++) { f(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]); } } function pushMany(arr, items) { for (const item of items) { arr.push(item); } } function compareBy(selector, comparator) { return (a, b) => comparator(selector(a), selector(b)); } const numberComparator = (a, b) => a - b; function reverseOrder(comparator) { return (a, b) => -comparator(a, b); } class BugIndicatingError extends Error { constructor(message) { super(message || "An unexpected bug occurred."); Object.setPrototypeOf(this, BugIndicatingError.prototype); } } function assert(condition, message = "unexpected state") { if (!condition) { throw new BugIndicatingError(`Assertion Failed: ${message}`); } } function assertFn(condition) { condition(); } function checkAdjacentItems(items, predicate) { let i = 0; while (i < items.length - 1) { const a = items[i]; const b = items[i + 1]; if (!predicate(a, b)) { return false; } i++; } return true; } class OffsetRange { constructor(start, endExclusive) { this.start = start; this.endExclusive = endExclusive; if (start > endExclusive) { throw new BugIndicatingError(`Invalid range: ${this.toString()}`); } } static fromTo(start, endExclusive) { return new OffsetRange(start, endExclusive); } static addRange(range, sortedRanges) { let i = 0; while (i < sortedRanges.length && sortedRanges[i].endExclusive < range.start) { i++; } let j = i; while (j < sortedRanges.length && sortedRanges[j].start <= range.endExclusive) { j++; } if (i === j) { sortedRanges.splice(i, 0, range); } else { const start = Math.min(range.start, sortedRanges[i].start); const end = Math.max(range.endExclusive, sortedRanges[j - 1].endExclusive); sortedRanges.splice(i, j - i, new OffsetRange(start, end)); } } static tryCreate(start, endExclusive) { if (start > endExclusive) { return undefined; } return new OffsetRange(start, endExclusive); } static ofLength(length) { return new OffsetRange(0, length); } static ofStartAndLength(start, length) { return new OffsetRange(start, start + length); } static emptyAt(offset) { return new OffsetRange(offset, offset); } get isEmpty() { return this.start === this.endExclusive; } delta(offset) { return new OffsetRange(this.start + offset, this.endExclusive + offset); } deltaStart(offset) { return new OffsetRange(this.start + offset, this.endExclusive); } deltaEnd(offset) { return new OffsetRange(this.start, this.endExclusive + offset); } get length() { return this.endExclusive - this.start; } toString() { return `[${this.start}, ${this.endExclusive})`; } equals(other) { return this.start === other.start && this.endExclusive === other.endExclusive; } containsRange(other) { return this.start <= other.start && other.endExclusive <= this.endExclusive; } contains(offset) { return this.start <= offset && offset < this.endExclusive; } /** * for all numbers n: range1.contains(n) or range2.contains(n) => range1.join(range2).contains(n) * The joined range is the smallest range that contains both ranges. */ join(other) { return new OffsetRange(Math.min(this.start, other.start), Math.max(this.endExclusive, other.endExclusive)); } /** * for all numbers n: range1.contains(n) and range2.contains(n) <=> range1.intersect(range2).contains(n) * * The resulting range is empty if the ranges do not intersect, but touch. * If the ranges don't even touch, the result is undefined. */ intersect(other) { const start = Math.max(this.start, other.start); const end = Math.min(this.endExclusive, other.endExclusive); if (start <= end) { return new OffsetRange(start, end); } return undefined; } intersectionLength(range) { const start = Math.max(this.start, range.start); const end = Math.min(this.endExclusive, range.endExclusive); return Math.max(0, end - start); } intersects(other) { const start = Math.max(this.start, other.start); const end = Math.min(this.endExclusive, other.endExclusive); return start < end; } intersectsOrTouches(other) { const start = Math.max(this.start, other.start); const end = Math.min(this.endExclusive, other.endExclusive); return start <= end; } isBefore(other) { return this.endExclusive <= other.start; } isAfter(other) { return this.start >= other.endExclusive; } slice(arr) { return arr.slice(this.start, this.endExclusive); } substring(str) { return str.substring(this.start, this.endExclusive); } /** * Returns the given value if it is contained in this instance, otherwise the closest value that is contained. * The range must not be empty. */ clip(value) { if (this.isEmpty) { throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`); } return Math.max(this.start, Math.min(this.endExclusive - 1, value)); } /** * Returns `r := value + k * length` such that `r` is contained in this range. * The range must not be empty. * * E.g. `[5, 10).clipCyclic(10) === 5`, `[5, 10).clipCyclic(11) === 6` and `[5, 10).clipCyclic(4) === 9`. */ clipCyclic(value) { if (this.isEmpty) { throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`); } if (value < this.start) { return this.endExclusive - (this.start - value) % this.length; } if (value >= this.endExclusive) { return this.start + (value - this.start) % this.length; } return value; } map(f) { const result = []; for (let i = this.start; i < this.endExclusive; i++) { result.push(f(i)); } return result; } forEach(f) { for (let i = this.start; i < this.endExclusive; i++) { f(i); } } } class Position { constructor(lineNumber, column) { this.lineNumber = lineNumber; this.column = column; } /** * Test if this position equals other position */ equals(other) { return Position.equals(this, other); } /** * Test if position `a` equals position `b` */ static equals(a, b) { if (!a && !b) { return true; } return !!a && !!b && a.lineNumber === b.lineNumber && a.column === b.column; } /** * Test if this position is before other position. * If the two positions are equal, the result will be false. */ isBefore(other) { return Position.isBefore(this, other); } /** * Test if position `a` is before position `b`. * If the two positions are equal, the result will be false. */ static isBefore(a, b) { if (a.lineNumber < b.lineNumber) { return true; } if (b.lineNumber < a.lineNumber) { return false; } return a.column < b.column; } /** * Test if this position is before other position. * If the two positions are equal, the result will be true. */ isBeforeOrEqual(other) { return Position.isBeforeOrEqual(this, other); } /** * Test if position `a` is before position `b`. * If the two positions are equal, the result will be true. */ static isBeforeOrEqual(a, b) { if (a.lineNumber < b.lineNumber) { return true; } if (b.lineNumber < a.lineNumber) { return false; } return a.column <= b.column; } } class Range { constructor(startLineNumber, startColumn, endLineNumber, endColumn) { if (startLineNumber > endLineNumber || startLineNumber === endLineNumber && startColumn > endColumn) { this.startLineNumber = endLineNumber; this.startColumn = endColumn; this.endLineNumber = startLineNumber; this.endColumn = startColumn; } else { this.startLineNumber = startLineNumber; this.startColumn = startColumn; this.endLineNumber = endLineNumber; this.endColumn = endColumn; } } /** * Test if this range is empty. */ isEmpty() { return Range.isEmpty(this); } /** * Test if `range` is empty. */ static isEmpty(range) { return range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn; } /** * Test if position is in this range. If the position is at the edges, will return true. */ containsPosition(position) { return Range.containsPosition(this, position); } /** * Test if `position` is in `range`. If the position is at the edges, will return true. */ static containsPosition(range, position) { if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) { return false; } if (position.lineNumber === range.startLineNumber && position.column < range.startColumn) { return false; } if (position.lineNumber === range.endLineNumber && position.column > range.endColumn) { return false; } return true; } /** * Test if range is in this range. If the range is equal to this range, will return true. */ containsRange(range) { return Range.containsRange(this, range); } /** * Test if `otherRange` is in `range`. If the ranges are equal, will return true. */ static containsRange(range, otherRange) { if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) { return false; } if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) { return false; } if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn < range.startColumn) { return false; } if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn > range.endColumn) { return false; } return true; } /** * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true. */ strictContainsRange(range) { return Range.strictContainsRange(this, range); } /** * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false. */ static strictContainsRange(range, otherRange) { if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) { return false; } if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) { return false; } if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn <= range.startColumn) { return false; } if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn >= range.endColumn) { return false; } return true; } /** * A reunion of the two ranges. * The smallest position will be used as the start point, and the largest one as the end point. */ plusRange(range) { return Range.plusRange(this, range); } /** * A reunion of the two ranges. * The smallest position will be used as the start point, and the largest one as the end point. */ static plusRange(a, b) { let startLineNumber; let startColumn; let endLineNumber; let endColumn; if (b.startLineNumber < a.startLineNumber) { startLineNumber = b.startLineNumber; startColumn = b.startColumn; } else if (b.startLineNumber === a.startLineNumber) { startLineNumber = b.startLineNumber; startColumn = Math.min(b.startColumn, a.startColumn); } else { startLineNumber = a.startLineNumber; startColumn = a.startColumn; } if (b.endLineNumber > a.endLineNumber) { endLineNumber = b.endLineNumber; endColumn = b.endColumn; } else if (b.endLineNumber === a.endLineNumber) { endLineNumber = b.endLineNumber; endColumn = Math.max(b.endColumn, a.endColumn); } else { endLineNumber = a.endLineNumber; endColumn = a.endColumn; } return new Range(startLineNumber, startColumn, endLineNumber, endColumn); } /** * A intersection of the two ranges. */ intersectRanges(range) { return Range.intersectRanges(this, range); } /** * A intersection of the two ranges. */ static intersectRanges(a, b) { let resultStartLineNumber = a.startLineNumber; let resultStartColumn = a.startColumn; let resultEndLineNumber = a.endLineNumber; let resultEndColumn = a.endColumn; const otherStartLineNumber = b.startLineNumber; const otherStartColumn = b.startColumn; const otherEndLineNumber = b.endLineNumber; const otherEndColumn = b.endColumn; if (resultStartLineNumber < otherStartLineNumber) { resultStartLineNumber = otherStartLineNumber; resultStartColumn = otherStartColumn; } else if (resultStartLineNumber === otherStartLineNumber) { resultStartColumn = Math.max(resultStartColumn, otherStartColumn); } if (resultEndLineNumber > otherEndLineNumber) { resultEndLineNumber = otherEndLineNumber; resultEndColumn = otherEndColumn; } else if (resultEndLineNumber === otherEndLineNumber) { resultEndColumn = Math.min(resultEndColumn, otherEndColumn); } if (resultStartLineNumber > resultEndLineNumber) { return null; } if (resultStartLineNumber === resultEndLineNumber && resultStartColumn > resultEndColumn) { return null; } return new Range(resultStartLineNumber, resultStartColumn, resultEndLineNumber, resultEndColumn); } /** * Test if this range equals other. */ equalsRange(other) { return Range.equalsRange(this, other); } /** * Test if range `a` equals `b`. */ static equalsRange(a, b) { if (!a && !b) { return true; } return !!a && !!b && a.startLineNumber === b.startLineNumber && a.startColumn === b.startColumn && a.endLineNumber === b.endLineNumber && a.endColumn === b.endColumn; } /** * Return the end position (which will be after or equal to the start position) */ getEndPosition() { return Range.getEndPosition(this); } /** * Return the end position (which will be after or equal to the start position) */ static getEndPosition(range) { return new Position(range.endLineNumber, range.endColumn); } /** * Return the start position (which will be before or equal to the end position) */ getStartPosition() { return Range.getStartPosition(this); } /** * Return the start position (which will be before or equal to the end position) */ static getStartPosition(range) { return new Position(range.startLineNumber, range.startColumn); } /** * Create a new empty range using this range's start position. */ collapseToStart() { return Range.collapseToStart(this); } /** * Create a new empty range using this range's start position. */ static collapseToStart(range) { return new Range(range.startLineNumber, range.startColumn, range.startLineNumber, range.startColumn); } /** * Create a new empty range using this range's end position. */ collapseToEnd() { return Range.collapseToEnd(this); } /** * Create a new empty range using this range's end position. */ static collapseToEnd(range) { return new Range(range.endLineNumber, range.endColumn, range.endLineNumber, range.endColumn); } // --- static fromPositions(start, end = start) { return new Range(start.lineNumber, start.column, end.lineNumber, end.column); } } function findLastMonotonous(array, predicate) { const idx = findLastIdxMonotonous(array, predicate); return idx === -1 ? undefined : array[idx]; } function findLastIdxMonotonous(array, predicate, startIdx = 0, endIdxEx = array.length) { let i = startIdx; let j = endIdxEx; while (i < j) { const k = Math.floor((i + j) / 2); if (predicate(array[k])) { i = k + 1; } else { j = k; } } return i - 1; } function findFirstMonotonous(array, predicate) { const idx = findFirstIdxMonotonousOrArrLen(array, predicate); return idx === array.length ? undefined : array[idx]; } function findFirstIdxMonotonousOrArrLen(array, predicate, startIdx = 0, endIdxEx = array.length) { let i = startIdx; let j = endIdxEx; while (i < j) { const k = Math.floor((i + j) / 2); if (predicate(array[k])) { j = k; } else { i = k + 1; } } return i; } class MonotonousArray { constructor(_array) { this._array = _array; this._findLastMonotonousLastIdx = 0; } static { this.assertInvariants = false; } /** * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`! * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`. */ findLastMonotonous(predicate) { if (MonotonousArray.assertInvariants) { if (this._prevFindLastPredicate) { for (const item of this._array) { if (this._prevFindLastPredicate(item) && !predicate(item)) { throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate."); } } } this._prevFindLastPredicate = predicate; } const idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx); this._findLastMonotonousLastIdx = idx + 1; return idx === -1 ? undefined : this._array[idx]; } } class LineRange { static fromRangeInclusive(range) { return new LineRange(range.startLineNumber, range.endLineNumber + 1); } static join(lineRanges) { if (lineRanges.length === 0) { throw new BugIndicatingError("lineRanges cannot be empty"); } let startLineNumber = lineRanges[0].startLineNumber; let endLineNumberExclusive = lineRanges[0].endLineNumberExclusive; for (let i = 1; i < lineRanges.length; i++) { startLineNumber = Math.min(startLineNumber, lineRanges[i].startLineNumber); endLineNumberExclusive = Math.max(endLineNumberExclusive, lineRanges[i].endLineNumberExclusive); } return new LineRange(startLineNumber, endLineNumberExclusive); } static ofLength(startLineNumber, length) { return new LineRange(startLineNumber, startLineNumber + length); } constructor(startLineNumber, endLineNumberExclusive) { if (startLineNumber > endLineNumberExclusive) { throw new BugIndicatingError(`startLineNumber ${startLineNumber} cannot be after endLineNumberExclusive ${endLineNumberExclusive}`); } this.startLineNumber = startLineNumber; this.endLineNumberExclusive = endLineNumberExclusive; } /** * Indicates if this line range is empty. */ get isEmpty() { return this.startLineNumber === this.endLineNumberExclusive; } /** * Moves this line range by the given offset of line numbers. */ delta(offset) { return new LineRange(this.startLineNumber + offset, this.endLineNumberExclusive + offset); } /** * The number of lines this line range spans. */ get length() { return this.endLineNumberExclusive - this.startLineNumber; } /** * Creates a line range that combines this and the given line range. */ join(other) { return new LineRange( Math.min(this.startLineNumber, other.startLineNumber), Math.max(this.endLineNumberExclusive, other.endLineNumberExclusive) ); } /** * The resulting range is empty if the ranges do not intersect, but touch. * If the ranges don't even touch, the result is undefined. */ intersect(other) { const startLineNumber = Math.max(this.startLineNumber, other.startLineNumber); const endLineNumberExclusive = Math.min(this.endLineNumberExclusive, other.endLineNumberExclusive); if (startLineNumber <= endLineNumberExclusive) { return new LineRange(startLineNumber, endLineNumberExclusive); } return undefined; } overlapOrTouch(other) { return this.startLineNumber <= other.endLineNumberExclusive && other.startLineNumber <= this.endLineNumberExclusive; } toInclusiveRange() { if (this.isEmpty) { return null; } return new Range(this.startLineNumber, 1, this.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER); } /** * Converts this 1-based line range to a 0-based offset range (subtracts 1!). * @internal */ toOffsetRange() { return new OffsetRange(this.startLineNumber - 1, this.endLineNumberExclusive - 1); } } class LineRangeSet { constructor(_normalizedRanges = []) { this._normalizedRanges = _normalizedRanges; } get ranges() { return this._normalizedRanges; } addRange(range) { if (range.length === 0) { return; } const joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, (r) => r.endLineNumberExclusive >= range.startLineNumber); const joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, (r) => r.startLineNumber <= range.endLineNumberExclusive) + 1; if (joinRangeStartIdx === joinRangeEndIdxExclusive) { this._normalizedRanges.splice(joinRangeStartIdx, 0, range); } else if (joinRangeStartIdx === joinRangeEndIdxExclusive - 1) { const joinRange = this._normalizedRanges[joinRangeStartIdx]; this._normalizedRanges[joinRangeStartIdx] = joinRange.join(range); } else { const joinRange = this._normalizedRanges[joinRangeStartIdx].join(this._normalizedRanges[joinRangeEndIdxExclusive - 1]).join(range); this._normalizedRanges.splice(joinRangeStartIdx, joinRangeEndIdxExclusive - joinRangeStartIdx, joinRange); } } contains(lineNumber) { const rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, (r) => r.startLineNumber <= lineNumber); return !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > lineNumber; } /** * Subtracts all ranges in this set from `range` and returns the result. */ subtractFrom(range) { const joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, (r) => r.endLineNumberExclusive >= range.startLineNumber); const joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, (r) => r.startLineNumber <= range.endLineNumberExclusive) + 1; if (joinRangeStartIdx === joinRangeEndIdxExclusive) { return new LineRangeSet([range]); } const result = []; let startLineNumber = range.startLineNumber; for (let i = joinRangeStartIdx; i < joinRangeEndIdxExclusive; i++) { const r = this._normalizedRanges[i]; if (r.startLineNumber > startLineNumber) { result.push(new LineRange(startLineNumber, r.startLineNumber)); } startLineNumber = r.endLineNumberExclusive; } if (startLineNumber < range.endLineNumberExclusive) { result.push(new LineRange(startLineNumber, range.endLineNumberExclusive)); } return new LineRangeSet(result); } getIntersection(other) { const result = []; let i1 = 0; let i2 = 0; while (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) { const r1 = this._normalizedRanges[i1]; const r2 = other._normalizedRanges[i2]; const i = r1.intersect(r2); if (i && !i.isEmpty) { result.push(i); } if (r1.endLineNumberExclusive < r2.endLineNumberExclusive) { i1++; } else { i2++; } } return new LineRangeSet(result); } getWithDelta(value) { return new LineRangeSet(this._normalizedRanges.map((r) => r.delta(value))); } } class TextLength { constructor(lineCount, columnCount) { this.lineCount = lineCount; this.columnCount = columnCount; } static { this.zero = new TextLength(0, 0); } toLineRange() { return LineRange.ofLength(1, this.lineCount); } addToPosition(position) { if (this.lineCount === 0) { return new Position(position.lineNumber, position.column + this.columnCount); } else { return new Position(position.lineNumber + this.lineCount, this.columnCount + 1); } } } class LineBasedText { constructor(_getLineContent, _lineCount) { assert(_lineCount >= 1); this._getLineContent = _getLineContent; this._lineCount = _lineCount; } getValueOfRange(range) { if (range.startLineNumber === range.endLineNumber) { return this._getLineContent(range.startLineNumber).substring(range.startColumn - 1, range.endColumn - 1); } let result = this._getLineContent(range.startLineNumber).substring(range.startColumn - 1); for (let i = range.startLineNumber + 1; i < range.endLineNumber; i++) { result += "\n" + this._getLineContent(i); } result += "\n" + this._getLineContent(range.endLineNumber).substring(0, range.endColumn - 1); return result; } getLineLength(lineNumber) { return this._getLineContent(lineNumber).length; } get length() { const lastLine = this._getLineContent(this._lineCount); return new TextLength(this._lineCount - 1, lastLine.length); } } class ArrayText extends LineBasedText { constructor(lines) { super( (lineNumber) => lines[lineNumber - 1], lines.length ); } } class LinesDiff { constructor(changes, moves, hitTimeout) { this.changes = changes; this.moves = moves; this.hitTimeout = hitTimeout; } } class MovedText { constructor(lineRangeMapping, changes) { this.lineRangeMapping = lineRangeMapping; this.changes = changes; } } class LineRangeMapping { constructor(originalRange, modifiedRange) { this.original = originalRange; this.modified = modifiedRange; } join(other) { return new LineRangeMapping( this.original.join(other.original), this.modified.join(other.modified) ); } get changedLineCount() { return Math.max(this.original.length, this.modified.length); } /** * This method assumes that the LineRangeMapping describes a valid diff! * I.e. if one range is empty, the other range cannot be the entire document. * It avoids various problems when the line range points to non-existing line-numbers. */ toRangeMapping() { const origInclusiveRange = this.original.toInclusiveRange(); const modInclusiveRange = this.modified.toInclusiveRange(); if (origInclusiveRange && modInclusiveRange) { return new RangeMapping(origInclusiveRange, modInclusiveRange); } else if (this.original.startLineNumber === 1 || this.modified.startLineNumber === 1) { if (!(this.modified.startLineNumber === 1 && this.original.startLineNumber === 1)) { throw new BugIndicatingError("not a valid diff"); } return new RangeMapping( new Range(this.original.startLineNumber, 1, this.original.endLineNumberExclusive, 1), new Range(this.modified.startLineNumber, 1, this.modified.endLineNumberExclusive, 1) ); } else { return new RangeMapping( new Range(this.original.startLineNumber - 1, Number.MAX_SAFE_INTEGER, this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), new Range(this.modified.startLineNumber - 1, Number.MAX_SAFE_INTEGER, this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER) ); } } /** * This method assumes that the LineRangeMapping describes a valid diff! * I.e. if one range is empty, the other range cannot be the entire document. * It avoids various problems when the line range points to non-existing line-numbers. */ toRangeMapping2(original, modified) { if (isValidLineNumber(this.original.endLineNumberExclusive, original) && isValidLineNumber(this.modified.endLineNumberExclusive, modified)) { return new RangeMapping( new Range(this.original.startLineNumber, 1, this.original.endLineNumberExclusive, 1), new Range(this.modified.startLineNumber, 1, this.modified.endLineNumberExclusive, 1) ); } if (!this.original.isEmpty && !this.modified.isEmpty) { return new RangeMapping( Range.fromPositions( new Position(this.original.startLineNumber, 1), normalizePosition(new Position(this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), original) ), Range.fromPositions( new Position(this.modified.startLineNumber, 1), normalizePosition(new Position(this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), modified) ) ); } if (this.original.startLineNumber > 1 && this.modified.startLineNumber > 1) { return new RangeMapping( Range.fromPositions( normalizePosition(new Position(this.original.startLineNumber - 1, Number.MAX_SAFE_INTEGER), original), normalizePosition(new Position(this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), original) ), Range.fromPositions( normalizePosition(new Position(this.modified.startLineNumber - 1, Number.MAX_SAFE_INTEGER), modified), normalizePosition(new Position(this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), modified) ) ); } throw new BugIndicatingError(); } } function normalizePosition(position, content) { if (position.lineNumber < 1) { return new Position(1, 1); } if (position.lineNumber > content.length) { return new Position(content.length, content[content.length - 1].length + 1); } const line = content[position.lineNumber - 1]; if (position.column > line.length + 1) { return new Position(position.lineNumber, line.length + 1); } return position; } function isValidLineNumber(lineNumber, lines) { return lineNumber >= 1 && lineNumber <= lines.length; } class DetailedLineRangeMapping extends LineRangeMapping { static fromRangeMappings(rangeMappings) { const originalRange = LineRange.join(rangeMappings.map((r) => LineRange.fromRangeInclusive(r.originalRange))); const modifiedRange = LineRange.join(rangeMappings.map((r) => LineRange.fromRangeInclusive(r.modifiedRange))); return new DetailedLineRangeMapping(originalRange, modifiedRange, rangeMappings); } constructor(originalRange, modifiedRange, innerChanges) { super(originalRange, modifiedRange); this.innerChanges = innerChanges; } flip() { return new DetailedLineRangeMapping(this.modified, this.original, this.innerChanges?.map((c) => c.flip())); } withInnerChangesFromLineRanges() { return new DetailedLineRangeMapping(this.original, this.modified, [this.toRangeMapping()]); } } class RangeMapping { static join(rangeMappings) { if (rangeMappings.length === 0) { throw new BugIndicatingError("Cannot join an empty list of range mappings"); } let result = rangeMappings[0]; for (let i = 1; i < rangeMappings.length; i++) { result = result.join(rangeMappings[i]); } return result; } static assertSorted(rangeMappings) { for (let i = 1; i < rangeMappings.length; i++) { const previous = rangeMappings[i - 1]; const current = rangeMappings[i]; if (!(previous.originalRange.getEndPosition().isBeforeOrEqual(current.originalRange.getStartPosition()) && previous.modifiedRange.getEndPosition().isBeforeOrEqual(current.modifiedRange.getStartPosition()))) { throw new BugIndicatingError("Range mappings must be sorted"); } } } constructor(originalRange, modifiedRange) { this.originalRange = originalRange; this.modifiedRange = modifiedRange; } flip() { return new RangeMapping(this.modifiedRange, this.originalRange); } /** * Creates a single text edit that describes the change from the original to the modified text. */ join(other) { return new RangeMapping( this.originalRange.plusRange(other.originalRange), this.modifiedRange.plusRange(other.modifiedRange) ); } } function lineRangeMappingFromRangeMappings(alignments, originalLines, modifiedLines, dontAssertStartLine = false) { const changes = []; for (const g of groupAdjacentBy( alignments.map((a) => getLineRangeMapping(a, originalLines, modifiedLines)), (a1, a2) => a1.original.overlapOrTouch(a2.original) || a1.modified.overlapOrTouch(a2.modified) )) { const first = g[0]; const last = g[g.length - 1]; changes.push(new DetailedLineRangeMapping( first.original.join(last.original), first.modified.join(last.modified), g.map((a) => a.innerChanges[0]) )); } assertFn(() => { if (!dontAssertStartLine && changes.length > 0) { if (changes[0].modified.startLineNumber !== changes[0].original.startLineNumber) { return false; } if (modifiedLines.length.lineCount - changes[changes.length - 1].modified.endLineNumberExclusive !== originalLines.length.lineCount - changes[changes.length - 1].original.endLineNumberExclusive) { return false; } } return checkAdjacentItems( changes, (m1, m2) => m2.original.startLineNumber - m1.original.endLineNumberExclusive === m2.modified.startLineNumber - m1.modified.endLineNumberExclusive && // There has to be an unchanged line in between (otherwise both diffs should have been joined) m1.original.endLineNumberExclusive < m2.original.startLineNumber && m1.modified.endLineNumberExclusive < m2.modified.startLineNumber ); }); return changes; } function getLineRangeMapping(rangeMapping, originalLines, modifiedLines) { let lineStartDelta = 0; let lineEndDelta = 0; if (rangeMapping.modifiedRange.endColumn === 1 && rangeMapping.originalRange.endColumn === 1 && rangeMapping.originalRange.startLineNumber + lineStartDelta <= rangeMapping.originalRange.endLineNumber && rangeMapping.modifiedRange.startLineNumber + lineStartDelta <= rangeMapping.modifiedRange.endLineNumber) { lineEndDelta = -1; } if (rangeMapping.modifiedRange.startColumn - 1 >= modifiedLines.getLineLength(rangeMapping.modifiedRange.startLineNumber) && rangeMapping.originalRange.startColumn - 1 >= originalLines.getLineLength(rangeMapping.originalRange.startLineNumber) && rangeMapping.originalRange.startLineNumber <= rangeMapping.originalRange.endLineNumber + lineEndDelta && rangeMapping.modifiedRange.startLineNumber <= rangeMapping.modifiedRange.endLineNumber + lineEndDelta) { lineStartDelta = 1; } const originalLineRange = new LineRange( rangeMapping.originalRange.startLineNumber + lineStartDelta, rangeMapping.originalRange.endLineNumber + 1 + lineEndDelta ); const modifiedLineRange = new LineRange( rangeMapping.modifiedRange.startLineNumber + lineStartDelta, rangeMapping.modifiedRange.endLineNumber + 1 + lineEndDelta ); return new DetailedLineRangeMapping(originalLineRange, modifiedLineRange, [rangeMapping]); } class DiffAlgorithmResult { constructor(diffs, hitTimeout) { this.diffs = diffs; this.hitTimeout = hitTimeout; } static trivial(seq1, seq2) { return new DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], false); } static trivialTimedOut(seq1, seq2) { return new DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], true); } } class SequenceDiff { constructor(seq1Range, seq2Range) { this.seq1Range = seq1Range; this.seq2Range = seq2Range; } static invert(sequenceDiffs, doc1Length) { const result = []; forEachAdjacent(sequenceDiffs, (a, b) => { result.push(SequenceDiff.fromOffsetPairs( a ? a.getEndExclusives() : OffsetPair.zero, b ? b.getStarts() : new OffsetPair(doc1Length, (a ? a.seq2Range.endExclusive - a.seq1Range.endExclusive : 0) + doc1Length) )); }); return result; } static fromOffsetPairs(start, endExclusive) { return new SequenceDiff( new OffsetRange(start.offset1, endExclusive.offset1), new OffsetRange(start.offset2, endExclusive.offset2) ); } static assertSorted(sequenceDiffs) { let last = undefined; for (const cur of sequenceDiffs) { if (last) { if (!(last.seq1Range.endExclusive <= cur.seq1Range.start && last.seq2Range.endExclusive <= cur.seq2Range.start)) { throw new BugIndicatingError("Sequence diffs must be sorted"); } } last = cur; } } swap() { return new SequenceDiff(this.seq2Range, this.seq1Range); } join(other) { return new SequenceDiff(this.seq1Range.join(other.seq1Range), this.seq2Range.join(other.seq2Range)); } delta(offset) { if (offset === 0) { return this; } return new SequenceDiff(this.seq1Range.delta(offset), this.seq2Range.delta(offset)); } deltaStart(offset) { if (offset === 0) { return this; } return new SequenceDiff(this.seq1Range.deltaStart(offset), this.seq2Range.deltaStart(offset)); } deltaEnd(offset) { if (offset === 0) { return this; } return new SequenceDiff(this.seq1Range.deltaEnd(offset), this.seq2Range.deltaEnd(offset)); } intersect(other) { const i1 = this.seq1Range.intersect(other.seq1Range); const i2 = this.seq2Range.intersect(other.seq2Range); if (!i1 || !i2) { return undefined; } return new SequenceDiff(i1, i2); } getStarts() { return new OffsetPair(this.seq1Range.start, this.seq2Range.start); } getEndExclusives() { return new OffsetPair(this.seq1Range.endExclusive, this.seq2Range.endExclusive); } } class OffsetPair { constructor(offset1, offset2) { this.offset1 = offset1; this.offset2 = offset2; } static { this.zero = new OffsetPair(0, 0); } static { this.max = new OffsetPair(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER); } delta(offset) { if (offset === 0) { return this; } return new OffsetPair(this.offset1 + offset, this.offset2 + offset); } equals(other) { return this.offset1 === other.offset1 && this.offset2 === other.offset2; } } class InfiniteTimeout { static { this.instance = new InfiniteTimeout(); } isValid() { return true; } } class DateTimeout { constructor(timeout) { this.timeout = timeout; this.startTime = Date.now(); this.valid = true; if (timeout <= 0) { throw new BugIndicatingError("timeout must be positive"); } } // Recommendation: Set a log-point `{this.disable()}` in the body isValid() { const valid = Date.now() - this.startTime < this.timeout; if (!valid && this.valid) { this.valid = false; } return this.valid; } disable() { this.timeout = Number.MAX_SAFE_INTEGER; this.isValid = () => true; this.valid = true; } } class Array2D { constructor(width, height) { this.width = width; this.height = height; this.array = []; this.array = new Array(width * height); } get(x, y) { return this.array[x + y * this.width]; } set(x, y, value) { this.array[x + y * this.width] = value; } } function isSpace(charCode) { return charCode === 32 || charCode === 9; } class LineRangeFragment { constructor(range, lines, source) { this.range = range; this.lines = lines; this.source = source; this.histogram = []; let counter = 0; for (let i = range.startLineNumber - 1; i < range.endLineNumberExclusive - 1; i++) { const line = lines[i]; for (let j = 0; j < line.length; j++) { counter++; const chr = line[j]; const key2 = LineRangeFragment.getKey(chr); this.histogram[key2] = (this.histogram[key2] || 0) + 1; } counter++; const key = LineRangeFragment.getKey("\n"); this.histogram[key] = (this.histogram[key] || 0) + 1; } this.totalCount = counter; } static { this.chrKeys = /* @__PURE__ */ new Map(); } static getKey(chr) { let key = this.chrKeys.get(chr); if (key === undefined) { key = this.chrKeys.size; this.chrKeys.set(chr, key); } return key; } computeSimilarity(other) { let sumDifferences = 0; const maxLength = Math.max(this.histogram.length, other.histogram.length); for (let i = 0; i < maxLength; i++) { sumDifferences += Math.abs((this.histogram[i] ?? 0) - (other.histogram[i] ?? 0)); } return 1 - sumDifferences / (this.totalCount + other.totalCount); } } class DynamicProgrammingDiffing { compute(sequence1, sequence2, timeout = InfiniteTimeout.instance, equalityScore) { if (sequence1.length === 0 || sequence2.length === 0) { return DiffAlgorithmResult.trivial(sequence1, sequence2); } const lcsLengths = new Array2D(sequence1.length, sequence2.length); const directions = new Array2D(sequence1.length, sequence2.length); const lengths = new Array2D(sequence1.length, sequence2.length); for (let s12 = 0; s12 < sequence1.length; s12++) { for (let s22 = 0; s22 < sequence2.length; s22++) { if (!timeout.isValid()) { return DiffAlgorithmResult.trivialTimedOut(sequence1, sequence2); } const horizontalLen = s12 === 0 ? 0 : lcsLengths.get(s12 - 1, s22); const verticalLen = s22 === 0 ? 0 : lcsLengths.get(s12, s22 - 1); let extendedSeqScore; if (sequence1.getElement(s12) === sequence2.getElement(s22)) { if (s12 === 0 || s22 === 0) { extendedSeqScore = 0; } else { extendedSeqScore = lcsLengths.get(s12 - 1, s22 - 1); } if (s12 > 0 && s22 > 0 && directions.get(s12 - 1, s22 - 1) === 3) { extendedSeqScore += lengths.get(s12 - 1, s22 - 1); } extendedSeqScore += equalityScore ? equalityScore(s12, s22) : 1; } else { extendedSeqScore = -1; } const newValue = Math.max(horizontalLen, verticalLen, extendedSeqScore); if (newValue === extendedSeqScore) { const prevLen = s12 > 0 && s22 > 0 ? lengths.get(s12 - 1, s22 - 1) : 0; lengths.set(s12, s22, prevLen + 1); directions.set(s12, s22, 3); } else if (newValue === horizontalLen) { lengths.set(s12, s22, 0); directions.set(s12, s22, 1); } else if (newValue === verticalLen) { lengths.set(s12, s22, 0); directions.set(s12, s22, 2); } lcsLengths.set(s12, s22, newValue); } } const result = []; let lastAligningPosS1 = sequence1.length; let lastAligningPosS2 = sequence2.length; function reportDecreasingAligningPositions(s12, s22) { if (s12 + 1 !== lastAligningPosS1 || s22 + 1 !== lastAligningPosS2) { result.push(new SequenceDiff( new OffsetRange(s12 + 1, lastAligningPosS1), new OffsetRange(s22 + 1, lastAligningPosS2) )); } lastAligningPosS1 = s12; lastAligningPosS2 = s22; } let s1 = sequence1.length - 1; let s2 = sequence2.length - 1; while (s1 >= 0 && s2 >= 0) { if (directions.get(s1, s2) === 3) { reportDecreasingAligningPositions(s1, s2); s1--; s2--; } else { if (directions.get(s1, s2) === 1) { s1--; } else { s2--; } } } reportDecreasingAligningPositions(-1, -1); result.reverse(); return new DiffAlgorithmResult(result, false); } } class MyersDiffAlgorithm { compute(seq1, seq2, timeout = InfiniteTimeout.instance) { if (seq1.length === 0 || seq2.length === 0) { return DiffAlgorithmResult.trivial(seq1, seq2); } const seqX = seq1; const seqY = seq2; function getXAfterSnake(x, y) { while (x < seqX.length && y < seqY.length && seqX.getElement(x) === seqY.getElement(y)) { x++; y++; } return x; } let d = 0; const V = new FastInt32Array(); V.set(0, getXAfterSnake(0, 0)); const paths = new FastArrayNegativeIndices(); paths.set(0, V.get(0) === 0 ? null : new SnakePath(null, 0, 0, V.get(0))); let k = 0; loop: while (true) { d++; if (!timeout.isValid()) { return DiffAlgorithmResult.trivialTimedOut(seqX, seqY); } const lowerBound = -Math.min(d, seqY.length + d % 2); const upperBound = Math.min(d, seqX.length + d % 2); for (k = lowerBound; k <= upperBound; k += 2) { const maxXofDLineTop = k === upperBound ? -1 : V.get(k + 1); const maxXofDLineLeft = k === lowerBound ? -1 : V.get(k - 1) + 1; const x = Math.min(Math.max(maxXofDLineTop, maxXofDLineLeft), seqX.length); const y = x - k; if (x > seqX.length || y > seqY.length) { continue; } const newMaxX = getXAfterSnake(x, y); V.set(k, newMaxX); const lastPath = x === maxXofDLineTop ? paths.get(k + 1) : paths.get(k - 1); paths.set(k, newMaxX !== x ? new SnakePath(lastPath, x, y, newMaxX - x) : lastPath); if (V.get(k) === seqX.length && V.get(k) - k === seqY.length) { break loop; } } } let path = paths.get(k); const result = []; let lastAligningPosS1 = seqX.length; let lastAligningPosS2 = seqY.length; while (true) { const endX = path ? path.x + path.length : 0; const endY = path ? path.y + path.length : 0; if (endX !== lastAligningPosS1 || endY !== lastAligningPosS2) { result.push(new SequenceDiff( new OffsetRange(endX, lastAligningPosS1), new OffsetRange(endY, lastAligningPosS2) )); } if (!path) { break; } lastAligningPosS1 = path.x; lastAligningPosS2 = path.y; path = path.prev; } result.reverse(); return new DiffAlgorithmResult(result, false); } } class SnakePath { constructor(prev, x, y, length) { this.prev = prev; this.x = x; this.y = y; this.length = length; } } class FastInt32Array { constructor() { this.positiveArr = new Int32Array(10); this.negativeArr = new Int32Array(10); } get(idx) { if (idx < 0) { idx = -idx - 1; return this.negativeArr[idx]; } else { return this.positiveArr[idx]; } } set(idx, value) { if (idx < 0) { idx = -idx - 1; if (idx >= this.negativeArr.length) { const arr = this.negativeArr; this.negativeArr = new Int32Array(arr.length * 2); this.negativeArr.set(arr); } this.negativeArr[idx] = value; } else { if (idx >= this.positiveArr.length) { const arr = this.positiveArr; this.positiveArr = new Int32Array(arr.length * 2); this.positiveArr.set(arr); } this.positiveArr[idx] = value; } } } class FastArrayNegativeIndices { constructor() { this.positiveArr = []; this.negativeArr = []; } get(idx) { if (idx < 0) { idx = -idx - 1; return this.negativeArr[idx]; } else { return this.positiveArr[idx]; } } set(idx, value) { if (idx < 0) { idx = -idx - 1; this.negativeArr[idx] = value; } else { this.positiveArr[idx] = value; } } } class SetMap { constructor() { this.map = /* @__PURE__ */ new Map(); } add(key, value) { let values = this.map.get(key); if (!values) { values = /* @__PURE__ */ new Set(); this.map.set(key, values); } values.add(value); } forEach(key, fn) { const values = this.map.get(key); if (!values) { return; } values.forEach(fn); } get(key) { const values = this.map.get(key); if (!values) { return /* @__PURE__ */ new Set(); } return values; } } class LinesSliceCharSequence { constructor(lines, range, considerWhitespaceChanges) { this.lines = lines; this.range = range; this.considerWhitespaceChanges = considerWhitespaceChanges; this.elements = []; this.firstElementOffsetByLineIdx = []; this.lineStartOffsets = []; this.trimmedWsLengthsByLineIdx = []; this.firstElementOffsetByLineIdx.push(0); for (let lineNumber = this.range.startLineNumber; lineNumber <= this.range.endLineNumber; lineNumber++) { let line = lines[lineNumber - 1]; let lineStartOffset = 0; if (lineNumber === this.range.startLineNumber && this.range.startColumn > 1) { lineStartOffset = this.range.startColumn - 1; line = line.substring(lineStartOffset); } this.lineStartOffsets.push(lineStartOffset); let trimmedWsLength = 0; if (!considerWhitespaceChanges) { const trimmedStartLine = line.trimStart(); trimmedWsLength = line.length - trimmedStartLine.length; line = trimmedStartLine.trimEnd(); } this.trimmedWsLengthsByLineIdx.push(trimmedWsLength); const lineLength = lineNumber === this.range.endLineNumber ? Math.min(this.range.endColumn - 1 - lineStartOffset - trimmedWsLength, line.length) : line.length; for (let i = 0; i < lineLength; i++) { this.elements.push(line.charCodeAt(i)); } if (lineNumber < this.range.endLineNumber) { this.elements.push("\n".charCodeAt(0)); this.firstElementOffsetByLineIdx.push(this.elements.length); } } } toString() { return `Slice: "${this.text}"`; } get text() { return this.getText(new OffsetRange(0, this.length)); } getText(range) { return this.elements.slice(range.start, range.endExclusive).map((e) => String.fromCharCode(e)).join(""); } getElement(offset) { return this.elements[offset]; } get length() { return this.elements.length; } getBoundaryScore(length) { const prevCategory = getCategory(length > 0 ? this.elements[length - 1] : -1); const nextCategory = getCategory(length < this.elements.length ? this.elements[length] : -1); if (prevCategory === 7 /* LineBreakCR */ && nextCategory === 8 /* LineBreakLF */) { return 0; } if (prevCategory === 8 /* LineBreakLF */) { return 150; } let score2 = 0; if (prevCategory !== nextCategory) { score2 += 10; if (prevCategory === 0 /* WordLower */ && nextCategory === 1 /* WordUpper */) { score2 += 1; } } score2 += getCategoryBoundaryScore(prevCategory); score2 += getCategoryBoundaryScore(nextCategory); return score2; } translateOffset(offset, preference = "right") { const i = findLastIdxMonotonous(this.firstElementOffsetByLineIdx, (value) => value <= offset); const lineOffset = offset - this.firstElementOffsetByLineIdx[i]; return new Position( this.range.startLineNumber + i, 1 + this.lineStartOffsets[i] + lineOffset + (lineOffset === 0 && preference === "left" ? 0 : this.trimmedWsLengthsByLineIdx[i]) ); } translateRange(range) { const pos1 = this.translateOffset(range.start, "right"); const pos2 = this.translateOffset(range.endExclusive, "left"); if (pos2.isBefore(pos1)) { return Range.fromPositions(pos2, pos2); } return Range.fromPositions(pos1, pos2); } /** * Finds the word that contains the character at the given offset */ findWordContaining(offset) { if (offset < 0 || offset >= this.elements.length) { return undefined; } if (!isWordChar(this.elements[offset])) { return undefined; } let start = offset; while (start > 0 && isWordChar(this.elements[start - 1])) { start--; } let end = offset; while (end < this.elements.length && isWordChar(this.elements[end])) { end++; } return new OffsetRange(start, end); } /** fooBar has the two sub-words foo and bar */ findSubWordContaining(offset) { if (offset < 0 || offset >= this.elements.length) { return undefined; } if (!isWordChar(this.elements[offset])) { return undefined; } let start = offset; while (start > 0 && isWordChar(this.elements[start - 1]) && !isUpperCase(this.elements[start])) { start--; } let end = offset; while (end < this.elements.length && isWordChar(this.elements[end]) && !isUpperCase(this.elements[end])) { end++; } return new OffsetRange(start, end); } countLinesIn(range) { return this.translateOffset(range.endExclusive).lineNumber - this.translateOffset(range.start).lineNumber; } isStronglyEqual(offset1, offset2) { return this.elements[offset1] === this.elements[offset2]; } extendToFullLines(range) { const start = findLastMonotonous(this.firstElementOffsetByLineIdx, (x) => x <= range.start) ?? 0; const end = findFirstMonotonous(this.firstElementOffsetByLineIdx, (x) => range.endExclusive <= x) ?? this.elements.length; return new OffsetRange(start, end); } } function isWordChar(charCode) { return charCode >= 97 && charCode <= 122 || charCode >= 65 && charCode <= 90 || charCode >= 48 && charCode <= 57; } function isUpperCase(charCode) { return charCode >= 65 && charCode <= 90; } const score = { [0 /* WordLower */]: 0, [1 /* WordUpper */]: 0, [2 /* WordNumber */]: 0, [3 /* End */]: 10, [4 /* Other */]: 2, [5 /* Separator */]: 30, [6 /* Space */]: 3, [7 /* LineBreakCR */]: 10, [8 /* LineBreakLF */]: 10 }; function getCategoryBoundaryScore(category) { return score[category]; } function getCategory(charCode) { if (charCode === 10) { return 8 /* LineBreakLF */; } else if (charCode === 13) { return 7 /* LineBreakCR */; } else if (isSpace(charCode)) { return 6 /* Space */; } else if (charCode >= 97 && charCode <= 122) { return 0 /* WordLower */; } else if (charCode >= 65 && charCode <= 90) { return 1 /* WordUpper */; } else if (charCode >= 48 && charCode <= 57) { return 2 /* WordNumber */; } else if (charCode === -1) { return 3 /* End */; } else if (charCode === 44 || charCode === 59) { return 5 /* Separator */; } else { return 4 /* Other */; } } function computeMovedLines(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout) { let { moves, excludedChanges } = computeMovesFromSimpleDeletionsToSimpleInsertions(changes, originalLines, modifiedLines, timeout); if (!timeout.isValid()) { return []; } const filteredChanges = changes.filter((c) => !excludedChanges.has(c)); const unchangedMoves = computeUnchangedMoves(filteredChanges, hashedOriginalLines, hashedModifiedLines, originalLines, modifiedLines, timeout); pushMany(moves, unchangedMoves); moves = joinCloseConsecutiveMoves(moves); moves = moves.filter((current) => { const lines = current.original.toOffsetRange().slice(originalLines).map((l) => l.trim()); const originalText = lines.join("\n"); return originalText.length >= 15 && countWhere(lines, (l) => l.length >= 2) >= 2; }); moves = removeMovesInSameDiff(changes, moves); return moves; } function countWhere(arr, predicate) { let count = 0; for (const t of arr) { if (predicate(t)) { count++; } } return count; } function computeMovesFromSimpleDeletionsToSimpleInsertions(changes, originalLines, modifiedLines, timeout) { const moves = []; const deletions = changes.filter((c) => c.modified.isEmpty && c.original.length >= 3).map((d) => new LineRangeFragment(d.original, originalLines, d)); const insertions = new Set(changes.filter((c) => c.original.isEmpty && c.modified.length >= 3).map((d) => new LineRangeFragment(d.modified, modifiedLines, d))); const excludedChanges = /* @__PURE__ */ new Set(); for (const deletion of deletions) { let highestSimilarity = -1; let best; for (const insertion of insertions) { const similarity = deletion.computeSimilarity(insertion); if (similarity > highestSimilarity) { highestSimilarity = similarity; best = insertion; } } if (highestSimilarity > 0.9 && best) { insertions.delete(best); moves.push(new LineRangeMapping(deletion.range, best.range)); excludedChanges.add(deletion.source); excludedChanges.add(best.source); } if (!timeout.isValid()) { return { moves, excludedChanges }; } } return { moves, excludedChanges }; } function computeUnchangedMoves(changes, hashedOriginalLines, hashedModifiedLines, originalLines, modifiedLines, timeout) { const moves = []; const original3LineHashes = new SetMap(); for (const change of changes) { for (let i = change.original.startLineNumber; i < change.original.endLineNumberExclusive - 2; i++) { const key = `${hashedOriginalLines[i - 1]}:${hashedOriginalLines[i + 1 - 1]}:${hashedOriginalLines[i + 2 - 1]}`; original3LineHashes.add(key, { range: new LineRange(i, i + 3) }); } } const possibleMappings = []; changes.sort(compareBy((c) => c.modified.startLineNumber, numberComparator)); for (const change of changes) { let lastMappings = []; for (let i = change.modified.startLineNumber; i < change.modified.endLineNumberExclusive - 2; i++) { const key = `${hashedModifiedLines[i - 1]}:${hashedModifiedLines[i + 1 - 1]}:${hashedModifiedLines[i + 2 - 1]}`; const currentModifiedRange = new LineRange(i, i + 3); const nextMappings = []; original3LineHashes.forEach(key, ({ range }) => { for (const lastMapping of lastMappings) { if (lastMapping.originalLineRange.endLineNumberExclusive + 1 === range.endLineNumberExclusive && lastMapping.modifiedLineRange.endLineNumberExclusive + 1 === currentModifiedRange.endLineNumberExclusive) { lastMapping.originalLineRange = new LineRange(lastMapping.originalLineRange.startLineNumber, range.endLineNumberExclusive); lastMapping.modifiedLineRange = new LineRange(lastMapping.modifiedLineRange.startLineNumber, currentModifiedRange.endLineNumberExclusive); nextMappings.push(lastMapping); return; } } const mapping = { modifiedLineRange: currentModifiedRange, originalLineRange: range }; possibleMappings.push(mapping); nextMappings.push(mapping); }); lastMappings = nextMappings; } if (!timeout.isValid()) { return []; } } possibleMappings.sort(reverseOrder(compareBy((m) => m.modifiedLineRange.length, numberComparator))); const modifiedSet = new LineRangeSet(); const originalSet = new LineRangeSet(); for (const mapping of possibleMappings) { const diffOrigToMod = mapping.modifiedLineRange.startLineNumber - mapping.originalLineRange.startLineNumber; const modifiedSections = modifiedSet.subtractFrom(mapping.modifiedLineRange); const originalTranslatedSections = originalSet.subtractFrom(mapping.originalLineRange).getWithDelta(diffOrigToMod); const modifiedIntersectedSections = modifiedSections.getIntersection(originalTranslatedSections); for (const s of modifiedIntersectedSections.ranges) { if (s.length < 3) { continue; } const modifiedLineRange = s; const originalLineRange = s.delta(-diffOrigToMod); moves.push(new LineRangeMapping(originalLineRange, modifiedLineRange)); modifiedSet.addRange(modifiedLineRange); originalSet.addRange(originalLineRange); } } moves.sort(compareBy((m) => m.original.startLineNumber, numberComparator)); const monotonousChanges = new MonotonousArray(changes); for (let i = 0; i < moves.length; i++) { const move = moves[i]; const firstTouchingChangeOrig = monotonousChanges.findLastMonotonous((c) => c.original.startLineNumber <= move.original.startLineNumber); const firstTouchingChangeMod = findLastMonotonous(changes, (c) => c.modified.startLineNumber <= move.modified.startLineNumber); const linesAbove = Math.max( move.original.startLineNumber - firstTouchingChangeOrig.original.startLineNumber, move.modified.startLineNumber - firstTouchingChangeMod.modified.startLineNumber ); const lastTouchingChangeOrig = monotonousChanges.findLastMonotonous((c) => c.original.startLineNumber < move.original.endLineNumberExclusive); const lastTouchingChangeMod = findLastMonotonous(changes, (c) => c.modified.startLineNumber < move.modified.endLineNumberExclusive); const linesBelow = Math.max( lastTouchingChangeOrig.original.endLineNumberExclusive - move.original.endLineNumberExclusive, lastTouchingChangeMod.modified.endLineNumberExclusive - move.modified.endLineNumberExclusive ); let extendToTop; for (extendToTop = 0; extendToTop < linesAbove; extendToTop++) { const origLine = move.original.startLineNumber - extendToTop - 1; const modLine = move.modified.startLineNumber - extendToTop - 1; if (origLine > originalLines.length || modLine > modifiedLines.length) { break; } if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) { break; } if (!areLinesSimilar(originalLines[origLine - 1], modifiedLines[modLine - 1], timeout)) { break; } } if (extendToTop > 0) { originalSet.addRange(new LineRange(move.original.startLineNumber - extendToTop, move.original.startLineNumber)); modifiedSet.addRange(new LineRange(move.modified.startLineNumber - extendToTop, move.modified.startLineNumber)); } let extendToBottom; for (extendToBottom = 0; extendToBottom < linesBelow; extendToBottom++) { const origLine = move.original.endLineNumberExclusive + extendToBottom; const modLine = move.modified.endLineNumberExclusive + extendToBottom; if (origLine > originalLines.length || modLine > modifiedLines.length) { break; } if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) { break; } if (!areLinesSimilar(originalLines[origLine - 1], modifiedLines[modLine - 1], timeout)) { break; } } if (extendToBottom > 0) { originalSet.addRange(new LineRange(move.original.endLineNumberExclusive, move.original.endLineNumberExclusive + extendToBottom)); modifiedSet.addRange(new LineRange(move.modified.endLineNumberExclusive, move.modified.endLineNumberExclusive + extendToBottom)); } if (extendToTop > 0 || extendToBottom > 0) { moves[i] = new LineRangeMapping( new LineRange(move.original.startLineNumber - extendToTop, move.original.endLineNumberExclusive + extendToBottom), new LineRange(move.modified.startLineNumber - extendToTop, move.modified.endLineNumberExclusive + extendToBottom) ); } } return moves; } function areLinesSimilar(line1, line2, timeout) { if (line1.trim() === line2.trim()) { return true; } if (line1.length > 300 && line2.length > 300) { return false; } const myersDiffingAlgorithm = new MyersDiffAlgorithm(); const result = myersDiffingAlgorithm.compute( new LinesSliceCharSequence([line1], new Range(1, 1, 1, line1.length), false), new LinesSliceCharSequence([line2], new Range(1, 1, 1, line2.length), false), timeout ); let commonNonSpaceCharCount = 0; const inverted = SequenceDiff.invert(result.diffs, line1.length); for (const seq of inverted) { seq.seq1Range.forEach((idx) => { if (!isSpace(line1.charCodeAt(idx))) { commonNonSpaceCharCount++; } }); } function countNonWsChars(str) { let count = 0; for (let i = 0; i < line1.length; i++) { if (!isSpace(str.charCodeAt(i))) { count++; } } return count; } const longerLineLength = countNonWsChars(line1.length > line2.length ? line1 : line2); const r = commonNonSpaceCharCount / longerLineLength > 0.6 && longerLineLength > 10; return r; } function joinCloseConsecutiveMoves(moves) { if (moves.length === 0) { return moves; } moves.sort(compareBy((m) => m.original.startLineNumber, numberComparator)); const result = [moves[0]]; for (let i = 1; i < moves.length; i++) { const last = result[result.length - 1]; const current = moves[i]; const originalDist = current.original.startLineNumber - last.original.endLineNumberExclusive; const modifiedDist = current.modified.startLineNumber - last.modified.endLineNumberExclusive; const currentMoveAfterLast = originalDist >= 0 && modifiedDist >= 0; if (currentMoveAfterLast && originalDist + modifiedDist <= 2) { result[result.length - 1] = last.join(current); continue; } result.push(current); } return result; } function removeMovesInSameDiff(changes, moves) { const changesMonotonous = new MonotonousArray(changes); moves = moves.filter((m) => { const diffBeforeEndOfMoveOriginal = changesMonotonous.findLastMonotonous((c) => c.original.startLineNumber < m.original.endLineNumberExclusive) || new LineRangeMapping(new LineRange(1, 1), new LineRange(1, 1)); const diffBeforeEndOfMoveModified = findLastMonotonous(changes, (c) => c.modified.startLineNumber < m.modified.endLineNumberExclusive); const differentDiffs = diffBeforeEndOfMoveOriginal !== diffBeforeEndOfMoveModified; return differentDiffs; }); return moves; } function optimizeSequenceDiffs(sequence1, sequence2, sequenceDiffs) { let result = sequenceDiffs; result = joinSequenceDiffsByShifting(sequence1, sequence2, result); result = joinSequenceDiffsByShifting(sequence1, sequence2, result); result = shiftSequenceDiffs(sequence1, sequence2, result); return result; } function joinSequenceDiffsByShifting(sequence1, sequence2, sequenceDiffs) { if (sequenceDiffs.length === 0) { return sequenceDiffs; } const result = []; result.push(sequenceDiffs[0]); for (let i = 1; i < sequenceDiffs.length; i++) { const prevResult = result[result.length - 1]; let cur = sequenceDiffs[i]; if (cur.seq1Range.isEmpty || cur.seq2Range.isEmpty) { const length = cur.seq1Range.start - prevResult.seq1Range.endExclusive; let d; for (d = 1; d <= length; d++) { if (sequence1.getElement(cur.seq1Range.start - d) !== sequence1.getElement(cur.seq1Range.endExclusive - d) || sequence2.getElement(cur.seq2Range.start - d) !== sequence2.getElement(cur.seq2Range.endExclusive - d)) { break; } } d--; if (d === length) { result[result.length - 1] = new SequenceDiff( new OffsetRange(prevResult.seq1Range.start, cur.seq1Range.endExclusive - length), new OffsetRange(prevResult.seq2Range.start, cur.seq2Range.endExclusive - length) ); continue; } cur = cur.delta(-d); } result.push(cur); } const result2 = []; for (let i = 0; i < result.length - 1; i++) { const nextResult = result[i + 1]; let cur = result[i]; if (cur.seq1Range.isEmpty || cur.seq2Range.isEmpty) { const length = nextResult.seq1Range.start - cur.seq1Range.endExclusive; let d; for (d = 0; d < length; d++) { if (!sequence1.isStronglyEqual(cur.seq1Range.start + d, cur.seq1Range.endExclusive + d) || !sequence2.isStronglyEqual(cur.seq2Range.start + d, cur.seq2Range.endExclusive + d)) { break; } } if (d === length) { result[i + 1] = new SequenceDiff( new OffsetRange(cur.seq1Range.start + length, nextResult.seq1Range.endExclusive), new OffsetRange(cur.seq2Range.start + length, nextResult.seq2Range.endExclusive) ); continue; } if (d > 0) { cur = cur.delta(d); } } result2.push(cur); } if (result.length > 0) { result2.push(result[result.length - 1]); } return result2; } function shiftSequenceDiffs(sequence1, sequence2, sequenceDiffs) { if (!sequence1.getBoundaryScore || !sequence2.getBoundaryScore) { return sequenceDiffs; } for (let i = 0; i < sequenceDiffs.length; i++) { const prevDiff = i > 0 ? sequenceDiffs[i - 1] : undefined; const diff = sequenceDiffs[i]; const nextDiff = i + 1 < sequenceDiffs.length ? sequenceDiffs[i + 1] : undefined; const seq1ValidRange = new OffsetRange(prevDiff ? prevDiff.seq1Range.endExclusive + 1 : 0, nextDiff ? nextDiff.seq1Range.start - 1 : sequence1.length); const seq2ValidRange = new OffsetRange(prevDiff ? prevDiff.seq2Range.endExclusive + 1 : 0, nextDiff ? nextDiff.seq2Range.start - 1 : sequence2.length); if (diff.seq1Range.isEmpty) { sequenceDiffs[i] = shiftDiffToBetterPosition(diff, sequence1, sequence2, seq1ValidRange, seq2ValidRange); } else if (diff.seq2Range.isEmpty) { sequenceDiffs[i] = shiftDiffToBetterPosition(diff.swap(), sequence2, sequence1, seq2ValidRange, seq1ValidRange).swap(); } } return sequenceDiffs; } function shiftDiffToBetterPosition(diff, sequence1, sequence2, seq1ValidRange, seq2ValidRange) { const maxShiftLimit = 100; let deltaBefore = 1; while (diff.seq1Range.start - deltaBefore >= seq1ValidRange.start && diff.seq2Range.start - deltaBefore >= seq2ValidRange.start && sequence2.isStronglyEqual(diff.seq2Range.start - deltaBefore, diff.seq2Range.endExclusive - deltaBefore) && deltaBefore < maxShiftLimit) { deltaBefore++; } deltaBefore--; let deltaAfter = 0; while (diff.seq1Range.start + deltaAfter < seq1ValidRange.endExclusive && diff.seq2Range.endExclusive + deltaAfter < seq2ValidRange.endExclusive && sequence2.isStronglyEqual(diff.seq2Range.start + deltaAfter, diff.seq2Range.endExclusive + deltaAfter) && deltaAfter < maxShiftLimit) { deltaAfter++; } if (deltaBefore === 0 && deltaAfter === 0) { return diff; } let bestDelta = 0; let bestScore = -1; for (let delta = -deltaBefore; delta <= deltaAfter; delta++) { const seq2OffsetStart = diff.seq2Range.start + delta; const seq2OffsetEndExclusive = diff.seq2Range.endExclusive + delta; const seq1Offset = diff.seq1Range.start + delta; const score = sequence1.getBoundaryScore(seq1Offset) + sequence2.getBoundaryScore(seq2OffsetStart) + sequence2.getBoundaryScore(seq2OffsetEndExclusive); if (score > bestScore) { bestScore = score; bestDelta = delta; } } return diff.delta(bestDelta); } function removeShortMatches(sequence1, sequence2, sequenceDiffs) { const result = []; for (const s of sequenceDiffs) { const last = result[result.length - 1]; if (!last) { result.push(s); continue; } if (s.seq1Range.start - last.seq1Range.endExclusive <= 2 || s.seq2Range.start - last.seq2Range.endExclusive <= 2) { result[result.length - 1] = new SequenceDiff(last.seq1Range.join(s.seq1Range), last.seq2Range.join(s.seq2Range)); } else { result.push(s); } } return result; } function extendDiffsToEntireWordIfAppropriate(sequence1, sequence2, sequenceDiffs, findParent, force = false) { const equalMappings = SequenceDiff.invert(sequenceDiffs, sequence1.length); const additional = []; let lastPoint = new OffsetPair(0, 0); function scanWord(pair, equalMapping) { if (pair.offset1 < lastPoint.offset1 || pair.offset2 < lastPoint.offset2) { return; } const w1 = findParent(sequence1, pair.offset1); const w2 = findParent(sequence2, pair.offset2); if (!w1 || !w2) { return; } let w = new SequenceDiff(w1, w2); const equalPart = w.intersect(equalMapping); let equalChars1 = equalPart.seq1Range.length; let equalChars2 = equalPart.seq2Range.length; while (equalMappings.length > 0) { const next = equalMappings[0]; const intersects = next.seq1Range.intersects(w.seq1Range) || next.seq2Range.intersects(w.seq2Range); if (!intersects) { break; } const v1 = findParent(sequence1, next.seq1Range.start); const v2 = findParent(sequence2, next.seq2Range.start); const v = new SequenceDiff(v1, v2); const equalPart2 = v.intersect(next); equalChars1 += equalPart2.seq1Range.length; equalChars2 += equalPart2.seq2Range.length; w = w.join(v); if (w.seq1Range.endExclusive >= next.seq1Range.endExclusive) { equalMappings.shift(); } else { break; } } if (force && equalChars1 + equalChars2 < w.seq1Range.length + w.seq2Range.length || equalChars1 + equalChars2 < (w.seq1Range.length + w.seq2Range.length) * 2 / 3) { additional.push(w); } lastPoint = w.getEndExclusives(); } while (equalMappings.length > 0) { const next = equalMappings.shift(); if (next.seq1Range.isEmpty) { continue; } scanWord(next.getStarts(), next); scanWord(next.getEndExclusives().delta(-1), next); } const merged = mergeSequenceDiffs(sequenceDiffs, additional); return merged; } function mergeSequenceDiffs(sequenceDiffs1, sequenceDiffs2) { const result = []; while (sequenceDiffs1.length > 0 || sequenceDiffs2.length > 0) { const sd1 = sequenceDiffs1[0]; const sd2 = sequenceDiffs2[0]; let next; if (sd1 && (!sd2 || sd1.seq1Range.start < sd2.seq1Range.start)) { next = sequenceDiffs1.shift(); } else { next = sequenceDiffs2.shift(); } if (result.length > 0 && result[result.length - 1].seq1Range.endExclusive >= next.seq1Range.start) { result[result.length - 1] = result[result.length - 1].join(next); } else { result.push(next); } } return result; } function removeVeryShortMatchingLinesBetweenDiffs(sequence1, _sequence2, sequenceDiffs) { let diffs = sequenceDiffs; if (diffs.length === 0) { return diffs; } let counter = 0; let shouldRepeat; do { shouldRepeat = false; const result = [ diffs[0] ]; for (let i = 1; i < diffs.length; i++) { let shouldJoinDiffs = function(before, after) { const unchangedRange = new OffsetRange(lastResult.seq1Range.endExclusive, cur.seq1Range.start); const unchangedText = sequence1.getText(unchangedRange); const unchangedTextWithoutWs = unchangedText.replace(/\s/g, ""); if (unchangedTextWithoutWs.length <= 4 && (before.seq1Range.length + before.seq2Range.length > 5 || after.seq1Range.length + after.seq2Range.length > 5)) { return true; } return false; }; const cur = diffs[i]; const lastResult = result[result.length - 1]; const shouldJoin = shouldJoinDiffs(lastResult, cur); if (shouldJoin) { shouldRepeat = true; result[result.length - 1] = result[result.length - 1].join(cur); } else { result.push(cur); } } diffs = result; } while (counter++ < 10 && shouldRepeat); return diffs; } function removeVeryShortMatchingTextBetweenLongDiffs(sequence1, sequence2, sequenceDiffs) { let diffs = sequenceDiffs; if (diffs.length === 0) { return diffs; } let counter = 0; let shouldRepeat; do { shouldRepeat = false; const result = [ diffs[0] ]; for (let i = 1; i < diffs.length; i++) { let shouldJoinDiffs = function(before, after) { const unchangedRange = new OffsetRange(lastResult.seq1Range.endExclusive, cur.seq1Range.start); const unchangedLineCount = sequence1.countLinesIn(unchangedRange); if (unchangedLineCount > 5 || unchangedRange.length > 500) { return false; } const unchangedText = sequence1.getText(unchangedRange).trim(); if (unchangedText.length > 20 || unchangedText.split(/\r\n|\r|\n/).length > 1) { return false; } const beforeLineCount1 = sequence1.countLinesIn(before.seq1Range); const beforeSeq1Length = before.seq1Range.length; const beforeLineCount2 = sequence2.countLinesIn(before.seq2Range); const beforeSeq2Length = before.seq2Range.length; const afterLineCount1 = sequence1.countLinesIn(after.seq1Range); const afterSeq1Length = after.seq1Range.length; const afterLineCount2 = sequence2.countLinesIn(after.seq2Range); const afterSeq2Length = after.seq2Range.length; const max = 2 * 40 + 50; function cap(v) { return Math.min(v, max); } if (Math.pow(Math.pow(cap(beforeLineCount1 * 40 + beforeSeq1Length), 1.5) + Math.pow(cap(beforeLineCount2 * 40 + beforeSeq2Length), 1.5), 1.5) + Math.pow(Math.pow(cap(afterLineCount1 * 40 + afterSeq1Length), 1.5) + Math.pow(cap(afterLineCount2 * 40 + afterSeq2Length), 1.5), 1.5) > (max ** 1.5) ** 1.5 * 1.3) { return true; } return false; }; const cur = diffs[i]; const lastResult = result[result.length - 1]; const shouldJoin = shouldJoinDiffs(lastResult, cur); if (shouldJoin) { shouldRepeat = true; result[result.length - 1] = result[result.length - 1].join(cur); } else { result.push(cur); } } diffs = result; } while (counter++ < 10 && shouldRepeat); const newDiffs = []; forEachWithNeighbors(diffs, (prev, cur, next) => { let newDiff = cur; function shouldMarkAsChanged(text) { return text.length > 0 && text.trim().length <= 3 && cur.seq1Range.length + cur.seq2Range.length > 100; } const fullRange1 = sequence1.extendToFullLines(cur.seq1Range); const prefix = sequence1.getText(new OffsetRange(fullRange1.start, cur.seq1Range.start)); if (shouldMarkAsChanged(prefix)) { newDiff = newDiff.deltaStart(-prefix.length); } const suffix = sequence1.getText(new OffsetRange(cur.seq1Range.endExclusive, fullRange1.endExclusive)); if (shouldMarkAsChanged(suffix)) { newDiff = newDiff.deltaEnd(suffix.length); } const availableSpace = SequenceDiff.fromOffsetPairs( prev ? prev.getEndExclusives() : OffsetPair.zero, next ? next.getStarts() : OffsetPair.max ); const result = newDiff.intersect(availableSpace); if (newDiffs.length > 0 && result.getStarts().equals(newDiffs[newDiffs.length - 1].getEndExclusives())) { newDiffs[newDiffs.length - 1] = newDiffs[newDiffs.length - 1].join(result); } else { newDiffs.push(result); } }); return newDiffs; } class LineSequence { constructor(trimmedHash, lines) { this.trimmedHash = trimmedHash; this.lines = lines; } getElement(offset) { return this.trimmedHash[offset]; } get length() { return this.trimmedHash.length; } getBoundaryScore(length) { const indentationBefore = length === 0 ? 0 : getIndentation(this.lines[length - 1]); const indentationAfter = length === this.lines.length ? 0 : getIndentation(this.lines[length]); return 1e3 - (indentationBefore + indentationAfter); } getText(range) { return this.lines.slice(range.start, range.endExclusive).join("\n"); } isStronglyEqual(offset1, offset2) { return this.lines[offset1] === this.lines[offset2]; } } function getIndentation(str) { let i = 0; while (i < str.length && (str.charCodeAt(i) === 32 || str.charCodeAt(i) === 9)) { i++; } return i; } class DefaultLinesDiffComputer { constructor() { this.dynamicProgrammingDiffing = new DynamicProgrammingDiffing(); this.myersDiffingAlgorithm = new MyersDiffAlgorithm(); } computeDiff(originalLines, modifiedLines, options) { if (originalLines.length <= 1 && equals(originalLines, modifiedLines, (a, b) => a === b)) { return new LinesDiff([], [], false); } if (originalLines.length === 1 && originalLines[0].length === 0 || modifiedLines.length === 1 && modifiedLines[0].length === 0) { return new LinesDiff([ new DetailedLineRangeMapping( new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [ new RangeMapping( new Range(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1) ) ] ) ], [], false); } const timeout = options.maxComputationTimeMs === 0 ? InfiniteTimeout.instance : new DateTimeout(options.maxComputationTimeMs); const considerWhitespaceChanges = !options.ignoreTrimWhitespace; const perfectHashes = /* @__PURE__ */ new Map(); function getOrCreateHash(text) { let hash = perfectHashes.get(text); if (hash === undefined) { hash = perfectHashes.size; perfectHashes.set(text, hash); } return hash; } const originalLinesHashes = originalLines.map((l) => getOrCreateHash(l.trim())); const modifiedLinesHashes = modifiedLines.map((l) => getOrCreateHash(l.trim())); const sequence1 = new LineSequence(originalLinesHashes, originalLines); const sequence2 = new LineSequence(modifiedLinesHashes, modifiedLines); const lineAlignmentResult = (() => { if (sequence1.length + sequence2.length < 1700) { return this.dynamicProgrammingDiffing.compute( sequence1, sequence2, timeout, (offset1, offset2) => originalLines[offset1] === modifiedLines[offset2] ? modifiedLines[offset2].length === 0 ? 0.1 : 1 + Math.log(1 + modifiedLines[offset2].length) : 0.99 ); } return this.myersDiffingAlgorithm.compute( sequence1, sequence2, timeout ); })(); let lineAlignments = lineAlignmentResult.diffs; let hitTimeout = lineAlignmentResult.hitTimeout; lineAlignments = optimizeSequenceDiffs(sequence1, sequence2, lineAlignments); lineAlignments = removeVeryShortMatchingLinesBetweenDiffs(sequence1, sequence2, lineAlignments); const alignments = []; const scanForWhitespaceChanges = (equalLinesCount) => { if (!considerWhitespaceChanges) { return; } for (let i = 0; i < equalLinesCount; i++) { const seq1Offset = seq1LastStart + i; const seq2Offset = seq2LastStart + i; if (originalLines[seq1Offset] !== modifiedLines[seq2Offset]) { const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff( new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1) ), timeout, considerWhitespaceChanges, options); for (const a of characterDiffs.mappings) { alignments.push(a); } if (characterDiffs.hitTimeout) { hitTimeout = true; } } } }; let seq1LastStart = 0; let seq2LastStart = 0; for (const diff of lineAlignments) { assertFn(() => diff.seq1Range.start - seq1LastStart === diff.seq2Range.start - seq2LastStart); const equalLinesCount = diff.seq1Range.start - seq1LastStart; scanForWhitespaceChanges(equalLinesCount); seq1LastStart = diff.seq1Range.endExclusive; seq2LastStart = diff.seq2Range.endExclusive; const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options); if (characterDiffs.hitTimeout) { hitTimeout = true; } for (const a of characterDiffs.mappings) { alignments.push(a); } } scanForWhitespaceChanges(originalLines.length - seq1LastStart); const changes = lineRangeMappingFromRangeMappings(alignments, new ArrayText(originalLines), new ArrayText(modifiedLines)); let moves = []; if (options.computeMoves) { moves = this.computeMoves(changes, originalLines, modifiedLines, originalLinesHashes, modifiedLinesHashes, timeout, considerWhitespaceChanges, options); } assertFn(() => { function validatePosition(pos, lines) { if (pos.lineNumber < 1 || pos.lineNumber > lines.length) { return false; } const line = lines[pos.lineNumber - 1]; if (pos.column < 1 || pos.column > line.length + 1) { return false; } return true; } function validateRange(range, lines) { if (range.startLineNumber < 1 || range.startLineNumber > lines.length + 1) { return false; } if (range.endLineNumberExclusive < 1 || range.endLineNumberExclusive > lines.length + 1) { return false; } return true; } for (const c of changes) { if (!c.innerChanges) { return false; } for (const ic of c.innerChanges) { const valid = validatePosition(ic.modifiedRange.getStartPosition(), modifiedLines) && validatePosition(ic.modifiedRange.getEndPosition(), modifiedLines) && validatePosition(ic.originalRange.getStartPosition(), originalLines) && validatePosition(ic.originalRange.getEndPosition(), originalLines); if (!valid) { return false; } } if (!validateRange(c.modified, modifiedLines) || !validateRange(c.original, originalLines)) { return false; } } return true; }); return new LinesDiff(changes, moves, hitTimeout); } computeMoves(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout, considerWhitespaceChanges, options) { const moves = computeMovedLines( changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout ); const movesWithDiffs = moves.map((m) => { const moveChanges = this.refineDiff(originalLines, modifiedLines, new SequenceDiff( m.original.toOffsetRange(), m.modified.toOffsetRange() ), timeout, considerWhitespaceChanges, options); const mappings = lineRangeMappingFromRangeMappings(moveChanges.mappings, new ArrayText(originalLines), new ArrayText(modifiedLines), true); return new MovedText(m, mappings); }); return movesWithDiffs; } refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options) { const lineRangeMapping = toLineRangeMapping(diff); const rangeMapping = lineRangeMapping.toRangeMapping2(originalLines, modifiedLines); const slice1 = new LinesSliceCharSequence(originalLines, rangeMapping.originalRange, considerWhitespaceChanges); const slice2 = new LinesSliceCharSequence(modifiedLines, rangeMapping.modifiedRange, considerWhitespaceChanges); const diffResult = slice1.length + slice2.length < 500 ? this.dynamicProgrammingDiffing.compute(slice1, slice2, timeout) : this.myersDiffingAlgorithm.compute(slice1, slice2, timeout); let diffs = diffResult.diffs; diffs = optimizeSequenceDiffs(slice1, slice2, diffs); diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs, (seq, idx) => seq.findWordContaining(idx)); if (options.extendToSubwords) { diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs, (seq, idx) => seq.findSubWordContaining(idx), true); } diffs = removeShortMatches(slice1, slice2, diffs); diffs = removeVeryShortMatchingTextBetweenLongDiffs(slice1, slice2, diffs); const result = diffs.map( (d) => new RangeMapping( slice1.translateRange(d.seq1Range), slice2.translateRange(d.seq2Range) ) ); return { mappings: result, hitTimeout: diffResult.hitTimeout }; } } function toLineRangeMapping(sequenceDiff) { return new LineRangeMapping( new LineRange(sequenceDiff.seq1Range.start + 1, sequenceDiff.seq1Range.endExclusive + 1), new LineRange(sequenceDiff.seq2Range.start + 1, sequenceDiff.seq2Range.endExclusive + 1) ); } function computeDiff(originalLines, modifiedLines, options) { let diffComputer = new DefaultLinesDiffComputer(); var result = diffComputer.computeDiff(originalLines, modifiedLines, options); return result?.changes.map((changes) => { let originalStartLineNumber; let originalEndLineNumber; let modifiedStartLineNumber; let modifiedEndLineNumber; let innerChanges = changes.innerChanges; originalStartLineNumber = changes.original.startLineNumber - 1; originalEndLineNumber = changes.original.endLineNumberExclusive - 1; modifiedStartLineNumber = changes.modified.startLineNumber - 1; modifiedEndLineNumber = changes.modified.endLineNumberExclusive - 1; return { origStart: originalStartLineNumber, origEnd: originalEndLineNumber, editStart: modifiedStartLineNumber, editEnd: modifiedEndLineNumber, charChanges: innerChanges?.map((m) => ({ originalStartLineNumber: m.originalRange.startLineNumber - 1, originalStartColumn: m.originalRange.startColumn - 1, originalEndLineNumber: m.originalRange.endLineNumber - 1, originalEndColumn: m.originalRange.endColumn - 1, modifiedStartLineNumber: m.modifiedRange.startLineNumber - 1, modifiedStartColumn: m.modifiedRange.startColumn - 1, modifiedEndLineNumber: m.modifiedRange.endLineNumber - 1, modifiedEndColumn: m.modifiedRange.endColumn - 1 })) }; }); } exports.computeDiff = computeDiff; var AceRange = require("../../../range").Range; var {DiffChunk} = require("../base_diff_view"); /** * VSCode’s computeDiff provider */ class DiffProvider { compute(originalLines, modifiedLines, opts) { if (!opts) opts = {}; if (!opts.maxComputationTimeMs) opts.maxComputationTimeMs = 500; const chunks = computeDiff(originalLines, modifiedLines, opts) || []; return chunks.map( c => new DiffChunk(new AceRange(c.origStart, 0, c.origEnd, 0), new AceRange(c.editStart, 0, c.editEnd, 0), c.charChanges )); } } exports.DiffProvider = DiffProvider; ================================================ FILE: src/ext/diff/scroll_diff_decorator.js ================================================ var Decorator = require("../../layer/decorators").Decorator; class ScrollDiffDecorator extends Decorator { /** * @param {import("../../../ace-internal").Ace.VScrollbar} scrollbarV * @param {import("../../virtual_renderer").VirtualRenderer} renderer * @param {boolean} [forInlineDiff] */ constructor(scrollbarV, renderer, forInlineDiff) { super(scrollbarV, renderer); this.colors.dark["delete"] = "rgba(255, 18, 18, 1)"; this.colors.dark["insert"] = "rgba(18, 136, 18, 1)"; this.colors.light["delete"] = "rgb(255,51,51)"; this.colors.light["insert"] = "rgb(32,133,72)"; this.$zones = []; this.$forInlineDiff = forInlineDiff; } /** * @param {number} startRow * @param {number} endRow * @param {"delete"|"insert"} type */ addZone(startRow, endRow, type) { this.$zones.push({ startRow, endRow, type }); } /** * @param {import("../../edit_session").EditSession} sessionA * @param {import("../../edit_session").EditSession} sessionB */ setSessions(sessionA, sessionB) { this.sessionA = sessionA; this.sessionB = sessionB; } $updateDecorators(config) { if (typeof this.canvas.getContext !== "function") { return; } super.$updateDecorators(config); if (this.$zones.length > 0) { var colors = (this.renderer.theme.isDark === true) ? this.colors.dark : this.colors.light; var ctx = this.canvas.getContext("2d"); this.$setDiffDecorators(ctx, colors); } } /** * @param {number} row * @param {string} type */ $transformPosition(row, type) { if (type == "delete") { return this.sessionA.documentToScreenRow(row, 0); } else { return this.sessionB.documentToScreenRow(row, 0); } } $setDiffDecorators(ctx, colors) { function compare(a, b) { if (a.from === b.from) { return a.to - b.to; } return a.from - b.from; } var zones = this.$zones; if (zones) { var resolvedZones = []; const deleteZones = zones.filter(z => z.type === "delete"); const insertZones = zones.filter(z => z.type === "insert"); [deleteZones, insertZones].forEach((typeZones) => { typeZones.forEach((zone, i) => { const offset1 = this.$transformPosition(zone.startRow, zone.type) * this.lineHeight; let offset2 = this.$transformPosition(zone.endRow, zone.type) * this.lineHeight + this.lineHeight; const y1 = Math.round(this.heightRatio * offset1); const y2 = Math.round(this.heightRatio * offset2); const padding = 1; let ycenter = Math.round((y1 + y2) / 2); let halfHeight = (y2 - ycenter); if (halfHeight < this.halfMinDecorationHeight) { halfHeight = this.halfMinDecorationHeight; } const previousZone = resolvedZones[resolvedZones.length - 1]; if (i > 0 && previousZone && previousZone.type === zone.type && ycenter - halfHeight < previousZone.to + padding) { ycenter = resolvedZones[resolvedZones.length - 1].to + padding + halfHeight; } if (ycenter - halfHeight < 0) { ycenter = halfHeight; } if (ycenter + halfHeight > this.canvasHeight) { ycenter = this.canvasHeight - halfHeight; } resolvedZones.push({ type: zone.type, from: ycenter - halfHeight, to: ycenter + halfHeight, color: colors[zone.type] || null }); }); }); resolvedZones = resolvedZones.sort(compare); for (const zone of resolvedZones) { ctx.fillStyle = zone.color || null; const zoneFrom = zone.from; const zoneTo = zone.to; const zoneHeight = zoneTo - zoneFrom; if (this.$forInlineDiff) { ctx.fillRect(this.oneZoneWidth, zoneFrom, 2 * this.oneZoneWidth, zoneHeight); } else { if (zone.type == "delete") { ctx.fillRect(this.oneZoneWidth, zoneFrom, this.oneZoneWidth, zoneHeight); } else { ctx.fillRect(2 * this.oneZoneWidth, zoneFrom, this.oneZoneWidth, zoneHeight); } } } } } setZoneWidth() { this.oneZoneWidth = Math.round(this.canvasWidth / 3); } } exports.ScrollDiffDecorator = ScrollDiffDecorator; ================================================ FILE: src/ext/diff/split_diff_view.js ================================================ "use strict"; var BaseDiffView = require("./base_diff_view").BaseDiffView; var config = require("../../config"); class SplitDiffView extends BaseDiffView { /** * Constructs a new side by side DiffView instance. * * @param {import("../diff").DiffModel} [diffModel] - The model for the diff view. */ constructor(diffModel) { diffModel = diffModel || {}; super(); this.init(diffModel); } init(diffModel) { this.onChangeTheme = this.onChangeTheme.bind(this); this.onMouseWheel = this.onMouseWheel.bind(this); this.onScroll = this.onScroll.bind(this); this.$setupModels(diffModel); this.addGutterDecorators(); this.onChangeTheme(); config.resetOptions(this); config["_signal"]("diffView", this); this.$attachEventHandlers(); } onChangeWrapLimit() { this.scheduleRealign(); } /*** scroll locking ***/ align() { var diffView = this; this.$initWidgets(diffView.editorA); this.$initWidgets(diffView.editorB); diffView.chunks.forEach(function (ch) { var diff1 = diffView.$screenRow(ch.old.start, diffView.sessionA); var diff2 = diffView.$screenRow(ch.new.start, diffView.sessionB); if (diff1 < diff2) { diffView.$addWidget(diffView.sessionA, { rowCount: diff2 - diff1, rowsAbove: ch.old.start.row === 0 ? diff2 - diff1 : 0, row: ch.old.start.row === 0 ? 0 : ch.old.start.row - 1 }); } else if (diff1 > diff2) { diffView.$addWidget(diffView.sessionB, { rowCount: diff1 - diff2, rowsAbove: ch.new.start.row === 0 ? diff1 - diff2 : 0, row: ch.new.start.row === 0 ? 0 : ch.new.start.row - 1 }); } var diff1 = diffView.$screenRow(ch.old.end, diffView.sessionA); var diff2 = diffView.$screenRow(ch.new.end, diffView.sessionB); if (diff1 < diff2) { diffView.$addWidget(diffView.sessionA, { rowCount: diff2 - diff1, rowsAbove: ch.old.end.row === 0 ? diff2 - diff1 : 0, row: ch.old.end.row === 0 ? 0 : ch.old.end.row - 1 }); } else if (diff1 > diff2) { diffView.$addWidget(diffView.sessionB, { rowCount: diff1 - diff2, rowsAbove: ch.new.end.row === 0 ? diff1 - diff2 : 0, row: ch.new.end.row === 0 ? 0 : ch.new.end.row - 1 }); } }); diffView.sessionA["_emit"]("changeFold", {data: {start: {row: 0}}}); diffView.sessionB["_emit"]("changeFold", {data: {start: {row: 0}}}); } onScroll(e, session) { this.syncScroll(this.sessionA === session ? this.editorA.renderer : this.editorB.renderer); } /** * @param {import("../../virtual_renderer").VirtualRenderer} renderer */ syncScroll(renderer) { if (this.$syncScroll == false) return; var r1 = this.editorA.renderer; var r2 = this.editorB.renderer; var isOrig = renderer == r1; if (r1["$scrollAnimation"] && r2["$scrollAnimation"]) return; var now = Date.now(); if (this.scrollSetBy != renderer && now - this.scrollSetAt < 500) return; var r = isOrig ? r1 : r2; if (this.scrollSetBy != renderer) { if (isOrig && this.scrollA == r.session.getScrollTop()) return; else if (!isOrig && this.scrollB == r.session.getScrollTop()) return; } var rOther = isOrig ? r2 : r1; var targetPos = r.session.getScrollTop(); this.$syncScroll = false; if (isOrig) { this.scrollA = r.session.getScrollTop(); this.scrollB = targetPos; } else { this.scrollA = targetPos; this.scrollB = r.session.getScrollTop(); } this.scrollSetBy = renderer; rOther.session.setScrollTop(targetPos); this.$syncScroll = true; this.scrollSetAt = now; } onMouseWheel(ev) { if (ev.getAccelKey()) return; if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) { ev.wheelX = ev.wheelY; ev.wheelY = 0; } var editor = ev.editor; var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed); if (!isScrolable) { var other = editor == this.editorA ? this.editorB : this.editorA; if (other.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed)) other.renderer.scrollBy( ev.wheelX * ev.speed, ev.wheelY * ev.speed); return ev.stop(); } } $attachSessionsEventHandlers() { this.$attachSessionEventHandlers(this.editorA, this.markerA); this.$attachSessionEventHandlers(this.editorB, this.markerB); } /** * @param {import("../../editor").Editor} editor * @param {import("./base_diff_view").DiffHighlight} marker */ $attachSessionEventHandlers(editor, marker) { editor.session.on("changeScrollTop", this.onScroll); editor.session.on("changeFold", this.onChangeFold); // @ts-expect-error editor.session.addDynamicMarker(marker); editor.selection.on("changeCursor", this.onSelect); editor.selection.on("changeSelection", this.onSelect); editor.session.on("changeWrapLimit", this.onChangeWrapLimit); editor.session.on("changeWrapMode", this.onChangeWrapLimit); } $detachSessionsEventHandlers() { this.$detachSessionHandlers(this.editorA, this.markerA); this.$detachSessionHandlers(this.editorB, this.markerB); } /** * @param {import("../../editor").Editor} editor * @param {import("./base_diff_view").DiffHighlight} marker */ $detachSessionHandlers(editor, marker) { editor.session.off("changeScrollTop", this.onScroll); editor.session.off("changeFold", this.onChangeFold); editor.session.removeMarker(marker.id); editor.selection.off("changeCursor", this.onSelect); editor.selection.off("changeSelection", this.onSelect); editor.session.off("changeWrapLimit", this.onChangeWrapLimit); editor.session.off("changeWrapMode", this.onChangeWrapLimit); } $attachEventHandlers() { this.editorA.renderer.on("themeChange", this.onChangeTheme); this.editorB.renderer.on("themeChange", this.onChangeTheme); this.editorA.on("mousewheel", this.onMouseWheel); this.editorB.on("mousewheel", this.onMouseWheel); this.editorA.on("input", this.onInput); this.editorB.on("input", this.onInput); } $detachEventHandlers() { this.$detachSessionsEventHandlers(); this.clearSelectionMarkers(); this.editorA.renderer.off("themeChange", this.onChangeTheme); this.editorB.renderer.off("themeChange", this.onChangeTheme); this.$detachEditorEventHandlers(this.editorA); this.$detachEditorEventHandlers(this.editorB); } $detachEditorEventHandlers(editor) { editor.off("mousewheel", this.onMouseWheel); editor.off("input", this.onInput); } } exports.SplitDiffView = SplitDiffView; ================================================ FILE: src/ext/diff/styles-css.js ================================================ exports.cssText = ` /* * Line Markers */ .ace_diff { position: absolute; z-index: 0; } .ace_diff.inline { z-index: 20; } /* * Light Colors */ .ace_diff.insert { background-color: #EFFFF1; } .ace_diff.delete { background-color: #FFF1F1; } .ace_diff.aligned_diff { background: rgba(206, 194, 191, 0.26); background: repeating-linear-gradient( 45deg, rgba(122, 111, 108, 0.26), rgba(122, 111, 108, 0.26) 5px, rgba(0, 0, 0, 0) 5px, rgba(0, 0, 0, 0) 10px ); } .ace_diff.insert.inline { background-color: rgb(74 251 74 / 18%); } .ace_diff.delete.inline { background-color: rgb(251 74 74 / 15%); } .ace_diff.delete.inline.empty { background-color: rgba(255, 128, 79, 0.7); width: 2px !important; } .ace_diff.insert.inline.empty { background-color: rgba(49, 230, 96, 0.7); width: 2px !important; } .ace_diff-active-line { border-bottom: 1px solid; border-top: 1px solid; background: transparent; position: absolute; box-sizing: border-box; border-color: #9191ac; } .ace_dark .ace_diff-active-line { background: transparent; border-color: #75777a; } /* gutter changes */ .ace_mini-diff_gutter-enabled > .ace_gutter-cell, .ace_mini-diff_gutter-enabled > .ace_gutter-cell_svg-icons { padding-right: 13px; } .ace_mini-diff_gutter_other > .ace_gutter-cell, .ace_mini-diff_gutter_other > .ace_gutter-cell_svg-icons { display: none; } .ace_mini-diff_gutter_other { pointer-events: none; } .ace_mini-diff_gutter-enabled > .mini-diff-added { background-color: #EFFFF1; border-left: 3px solid #2BB534; padding-left: 16px; display: block; } .ace_mini-diff_gutter-enabled > .mini-diff-deleted { background-color: #FFF1F1; border-left: 3px solid #EA7158; padding-left: 16px; display: block; } .ace_mini-diff_gutter-enabled > .mini-diff-added:after { position: absolute; right: 2px; content: "+"; background-color: inherit; } .ace_mini-diff_gutter-enabled > .mini-diff-deleted:after { position: absolute; right: 2px; content: "-"; background-color: inherit; } .ace_fade-fold-widgets:hover > .ace_folding-enabled > .mini-diff-added:after, .ace_fade-fold-widgets:hover > .ace_folding-enabled > .mini-diff-deleted:after { display: none; } .ace_diff_other .ace_selection { filter: drop-shadow(1px 2px 3px darkgray); } .ace_hidden_marker-layer .ace_bracket, .ace_hidden_marker-layer .ace_error_bracket { display: none; } /* * Dark Colors */ .ace_dark .ace_diff.insert { background-color: #212E25; } .ace_dark .ace_diff.delete { background-color: #3F2222; } .ace_dark .ace_mini-diff_gutter-enabled > .mini-diff-added { background-color: #212E25; border-left-color:#00802F; } .ace_dark .ace_mini-diff_gutter-enabled > .mini-diff-deleted { background-color: #3F2222; border-left-color: #9C3838; } `; ================================================ FILE: src/ext/diff.js ================================================ /** * ## Diff extension * * Provides side-by-side and inline diff view capabilities for comparing code differences between two versions. * Supports visual highlighting of additions, deletions, and modifications with customizable diff providers * and rendering options. Includes features for synchronized scrolling, line number alignment, and * various diff computation algorithms. * * **Components:** * - `InlineDiffView`: Single editor view showing changes inline with markers * - `SplitDiffView`: Side-by-side comparison view with two synchronized editors * - `DiffProvider`: Configurable algorithms for computing differences * * **Usage:** * ```javascript * const diffView = createDiffView({ * valueA: originalContent, * valueB: modifiedContent, * inline: false // or 'a'/'b' for inline view * }); * ``` * * @module */ var InlineDiffView = require("./diff/inline_diff_view").InlineDiffView; var SplitDiffView = require("./diff/split_diff_view").SplitDiffView; var DiffProvider = require("./diff/providers/default").DiffProvider; /** * Interface representing a model for handling differences between two views or states. * @typedef {Object} DiffModel * @property {import("../editor").Editor} [editorA] - The editor for the original view. * @property {import("../editor").Editor} [editorB] - The editor for the edited view. * @property {import("../edit_session").EditSession} [sessionA] - The edit session for the original view. * @property {import("../edit_session").EditSession} [sessionB] - The edit session for the edited view. * @property {string} [valueA] - The original content. * @property {string} [valueB] - The modified content. * @property {"a"|"b"} [inline] - Whether to show the original view("a") or modified view("b") for inline diff view * @property {IDiffProvider} [diffProvider] - Provider for computing differences between original and modified content. */ /** * @typedef {Object} DiffViewOptions * @property {boolean} [showOtherLineNumbers=true] - Whether to show line numbers in the other editor's gutter * @property {boolean} [folding] - Whether to enable code folding widgets * @property {boolean} [syncSelections] - Whether to synchronize selections between both editors * @property {boolean} [ignoreTrimWhitespace] - Whether to ignore trimmed whitespace when computing diffs * @property {boolean} [wrap] - Whether to enable word wrapping in both editors * @property {number} [maxDiffs=5000] - Maximum number of diffs to compute before failing silently * @property {string|import("../../ace-internal").Ace.Theme} [theme] - Theme to apply to both editors */ /** * @typedef {Object} IDiffProvider * @property {(originalLines: string[], modifiedLines: string[], opts?: any) => import("./diff/base_diff_view").DiffChunk[]} compute - Computes differences between original and modified lines */ /** * Creates a diff view for comparing code. * @param {DiffModel} [diffModel] model for the diff view * @param {DiffViewOptions} [options] options for the diff view * @returns {InlineDiffView|SplitDiffView} Configured diff view instance */ function createDiffView(diffModel, options) { diffModel = diffModel || {}; diffModel.diffProvider = diffModel.diffProvider || new DiffProvider(); //use default diff provider; let diffView; if (diffModel.inline) { diffView = new InlineDiffView(diffModel); } else { diffView = new SplitDiffView(diffModel); } if (options) { diffView.setOptions(options); } return diffView; } exports.InlineDiffView = InlineDiffView; exports.SplitDiffView = SplitDiffView; exports.DiffProvider = DiffProvider; exports.createDiffView = createDiffView; ================================================ FILE: src/ext/diff_test.js ================================================ "use strict"; var assert = require("../test/assertions"); require("../test/mockdom"); var {InlineDiffView} = require("./diff/inline_diff_view"); var {SplitDiffView} = require("./diff/split_diff_view"); const {createDiffView} = require("./diff"); var diffView; module.exports = { tearDown: function () { if (diffView) { diffView.destroy(); diffView = null; } }, "test: diff wrapper test": function () { diffView = createDiffView({inline: "a"}); assert.ok(diffView instanceof InlineDiffView); diffView.destroy(); diffView = createDiffView({}); assert.ok(diffView instanceof SplitDiffView); }, "test: diff setOptions": function () { diffView = createDiffView({}, { maxDiffs: 1000, ignoreTrimWhitespace: true }); assert.ok(diffView.getOption("maxDiffs"), 1000); assert.ok(diffView.getOption("ignoreTrimWhitespace"), true); } }; require("../test/run")(module); ================================================ FILE: src/ext/elastic_tabstops_lite.js ================================================ /** * ## Elastic Tabstops Lite extension. * * Automatically adjusts tab spacing to align content in tabular format by calculating optimal column widths * and maintaining consistent vertical alignment across multiple lines. Tracks content changes and dynamically * reprocesses affected rows to ensure proper formatting without manual intervention. * * **Enable:** `editor.setOption("useElasticTabstops", true)` * or configure it during editor initialization in the options object. * @module */ "use strict"; class ElasticTabstopsLite { /** * @param {Editor} editor */ constructor(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); } }; } /** * @param {number[]} rows */ processRows(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; } /** * @param {number} row */ $findCellWidthsForBlock(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 }; } /** * @param {number} row * @returns {number[]} */ $cellWidthsForRow(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; } /** * @param {number} row * @returns {number[]} */ $selectionColumnsForRow(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; } /** * @param {number[][]} cellWidths */ $setBlockCellWidthsToMax(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; } /** * @param {number[]} selectionColumns * @param {number} cellRightEdge * @returns {number} */ $rightmostSelectionInCell(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; } /** * @param {number} row * @returns {number[]} */ $tabsForRow(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; } /** * @param {number} row * @param {number[]} widths */ $adjustRow(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 * @param {any[][]} iterables */ $izip_longest(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 * @param {string | any[]} widths * @param {string | any[]} tabs */ $izip(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; } } exports.ElasticTabstopsLite = ElasticTabstopsLite; var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { useElasticTabstops: { /** * @param {boolean} val * @this {Editor} */ 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: src/ext/emmet.js ================================================ /** * ## Emmet extension * * Providing HTML/CSS abbreviation expansion, code navigation, and text editing utilities with configurable options and * keyboard shortcuts for rapid web development workflow. * * **Enable:** `editor.setOption("enableEmmet", true)` * or configure it during editor initialization in the options object. * @module */ "use strict"; var HashHandler = require("../keyboard/hash_handler").HashHandler; var Editor = require("../editor").Editor; var snippetManager = require("../snippets").snippetManager; var Range = require("../range").Range; var config = require("../config"); var emmet, emmetPath; /** * Implementation of {@link IEmmetEditor} interface for Ace */ class AceEmmetEditor { /** * @param {Editor} editor */ setupContext(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() { // 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(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() { 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(){ var pos = this.ace.getCursorPosition(); return this.ace.session.doc.positionToIndex(pos); } /** * Set new caret position * @param {Number} index Caret position */ setCaretPos(index){ var pos = this.ace.session.doc.indexToPosition(index); this.ace.selection.moveToPosition(pos); } /** * Returns content of current line * @return {String} */ getCurrentLine() { 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(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(){ return this.ace.getValue(); } /** * Returns current editor's syntax mode * @return {String} */ getSyntax() { if (this.$syntax) return this.$syntax; var syntax = this.ace.session.$modeId.split("/").pop(); if (syntax == "html" || syntax == "php") { var cursor = this.ace.getCursorPosition(); /**@type {string | string[]} */ 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() { 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(title) { return prompt(title); // eslint-disable-line no-alert } /** * Returns current selection * @return {String} * @since 0.65 */ getSelection() { return this.ace.session.getTextRange(); } /** * Returns current editor's file path * @return {String} * @since 0.65 */ getFilePath() { 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 /** * @param {string} value */ $updateTabstops(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(); /** * Runs an Emmet command on the given editor. * * @param {Editor} editor - The Ace editor instance to run the Emmet command on * @return {ReturnType | boolean} The result of the Emmet command execution */ exports.runEmmetCommand = function runEmmetCommand(editor) { 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; } try { editorProxy.setupContext(editor); var actions = emmet.actions || emmet.require("actions"); 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) { var loading = exports.load(runEmmetCommand.bind(this, editor)); if (this.action == "expand_abbreviation_with_tab") return false; return loading; } editor._signal("changeStatus", typeof e == "string" ? e : e.message); config.warn(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" }); } /** * Updates the keyboard handler for Emmet commands in the editor. * * @param {Editor} editor - The Ace editor instance * @param {boolean} [enabled] - Whether Emmet commands should be enabled */ exports.updateCommands = function(editor, enabled) { if (enabled) { editor.keyBinding.addKeyboardHandler(exports.commands); } else { editor.keyBinding.removeKeyboardHandler(exports.commands); } }; /** * Determines if a given editor mode is supported by Emmet. * * @param {Object|string} mode - The editor mode to check for Emmet support * @returns {boolean} Whether the mode is supported by Emmet */ 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); }; /** * Checks if an Emmet command is available for the current editor context. * * @param {Editor} editor - The current Ace editor instance * @param {string} command - The Emmet command to check availability for * @return {boolean} Whether the command is available in the current editor mode */ 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) exports.load(); exports.updateCommands(editor, enabled); }; /** * Loads the Emmet core module dynamically. * * @param {Function} [cb] - Optional callback function to be executed after module loading * @return {boolean} Whether the Emmet core module loading was initiated successfully */ exports.load = function(cb) { if (typeof emmetPath !== "string") { config.warn("script for emmet-core is not loaded"); return false; } config.loadModule(emmetPath, function() { emmetPath = null; cb && cb(); }); return true; }; exports.AceEmmetEditor = AceEmmetEditor; config.defineOptions(Editor.prototype, "editor", { enableEmmet: { set: function(val) { this[val ? "on" : "removeListener"]("changeMode", onChangeMode); onChangeMode({enableEmmet: !!val}, this); }, value: true } }); /** * Sets the Emmet core module or path. * * @param {string|Object} e - Either the path to the Emmet core script or the Emmet core module itself * If a string is provided, it sets the path to load the Emmet core script. * If an object is provided, it directly sets the Emmet core module. */ exports.setCore = function(e) { if (typeof e == "string") emmetPath = e; else emmet = e; }; ================================================ FILE: src/ext/emmet_test.js ================================================ "use strict"; require("../test/mockdom"); var Mode = require("../mode/html").Mode; var ace = require("../ace"); var assert = require("assert"); require("./emmet"); module.exports = { "test doesn't break tab when emmet is not loaded": function() { var editor = ace.edit(null, { mode: new Mode(), enableEmmet: true, useSoftTabs: false }); window.emmet = null; editor.onCommandKey({}, 0, 9); assert.equal(editor.getValue(), "\t"); try { var called = 0; window.emmet = { actions: { run: function() { called++; } }, resources: { setVariable: function() { called++; } } }; editor.onCommandKey({}, 0, 9); assert.equal(called, 2); } finally { window.emmet = null; } } }; require("../test/run")(module); ================================================ FILE: src/ext/error_marker.js ================================================ /** * ## Error Marker extension * * Provides inline error display functionality for Ace editor. Creates visual error markers that appear as tooltips * below editor lines containing annotations (errors, warnings, info). Enables navigation between error locations with * keyboard shortcuts and displays context-sensitive messages with proper styling based on annotation severity. * * @module */ "use strict"; var dom = require("../lib/dom"); var Range = require("../range").Range; var nls = require("../config").nls; 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); } /** * @param {import("../edit_session").EditSession} session * @param {number} row * @param {number} dir */ 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; } /** * Displays an error marker widget in the editor for annotations at the current cursor position. * * @param {import("../editor").Editor} editor - The Ace editor instance * @param {number} dir - The direction of navigation through annotations (-1 or 1) */ exports.showErrorMarker = function(editor, dir) { var session = editor.session; 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 = { displayText: [nls("error-marker.good-state", "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; gutterAnno.displayText.forEach(function (annoTextLine, i) { el.appendChild(dom.createTextNode(annoTextLine)); if (i < gutterAnno.displayText.length - 1) { el.appendChild(dom.createElement("br")); } }); 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; // @ts-ignore 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); }; // @ts-ignore 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; } `, "error_marker.css", false); ================================================ FILE: src/ext/error_marker_test.js ================================================ "use strict"; var assert = require("./../test/assertions"); require("./../test/mockdom"); var ace = require("../ace"); var editor, changes; module.exports = { setUp: function() { ace.config.setLoader(function(moduleName, cb) { if (moduleName == "ace/ext/error_marker") return cb(null, require("../ext/error_marker")); }); if (!editor) { editor = ace.edit(null); document.body.appendChild(editor.container); editor.container.style.height = "200px"; editor.container.style.width = "300px"; editor.container.style.position = "absolute"; editor.container.style.outline = "solid"; editor.on("change", function(e) { changes.push(e); }); } changes = []; editor.focus(); }, tearDown: function() { if (editor) { editor.destroy(); editor.container.remove(); editor = null; } }, "test: go to next error": function() { editor.session.setValue("1\nerror 2 warning\n3\n4 info\n5\n6\n"); editor.execCommand("goToNextError"); editor.resize(true); assert.ok(/Looks good/.test(editor.container.innerHTML)); editor.$search.$options.needle = /[a-z]+/gim; var ranges = editor.$search.findAll(editor.session); editor.session.setAnnotations(ranges.map(function(r) { var type = editor.session.getTextRange(r); return { row: r.start.row, column: r.start.column, text: type + " " + r, type: type }; })); editor.execCommand("goToNextError"); editor.renderer.$loop._flush(); assert.ok(/error_widget\s+ace_error/.test(editor.container.innerHTML)); editor.execCommand("goToNextError"); editor.renderer.$loop._flush(); assert.ok(/error_widget\s+ace_info/.test(editor.container.innerHTML)); editor.execCommand("goToPreviousError"); editor.renderer.$loop._flush(); assert.ok(/error_widget\s+ace_error/.test(editor.container.innerHTML)); editor.execCommand("insertstring", "\n"); editor.renderer.$loop._flush(); assert.notOk(/error_widget/.test(editor.container.innerHTML)); } }; require("../test/run")(module); ================================================ FILE: src/ext/hardwrap.js ================================================ /** * ## Text hard wrapping extension for automatic line breaking and text formatting. * * Provides intelligent line wrapping functionality that breaks long lines at configurable column limits while * preserving indentation and optionally merging short adjacent lines. Supports both automatic wrapping during text * input and manual formatting of selected text ranges. * * **Enable:** `editor.setOption("hardWrap", true)` * or configure it during editor initialization in the options object. * @module */ "use strict"; var Range = require("../range").Range; /** * Wraps lines at specified column limits and optionally merges short adjacent lines. * * Processes text within the specified row range, breaking lines that exceed the maximum column * width at appropriate word boundaries while preserving indentation. When merge is enabled, * combines short consecutive lines that can fit within the column limit. Automatically adjusts * the end row when new line breaks are inserted to ensure all affected content is processed. * * @param {import("../editor").Editor} editor - The editor instance containing the text to wrap * @param {import("../../ace-internal").Ace.HardWrapOptions} options - Configuration options for wrapping behavior */ function hardWrap(editor, options) { var max = options.column || editor.getOption("printMarginColumn"); var allowMerge = options.allowMerge != false; var row = Math.min(options.startRow, options.endRow); var endRow = Math.max(options.startRow, options.endRow); var session = editor.session; while (row <= endRow) { var line = session.getLine(row); if (line.length > max) { var space = findSpace(line, max, 5); if (space) { var indentation = /^\s*/.exec(line)[0]; session.replace(new Range(row,space.start,row,space.end), "\n" + indentation); } endRow++; } else if (allowMerge && /\S/.test(line) && row != endRow) { var nextLine = session.getLine(row + 1); if (nextLine && /\S/.test(nextLine)) { var trimmedLine = line.replace(/\s+$/, ""); var trimmedNextLine = nextLine.replace(/^\s+/, ""); var mergedLine = trimmedLine + " " + trimmedNextLine; var space = findSpace(mergedLine, max, 5); if (space && space.start > trimmedLine.length || mergedLine.length < max) { var replaceRange = new Range(row,trimmedLine.length,row + 1,nextLine.length - trimmedNextLine.length); session.replace(replaceRange, " "); row--; endRow--; } else if (trimmedLine.length < line.length) { session.remove(new Range(row, trimmedLine.length, row, line.length)); } } } row++; } /** * @param {string} line * @param {number} max * @param {number} min */ function findSpace(line, max, min) { if (line.length < max) return; var before = line.slice(0, max); var after = line.slice(max); var spaceAfter = /^(?:(\s+)|(\S+)(\s+))/.exec(after); var spaceBefore = /(?:(\s+)|(\s+)(\S+))$/.exec(before); var start = 0; var end = 0; if (spaceBefore && !spaceBefore[2]) { start = max - spaceBefore[1].length; end = max; } if (spaceAfter && !spaceAfter[2]) { if (!start) start = max; end = max + spaceAfter[1].length; } if (start) { return { start: start, end: end }; } if (spaceBefore && spaceBefore[2] && spaceBefore.index > min) { return { start: spaceBefore.index, end: spaceBefore.index + spaceBefore[2].length }; } if (spaceAfter && spaceAfter[2]) { start = max + spaceAfter[2].length; return { start: start, end: start + spaceAfter[3].length }; } } } function wrapAfterInput(e) { if (e.command.name == "insertstring" && /\S/.test(e.args)) { var editor = e.editor; var cursor = editor.selection.cursor; if (cursor.column <= editor.renderer.$printMarginColumn) return; var lastDelta = editor.session.$undoManager.$lastDelta; hardWrap(editor, { startRow: cursor.row, endRow: cursor.row, allowMerge: false }); if (lastDelta != editor.session.$undoManager.$lastDelta) editor.session.markUndoGroup(); } } var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { hardWrap: { set: function(val) { if (val) { this.commands.on("afterExec", wrapAfterInput); } else { this.commands.off("afterExec", wrapAfterInput); } }, value: false } }); exports.hardWrap = hardWrap; ================================================ FILE: src/ext/hardwrap_test.js ================================================ "use strict"; var assert = require("./../test/assertions"); require("./../test/mockdom"); var ace = require("../ace"); var hardWrap = require("./hardwrap").hardWrap; var editor; module.exports = { setUp: function() { if (!editor) { editor = ace.edit(null); } editor.focus(); }, tearDown: function() { if (editor) { editor.destroy(); editor.container.remove(); editor = null; } }, "test: split lines": function() { editor.setValue("line 1 longword line 2"); hardWrap(editor, {column: 12, startRow: 0, endRow: 2}); assert.equal(editor.getValue(), "line 1\nlongword\nline 2"); editor.setValue("line1longword line 2"); hardWrap(editor, {column: 12, startRow: 0, endRow: 2}); assert.equal(editor.getValue(), "line1longword\nline 2"); editor.setValue("line1longword "); hardWrap(editor, {column: 12, startRow: 0, endRow: 2}); assert.equal(editor.getValue(), "line1longword\n"); editor.setValue("line 1 line 2"); hardWrap(editor, {column: 12, startRow: 0, endRow: 2}); assert.equal(editor.getValue(), "line 1\nline 2"); editor.setValue("line 1 line 2"); hardWrap(editor, {column: 6, startRow: 0, endRow: 2}); assert.equal(editor.getValue(), "line 1\nline 2"); editor.setValue("line 1"); hardWrap(editor, {column: 10, startRow: 0, endRow: 2}); assert.equal(editor.getValue(), "line 1"); }, "test: merge lines": function() { editor.setValue("line \n \t 1 \nlongword\nline \n 2"); hardWrap(editor, {column: 12, startRow: 0, endRow: 4}); assert.equal(editor.getValue(), "line 1\nlongword\nline 2"); editor.setValue("line \n 1 \n longword \n line \n2 a longer line"); hardWrap(editor, {column: 12, startRow: 0, endRow: 4, allowMerge: false}); assert.equal(editor.getValue(), "line \n 1 \n longword \n line \n2 a longer\nline"); }, "test: keep indentation": function() { var value = "hello\n long long text\n unchanged next line"; editor.setValue(value); hardWrap(editor, {column: 12, startRow: 1, endRow: 1}); assert.equal(editor.getValue(), "hello\n long\n long\n text\n unchanged next line"); hardWrap(editor, {column: 80, startRow: 1, endRow: 3}); assert.equal(editor.getValue(), value); }, "test: wrap as you type": function() { editor.setValue("hello\n long long text\n unchanged next line", -1); editor.execCommand("golinedown"); editor.execCommand("gotolineend"); editor.execCommand("insertstring", " "); editor.execCommand("insertstring", "t"); assert.equal(editor.session.getLine(1), " long long text t"); editor.setOptions({printMargin: 12, hardWrap: true}); editor.execCommand("insertstring", " "); assert.equal(editor.session.getLine(1), " long long text t "); editor.execCommand("insertstring", "x"); assert.equal(editor.getValue(), "hello\n long\n long\n text t x\n unchanged next line"); } }; require("../test/run")(module); ================================================ FILE: src/ext/inline_autocomplete.js ================================================ /** * ## Inline Autocomplete extension * * Provides lightweight, prefix-based autocompletion with inline ghost text rendering and an optional command bar tooltip. * Displays completion suggestions as ghost text directly in the editor with keyboard navigation and interactive controls. * * **Enable:** `editor.setOption("enableInlineAutocompletion", true)` * or configure it during editor initialization in the options object. * @module */ "use strict"; var HashHandler = require("../keyboard/hash_handler").HashHandler; var AceInline = require("../autocomplete/inline").AceInline; var FilteredList = require("../autocomplete").FilteredList; var CompletionProvider = require("../autocomplete").CompletionProvider; var Editor = require("../editor").Editor; var util = require("../autocomplete/util"); var dom = require("../lib/dom"); var lang = require("../lib/lang"); var CommandBarTooltip = require("./command_bar").CommandBarTooltip; var BUTTON_CLASS_NAME = require("./command_bar").BUTTON_CLASS_NAME; var snippetCompleter = require("./language_tools").snippetCompleter; var textCompleter = require("./language_tools").textCompleter; var keyWordCompleter = require("./language_tools").keyWordCompleter; var destroyCompleter = function(e, editor) { editor.completer && editor.completer.destroy(); }; /** * This class controls the inline-only autocompletion components and their lifecycle. * This is more lightweight than the popup-based autocompletion, as it can only work with exact prefix matches. * There is an inline ghost text renderer and an optional command bar tooltip inside. */ class InlineAutocomplete { /** * @param {Editor} editor */ constructor(editor) { this.editor = editor; this.keyboardHandler = new HashHandler(this.commands); this.$index = -1; this.blurListener = this.blurListener.bind(this); this.changeListener = this.changeListener.bind(this); this.changeTimer = lang.delayedCall(function() { this.updateCompletions(); }.bind(this)); } /** * * @return {AceInline} */ getInlineRenderer() { if (!this.inlineRenderer) this.inlineRenderer = new AceInline(); return this.inlineRenderer; } /** * @return {CommandBarTooltip} */ getInlineTooltip() { if (!this.inlineTooltip) { this.inlineTooltip = InlineAutocomplete.createInlineTooltip(document.body || document.documentElement); } return this.inlineTooltip; } /** * This function is the entry point to the class. This triggers the gathering of the autocompletion and displaying the results; * @param {import("../../ace-internal").Ace.CompletionOptions} options */ show(options) { this.activated = true; if (this.editor.completer !== this) { if (this.editor.completer) this.editor.completer.detach(); this.editor.completer = this; } this.editor.on("changeSelection", this.changeListener); this.editor.on("blur", this.blurListener); this.updateCompletions(options); } $open() { if (this.editor.textInput.setAriaOptions) { this.editor.textInput.setAriaOptions({}); } this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); this.getInlineTooltip().attach(this.editor); if (this.$index === -1) { this.setIndex(0); } else { this.$showCompletion(); } this.changeTimer.cancel(); } insertMatch() { var result = this.getCompletionProvider().insertByIndex(this.editor, this.$index); this.detach(); return result; } changeListener(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(); } blurListener(e) { this.detach(); } /** * @param {import("../../ace-internal").Ace.InlineAutocompleteAction} where */ goTo(where) { if (!this.completions || !this.completions.filtered) { return; } var completionLength = this.completions.filtered.length; switch(where.toLowerCase()) { case "prev": this.setIndex((this.$index - 1 + completionLength) % completionLength); break; case "next": this.setIndex((this.$index + 1 + completionLength) % completionLength); break; case "first": this.setIndex(0); break; case "last": this.setIndex(this.completions.filtered.length - 1); break; } } getLength() { if (!this.completions || !this.completions.filtered) { return 0; } return this.completions.filtered.length; } /** * @param {number} [index] * @returns {import("../../ace-internal").Ace.Completion | undefined} */ getData(index) { if (index == undefined || index === null) { return this.completions.filtered[this.$index]; } else { return this.completions.filtered[index]; } } getIndex() { return this.$index; } isOpen() { return this.$index >= 0; } /** * @param {number} value */ setIndex(value) { if (!this.completions || !this.completions.filtered) { return; } var newIndex = Math.max(-1, Math.min(this.completions.filtered.length - 1, value)); if (newIndex !== this.$index) { this.$index = newIndex; this.$showCompletion(); } } /** * @return {CompletionProvider} */ getCompletionProvider(initialPosition) { if (!this.completionProvider) this.completionProvider = new CompletionProvider(initialPosition); return this.completionProvider; } $showCompletion() { if (!this.getInlineRenderer().show(this.editor, this.completions.filtered[this.$index], this.completions.filterText)) { // Not able to show the completion, hide the previous one this.getInlineRenderer().hide(); } if (this.inlineTooltip && this.inlineTooltip.isShown()) { this.inlineTooltip.update(); } } /** * @return {any} */ $updatePrefix() { var pos = this.editor.getCursorPosition(); var prefix = this.editor.session.getTextRange({start: this.base, end: pos}); 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(); //@ts-expect-error TODO: potential wrong arguments this.$open(this.editor, prefix); return prefix; } /** * @param {import("../../ace-internal").Ace.CompletionOptions} [options] */ updateCompletions(options) { var prefix = ""; if (options && options.matches) { var pos = this.editor.getSelectionRange().start; this.base = this.editor.session.doc.createAnchor(pos.row, pos.column); this.base.$insertRight = true; this.completions = new FilteredList(options.matches); //@ts-expect-error TODO: potential wrong arguments return this.$open(this.editor, ""); } if (this.base && this.completions) { prefix = this.$updatePrefix(); } var session = this.editor.getSession(); var pos = this.editor.getCursorPosition(); var prefix = util.getCompletionPrefix(this.editor); this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length); this.base.$insertRight = true; // @ts-ignore var options = { exactMatch: true, ignoreCaption: true }; this.getCompletionProvider({ prefix, base: this.base, pos // @ts-ignore }).provideCompletions(this.editor, options, /** * @this {InlineAutocomplete} */ function(err, completions, finished) { var filtered = completions.filtered; var prefix = util.getCompletionPrefix(this.editor); if (finished) { // No results if (!filtered.length) return this.detach(); // One result equals to the prefix if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet) return this.detach(); } this.completions = completions; //@ts-expect-error TODO: potential wrong arguments this.$open(this.editor, prefix); }.bind(this)); } detach() { if (this.editor) { this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler); this.editor.off("changeSelection", this.changeListener); this.editor.off("blur", this.blurListener); } this.changeTimer.cancel(); if (this.inlineTooltip) { this.inlineTooltip.detach(); } this.setIndex(-1); if (this.completionProvider) { this.completionProvider.detach(); } if (this.inlineRenderer && this.inlineRenderer.isOpen()) { this.inlineRenderer.hide(); } if (this.base) this.base.detach(); this.activated = false; this.completionProvider = this.completions = this.base = null; } destroy() { this.detach(); if (this.inlineRenderer) this.inlineRenderer.destroy(); if (this.inlineTooltip) this.inlineTooltip.destroy(); if (this.editor && this.editor.completer == this) { this.editor.off("destroy", destroyCompleter); this.editor.completer = null; } this.inlineTooltip = this.editor = this.inlineRenderer = null; } updateDocTooltip(){ } } /** * * @type {{[key: string]: import("../../ace-internal").Ace.Command}} */ InlineAutocomplete.prototype.commands = { "Previous": { bindKey: "Alt-[", name: "Previous", exec: function(editor) { editor.completer.goTo("prev"); } }, "Next": { bindKey: "Alt-]", name: "Next", exec: function(editor) { editor.completer.goTo("next"); } }, "Accept": { bindKey: { win: "Tab|Ctrl-Right", mac: "Tab|Cmd-Right" }, name: "Accept", exec: function(editor) { return /**@type{InlineAutocomplete}*/(editor.completer).insertMatch(); } }, "Close": { bindKey: "Esc", name: "Close", exec: function(editor) { editor.completer.detach(); } } }; InlineAutocomplete.for = function(editor) { if (editor.completer instanceof InlineAutocomplete) { return editor.completer; } if (editor.completer) { editor.completer.destroy(); editor.completer = null; } editor.completer = new InlineAutocomplete(editor); editor.once("destroy", destroyCompleter); return editor.completer; }; InlineAutocomplete.startCommand = { name: "startInlineAutocomplete", exec: function(editor, options) { var completer = InlineAutocomplete.for(editor); completer.show(options); }, bindKey: { win: "Alt-C", mac: "Option-C" } }; var completers = [snippetCompleter, textCompleter, keyWordCompleter]; require("../config").defineOptions(Editor.prototype, "editor", { enableInlineAutocompletion: { /** * @this{Editor} * @param val */ set: function(val) { if (val) { if (!this.completers) this.completers = Array.isArray(val)? val : completers; this.commands.addCommand(InlineAutocomplete.startCommand); } else { this.commands.removeCommand(InlineAutocomplete.startCommand); } }, value: false } }); /** * Factory method to create a command bar tooltip for inline autocomplete. * * @param {HTMLElement} parentEl The parent element where the tooltip HTML elements will be added. * @returns {CommandBarTooltip} The command bar tooltip for inline autocomplete */ InlineAutocomplete.createInlineTooltip = function(parentEl) { /**@type {CommandBarTooltip}*/ var inlineTooltip = new CommandBarTooltip(parentEl); inlineTooltip.registerCommand("Previous", // @ts-expect-error Object.assign({}, InlineAutocomplete.prototype.commands["Previous"], { enabled: true, type: "button", iconCssClass: "ace_arrow_rotated" }) ); inlineTooltip.registerCommand("Position", { enabled: false, getValue: function (editor) { return editor ? [/**@type{InlineAutocomplete}*/ (editor.completer).getIndex() + 1, /**@type{InlineAutocomplete}*/(editor.completer).getLength() ].join("/") : ""; }, type: "text", cssClass: "completion_position" }); inlineTooltip.registerCommand("Next", // @ts-expect-error Object.assign({}, InlineAutocomplete.prototype.commands["Next"], { enabled: true, type: "button", iconCssClass: "ace_arrow" }) ); inlineTooltip.registerCommand("Accept", // @ts-expect-error Object.assign({}, InlineAutocomplete.prototype.commands["Accept"], { enabled: function(editor) { return !!editor && editor.completer.getIndex() >= 0; }, type: "button" }) ); inlineTooltip.registerCommand("ShowTooltip", { name: "Always Show Tooltip", exec: function() { inlineTooltip.setAlwaysShow(!inlineTooltip.getAlwaysShow()); }, enabled: true, getValue: function() { return inlineTooltip.getAlwaysShow(); }, type: "checkbox" }); return inlineTooltip; }; dom.importCssString(` .ace_icon_svg.ace_arrow, .ace_icon_svg.ace_arrow_rotated { -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTUuODM3MDEgMTVMNC41ODc1MSAxMy43MTU1TDEwLjE0NjggOEw0LjU4NzUxIDIuMjg0NDZMNS44MzcwMSAxTDEyLjY0NjUgOEw1LjgzNzAxIDE1WiIgZmlsbD0iYmxhY2siLz48L3N2Zz4="); } .ace_icon_svg.ace_arrow_rotated { transform: rotate(180deg); } div.${BUTTON_CLASS_NAME}.completion_position { padding: 0; } `, "inlineautocomplete.css", false); exports.InlineAutocomplete = InlineAutocomplete; ================================================ FILE: src/ext/inline_autocomplete_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; var Editor = require("../editor").Editor; var EditSession = require("../edit_session").EditSession; var InlineAutocomplete = require("./inline_autocomplete").InlineAutocomplete; const { Autocomplete } = require("../autocomplete"); var assert = require("../test/assertions"); var BUTTON_CLASS_NAME = require("./command_bar").BUTTON_CLASS_NAME; var type = require("../test/user").type; var VirtualRenderer = require("../virtual_renderer").VirtualRenderer; var editor; var autocomplete; var inlineTooltip; var wrapperEl; function simulateClick(node) { node.dispatchEvent(new window.CustomEvent("click", { bubbles: true })); } var getAllLines = function() { var text = Array.from(editor.renderer.$textLayer.element.childNodes).map(function (node) { return node.textContent; }).join("\n"); if (editor.renderer.$ghostTextWidget) { return text + "\n" + editor.renderer.$ghostTextWidget.el.innerHTML; } return text; }; var typeAndChange = function(...args) { assert.equal(autocomplete.changeTimer.isPending(), null); type(args); assert.ok(autocomplete.changeTimer.isPending); autocomplete.changeTimer.call(); }; var completions = [ { value: "foo" }, { value: "foobar" }, { value: "function" }, { value: "fundraiser" }, { snippet: "function foo() {\n console.log('test');\n}", caption: "func" }, { value: "foobar2" } ]; var mockCompleter = { getCompletions: function(_1, _2, _3, _4, callback) { callback(null, completions); } }; var setupInlineTooltip = function() { inlineTooltip = autocomplete.getInlineTooltip(); inlineTooltip.setAlwaysShow(true); // Workaround: non-standard width and height hints for mock dom (mock dom does not work well with flex elements) // When running in the browser, these are ignored inlineTooltip.tooltip.getElement().style.widthHint = 150; inlineTooltip.tooltip.getElement().style.heightHint = editor.renderer.lineHeight * 2; inlineTooltip.moreOptions.getElement().style.widthHint = 150; inlineTooltip.moreOptions.getElement().style.heightHint = editor.renderer.lineHeight * 2; }; module.exports = { setUp: function() { wrapperEl = document.createElement("div"); wrapperEl.style.position = "fixed"; wrapperEl.style.left = "400px"; wrapperEl.style.top = "30px"; wrapperEl.style.width = "500px"; wrapperEl.style.height = "500px"; document.body.appendChild(wrapperEl); var renderer = new VirtualRenderer(wrapperEl); var session = new EditSession(""); editor = new Editor(renderer, session); editor.setOption("enableInlineAutocompletion", true); editor.execCommand("insertstring", "f"); editor.getSelection().moveCursorFileEnd(); editor.renderer.$loop._flush(); editor.completers = [mockCompleter]; autocomplete = InlineAutocomplete.for(editor); setupInlineTooltip(); editor.focus(); }, "test: autocomplete completion shows up": function() { autocomplete.show(editor); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(autocomplete.getData().value, "foo"); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), "foo"); }, "test: autocomplete start keybinding works": function() { type("Alt-C"); assert.strictEqual(autocomplete.isOpen(), true); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(autocomplete.getData().value, "foo"); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), "foo"); autocomplete.detach(); editor.setOption("enableInlineAutocompletion", false); type("Alt-C"); assert.strictEqual(autocomplete.isOpen(), false); assert.strictEqual(autocomplete.getIndex(), -1); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), "f"); }, "test: replaces different autocomplete implementation for the editor when opened": function() { var completer = Autocomplete.for(editor); completer.showPopup(editor, {}); assert.strictEqual(editor.completer, completer); assert.strictEqual(autocomplete.isOpen(), false); autocomplete = InlineAutocomplete.for(editor); autocomplete.show(editor); assert.strictEqual(editor.completer.isOpen(), true); editor.renderer.$loop._flush(); assert.strictEqual(getAllLines(), "foo"); }, "test: autocomplete tooltip is shown according to the selected option": function() { autocomplete.show(editor); assert.strictEqual(inlineTooltip.isShown(), true); autocomplete.detach(); assert.strictEqual(inlineTooltip.isShown(), false); }, "test: autocomplete keyboard navigation works": function() { autocomplete.show(editor); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(autocomplete.getData().value, "foo"); assert.equal(getAllLines(), "foo"); type("Alt-]"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 1); assert.strictEqual(autocomplete.getData().value, "foobar"); assert.equal(getAllLines(), "foobar"); type("Alt-["); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(autocomplete.getData().value, "foo"); assert.equal(getAllLines(), "foo"); }, "test: autocomplete tooltip navigation works": function() { autocomplete.show(editor); assert.strictEqual(autocomplete.getInlineTooltip().isShown(), true); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(autocomplete.getData().value, "foo"); assert.strictEqual(getAllLines(), "foo"); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); var prevButton = buttonElements[0]; var nextButton = buttonElements[2]; simulateClick(prevButton); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 5); assert.strictEqual(autocomplete.getData().value, "fundraiser"); assert.strictEqual(getAllLines(), "fundraiser"); simulateClick(nextButton); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(autocomplete.getData().value, "foo"); assert.strictEqual(getAllLines(), "foo"); simulateClick(nextButton); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 1); assert.strictEqual(autocomplete.getData().value, "foobar"); assert.strictEqual(getAllLines(), "foobar"); autocomplete.setIndex(5); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getData().value, "fundraiser"); assert.equal(getAllLines(), "fundraiser"); simulateClick(nextButton); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(autocomplete.getData().value, "foo"); assert.strictEqual(getAllLines(), "foo"); simulateClick(prevButton); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 5); assert.strictEqual(autocomplete.getData().value, "fundraiser"); assert.strictEqual(getAllLines(), "fundraiser"); simulateClick(prevButton); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 4); assert.strictEqual(autocomplete.getData().value, "function"); assert.strictEqual(getAllLines(), "function"); }, "test: verify goTo commands": function() { autocomplete.show(editor); autocomplete.setIndex(1); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getData().value, "foobar"); assert.equal(getAllLines(), "foobar"); autocomplete.goTo("next"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 2); assert.strictEqual(autocomplete.getData().value, "foobar2"); assert.strictEqual(getAllLines(), "foobar2"); autocomplete.goTo("prev"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 1); assert.strictEqual(autocomplete.getData().value, "foobar"); assert.strictEqual(getAllLines(), "foobar"); autocomplete.goTo("last"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 5); assert.strictEqual(autocomplete.getData().value, "fundraiser"); assert.strictEqual(getAllLines(), "fundraiser"); autocomplete.goTo("next"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(autocomplete.getData().value, "foo"); assert.strictEqual(getAllLines(), "foo"); autocomplete.setIndex(5); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getData().value, "fundraiser"); assert.equal(getAllLines(), "fundraiser"); autocomplete.goTo("first"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(autocomplete.getData().value, "foo"); assert.strictEqual(getAllLines(), "foo"); autocomplete.goTo("prev"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 5); assert.strictEqual(autocomplete.getData().value, "fundraiser"); assert.strictEqual(getAllLines(), "fundraiser"); }, "test: set index to negative value hides suggestions": function() { autocomplete.show(editor); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(getAllLines(), "foo"); autocomplete.setIndex(-1); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), false); assert.strictEqual(getAllLines(), "f"); }, "test: autocomplete can be closed": function() { autocomplete.show(editor); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), true); assert.equal(getAllLines(), "foo"); type("Escape"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), false); assert.equal(getAllLines(), "f"); }, "test: autocomplete can be accepted": function() { autocomplete.show(editor); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), true); assert.ok(document.querySelectorAll(".ace_ghost_text").length > 0); assert.strictEqual(getAllLines(), "foo"); type("Tab"); editor.renderer.$loop._flush(); assert.equal(autocomplete.inlineCompleter, null); assert.equal(autocomplete.inlineTooltip.isShown(), false); assert.strictEqual(autocomplete.isOpen(), false); assert.equal(editor.renderer.$ghostText, null); assert.equal(editor.renderer.$ghostTextWidget, null); assert.strictEqual(document.querySelectorAll(".ace_ghost_text").length, 0); assert.strictEqual(getAllLines(), "foo"); }, "test: autocomplete can be accepted via tooltip": function() { autocomplete.show(editor); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), true); assert.equal(autocomplete.inlineTooltip.isShown(), true); assert.ok(document.querySelectorAll(".ace_ghost_text").length > 0); assert.strictEqual(getAllLines(), "foo"); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); var acceptButton = buttonElements[3]; simulateClick(acceptButton); editor.renderer.$loop._flush(); assert.equal(autocomplete.inlineCompleter, null); assert.equal(autocomplete.inlineTooltip.isShown(), false); assert.strictEqual(autocomplete.isOpen(), false); assert.equal(editor.renderer.$ghostText, null); assert.equal(editor.renderer.$ghostTextWidget, null); assert.strictEqual(document.querySelectorAll(".ace_ghost_text").length, 0); assert.strictEqual(getAllLines(), "foo"); }, "test: incremental typing filters results": function() { autocomplete.show(editor); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), true); assert.equal(getAllLines(), "foo"); typeAndChange("u", "n"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), true); assert.equal(getAllLines(), `function foo() {\n
    console.log('test');
    }
    `); typeAndChange("d"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), true); assert.equal(getAllLines(), "fundraiser"); typeAndChange("Backspace", "Backspace", "Backspace"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), true); assert.equal(getAllLines(), "foo"); typeAndChange("r"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), false); assert.equal(getAllLines(), "fr"); }, "test: tooltip stays open on incremental typing": function() { autocomplete.show(editor); assert.strictEqual(inlineTooltip.isShown(), true); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), true); assert.equal(getAllLines(), "foo"); typeAndChange("u", "n"); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.isOpen(), true); assert.strictEqual(inlineTooltip.isShown(), true); }, "test: can toggle tooltip display mode via tooltip button": function() { autocomplete.show(editor); assert.strictEqual(inlineTooltip.isShown(), true); var buttonElements = Array.from(document.querySelectorAll("." + BUTTON_CLASS_NAME)); var moreOptionsButton = buttonElements[4]; var showTooltipToggle = buttonElements[5]; var showTooltipToggleCheckMark = showTooltipToggle.firstChild; assert.strictEqual(showTooltipToggle.ariaChecked.toString(), "true"); assert.strictEqual(showTooltipToggleCheckMark.classList.contains("ace_checkmark"), true); assert.strictEqual(inlineTooltip.getAlwaysShow(), true); assert.strictEqual(inlineTooltip.isMoreOptionsShown(), false); simulateClick(moreOptionsButton); assert.strictEqual(inlineTooltip.isShown(), true); assert.strictEqual(showTooltipToggle.ariaChecked.toString(), "true"); assert.strictEqual(showTooltipToggleCheckMark.classList.contains("ace_checkmark"), true); assert.strictEqual(inlineTooltip.getAlwaysShow(), true); assert.strictEqual(inlineTooltip.isMoreOptionsShown(), true); simulateClick(showTooltipToggle); assert.strictEqual(showTooltipToggle.ariaChecked.toString(), "false"); assert.strictEqual(showTooltipToggleCheckMark.classList.contains("ace_checkmark"), false); assert.strictEqual(inlineTooltip.getAlwaysShow(), false); assert.strictEqual(inlineTooltip.isMoreOptionsShown(), false); }, "test: verify detach": function() { autocomplete.show(editor); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(getAllLines(), "foo"); autocomplete.detach(); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), -1); assert.strictEqual(autocomplete.getLength(), 0); assert.strictEqual(autocomplete.isOpen(), false); assert.equal(autocomplete.base, null); assert.equal(autocomplete.completions, null); assert.equal(autocomplete.completionProvider, null); assert.strictEqual(getAllLines(), "f"); }, "test: verify destroy": function() { autocomplete.show(editor); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), 0); assert.strictEqual(getAllLines(), "foo"); assert.strictEqual(editor.completer, autocomplete); autocomplete.destroy(); editor.renderer.$loop._flush(); assert.strictEqual(autocomplete.getIndex(), -1); assert.strictEqual(autocomplete.getLength(), 0); assert.strictEqual(autocomplete.isOpen(), false); assert.equal(autocomplete.base, null); assert.equal(autocomplete.completions, null); assert.equal(autocomplete.completionProvider, null); assert.equal(autocomplete.editor, null); assert.equal(autocomplete.inlineTooltip, null); assert.equal(autocomplete.inlineRenderer, null); assert.strictEqual(editor.completer, null); assert.strictEqual(getAllLines(), "f"); autocomplete.destroy(); editor.renderer.$loop._flush(); }, tearDown: function() { autocomplete.destroy(); editor.destroy(); wrapperEl.parentElement.removeChild(wrapperEl); } }; require("../test/run")(module); ================================================ FILE: src/ext/keybinding_menu.js ================================================ /** * ## Show Keyboard Shortcuts extension * * Provides a keyboard shortcuts display overlay for the Ace editor. Creates an interactive menu that shows all available * keyboard shortcuts with their corresponding commands, organized in a searchable and navigable format. The menu * appears as an overlay page and can be triggered via keyboard shortcut (Ctrl-Alt-H/Cmd-Alt-H) or programmatically. * * @author * Matthew Christopher Kastor-Inare III
    * @module */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ "use strict"; var Editor = require("../editor").Editor; /** * Generates a menu which displays the keyboard shortcuts. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {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); } } /** * Initializes keyboard shortcut functionality for the editor. * Adds a method to show keyboard shortcuts and registers a command * to trigger the keyboard shortcuts display. * * @param {Editor} editor The Ace editor instance to initialize */ 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: /** * * @param {Editor} editor * @param [line] */ function (editor, line) { editor.showKeyboardShortcuts(); } }]); }; ================================================ FILE: src/ext/language_tools.js ================================================ /** * ## Language Tools extension for Ace Editor * * Provides autocompletion, snippets, and language intelligence features for the Ace code editor. * This extension integrates multiple completion providers including keyword completion, snippet expansion, * and text-based completion to enhance the coding experience with contextual suggestions and automated code generation. * * **Configuration Options:** * - `enableBasicAutocompletion`: Enable/disable basic completion functionality * - `enableLiveAutocompletion`: Enable/disable real-time completion suggestions * - `enableSnippets`: Enable/disable snippet expansion with Tab key * - `liveAutocompletionDelay`: Delay before showing live completion popup * - `liveAutocompletionThreshold`: Minimum prefix length to trigger completion * * **Usage:** * ```javascript * editor.setOptions({ * enableBasicAutocompletion: true, * enableLiveAutocompletion: true, * enableSnippets: true * }); * ``` * * @module */ "use strict"; /**@type{import("../snippets").snippetManager & {files?: {[key: string]: any}}}*/ 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 MarkerGroup = require("../marker_group").MarkerGroup; var textCompleter = require("../autocomplete/text_completer"); /**@type {import("../../ace-internal").Ace.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); completions = completions.map((el) => { el.completerId = keyWordCompleter.id; return el; }); callback(null, completions); }, id: "keywordCompleter" }; var transformSnippetTooltip = function(str) { var record = {}; return str.replace(/\${(\d+)(:(.*?))?}/g, function(_, p1, p2, p3) { return (record[p1] = p3 || ''); }).replace(/\$(\d+?)/g, function (_, p1) { return record[p1]; }); }; /**@type {import("../../ace-internal").Ace.Completer} */ var snippetCompleter = { getCompletions: function(editor, session, pos, prefix, callback) { var scopes = []; // set scope to html-tag if we're inside an html tag var token = session.getTokenAt(pos.row, pos.column); if (token && token.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)) scopes.push('html-tag'); else scopes = snippetManager.getActiveScopes(editor); var snippetMap = snippetManager.snippetMap; var completions = []; scopes.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", completerId: snippetCompleter.id }); } }, this); callback(null, completions); }, getDocTooltip: function(item) { if (item.snippet && !item.docHTML) { item.docHTML = [ "", lang.escapeHTML(item.caption), "", "
    ", lang.escapeHTML(transformSnippetTooltip(item.snippet)) ].join(""); } }, id: "snippetCompleter" }; var completers = [snippetCompleter, textCompleter, keyWordCompleter]; /** * Replaces the default list of completers with a new set of completers. * * @param {import("../../ace-internal").Ace.Completer[]} [val] * */ exports.setCompleters = function(val) { completers.length = 0; if (val) completers.push.apply(completers, val); }; /** * Adds a new completer to the list of available completers. * * @param {import("../../ace-internal").Ace.Completer} completer - The completer object to be added to the completers array. */ 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) { if (typeof mode == "string") mode = config.$modes[mode]; if (!mode) return; if (!snippetManager.files) snippetManager.files = {}; loadSnippetFile(mode.$id, mode.snippetFileId); if (mode.modes) mode.modes.forEach(loadSnippetsForMode); }; var loadSnippetFile = function(id, snippetFilePath) { if (!snippetFilePath || !id || snippetManager.files[id]) return; snippetManager.files[id] = {}; config.loadModule(snippetFilePath, function(m) { if (!m) return; 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) { loadSnippetsForMode("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" && !hasCompleter) { lastExecEvent = e; var delay = e.editor.$liveAutocompletionDelay; if (delay) { liveAutocompleteTimer.delay(delay); } else { showLiveAutocomplete(e); } } }; var lastExecEvent; var liveAutocompleteTimer = lang.delayedCall(function () { showLiveAutocomplete(lastExecEvent); }, 0); var showLiveAutocomplete = function(e) { var editor = e.editor; var prefix = util.getCompletionPrefix(editor); // Only autocomplete if there's a prefix that can be matched or previous char is trigger character var previousChar = e.args; var triggerAutocomplete = util.triggerAutocomplete(editor, previousChar); if (prefix && prefix.length >= editor.$liveAutocompletionThreshold || triggerAutocomplete) { var completer = Autocomplete.for(editor); // Set a flag for auto shown completer.autoShown = true; completer.showPopup(editor); } }; var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { enableBasicAutocompletion: { /** * @param val * @this{Editor} */ set: function(val) { if (val) { Autocomplete.for(this); 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 autocompletion */ enableLiveAutocompletion: { /** * @param {boolean} val * @this {Editor} */ 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.off('afterExec', doLiveAutocomplete); } }, value: false }, liveAutocompletionDelay: { initialValue: 0 }, liveAutocompletionThreshold: { initialValue: 0 }, 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 } }); exports.MarkerGroup = MarkerGroup; ================================================ FILE: src/ext/linking.js ================================================ /** * ## Interactive Linking Extension * * Enables clickable links and hover interactions in the editor when the Control key is pressed. Provides * keyboard-accelerated navigation by detecting tokens under the cursor and emitting custom events that can be handled * by external code to implement go-to-definition, symbol navigation, or other link-based functionality. * * **Enable:** `editor.setOption("enableLinking", true)` * @module */ var Editor = require("../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: src/ext/menu_tools/get_editor_keyboard_shortcuts.js ================================================ /** * ## Editor Keyboard Shortcuts Utility * * Provides functionality to extract and format keyboard shortcuts from an Ace editor instance. Analyzes all registered * command handlers and their key bindings to generate a list of available keyboard shortcuts for the * current platform. Returns formatted key combinations with proper modifier key representations and handles multiple * bindings per command with pipe-separated notation. * * **Usage:** * ```javascript * var getKbShortcuts = require('ace/ext/menu_tools/get_editor_keyboard_shortcuts'); * var shortcuts = getKbShortcuts.getEditorKeybordShortcuts(editor); * console.log(shortcuts); * // [ * // {'command': 'selectall', 'key': 'Ctrl-A'}, * // {'command': 'copy', 'key': 'Ctrl-C|Ctrl-Insert'} * // ] * ``` * * @module */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ "use strict"; /** @type{any} */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 {import("../../editor").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: src/ext/menu_tools/overlay_page.js ================================================ /** * ## Overlay Page utility * * Provides modal overlay functionality for displaying editor extension interfaces. Creates a full-screen overlay with * configurable backdrop behavior, keyboard navigation (ESC to close), and focus management. Used by various extensions * to display menus, settings panels, and other interactive content over the editor interface. * * **Usage:** * ```javascript * var overlayPage = require('./overlay_page').overlayPage; * var contentElement = document.createElement('div'); * contentElement.innerHTML = '

    Settings

    '; * * var overlay = overlayPage(editor, contentElement, function() { * console.log('Overlay closed'); * }); * ``` * * @module */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ 'use strict'; var dom = require("../../lib/dom"); var cssText = require("./settings_menu.css"); dom.importCssString(cssText, "settings_menu.css", false); /** * Generates an overlay for displaying menus. The overlay is an absolutely * positioned div. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {import("../../editor").Editor} editor * @param {HTMLElement} contentElement Any element which may be presented inside * a div. * @param {() => void} [callback] */ module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { var closer = document.createElement('div'); var ignoreFocusOut = false; function documentEscListener(e) { if (e.keyCode === 27) { close(); } } function close() { if (!closer) return; document.removeEventListener('keydown', documentEscListener); closer.parentNode.removeChild(closer); if (editor) { editor.focus(); } closer = null; callback && callback(); } /** * Defines whether overlay is closed when user clicks outside of it. * * @param {Boolean} ignore If set to true overlay stays open when focus moves to another part of the editor. */ function setIgnoreFocusOut(ignore) { ignoreFocusOut = ignore; if (ignore) { closer.style.pointerEvents = "none"; contentElement.style.pointerEvents = "auto"; } } closer.style.cssText = 'margin: 0; padding: 0; ' + 'position: fixed; top:0; bottom:0; left:0; right:0;' + 'z-index: 9990; ' + (editor ? 'background-color: rgba(0, 0, 0, 0.3);' : ''); closer.addEventListener('click', function(e) { if (!ignoreFocusOut) { close(); } }); // click closer if esc key is pressed document.addEventListener('keydown', documentEscListener); contentElement.addEventListener('click', function (e) { e.stopPropagation(); }); closer.appendChild(contentElement); document.body.appendChild(closer); if (editor) { editor.blur(); } return { close: close, setIgnoreFocusOut: setIgnoreFocusOut }; }; ================================================ FILE: src/ext/menu_tools/settings_menu.css.js ================================================ module.exports = `#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); 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: 100000; } .ace_closeButton{ background: rgba(245, 146, 146, 0.9); } .ace_optionsMenuKey { color: darkslateblue; font-weight: bold; } .ace_optionsMenuCommand { color: darkcyan; font-weight: normal; } .ace_optionsMenuEntry input, .ace_optionsMenuEntry button { vertical-align: middle; } .ace_optionsMenuEntry button[ace_selected_button=true] { background: #e7e7e7; box-shadow: 1px 0px 2px 0px #adadad inset; border-color: #adadad; } .ace_optionsMenuEntry button { background: white; border: 1px solid lightgray; margin: 0px; } .ace_optionsMenuEntry button:hover{ background: #f0f0f0; }`; ================================================ FILE: src/ext/modelist.js ================================================ /** * ## File mode detection utility * * Provides automatic detection of editor syntax modes based on file paths and extensions. Maps file extensions to * appropriate Ace Editor syntax highlighting modes for over 100 programming languages and file formats including * JavaScript, TypeScript, HTML, CSS, Python, Java, C++, and many others. Supports complex extension patterns and * provides fallback mechanisms for unknown file types. * * @module */ "use strict"; /** * Represents an array to store various syntax modes. * * @type {Mode[]} */ var modes = []; /** * Suggests a mode based on the file extension present in the given path * @param {string} path The path to the file * @returns {Mode} 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; } class Mode { /** * @param {string} name * @param {string} caption * @param {string} extensions */ constructor(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"); } /** * @param {string} filename * @returns {RegExpMatchArray | null} */ supportsFile(filename) { return filename.match(this.extRe); } } // todo firstlinematch var supportedModes = { ABAP: ["abap"], ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], Alda: ["alda"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], Apex: ["apex|cls|trigger|tgr"], AQL: ["aql"], AsciiDoc: ["asciidoc|adoc"], ASL: ["dsl|asl|asl.json"], Assembly_ARM32:["s"], Assembly_x86:["asm|a"], Astro: ["astro"], AutoHotKey: ["ahk"], Basic: ["bas|bak"], BatchFile: ["bat|cmd"], BibTeX: ["bib"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Clue: ["clue"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm|cfc"], Crystal: ["cr"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], Csound_Score: ["sco"], CSS: ["css"], CSV: ["csv"], Curly: ["curly"], Cuttlefish: ["conf"], D: ["d|di"], Dart: ["dart"], Diff: ["diff|patch"], Django: ["djt|html.djt|dj.html|djhtml"], Dockerfile: ["^Dockerfile"], Dot: ["dot"], Drools: ["drl"], Edifact: ["edi"], Eiffel: ["e|ge"], EJS: ["ejs"], Elixir: ["ex|exs"], Elm: ["elm"], Erlang: ["erl|hrl"], Flix: ["flix"], Forth: ["frt|fs|ldr|fth|4th"], Fortran: ["f|f90"], FSharp: ["fsi|fs|ml|mli|fsx|fsscript"], FSL: ["fsl"], 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|we|wpy"], HTML_Elixir: ["eex|html.eex"], HTML_Ruby: ["erb|rhtml|html.erb"], INI: ["ini|conf|cfg|prefs"], Io: ["io"], Ion: ["ion"], Jack: ["jack"], Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|cjs|mjs"], JEXL: ["jexl"], JSON: ["json"], JSON5: ["json5"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], JSX: ["jsx"], Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], Latte: ["latte"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], LiveScript: ["ls"], LogiQL: ["logic|lql"], Logtalk: ["lgt"], LSL: ["lsl"], Lua: ["lua"], LuaPage: ["lp"], Lucene: ["lucene"], Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"], Markdown: ["md|markdown"], Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], MediaWiki: ["wiki|mediawiki"], MEL: ["mel"], MIPS: ["s|asm"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nasal: ["nas"], Nginx: ["nginx|conf"], Nim: ["nim"], Nix: ["nix"], NSIS: ["nsi|nsh"], Nunjucks: ["nunjucks|nunjs|nj|njk"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Odin: ["odin"], PartiQL: ["partiql|pql"], Pascal: ["pas|p"], Perl: ["pl|pm"], pgSQL: ["pgsql"], PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], PHP_Laravel_blade: ["blade.php"], Pig: ["pig"], PLSQL: ["plsql"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], Prisma: ["prisma"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], PRQL: ["prql"], Puppet: ["epp|pp"], Python: ["py"], QML: ["qml"], R: ["r"], Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], RHTML: ["Rhtml"], Robot: ["robot|resource"], RST: ["rst"], Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"], Rust: ["rs"], SaC: ["sac"], SASS: ["sass"], SCAD: ["scad"], Scala: ["scala|sbt"], Scheme: ["scm|sm|rkt|oak|scheme"], Scrypt: ["scrypt"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Slim: ["slim|skim"], Smarty: ["smarty|tpl"], Smithy: ["smithy"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], SPARQL: ["rq"], SQL: ["sql"], SQLServer: ["sqlserver"], Stylus: ["styl|stylus"], SVG: ["svg"], Swift: ["swift"], Tcl: ["tcl"], Terraform: ["tf", "tfvars", "terragrunt"], Tex: ["tex"], Text: ["txt"], Textile: ["textile"], Toml: ["toml"], TSV: ["tsv"], TSX: ["tsx"], Turtle: ["ttl"], Twig: ["twig|swig"], Typescript: ["ts|mts|cts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], Velocity: ["vm"], Verilog: ["v|vh|sv|svh"], VHDL: ["vhd|vhdl"], Visualforce: ["vfp|component|page"], Vue: ["vue"], Wollok: ["wlk|wpgm|wtest"], XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"], XQuery: ["xq"], YAML: ["yaml|yml"], Zeek: ["zeek|bro"], Zig: ["zig"] }; 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", PHP_Laravel_blade: "PHP (Blade Template)", Perl6: "Perl 6", AutoHotKey: "AutoHotkey / AutoIt" }; /** * An object that serves as a mapping of mode names to their corresponding mode data. * The keys of this object are mode names (as strings), and the values are expected * to represent data associated with each mode. * * This structure can be used for quick lookups of mode information by name. * @type {Record} */ 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); } exports.getModeForPath = getModeForPath; exports.modes = modes; exports.modesByName = modesByName; ================================================ FILE: src/ext/options.js ================================================ /** * ## Settings Menu extension * * Provides a settings panel for configuring editor options through an interactive UI. * Creates a tabular interface with grouped configuration options including themes, modes, keybindings, * font settings, display preferences, and advanced editor behaviors. Supports dynamic option rendering * with various input types (dropdowns, checkboxes, number inputs, button bars) and real-time updates. * * **Usage:** * ```javascript * var OptionPanel = require("ace/ext/settings_menu").OptionPanel; * var panel = new OptionPanel(editor); * panel.render(); * ``` * * @module */ "use strict"; /** * @typedef {import("../editor").Editor} Editor */ require("./menu_tools/overlay_page"); var dom = require("../lib/dom"); var oop = require("../lib/oop"); var config = require("../config"); var EventEmitter = require("../lib/event_emitter").EventEmitter; var buildDom = dom.buildDom; var modelist = require("./modelist"); var themelist = require("./themelist"); var themes = { Bright: [], Dark: [] }; themelist.themes.forEach(function(x) { themes[x.isDark ? "Dark" : "Bright"].push({ caption: x.caption, value: x.theme }); }); var modes = modelist.modes.map(function(x){ return { caption: x.caption, value: x.mode }; }); /** * Configuration object for grouping various options/settings into categorized groups. * * Organizes settings into two main categories: "Main" and "More", * each containing settings for configurable features of an application. */ var optionGroups = { Main: { Mode: { path: "mode", type: "select", items: modes }, Theme: { path: "theme", type: "select", items: themes }, "Keybinding": { type: "buttonBar", path: "keyboardHandler", items: [ { caption : "Ace", value : null }, { caption : "Vim", value : "ace/keyboard/vim" }, { caption : "Emacs", value : "ace/keyboard/emacs" }, { caption : "Sublime", value : "ace/keyboard/sublime" }, { caption : "VSCode", value : "ace/keyboard/vscode" } ] }, "Font Size": { path: "fontSize", type: "number", defaultValue: 12, defaults: [ {caption: "12px", value: 12}, {caption: "24px", value: 24} ] }, "Soft Wrap": { type: "buttonBar", path: "wrap", items: [ { caption : "Off", value : "off" }, { caption : "View", value : "free" }, { caption : "margin", value : "printMargin" }, { caption : "40", value : "40" } ] }, "Cursor Style": { path: "cursorStyle", items: [ { caption : "Ace", value : "ace" }, { caption : "Slim", value : "slim" }, { caption : "Smooth", value : "smooth" }, { caption : "Smooth And Slim", value : "smooth slim" }, { caption : "Wide", value : "wide" } ] }, "Folding": { path: "foldStyle", items: [ { caption : "Manual", value : "manual" }, { caption : "Mark begin", value : "markbegin" }, { caption : "Mark begin and end", value : "markbeginend" } ] }, "Soft Tabs": [{ path: "useSoftTabs" }, { ariaLabel: "Tab Size", path: "tabSize", type: "number", values: [2, 3, 4, 8, 16] }], "Overscroll": { type: "buttonBar", path: "scrollPastEnd", items: [ { caption : "None", value : 0 }, { caption : "Half", value : 0.5 }, { caption : "Full", value : 1 } ] } }, More: { "Atomic soft tabs": { path: "navigateWithinSoftTabs" }, "Enable Behaviours": { path: "behavioursEnabled" }, "Wrap with quotes": { path: "wrapBehavioursEnabled" }, "Enable Auto Indent": { path: "enableAutoIndent" }, "Full Line Selection": { type: "checkbox", values: "text|line", path: "selectionStyle" }, "Highlight Active Line": { path: "highlightActiveLine" }, "Show Invisibles": { path: "showInvisibles" }, "Show Indent Guides": { path: "displayIndentGuides" }, "Highlight Indent Guides": { path: "highlightIndentGuides" }, "Persistent HScrollbar": { path: "hScrollBarAlwaysVisible" }, "Persistent VScrollbar": { path: "vScrollBarAlwaysVisible" }, "Animate scrolling": { path: "animatedScroll" }, "Show Gutter": { path: "showGutter" }, "Show Line Numbers": { path: "showLineNumbers" }, "Relative Line Numbers": { path: "relativeLineNumbers" }, "Fixed Gutter Width": { path: "fixedWidthGutter" }, "Show Print Margin": [{ path: "showPrintMargin" }, { ariaLabel: "Print Margin", type: "number", path: "printMarginColumn" }], "Indented Soft Wrap": { path: "indentedSoftWrap" }, "Highlight selected word": { path: "highlightSelectedWord" }, "Fade Fold Widgets": { path: "fadeFoldWidgets" }, "Use textarea for IME": { path: "useTextareaForIME" }, "Merge Undo Deltas": { path: "mergeUndoDeltas", items: [ { caption : "Always", value : "always" }, { caption : "Never", value : "false" }, { caption : "Timed", value : "true" } ] }, "Elastic Tabstops": { path: "useElasticTabstops" }, "Incremental Search": { path: "useIncrementalSearch" }, "Read-only": { path: "readOnly" }, "Copy without selection": { path: "copyWithEmptySelection" }, "Live Autocompletion": { path: "enableLiveAutocompletion" }, "Custom scrollbar": { path: "customScrollbar" }, "Use SVG gutter icons": { path: "useSvgGutterIcons" }, "Annotations for folded lines": { path: "showFoldedAnnotations" }, "Keyboard Accessibility Mode": { path: "enableKeyboardAccessibility" } } }; /** * Option panel component for configuring settings or options. * The panel is designed to integrate with an editor and render various UI controls based on provided configuration. */ class OptionPanel { /** * * @param {Editor} editor * @param {HTMLElement} [element] */ constructor(editor, element) { this.editor = editor; this.container = element || document.createElement("div"); this.groups = []; this.options = {}; } add(config) { if (config.Main) oop.mixin(optionGroups.Main, config.Main); if (config.More) oop.mixin(optionGroups.More, config.More); } render() { this.container.innerHTML = ""; buildDom(["table", {role: "presentation", id: "controls"}, this.renderOptionGroup(optionGroups.Main), ["tr", null, ["td", {colspan: 2}, ["table", {role: "presentation", id: "more-controls"}, this.renderOptionGroup(optionGroups.More) ] ]], ["tr", null, ["td", {colspan: 2}, "version " + config.version]] ], this.container); } renderOptionGroup(group) { return Object.keys(group).map(function(key, i) { var item = group[key]; if (!item.position) item.position = i / 10000; if (!item.label) item.label = key; return item; }).sort(function(a, b) { return a.position - b.position; }).map(function(item) { return this.renderOption(item.label, item); }, this); } /** * @param {string} key * @param {Object} option */ renderOptionControl(key, option) { var self = this; if (Array.isArray(option)) { return option.map(function(x) { return self.renderOptionControl(key, x); }); } /**@type {any}*/ var control; var value = self.getOption(option); if (option.values && option.type != "checkbox") { if (typeof option.values == "string") option.values = option.values.split("|"); option.items = option.values.map(function(v) { return { value: v, name: v }; }); } if (option.type == "buttonBar") { control = ["div", {role: "group", "aria-labelledby": option.path + "-label"}, option.items.map(function(item) { return ["button", { value: item.value, ace_selected_button: value == item.value, 'aria-pressed': value == item.value, onclick: function() { self.setOption(option, item.value); var nodes = this.parentNode.querySelectorAll("[ace_selected_button]"); for (var i = 0; i < nodes.length; i++) { nodes[i].removeAttribute("ace_selected_button"); nodes[i].setAttribute("aria-pressed", false); } this.setAttribute("ace_selected_button", true); this.setAttribute("aria-pressed", true); } }, item.desc || item.caption || item.name]; })]; } else if (option.type == "number") { control = ["input", {type: "number", value: value || option.defaultValue, style:"width:3em", oninput: function() { self.setOption(option, parseInt(this.value)); }}]; if (option.ariaLabel) { control[1]["aria-label"] = option.ariaLabel; } else { control[1].id = key; } if (option.defaults) { control = [control, option.defaults.map(function(item) { return ["button", {onclick: function() { var input = this.parentNode.firstChild; input.value = item.value; input.oninput(); }}, item.caption]; })]; } } else if (option.items) { var buildItems = function(items) { return items.map(function(item) { return ["option", { value: item.value || item.name }, item.desc || item.caption || item.name]; }); }; var items = Array.isArray(option.items) ? buildItems(option.items) : Object.keys(option.items).map(function(key) { return ["optgroup", {"label": key}, buildItems(option.items[key])]; }); control = ["select", { id: key, value: value, onchange: function() { self.setOption(option, this.value); } }, items]; } else { if (typeof option.values == "string") option.values = option.values.split("|"); if (option.values) value = value == option.values[1]; control = ["input", { type: "checkbox", id: key, checked: value || null, onchange: function() { var value = this.checked; if (option.values) value = option.values[value ? 1 : 0]; self.setOption(option, value); }}]; if (option.type == "checkedNumber") { control = [control, []]; } } return control; } /** * * @param key * @param option */ renderOption(key, option) { if (option.path && !option.onchange && !this.editor.$options[option.path]) return; var path = Array.isArray(option) ? option[0].path : option.path; this.options[path] = option; var safeKey = "-" + path; var safeId = path + "-label"; var control = this.renderOptionControl(safeKey, option); return ["tr", {class: "ace_optionsMenuEntry"}, ["td", ["label", {for: safeKey, id: safeId}, key] ], ["td", control]]; } /** * @param {string | number | Object} option * @param {string | number | boolean} value */ setOption(option, value) { if (typeof option == "string") option = this.options[option]; if (value == "false") value = false; if (value == "true") value = true; if (value == "null") value = null; if (value == "undefined") value = undefined; if (typeof value == "string" && parseFloat(value).toString() == value) value = parseFloat(value); if (option.onchange) option.onchange(value); else if (option.path) this.editor.setOption(option.path, value); this._signal("setOption", {name: option.path, value: value}); } getOption(option) { if (option.getValue) return option.getValue(); return this.editor.getOption(option.path); } } oop.implement(OptionPanel.prototype, EventEmitter); exports.OptionPanel = OptionPanel; exports.optionGroups = optionGroups; ================================================ FILE: src/ext/prompt.js ================================================ /** * ## User Input Prompt extension * * Provides customizable modal prompts for gathering user input with support for autocompletion, validation, and * specialized input types. Includes built-in prompt types for navigation (goto line), command palette, and mode * selection, with extensible architecture for custom prompt implementations. * * **Built-in Prompt Types:** * - `gotoLine`: Navigate to specific line numbers with selection support * - `commands`: Command palette with searchable editor commands and shortcuts * - `modes`: Language mode selector with filtering capabilities * * **Usage:** * ```javascript * // Basic prompt * prompt(editor, "Default value", { * placeholder: "Enter text...", * onAccept: (data) => console.log(data.value) * }); * * // Built-in prompts * prompt.gotoLine(editor); * prompt.commands(editor); * prompt.modes(editor); * ``` * * @module */ /** * @typedef {import("../editor").Editor} Editor */ "use strict"; var nls = require("../config").nls; var Range = require("../range").Range; var dom = require("../lib/dom"); var FilteredList= require("../autocomplete").FilteredList; var AcePopup = require('../autocomplete/popup').AcePopup; var $singleLineEditor = require('../autocomplete/popup').$singleLineEditor; var UndoManager = require("../undomanager").UndoManager; var Tokenizer = require("../tokenizer").Tokenizer; var overlayPage = require("./menu_tools/overlay_page").overlayPage; var modelist = require("./modelist"); var openPrompt; /** * @typedef PromptOptions * @property {String} name Prompt name. * @property {String} $type Use prompt of specific type (gotoLine|commands|modes or default if empty). * @property {[number, number]} selection Defines which part of the predefined value should be highlighted. * @property {Boolean} hasDescription Set to true if prompt has description below input box. * @property {String} prompt Description below input box. * @property {String} placeholder Placeholder for value. * @property {Object} $rules Specific rules for input like password or regexp. * @property {Boolean} ignoreFocusOut Set to true to keep the prompt open when focus moves to another part of the editor. * @property {Function} getCompletions Function for defining list of options for value. * @property {Function} getPrefix Function for defining current value prefix. * @property {Function} onAccept Function called when Enter is pressed. * @property {Function} onInput Function called when input is added to prompt input box. * @property {Function} onCancel Function called when Esc|Shift-Esc is pressed. * @property {Function} history Function for defining history list. * @property {number} maxHistoryCount * @property {Function} addToHistory */ /** * Prompt plugin is used for getting input from user. * * @param {Editor} editor Ouside editor related to this prompt. Will be blurred when prompt is open. * @param {String | Partial} message Predefined value of prompt input box. * @param {Partial} options Cusomizable options for this prompt. * @param {Function} [callback] Function called after done. * */ function prompt(editor, message, options, callback) { if (typeof message == "object") { // @ts-ignore return prompt(editor, "", message, options); } if (openPrompt) { var lastPrompt = openPrompt; editor = lastPrompt.editor; lastPrompt.close(); if (lastPrompt.name && lastPrompt.name == options.name) return; } if (options.$type) return prompt[options.$type](editor, callback); var cmdLine = $singleLineEditor(); cmdLine.session.setUndoManager(new UndoManager()); /**@type {any}*/ var el = dom.buildDom(["div", {class: "ace_prompt_container" + (options.hasDescription ? " input-box-with-description" : "")}]); var overlay = overlayPage(editor, el, done); el.appendChild(cmdLine.container); if (editor) { editor.cmdLine = cmdLine; cmdLine.setOption("fontSize", editor.getOption("fontSize")); } if (message) { cmdLine.setValue(message, 1); } if (options.selection) { cmdLine.selection.setRange({ start: cmdLine.session.doc.indexToPosition(options.selection[0]), end: cmdLine.session.doc.indexToPosition(options.selection[1]) }); } if (options.getCompletions) { var popup = new AcePopup(); popup.renderer.setStyle("ace_autocomplete_inline"); popup.container.style.display = "block"; popup.container.style.maxWidth = "600px"; popup.container.style.width = "100%"; popup.container.style.marginTop = "3px"; popup.renderer.setScrollMargin(2, 2, 0, 0); popup.autoSelect = false; popup.renderer.$maxLines = 15; popup.setRow(-1); popup.on("click", function(e) { var data = popup.getData(popup.getRow()); if (!data["error"]) { cmdLine.setValue(data.value || data["name"] || data); accept(); e.stop(); } }); el.appendChild(popup.container); updateCompletions(); } if (options.$rules) { var tokenizer = new Tokenizer(options.$rules); cmdLine.session.bgTokenizer.setTokenizer(tokenizer); } if (options.placeholder) { cmdLine.setOption("placeholder", options.placeholder); } if (options.hasDescription) { /**@type {any}*/ var promptTextContainer = dom.buildDom(["div", {class: "ace_prompt_text_container"}]); dom.buildDom(options.prompt || "Press 'Enter' to confirm or 'Escape' to cancel", promptTextContainer); el.appendChild(promptTextContainer); } overlay.setIgnoreFocusOut(options.ignoreFocusOut); function accept() { var val; if (popup && popup.getCursorPosition().row > 0) { val = valueFromRecentList(); } else { val = cmdLine.getValue(); } var curData = popup ? popup.getData(popup.getRow()) : val; if (curData && !curData["error"]) { done(); options.onAccept && options.onAccept({ value: val, item: curData }, cmdLine); } } var keys = { "Enter": accept, "Esc|Shift-Esc": function() { options.onCancel && options.onCancel(cmdLine.getValue(), cmdLine); done(); } }; if (popup) { Object.assign(keys, { "Up": function(editor) { popup.goTo("up"); valueFromRecentList();}, "Down": function(editor) { popup.goTo("down"); valueFromRecentList();}, "Ctrl-Up|Ctrl-Home": function(editor) { popup.goTo("start"); valueFromRecentList();}, "Ctrl-Down|Ctrl-End": function(editor) { popup.goTo("end"); valueFromRecentList();}, "Tab": function(editor) { popup.goTo("down"); valueFromRecentList(); }, "PageUp": function(editor) { popup.gotoPageUp(); valueFromRecentList();}, "PageDown": function(editor) { popup.gotoPageDown(); valueFromRecentList();} }); } cmdLine.commands.bindKeys(keys); function done() { overlay.close(); callback && callback(); openPrompt = null; } cmdLine.on("input", function() { options.onInput && options.onInput(); updateCompletions(); }); function updateCompletions() { if (options.getCompletions) { var prefix; if (options.getPrefix) { prefix = options.getPrefix(cmdLine); } var completions = options.getCompletions(cmdLine); popup.setData(completions, prefix); popup.resize(true); } } function valueFromRecentList() { var current = popup.getData(popup.getRow()); if (current && !current["error"]) return current.value || current.caption || current; } cmdLine.resize(true); if (popup) { popup.resize(true); } cmdLine.focus(); openPrompt = { close: done, name: options.name, editor: editor }; } /** * Displays a "Go to Line" prompt for navigating to specific line and column positions with selection support. * * @param {Editor} editor - The editor instance to navigate within * @param {Function} [callback] */ prompt.gotoLine = function(editor, callback) { function stringifySelection(selection) { if (!Array.isArray(selection)) selection = [selection]; return selection.map(function(r) { var cursor = r.isBackwards ? r.start: r.end; var anchor = r.isBackwards ? r.end: r.start; var row = anchor.row; var s = (row + 1) + ":" + anchor.column; if (anchor.row == cursor.row) { if (anchor.column != cursor.column) s += ">" + ":" + cursor.column; } else { s += ">" + (cursor.row + 1) + ":" + cursor.column; } return s; }).reverse().join(", "); } prompt(editor, ":" + stringifySelection(editor.selection.toJSON()), { name: "gotoLine", selection: [1, Number.MAX_VALUE], onAccept: function(data) { var value = data.value; var _history = prompt.gotoLine["_history"]; if (!_history) prompt.gotoLine["_history"] = _history = []; if (_history.indexOf(value) != -1) _history.splice(_history.indexOf(value), 1); _history.unshift(value); if (_history.length > 20) _history.length = 20; var pos = editor.getCursorPosition(); var ranges = []; value.replace(/^:/, "").split(/,/).map(function(str) { var parts = str.split(/([<>:+-]|c?\d+)|[^c\d<>:+-]+/).filter(Boolean); var i = 0; function readPosition() { var c = parts[i++]; if (!c) return; if (c[0] == "c") { var index = parseInt(c.slice(1)) || 0; return editor.session.doc.indexToPosition(index); } var row = pos.row; var column = 0; if (/\d/.test(c)) { row = parseInt(c) - 1; c = parts[i++]; } if (c == ":") { c = parts[i++]; if (/\d/.test(c)) { column = parseInt(c) || 0; } } return {row: row, column: column}; } pos = readPosition(); var range = Range.fromPoints(pos, pos); if (parts[i] == ">") { i++; range.end = readPosition(); } else if (parts[i] == "<") { i++; range.start = readPosition(); } ranges.unshift(range); }); editor.selection.fromJSON(ranges); var scrollTop = editor.renderer.scrollTop; editor.renderer.scrollSelectionIntoView( editor.selection.anchor, editor.selection.cursor, 0.5 ); editor.renderer.animateScrolling(scrollTop); }, history: function() { if (!prompt.gotoLine["_history"]) return []; return prompt.gotoLine["_history"]; }, getCompletions: function(cmdLine) { var value = cmdLine.getValue(); var m = value.replace(/^:/, "").split(":"); var row = Math.min(parseInt(m[0]) || 1, editor.session.getLength()) - 1; var line = editor.session.getLine(row); var current = value + " " + line; return [current].concat(this.history()); }, $rules: { start: [{ regex: /\d+/, token: "string" }, { regex: /[:,><+\-c]/, token: "keyword" }] } }); }; /** * Displays a searchable command palette for executing editor commands with keyboard shortcuts and history. * * @param {Editor} editor - The editor instance to execute commands on * @param {Function} [callback] */ prompt.commands = function(editor, callback) { function normalizeName(name) { return (name || "").replace(/^./, function(x) { return x.toUpperCase(x); }).replace(/[a-z][A-Z]/g, function(x) { return x[0] + " " + x[1].toLowerCase(x); }); } function getEditorCommandsByName(excludeCommands) { var commandsByName = []; var commandMap = {}; editor.keyBinding.$handlers.forEach(function(handler) { var platform = handler["platform"]; var cbn = handler["byName"]; for (var i in cbn) { var key = cbn[i].bindKey; if (typeof key !== "string") { key = key && key[platform] || ""; } var commands = cbn[i]; var description = commands.description || normalizeName(commands.name); if (!Array.isArray(commands)) commands = [commands]; commands.forEach(function(command) { if (typeof command != "string") command = command.name; var needle = excludeCommands.find(function(el) { return el === command; }); if (!needle) { if (commandMap[command]) { commandMap[command].key += "|" + key; } else { commandMap[command] = {key: key, command: command, description: description}; commandsByName.push(commandMap[command]); } } }); } }); return commandsByName; } // exclude commands that can not be executed without args var excludeCommandsList = ["insertstring", "inserttext", "setIndentation", "paste"]; var shortcutsArray = getEditorCommandsByName(excludeCommandsList); shortcutsArray = shortcutsArray.map(function(item) { return {value: item.description, meta: item.key, command: item.command}; }); prompt(editor, "", { name: "commands", selection: [0, Number.MAX_VALUE], maxHistoryCount: 5, onAccept: function(data) { if (data.item) { var commandName = data.item.command; this.addToHistory(data.item); editor.execCommand(commandName); } }, addToHistory: function(item) { var history = this.history(); history.unshift(item); delete item.message; for (var i = 1; i < history.length; i++) { if (history[i]["command"] == item.command ) { history.splice(i, 1); break; } } if (this.maxHistoryCount > 0 && history.length > this.maxHistoryCount) { history.splice(history.length - 1, 1); } prompt.commands["history"] = history; }, history: function() { return prompt.commands["history"] || []; }, getPrefix: function(cmdLine) { var currentPos = cmdLine.getCursorPosition(); var filterValue = cmdLine.getValue(); return filterValue.substring(0, currentPos.column); }, getCompletions: function(cmdLine) { function getFilteredCompletions(commands, prefix) { var resultCommands = JSON.parse(JSON.stringify(commands)); var filtered = new FilteredList(resultCommands); return filtered.filterCompletions(resultCommands, prefix); } function getUniqueCommandList(commands, usedCommands) { if (!usedCommands || !usedCommands.length) { return commands; } var excludeCommands = []; usedCommands.forEach(function(item) { excludeCommands.push(item.command); }); var resultCommands = []; commands.forEach(function(item) { if (excludeCommands.indexOf(item.command) === -1) { resultCommands.push(item); } }); return resultCommands; } var prefix = this.getPrefix(cmdLine); var recentlyUsedCommands = getFilteredCompletions(this.history(), prefix); var otherCommands = getUniqueCommandList(shortcutsArray, recentlyUsedCommands); otherCommands = getFilteredCompletions(otherCommands, prefix); if (recentlyUsedCommands.length && otherCommands.length) { recentlyUsedCommands[0].message = nls("prompt.recently-used", "Recently used"); otherCommands[0].message = nls("prompt.other-commands", "Other commands"); } var completions = recentlyUsedCommands.concat(otherCommands); return completions.length > 0 ? completions : [{ value: nls("prompt.no-matching-commands", "No matching commands"), error: 1 }]; } }); }; /** * Shows an interactive prompt containing all available syntax highlighting modes * that can be applied to the editor session. Users can type to filter through the modes list * and select one to change the editor's syntax highlighting mode. The prompt includes real-time * filtering based on mode names and captions. * * @param {Editor} editor - The editor instance to change the language mode for * @param {Function} [callback] */ prompt.modes = function(editor, callback) { /**@type {any[]}*/ var modesArray = modelist.modes; modesArray = modesArray.map(function(item) { return {value: item.caption, mode: item.name}; }); prompt(editor, "", { name: "modes", selection: [0, Number.MAX_VALUE], onAccept: function(data) { if (data.item) { var modeName = "ace/mode/" + data.item.mode; editor.session.setMode(modeName); } }, getPrefix: function(cmdLine) { var currentPos = cmdLine.getCursorPosition(); var filterValue = cmdLine.getValue(); return filterValue.substring(0, currentPos.column); }, getCompletions: function(cmdLine) { function getFilteredCompletions(modes, prefix) { var resultCommands = JSON.parse(JSON.stringify(modes)); var filtered = new FilteredList(resultCommands); return filtered.filterCompletions(resultCommands, prefix); } var prefix = this.getPrefix(cmdLine); var completions = getFilteredCompletions(modesArray, prefix); return completions.length > 0 ? completions : [{ "caption": "No mode matching", "value": "No mode matching", "error": 1 }]; } }); }; dom.importCssString(`.ace_prompt_container { max-width: 603px; width: 100%; margin: 20px auto; padding: 3px; background: white; border-radius: 2px; box-shadow: 0px 2px 3px 0px #555; }`, "promtp.css", false); exports.prompt = prompt; ================================================ FILE: src/ext/rtl.js ================================================ /** * ## Right-to-Left (RTL) text support extension * * Provides bidirectional text support enabling proper rendering and editing of RTL languages such as Arabic, Hebrew, * and Persian. Handles text direction detection, cursor positioning, and ensures correct visual behavior for mixed * LTR/RTL content. Includes keyboard shortcuts for manual text direction control and automatic * RLE (Right-to-Left Embedding) marker management. * * **Configuration Options:** * - `rtlText`: Enable automatic RTL text detection and handling * - `rtl`: Force RTL direction for the entire editor * * **Keyboard Shortcuts:** * - `Ctrl-Alt-Shift-L` (Win) / `Cmd-Alt-Shift-L` (Mac): Force left-to-right direction * - `Ctrl-Alt-Shift-R` (Win) / `Cmd-Alt-Shift-R` (Mac): Force right-to-left direction * * **Usage:** * ```javascript * editor.setOptions({ * rtlText: true, // Enable automatic RTL detection * rtl: false // Or force RTL direction * }); * ``` * * @module */ "use strict"; var commands = [{ name: "leftToRight", bindKey: { win: "Ctrl-Alt-Shift-L", mac: "Command-Alt-Shift-L" }, exec: function(editor) { editor.session.$bidiHandler.setRtlDirection(editor, false); }, readOnly: true }, { name: "rightToLeft", bindKey: { win: "Ctrl-Alt-Shift-R", mac: "Command-Alt-Shift-R" }, exec: function(editor) { editor.session.$bidiHandler.setRtlDirection(editor, true); }, readOnly: true }]; var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { rtlText: { set: function(val) { if (val) { this.on("change", onChange); this.on("changeSelection", onChangeSelection); this.renderer.on("afterRender", updateLineDirection); this.commands.on("exec", onCommandEmitted); this.commands.addCommands(commands); } else { this.off("change", onChange); this.off("changeSelection", onChangeSelection); this.renderer.off("afterRender", updateLineDirection); this.commands.off("exec", onCommandEmitted); this.commands.removeCommands(commands); clearTextLayer(this.renderer); } this.renderer.updateFull(); } }, rtl: { set: function(val) { this.session.$bidiHandler.$isRtl = val; if (val) { this.setOption("rtlText", false); this.renderer.on("afterRender", updateLineDirection); this.session.$bidiHandler.seenBidi = true; } else { this.renderer.off("afterRender", updateLineDirection); clearTextLayer(this.renderer); } this.renderer.updateFull(); } } }); /** * Whenever the selection is changed, prevent cursor (lead) to be positioned at * position 0 of right-to-left line in order to maintain the RLE marker at this position. * When cursor reaches position 0, either advance it to position 1 of current line (default) * or to last position of previous line (if it comes from position 1 as the result of commands * mentioned in 'onCommandEmitted' event handler). * This serves few purposes: * - ensures cursor visual movement as if RLE mark doesn't exist. * - prevents character insertion before RLE mark. * - prevents RLE mark removal when 'delete' is pressed when cursot stays at position 0. * - ensures RLE mark removal on line merge, when 'delete' is pressed and cursor stays * at last position of previous line and when 'backspace' is pressed and cursor stays at * first position of current line. This is achived by hacking range boundaries on 'remove' operation. * @param {any} e * @param {Editor} editor */ function onChangeSelection(e, editor) { var lead = editor.getSelection().lead; if (editor.session.$bidiHandler.isRtlLine(lead.row)) { if (lead.column === 0) { if (editor.session.$bidiHandler.isMoveLeftOperation && lead.row > 0) { editor.getSelection().moveCursorTo(lead.row - 1, editor.session.getLine(lead.row - 1).length); } else { if (editor.getSelection().isEmpty()) lead.column += 1; else lead.setPosition(lead.row, lead.column + 1); } } } } function onCommandEmitted(commadEvent) { commadEvent.editor.session.$bidiHandler.isMoveLeftOperation = /gotoleft|selectleft|backspace|removewordleft/.test(commadEvent.command.name); } /** * Whenever the document is changed make sure that line break operatin * on right-to-left line (like pressing Enter or pasting multi-line text) * produces new right-to-left lines * @param {import("../../ace-internal").Ace.Delta} delta * @param {Editor} editor */ function onChange(delta, editor) { var session = editor.session; session.$bidiHandler.currentRow = null; if (session.$bidiHandler.isRtlLine(delta.start.row) && delta.action === 'insert' && delta.lines.length > 1) { for (var row = delta.start.row; row < delta.end.row; row++) { if (session.getLine(row + 1).charAt(0) !== session.$bidiHandler.RLE) session.doc.$lines[row + 1] = session.$bidiHandler.RLE + session.getLine(row + 1); } } } /** * @param {any} e * @param {import("../virtual_renderer").VirtualRenderer} renderer */ function updateLineDirection(e, renderer) { var session = renderer.session; var $bidiHandler = session.$bidiHandler; var cells = renderer.$textLayer.$lines.cells; var width = renderer.layerConfig.width - renderer.layerConfig.padding + "px"; cells.forEach(function(cell) { var style = cell.element.style; if ($bidiHandler && $bidiHandler.isRtlLine(cell.row)) { style.direction = "rtl"; style.textAlign = "right"; style.width = width; } else { style.direction = ""; style.textAlign = ""; style.width = ""; } }); } /** * @param {import("../virtual_renderer").VirtualRenderer} renderer */ function clearTextLayer(renderer) { var lines = renderer.$textLayer.$lines; lines.cells.forEach(clear); lines.cellCache.forEach(clear); function clear(cell) { var style = cell.element.style; style.direction = style.textAlign = style.width = ""; } } ================================================ FILE: src/ext/searchbox-css.js ================================================ module.exports = ` /* ------------------------------------------------------------------------------------------ * 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; outline: 0; padding: 0; font-size: inherit; margin: 0; line-height: inherit; padding: 0 6px; min-width: 17em; vertical-align: top; min-height: 1.8em; box-sizing: content-box; } .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; 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: src/ext/searchbox.js ================================================ /** * ## Interactive search and replace UI extension for text editing * * Provides a floating search box interface with find/replace functionality including live search results, regex * support, case sensitivity options, whole word matching, and scoped selection searching. Features keyboard shortcuts * for quick access and navigation, with visual feedback for search matches and a counter showing current position * in results. * * **Key Features:** * - Real-time search with highlighted matches * - Find and replace with individual or bulk operations * - Advanced options: regex, case sensitivity, whole words, search in selection * - Keyboard navigation and shortcuts * - Visual match counter and no-match indicators * * **Usage:** * ```javascript * // Show search box * require("ace/ext/searchbox").Search(editor); * * // Show with replace functionality * require("ace/ext/searchbox").Search(editor, true); * ``` * * @module */ "use strict"; /** * @typedef {import("../editor").Editor} Editor */ var dom = require("../lib/dom"); var lang = require("../lib/lang"); var event = require("../lib/event"); var searchboxCss = require("./searchbox-css"); var HashHandler = require("../keyboard/hash_handler").HashHandler; var keyUtil = require("../lib/keys"); var nls = require("../config").nls; var MAX_COUNT = 999; dom.importCssString(searchboxCss, "ace_searchbox", false); class SearchBox { /** * @param {Editor} editor * @param {never} [range] * @param {never} [showReplaceForm] */ constructor(editor, range, showReplaceForm) { /**@type {HTMLInputElement}*/ this.activeInput; /**@type {HTMLDivElement}*/ this.element = dom.buildDom(["div", {class:"ace_search right"}, ["span", {action: "hide", class: "ace_searchbtn_close"}], ["div", {class: "ace_search_form"}, ["input", {class: "ace_search_field", placeholder: nls("search-box.find.placeholder", "Search for"), spellcheck: "false"}], ["span", {action: "findPrev", class: "ace_searchbtn prev"}, "\u200b"], ["span", {action: "findNext", class: "ace_searchbtn next"}, "\u200b"], ["span", {action: "findAll", class: "ace_searchbtn", title: "Alt-Enter"}, nls("search-box.find-all.text", "All")] ], ["div", {class: "ace_replace_form"}, ["input", {class: "ace_search_field", placeholder: nls("search-box.replace.placeholder", "Replace with"), spellcheck: "false"}], ["span", {action: "replaceAndFindNext", class: "ace_searchbtn"}, nls("search-box.replace-next.text", "Replace")], ["span", {action: "replaceAll", class: "ace_searchbtn"}, nls("search-box.replace-all.text", "All")] ], ["div", {class: "ace_search_options"}, ["span", {action: "toggleReplace", class: "ace_button", title: nls("search-box.toggle-replace.title", "Toggle Replace mode"), style: "float:left;margin-top:-2px;padding:0 5px;"}, "+"], ["span", {class: "ace_search_counter"}], ["span", {action: "toggleRegexpMode", class: "ace_button", title: nls("search-box.toggle-regexp.title", "RegExp Search")}, ".*"], ["span", {action: "toggleCaseSensitive", class: "ace_button", title: nls("search-box.toggle-case.title", "CaseSensitive Search")}, "Aa"], ["span", {action: "toggleWholeWords", class: "ace_button", title: nls("search-box.toggle-whole-word.title", "Whole Word Search")}, "\\b"], ["span", {action: "searchInSelection", class: "ace_button", title: nls("search-box.toggle-in-selection.title", "Search In Selection")}, "S"] ] ]); this.setSession = this.setSession.bind(this); this.$onEditorInput = this.onEditorInput.bind(this); this.$init(); this.setEditor(editor); dom.importCssString(searchboxCss, "ace_searchbox", editor.container); event.addListener(this.element, "touchstart", function(e) { e.stopPropagation(); }, editor); } /** * @param {Editor} editor */ setEditor(editor) { editor.searchBox = this; editor.renderer.scroller.appendChild(this.element); /**@type {Editor}*/ this.editor = editor; } setSession(e) { this.searchRange = null; this.$syncOptions(true); } // Auto update "updateCounter" and "ace_nomatch" onEditorInput() { this.find(false, false, true); } /** * @param {HTMLElement} sb */ $initElements(sb) { /**@type {HTMLElement}*/ this.searchBox = sb.querySelector(".ace_search_form"); /**@type {HTMLElement}*/ this.replaceBox = sb.querySelector(".ace_replace_form"); /**@type {HTMLInputElement}*/ this.searchOption = sb.querySelector("[action=searchInSelection]"); /**@type {HTMLInputElement}*/ this.replaceOption = sb.querySelector("[action=toggleReplace]"); /**@type {HTMLInputElement}*/ this.regExpOption = sb.querySelector("[action=toggleRegexpMode]"); /**@type {HTMLInputElement}*/ this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]"); /**@type {HTMLInputElement}*/ this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]"); /**@type {HTMLInputElement}*/ this.searchInput = this.searchBox.querySelector(".ace_search_field"); /**@type {HTMLInputElement}*/ this.replaceInput = this.replaceBox.querySelector(".ace_search_field"); /**@type {HTMLElement}*/ this.searchCounter = sb.querySelector(".ace_search_counter"); } $init() { 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); } }); /** * @type {{schedule: (timeout?: number) => void}} * @external */ 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(); }); } setSearchRange(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; } } /** * @param {boolean} [preventScroll] * @external */ $syncOptions(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); var readOnly = this.editor.getReadOnly(); this.replaceOption.style.display = readOnly ? "none" : ""; this.replaceBox.style.display = this.replaceOption.checked && !readOnly ? "" : "none"; this.find(false, false, preventScroll); } /** * @param {RegExp} [re] */ highlight(re) { this.editor.session.highlight(re || this.editor.$search.$options.re); this.editor.renderer.updateBackMarkers(); } /** * @param {boolean} skipCurrent * @param {boolean} backwards * @param {any} [preventScroll] */ find(skipCurrent, backwards, preventScroll) { if (!this.editor.session) return; 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 }); /**@type {any}*/ var noMatch = !range && this.searchInput.value; dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); this.editor._emit("findSearchBox", { match: !noMatch }); this.highlight(); this.updateCounter(); } updateCounter() { var editor = this.editor; var regex = editor.$search.$options.re; var supportsUnicodeFlag = regex.unicode; var all = 0; var before = 0; if (regex) { var value = this.searchRange ? editor.session.getTextRange(this.searchRange) : editor.getValue(); /** * Convert all line ending variations to Unix-style = \n * Windows (\r\n), MacOS Classic (\r), and Unix (\n) */ if (editor.$search.$isMultilineSearch(editor.getLastSearchOptions())) { value = value.replace(/\r\n|\r|\n/g, "\n"); editor.session.doc.$autoNewLine = "\n"; } 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 += lang.skipEmptyMatch(value, last, supportsUnicodeFlag); if (last >= value.length) break; } } } this.searchCounter.textContent = nls("search-box.search-counter", "$0 of $1", [before , (all > MAX_COUNT ? MAX_COUNT + "+" : all)]); } findNext() { this.find(true, false); } findPrev() { this.find(true, true); } findAll(){ var range = this.editor.findAll(this.searchInput.value, { regExp: this.regExpOption.checked, caseSensitive: this.caseSensitiveOption.checked, wholeWord: this.wholeWordOption.checked }); /**@type {any}*/ var noMatch = !range && this.searchInput.value; dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); this.editor._emit("findSearchBox", { match: !noMatch }); this.highlight(); this.hide(); } replace() { if (!this.editor.getReadOnly()) this.editor.replace(this.replaceInput.value); } replaceAndFindNext() { if (!this.editor.getReadOnly()) { this.editor.replace(this.replaceInput.value); this.findNext(); } } replaceAll() { if (!this.editor.getReadOnly()) this.editor.replaceAll(this.replaceInput.value); } hide() { this.active = false; this.setSearchRange(null); this.editor.off("changeSession", this.setSession); this.editor.off("input", this.$onEditorInput); this.element.style.display = "none"; this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb); this.editor.focus(); } /** * @param {string} value * @param {boolean} [isReplace] */ show(value, isReplace) { this.active = true; this.editor.on("changeSession", this.setSession); this.editor.on("input", this.$onEditorInput); this.element.style.display = ""; this.replaceOption.checked = isReplace; if (this.editor.$search.$options.regExp) value = lang.escapeRegExp(value); if (value != undefined) this.searchInput.value = value; this.searchInput.focus(); this.searchInput.select(); this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb); this.$syncOptions(true); } isFocused() { var el = document.activeElement; return el == this.searchInput || el == this.replaceInput; } } //keybinding outside of the searchbox var $searchBarKb = new HashHandler(); $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) { if (sb.editor.getReadOnly()) return; 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(); } }); $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(); } }]); //keybinding outside of the searchbox var $closeSearchBarKb = new HashHandler([{ bindKey: "Esc", name: "closeSearchBar", exec: function(editor) { editor.searchBox.hide(); } }]); SearchBox.prototype.$searchBarKb = $searchBarKb; SearchBox.prototype.$closeSearchBarKb = $closeSearchBarKb; exports.SearchBox = SearchBox; /** * Shows the search box for the editor with optional replace functionality. * * @param {Editor} editor - The editor instance * @param {boolean} [isReplace] - Whether to show replace options */ exports.Search = function(editor, isReplace) { var sb = editor.searchBox || new SearchBox(editor); var range = editor.session.selection.getRange(); var value = range.isMultiLine() ? "" : editor.session.getTextRange(range); sb.show(value, 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: src/ext/settings_menu.js ================================================ /** * ## Interactive Settings Menu Extension * * Provides settings interface for the Ace editor that displays dynamically generated configuration options based on * the current editor state. The menu appears as an overlay panel allowing users to modify editor options, themes, * modes, and other settings through an intuitive graphical interface. * * **Usage:** * ```javascript * editor.showSettingsMenu(); * ``` * * The extension automatically registers the `showSettingsMenu` command and method * on the editor instance when initialized. * * @author * Matthew Christopher Kastor-Inare III
    * * @module */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ "use strict"; var OptionPanel = require("./options").OptionPanel; 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 {import("../editor").Editor} editor An instance of the ace editor. */ function showSettingsMenu(editor) { // show if the menu isn't open already. if (!document.getElementById('ace_settingsmenu')) { var options = new OptionPanel(editor); options.render(); options.container.id = "ace_settingsmenu"; overlayPage(editor, options.container); // @ts-ignore options.container.querySelector("select,input,button,checkbox").focus(); } } /** * 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. */ module.exports.init = function() { var Editor = require("../editor").Editor; Editor.prototype.showSettingsMenu = function() { showSettingsMenu(this); }; }; ================================================ FILE: src/ext/simple_tokenizer.js ================================================ /** * ## Simple tokenizer extension * * Provides standalone tokenization functionality that can parse code content using Ace's highlight rules without * requiring a full editor instance. This is useful for generating syntax-highlighted tokens for external rendering, * static code generation, or testing tokenization rules. The tokenizer processes text line by line and returns * structured token data with CSS class names compatible with Ace themes. * * **Usage:** * ```javascript * const { tokenize } = require("ace/ext/simple_tokenizer"); * const { JsonHighlightRules } = require("ace/mode/json_highlight_rules"); * * const content = '{"name": "value"}'; * const tokens = tokenize(content, new JsonHighlightRules()); * // Returns: [[{className: "ace_paren ace_lparen", value: "{"}, ...]] * ``` * * @module */ "use strict"; const { Tokenizer } = require("../tokenizer"); const isTextToken = require("../layer/text_util").isTextToken; class SimpleTokenizer { /** * @param {string} content * @param {Tokenizer} tokenizer */ constructor(content, tokenizer) { this._lines = content.split(/\r\n|\r|\n/); this._states = []; this._tokenizer = tokenizer; } /** * @param {number} row * @returns {import("../../ace-internal").Ace.Token[]} */ getTokens(row) { const line = this._lines[row]; const previousState = this._states[row - 1]; const data = this._tokenizer.getLineTokens(line, previousState); this._states[row] = data.state; return data.tokens; } /** * @returns {number} */ getLength() { return this._lines.length; } } /** * Parses provided content according to provided highlighting rules and return tokens. * Tokens either have the className set according to Ace themes or have no className if they are just pure text tokens. * Result is a list of list of tokens, where each line from the provided content is a separate list of tokens. * * @param {string} content to tokenize * @param {import("../../ace-internal").Ace.HighlightRules} highlightRules defining the language grammar * @returns {import("../../ace-internal").Ace.TokenizeResult} tokenization result containing a list of token for each of the lines from content */ function tokenize(content, highlightRules) { const tokenizer = new SimpleTokenizer(content, new Tokenizer(highlightRules.getRules())); let result = []; for (let lineIndex = 0; lineIndex < tokenizer.getLength(); lineIndex++) { const lineTokens = tokenizer.getTokens(lineIndex); result.push(lineTokens.map((token) => ({ className: isTextToken(token.type) ? undefined : "ace_" + token.type.replace(/\./g, " ace_"), value: token.value }))); } return result; } exports.tokenize = tokenize; ================================================ FILE: src/ext/simple_tokenizer_test.js ================================================ "use strict"; const assert = require("../test/assertions"); const tokenize = require("./simple_tokenizer").tokenize; const JsonHighlightRules = require("../mode/json_highlight_rules").JsonHighlightRules; const JavaScriptHighlightRules = require("../mode/javascript_highlight_rules").JavaScriptHighlightRules; module.exports = { "test: can tokenize JSON": function() { const content = `{ "name": "John", "age": 30, "car": null }`; const result = tokenize(content, new JsonHighlightRules()); const expectedResult = [ [{ className: "ace_paren ace_lparen", value: "{" }], [ {className: undefined, value: ' '}, { className: "ace_variable", value: '"name"' }, { className: undefined, value: ": " }, { className: "ace_string", value: '"John"' }, { className: "ace_punctuation ace_operator", value: "," } ], [ {className: undefined, value: ' '}, { className: "ace_variable", value: '"age"' }, { className: undefined, value: ": " }, { className: "ace_constant ace_numeric", value: "30" }, { className: "ace_punctuation ace_operator", value: "," } ], [ {className: undefined, value: ' '}, { className: "ace_variable", value: '"car"' }, { className: undefined, value: ": null" } ], [ {className: undefined, value: ' '}, { className: "ace_paren ace_rparen", value: "}" } ] ]; assert.deepEqual(result, expectedResult); }, "test: can tokenize Javascript": function() { const content = `console.log("content")`; const result = tokenize(content, new JavaScriptHighlightRules()); const expectedResult = [ [ {className: 'ace_storage ace_type', value: 'console'}, {className: 'ace_punctuation ace_operator', value: '.'}, {className: 'ace_support ace_function ace_firebug', value: 'log'}, {className: 'ace_paren ace_lparen', value: '('}, {className: 'ace_string', value: '"content"'}, {className: 'ace_paren ace_rparen', value: ')'} ] ]; assert.deepEqual(result, expectedResult); } }; ================================================ FILE: src/ext/spellcheck.js ================================================ /** * ## Browser spellcheck integration extension for native spelling correction * * Provides seamless integration with browser's native spellcheck functionality through context menu interactions. * Enables right-click spelling suggestions on misspelled words while preserving editor functionality and text input * handling. The extension bridges browser spellcheck capabilities with the editor's text manipulation system. * * **Enable:** `editor.setOption("spellcheck", true)` (enabled by default) * or configure it during editor initialization in the options object. * * @module */ "use strict"; var event = require("../lib/event"); /** * Handles context menu events for spellcheck integration by setting up a hidden input field * with the word at cursor position to trigger browser spellcheck suggestions. * @param {any} e - The context menu 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) { 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: src/ext/split.js ================================================ /** * ## Split editor container extension for multiple editor instances * * Provides functionality to create and manage multiple editor instances within a single container, * arranged either horizontally (beside) or vertically (below). Enables synchronized editing sessions * with shared configurations while maintaining independent cursor positions and selections. * * **Usage:** * ```javascript * var Split = require("ace/ext/split").Split; * var split = new Split(container, theme, numberOfSplits); * split.setOrientation(split.BESIDE); // or split.BELOW * ``` * * @experimental * @module */ "use strict"; /** * this is experimental, and subject to change, use at your own risk! */ module.exports = require("../split"); ================================================ FILE: src/ext/static-css.js ================================================ module.exports = `.ace_static_highlight { font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Source Code Pro', '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; contain: none; } .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: src/ext/static_highlight.js ================================================ /** * ## Static syntax highlighting extension for code-to-HTML conversion * * Transforms code snippets into syntax-highlighted HTML with CSS styling without requiring a live editor instance. * Uses a simplified DOM implementation to generate standalone HTML output suitable for static content generation, * documentation, code export, and embedding highlighted code in web pages. Supports automatic language detection * from CSS classes and custom modes/themes. * * @module */ "use strict"; /** * @typedef {import("../../ace-internal").Ace.SyntaxMode} SyntaxMode * @typedef {import("../../ace-internal").Ace.Theme} Theme */ var EditSession = require("../edit_session").EditSession; var TextLayer = require("../layer/text").Text; var baseStyles = require("./static-css"); var config = require("../config"); var dom = require("../lib/dom"); var escapeHTML = require("../lib/lang").escapeHTML; class Element { /** * @param {string} type */ constructor(type) { /** @type{string} */this.className; this.type = type; this.style = {}; this.textContent = ""; } cloneNode() { return this; } appendChild(child) { this.textContent += child.toString(); } toString() { var stringBuilder = []; if (this.type != "fragment") { stringBuilder.push("<", this.type); if (this.className) stringBuilder.push(" class='", this.className, "'"); var styleStr = []; for (var key in this.style) { styleStr.push(key, ":", this.style[key]); } if (styleStr.length) stringBuilder.push(" style='", styleStr.join(""), "'"); stringBuilder.push(">"); } if (this.textContent) { stringBuilder.push(this.textContent); } if (this.type != "fragment") { stringBuilder.push(""); } return stringBuilder.join(""); } } var simpleDom = { createTextNode: function(/** @type {string} */ textContent, /** @type {any} */ element) { return escapeHTML(textContent); }, createElement: function(/** @type {string} */ type) { return new Element(type); }, createFragment: function() { return new Element("fragment"); } }; /**@type {any}*/ var SimpleTextLayer = function() { this.config = {}; this.dom = simpleDom; }; SimpleTextLayer.prototype = TextLayer.prototype; /** * Applies syntax highlighting to an HTML element containing code. * * Automatically detects the language from CSS class names (e.g., 'lang-javascript') or uses * the specified mode. Transforms the element's content into syntax-highlighted HTML with * CSS styling and preserves any existing child elements by repositioning them after highlighting. * * @param {HTMLElement} el - The HTML element containing code to highlight * @param {import("../../ace-internal").Ace.StaticHighlightOptions} opts - Highlighting options * @param {function} [callback] - Optional callback executed after highlighting is complete * @returns {boolean} Returns false if no valid mode is found, otherwise true */ 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++) { /**@type {any}*/ var ch = el.childNodes[i]; if (ch.nodeType == 3) { textLen += ch.data.length; data += ch.data; } else { nodes.push(textLen, ch); } } } else { data = el.textContent; if (opts.trim) data = data.trim(); } highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) { dom.importCssString(highlighted.css, "ace_highlight", true); el.innerHTML = highlighted.html; /** * TODO: check if child exists * @type {any} */ 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 | SyntaxMode} 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[/**@type{string}*/(mode)] || modeOptions) modeCache[/**@type{string}*/(mode)] = new m.Mode(modeOptions); mode = modeCache[/**@type{string}*/(mode)]; --waiting || done(); }); } // loads or passes the specified mode module then calls renderer function done() { var result = highlight.renderSync(input, mode, /**@type{Theme}*/(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 {SyntaxMode | string} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode') * @param {Theme} theme * @param {any} lineStart * @param {boolean} disableGutter * @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); /**@type {TextLayer}*/ var textLayer = new SimpleTextLayer(); textLayer.setSession(session); Object.keys(textLayer.$tabStrings).forEach(function(k) { if (typeof textLayer.$tabStrings[k] == "string") { var el = simpleDom.createFragment(); el.textContent = textLayer.$tabStrings[k]; textLayer.$tabStrings[k] = el; } }); session.setValue(input); var length = session.getLength(); var outerEl = simpleDom.createElement("div"); outerEl.className = theme.cssClass; var innerEl = simpleDom.createElement("div"); innerEl.className = "ace_static_highlight" + (disableGutter ? "" : " ace_show_gutter"); innerEl.style["counter-reset"] = "ace_line " + (lineStart - 1); for (var ix = 0; ix < length; ix++) { var lineEl = simpleDom.createElement("div"); lineEl.className = "ace_line"; if (!disableGutter) { var gutterEl = simpleDom.createElement("span"); gutterEl.className ="ace_gutter ace_gutter-cell"; gutterEl.textContent = ""; /*(ix + lineStart) + */ lineEl.appendChild(gutterEl); } textLayer.$renderLine(lineEl, ix, false); lineEl.textContent += "\n"; innerEl.appendChild(lineEl); } //console.log(JSON.stringify(outerEl, null, 2)); //console.log(outerEl.toString()); outerEl.appendChild(innerEl); return { css: baseStyles + theme.cssText, html: outerEl.toString(), session: session }; }; module.exports = highlight; module.exports.highlight = highlight; ================================================ FILE: src/ext/static_highlight_test.js ================================================ "use strict"; var assert = require("assert"); var highlighter = require("./static_highlight"); var EditSession = require("../edit_session").EditSession; var JavaScriptMode = require("../mode/javascript").Mode; var TextMode = require("../mode/text").Mode; var dom = require("../lib/dom"); var config = require("../config"); // Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite module.exports = { "test loading in node": function(done) { if (typeof process === "undefined") { return done(); } var req = require; req("child_process").execFile(process.execPath, ["-p", "require('../ace').version"], { cwd: __dirname }, function(err, stdout, stderr) { assert.ok(!err, "Failed to load ace in node: " + err); assert.equal(stdout.trim(), config.version); done(); }); }, "test simple snippet": function() { var theme = require("../theme/tomorrow"); var snippet = [ "/** this is a function", "*", "*/", "", "function hello (a, b, c) {", " console.log(a * b + c + 'sup$');", " //", "\t\t\t//", "}" ].join("\n"); var mode = new JavaScriptMode(); var result = highlighter.render(snippet, mode, theme); assert.equal(result.html, `
    /** this is a function
    *
    */
    function hello (a, b, c) {
    console.log(a * b + c + 'sup$');
    //
    //
    }
    `); assert.ok(!!result.css); }, "test css from theme is used": function() { 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); }, "test theme classname should be in output html": function() { 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); }, "test js string replace specials": function() { 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("$'$1$2$$$&\n
    ") != -1); }, "test html special chars": function() { var theme = require("../theme/tomorrow"); var snippet = "&<>'\""; var mode = new TextMode(); var result = highlighter.render(snippet, mode, theme); assert.ok(result.html.indexOf("&<>'"\n") != -1); var mode = new JavaScriptMode(); var result = highlighter.render("/*" + snippet, mode, theme); assert.ok(result.html.indexOf("/*&<>'"") != -1); }, "test async highlight": function(next) { require("../test/mockdom"); EditSession.prototype.$modes["./mode/javascript"] = new JavaScriptMode(); var el = dom.buildDom(["div", {}, "var a = 1"]); highlighter.highlight(el, { theme: "./theme/tomorrow", mode: "./mode/javascript" }, function() { assert.ok(/class="ace_storage ace_type">var/.test(el.innerHTML)); next(); }); } }; require("../test/run")(module); ================================================ FILE: src/ext/statusbar.js ================================================ /** * ## Status bar extension for displaying editor state information * * Provides a lightweight status indicator that displays real-time information about the editor state including * cursor position, selection details, recording status, and keyboard binding information. The status bar * automatically updates on editor events and renders as an inline element that can be embedded in any parent container. * * **Usage:** * ```javascript * var StatusBar = require("ace/ext/statusbar").StatusBar; * var statusBar = new StatusBar(editor, parentElement); * ``` * * @module */ "use strict"; /** * * @typedef {import("../editor").Editor} Editor */ var dom = require("../lib/dom"); var lang = require("../lib/lang"); /** simple statusbar **/ class StatusBar{ /** * @param {Editor} editor * @param {HTMLElement} parentNode */ constructor(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); } /** * @param {Editor} editor */ updateStatus(editor) { var status = []; function add(str, separator) { str && status.push(str, separator || "|"); } // @ts-expect-error TODO: potential wrong argument 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(""); } } exports.StatusBar = StatusBar; ================================================ FILE: src/ext/textarea.js ================================================ /** * ## Textarea transformation extension * * Transforms HTML textarea elements into fully-featured Ace editor instances while maintaining form compatibility * and providing an interactive settings panel. Handles automatic resizing, form submission integration, and * preserves the original textarea's styling properties. Includes a visual settings interface for configuring * editor options like themes, modes, keybindings, and display preferences through an overlay panel. * * **Usage:** * ```javascript * var ace = require("ace/ext/textarea"); * var editor = ace.transformTextarea(textareaElement, { * mode: "javascript", * theme: "monokai", * wrap: true * }); * ``` * * @module */ "use strict"; var event = require("../lib/event"); var UA = require("../lib/useragent"); var ace = require("../ace"); module.exports = exports = ace; /** * @typedef {Object} TextAreaOptions * @property {string} [mode] - Programming language mode for syntax highlighting (e.g., "javascript", "html", "css") * @property {string} [theme] - Visual theme for the editor appearance (e.g., "textmate", "monokai", "eclipse") * @property {string|number} [wrap] - Line wrapping behavior - "off", "free", or specific column number like "40", "80" * @property {string} [fontSize] - Font size in CSS units (e.g., "12px", "14px", "16px") * @property {boolean|string} [showGutter] - Whether to display the line number gutter on the left side * @property {string} [keybindings] - Keyboard handler/bindings to use - "ace", "vim", or "emacs" * @property {boolean|string} [showPrintMargin] - Whether to show the print margin indicator line * @property {boolean|string} [useSoftTabs] - Whether to use soft tabs (spaces) instead of hard tabs * @property {boolean|string} [showInvisibles] - Whether to show invisible characters like spaces and tabs */ /** * 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). * @param {HTMLElement} element * @param {HTMLElement} container * @param {string} property */ var getCSSProperty = function(element, container, property) { var ret = element.style[property]; if (!ret) { if (window.getComputedStyle) { ret = window.getComputedStyle(element, '').getPropertyValue(property); } else { // @ts-ignore ret = element.currentStyle[property]; } } if (!ret || ret == 'auto' || ret == 'intrinsic') { ret = container.style[property]; } return ret; }; /** * @param {HTMLElement} elm * @param {Object} styles */ 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.style.cssText = 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; } /** * Transforms a textarea element into an Ace editor instance. * * This function replaces the original textarea with an Ace editor, * preserving the textarea's initial value and focus state. It creates * a container with settings panel and provides full editor functionality. * * @param {HTMLTextAreaElement} element - The textarea element to transform * @param {TextAreaOptions} [options] - Optional configuration options for the editor * @returns {import("../editor").Editor} The created Ace editor instance */ exports.transformTextarea = function(element, options) { var isFocused = element.autofocus || document.activeElement == element; 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", cursor: "nw-resize", border: "solid 9px", borderColor: "lightblue gray gray #ceade6", 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); if (isFocused) 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) { e.preventDefault(); 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 setupApi(editor, editorDiv, settingDiv, ace, options) { 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 "wrap": 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. * @type {TextAreaOptions} */ exports.defaultOptions = { mode: "javascript", theme: "textmate", wrap: "off", fontSize: "12px", showGutter: "false", keybindings: "ace", showPrintMargin: "false", useSoftTabs: "true", showInvisibles: "false" }; ================================================ FILE: src/ext/themelist.js ================================================ /** * ## Theme enumeration utility * * Provides theme management for the Ace Editor by generating and organizing available themes into * categorized collections. Automatically maps theme data into structured objects containing theme metadata including * display captions, theme paths, brightness classification (dark/light), and normalized names. Exports both an * indexed theme collection and a complete themes array for easy integration with theme selection components * and configuration systems. * * @author * Matthew Christopher Kastor-Inare III
    * @module */ /** * 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!! ☭ */ "use strict"; /** * @typedef {Object} Theme * @property {string} caption - The display caption of the theme. * @property {string} theme - The path or identifier for the ACE theme. * @property {boolean} isDark - Indicates whether the theme is dark or light. * @property {string} name - The normalized name used as the key. */ var themeData = [ ["Chrome" ], ["Clouds" ], ["Crimson Editor" ], ["Dawn" ], ["Dreamweaver" ], ["Eclipse" ], ["GitHub Light Default" ], ["GitHub (Legacy)" ,"github" , "light"], ["IPlastic" ], ["Solarized Light"], ["TextMate" ], ["Tomorrow" ], ["XCode" ], ["Kuroir"], ["KatzenMilch"], ["SQL Server" ,"sqlserver" , "light"], ["CloudEditor" ,"cloud_editor" , "light"], ["Ambiance" ,"ambiance" , "dark"], ["Chaos" ,"chaos" , "dark"], ["Clouds Midnight" ,"clouds_midnight" , "dark"], ["Dracula" ,"" , "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"], ["Nord Dark" ,"nord_dark" , "dark"], ["One Dark" ,"one_dark" , "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"], ["GitHub Dark" ,"github_dark" , "dark"], ["CloudEditor Dark" ,"cloud_editor_dark" , "dark"] ]; /** * @type {Object} */ exports.themesByName = {}; /** * An array containing information about available themes. * @type {Theme[]} */ 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: src/ext/whitespace.js ================================================ /** * ## Whitespace management and indentation utilities extension * * Provides whitespace handling capabilities including automatic indentation detection, trailing whitespace trimming, * and indentation format conversion. Analyzes code patterns to determine optimal tab settings and offers commands for * maintaining consistent code formatting across different indentation styles (spaces vs. tabs) and sizes. * * @module */ "use strict"; /** * * @typedef {import("../edit_session").EditSession} EditSession */ var lang = require("../lib/lang"); // based on http://www.freehackers.org/Indent_Finder /** * * @param {string[]} lines * @param [fallback] * @returns {{ch?: string, length?: number}} */ 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}; }; /** * Detects the indentation style of a document and configures the session accordingly. * * @param {EditSession} session The editing session to analyze and configure * @returns {{ch?: string, length?: number}|{}} An object containing detected indentation details (character and length) */ 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; }; /** * Removes trailing whitespace from all lines in the session. * @param {EditSession} session * @param {Object} options * @param {boolean} [options.trimEmpty] trim empty lines too * @param {boolean} [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); } }; /** * Converts indentation format throughout the session to use specified character and size. * @param {EditSession} session * @param {string} ch * @param {number} len */ 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 == " "); }; /** * * @param {string} text * @returns {{}} */ 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", description: "Detect indentation from content", exec: function(editor) { exports.detectIndentation(editor.session); // todo show message? } }, { name: "trimTrailingSpace", description: "Trim trailing whitespace", exec: function(editor, args) { exports.trimTrailingSpace(editor.session, args); } }, { name: "convertIndentation", description: "Convert indentation to ...", exec: function(editor, arg) { var indent = exports.$parseArg(arg); exports.convertIndentation(editor.session, indent.ch, indent.length); } }, { name: "setIndentation", description: "Set indentation", exec: function(editor, arg) { var indent = exports.$parseArg(arg); indent.length && editor.session.setTabSize(indent.length); indent.ch && editor.session.setUseSoftTabs(indent.ch == " "); } }]; ================================================ FILE: src/ext/whitespace_test.js ================================================ "use strict"; require("../test/mockdom"); var ace = require("../ace"); 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() { 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); }, "test empty session": function() { 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); }, "!test one line": function() { var s = new EditSession([ "define({", " foo:1,", "})" ]); var indent = whitespace.$detectIndentation(s.doc.$lines); assert.equal(indent.ch, " "); assert.equal(indent.length, 4); }, "test 1 width indents": function() { 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); }, "test trimTrailingSpace": function() { var session = new EditSession([ "a", "\t b \t", " ", "\t", "\t\tx\t\t", " ", " " ]); session.setUndoManager(new UndoManager()); function testOne(value, options) { 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 }); }, "test convertIndentation": function() { var value = "\ta\n\t\tb\n\t\t\n\t\tc"; var editor = ace.edit(null, {value: value}); editor.commands.addCommands(whitespace.commands); editor.execCommand("detectIndentation"); editor.execCommand("convertIndentation", "s8"); assert.equal(editor.getValue(), value.replace(/\t/g, " ")); editor.execCommand("setIndentation", "s4"); editor.execCommand("convertIndentation", "t1"); assert.equal(editor.getValue(), value.replace(/\t/g, "\t\t")); editor.execCommand("convertIndentation", {text: "space"}); editor.execCommand("trimTrailingSpace", {trimEmpty: true}); assert.equal(editor.getValue(), value.replace(/\t/g, " ").replace(/ *$/gm, "")); } }; require("../test/run")(module); ================================================ FILE: src/ext/whitespaces_in_selection.js ================================================ /** * ## Show whitespaces in the current selection * * This extension adds a configuration option `showWhitespacesInSelection` to the editor * that highlights whitespaces within the current selection. When enabled, it adds a * marker to the selection that makes whitespaces visible. */ "use strict"; require("../layer/text_markers"); var Editor = require("../editor").Editor; var config = require("../config"); var dom = require("../lib/dom"); dom.importCssString(` .ace_whitespaces_in_selection { color: rgba(0,0,0,0.29); } .ace_dark .ace_whitespaces_in_selection { color: rgba(187, 181, 181, 0.5); } `, "ace_whitespaces_in_selection", false); config.defineOptions(Editor.prototype, "editor", { showWhitespacesInSelection: { set: function(val) { this.$showWhitespacesInSelection = val; if (val) { if (!this.$boundChangeSelectionForWhitespace) { this.$boundChangeSelectionForWhitespace = $onChangeSelectionForWhitespace.bind(this); } this.on("changeSelection", this.$boundChangeSelectionForWhitespace); } else { this.off("changeSelection", this.$boundChangeSelectionForWhitespace); if (this.session && this.session.$invisibleMarkerId) { this.session.removeTextMarker(this.session.$invisibleMarkerId); this.session.$invisibleMarkerId = null; } this.$boundChangeSelectionForWhitespace = null; } }, get: function() { return this.$showWhitespacesInSelection; }, initialValue: false } }); function $onChangeSelectionForWhitespace() { let invisibleMarkerId = this.session.$invisibleMarkerId; if (invisibleMarkerId) { this.session.removeTextMarker(invisibleMarkerId); this.session.$invisibleMarkerId = null; } var currentRange = this.selection.getRange(); if (!currentRange.isEmpty()) { this.session.$invisibleMarkerId = this.session.addTextMarker( currentRange, "ace_whitespaces_in_selection", "invisible" ); } } ================================================ FILE: src/ext/whitespaces_in_selection_test.js ================================================ "use strict"; require("../test/mockdom"); var assert = require("assert"); var EditSession = require("../edit_session").EditSession; var Editor = require("../editor").Editor; var MockRenderer = require("../test/mockrenderer").MockRenderer; require("./whitespaces_in_selection"); module.exports = { setUp: function() { this.session = new EditSession("hello world\n with spaces"); this.editor = new Editor(new MockRenderer(), this.session); }, tearDown: function() { this.session.destroy(); }, "test: turning on extension": function() { assert.equal(this.editor.getOption("showWhitespacesInSelection"), false); this.editor.setOption("showWhitespacesInSelection", true); assert.equal(this.editor.getOption("showWhitespacesInSelection"), true); assert.ok(this.editor.$boundChangeSelectionForWhitespace); }, "test: turning off extension": function() { this.editor.setOption("showWhitespacesInSelection", true); assert.equal(this.editor.getOption("showWhitespacesInSelection"), true); this.editor.selection.setRange({start: {row: 0, column: 0}, end: {row: 0, column: 5}}); this.editor.setOption("showWhitespacesInSelection", false); assert.equal(this.editor.getOption("showWhitespacesInSelection"), false); assert.equal(this.editor.$boundChangeSelectionForWhitespace, null); }, "test: marker present after selection": function() { this.editor.setOption("showWhitespacesInSelection", true); this.editor.selection.setRange({start: {row: 0, column: 0}, end: {row: 0, column: 5}}); assert.ok(this.session.$invisibleMarkerId); var markers = this.session.getTextMarkers(); assert.ok(markers[this.session.$invisibleMarkerId]); assert.equal(markers[this.session.$invisibleMarkerId].className, "ace_whitespaces_in_selection"); } }; require("../test/run")(module); ================================================ FILE: src/incremental_search.js ================================================ "use strict"; 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; // regexp handling function isRegExp(obj) { return obj instanceof RegExp; } /** * @param {RegExp} re */ 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) }; } /** * @param {string} string * @param {string} flags * @return {RegExp|string} */ function stringToRegExp(string, flags) { try { return new RegExp(string, flags); } catch (e) { return string; } } function objectToRegExp(obj) { return stringToRegExp(obj.expression, obj.flags); } /** * 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 * **/ class IncrementalSearch extends Search { /** * Creates a new `IncrementalSearch` object. **/ constructor() { super(); this.$options = {wrap: false, skipCurrent: false}; this.$keyboardHandler = new ISearchKbd(this); } /** * @param {boolean} backwards */ activate(editor, backwards) { this.$editor = editor; this.$startPos = this.$currentPos = editor.getCursorPosition(); this.$options.needle = ''; this.$options.backwards = backwards; editor.keyBinding.addKeyboardHandler(this.$keyboardHandler); // we need to completely intercept paste, just registering an event handler does not work this.$originalEditorOnPaste = editor.onPaste; editor.onPaste = this.onPaste.bind(this); this.$mousedownHandler = editor.on('mousedown', this.onMouseDown.bind(this)); this.selectionFix(editor); this.statusMessage(true); } /** * @param {boolean} [reset] */ deactivate(reset) { this.cancelSearch(reset); var editor = this.$editor; editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler); if (this.$mousedownHandler) { editor.off('mousedown', this.$mousedownHandler); delete this.$mousedownHandler; } editor.onPaste = this.$originalEditorOnPaste; this.message(''); } /** * @param {Editor} editor */ selectionFix(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(); } } /** * @param {RegExp} regexp */ highlight(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 } /** * @param {boolean} [reset] */ cancelSearch(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); } /** * @param {boolean} moveToNext * @param {Function} needleUpdateFunc */ highlightAndFindWithNeedle(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; } /** * @param {string} s */ addString(s) { return this.highlightAndFindWithNeedle(false, function(needle) { if (!isRegExp(needle)) return needle + s; var reObj = regExpToObject(needle); reObj.expression += s; return objectToRegExp(reObj); }); } /** * @param {any} c */ removeChar(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); }); } next(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; }); } /** * @internal */ onMouseDown(evt) { // when mouse interaction happens then we quit incremental search this.deactivate(); return true; } /** * @param {string} text * @internal */ onPaste(text) { this.addString(text); } convertNeedleToRegExp() { return this.highlightAndFindWithNeedle(false, function(needle) { return isRegExp(needle) ? needle : stringToRegExp(needle, 'ig'); }); } convertNeedleToString() { return this.highlightAndFindWithNeedle(false, function(needle) { return isRegExp(needle) ? regExpToObject(needle).expression : needle; }); } statusMessage(found) { var options = this.$options, msg = ''; msg += options.backwards ? 'reverse-' : ''; msg += 'isearch: ' + options.needle; msg += found ? '' : ' (not found)'; this.message(msg); } message(msg) { if (this.$editor.showCommandLine) { this.$editor.showCommandLine(msg); this.$editor.focus(); } } } exports.IncrementalSearch = IncrementalSearch; /** * * Config settings for enabling/disabling [[IncrementalSearch `IncrementalSearch`]]. * **/ var dom = require('./lib/dom'); dom.importCssString(` .ace_marker-layer .ace_isearch-result { position: absolute; z-index: 6; 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", false); // 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: src/incremental_search_test.js ================================================ "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()]); } }; require("./test/run")(module); ================================================ FILE: src/keyboard/emacs.js ================================================ "use strict"; var dom = require("../lib/dom"); require("../incremental_search"); var iSearchCommandModule = require("../commands/incremental_search_commands"); var HashHandler = require("./hash_handler").HashHandler; exports.handler = new HashHandler(); exports.handler.isEmacs = true; exports.handler.$id = "ace/keyboard/emacs"; dom.importCssString(` .emacs-mode .ace_cursor{ border: 1px rgba(50,250,50,0.8) solid!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', false ); var $formerLongWords; var $formerLineStart; exports.handler.attach = function(editor) { // 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) pushUnique(this.session.$emacsMarkRing, prevMark); if (!p || activate) this.setEmacsMark(p); else pushUnique(this.session.$emacsMarkRing, 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.$blockCursor = true; editor.setStyle("emacs-mode"); editor.commands.addCommands(commands); exports.handler.platform = editor.commands.platform; editor.$emacsModeHandler = this; editor.on('copy', this.onCopy); editor.on('paste', this.onPaste); }; function pushUnique(ring, mark) { var last = ring[ring.length - 1]; if (last && last.row === mark.row && last.column === mark.column) { return; } ring.push(mark); } exports.handler.detach = function(editor) { editor.renderer.$blockCursor = false; editor.session.$selectLongWords = $formerLongWords; editor.session.$useEmacsStyleLineStart = $formerLineStart; editor.off("click", $resetMarkMode); editor.off("changeSession", $kbSessionChange); editor.unsetStyle("emacs-mode"); editor.commands.removeCommands(commands); editor.off('copy', this.onCopy); editor.off('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.setEmacsMark(null); 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: src/keyboard/emacs_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; require("../multi_select"); var {type} = require("../test/user"); var EditSession = require("./../edit_session").EditSession, Editor = require("../editor").Editor, Range = require("./../range").Range, VirtualRenderer = require("./../virtual_renderer").VirtualRenderer, emacs = require('./emacs'), assert = require("./../test/assertions"), editor, sel; function initEditor(docString) { var doc = new EditSession(docString.split("\n")); editor = new Editor(new VirtualRenderer(), doc); editor.setKeyboardHandler(emacs.handler); sel = editor.selection; document.body.appendChild(editor.container); editor.focus(); } function print(obj) { return JSON.stringify(obj, null, 2); } function pluck(arr, what) { return arr.map(function(ea) { return ea[what]; }); } module.exports = { tearDown: function() { editor.container.remove(); editor.destroy(); }, "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(); type('Ctrl-g'); 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})); type('Ctrl-x', 'Ctrl-x'); assert.deepEqual({row: 0, column: 1}, editor.getCursorPosition(), print(editor.getCursorPosition())); }, "test: exchangePointAndMark with mark set": function() { initEditor('foo'); // push marks editor.selection.moveTo(0, 1); type('Ctrl-Space', 'Ctrl-Space'); editor.selection.moveTo(0, 2); type('Ctrl-Space', 'Ctrl-Space'); editor.selection.moveTo(0, 0); // exchange point and mark with argument type('Ctrl-4', 'Ctrl-x', 'Ctrl-x'); 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(); type("Ctrl-k"); assert.equal(editor.getValue(),"fo\n Hello world\n \n 123"); type("Ctrl-k"); assert.equal(editor.getValue(),"fo Hello world\n \n 123"); type("Ctrl-k"); assert.equal(editor.getValue(),"fo\n \n 123"); type("Ctrl-k"); assert.equal(editor.getValue(),"fo\n 123"); type("Ctrl-k"); assert.equal(editor.getValue(),"fo 123"); type("Ctrl-k"); assert.equal(editor.getValue(),"fo"); type("Ctrl-k"); type("Ctrl-y"); assert.equal(editor.getValue(),"foo \n Hello world\n \n 123"); } }; require("../test/run")(module); ================================================ FILE: src/keyboard/gutter_handler.js ================================================ "use strict"; var keys = require('../lib/keys'); class GutterKeyboardHandler { constructor(editor) { this.editor = editor; this.gutterLayer = editor.renderer.$gutterLayer; this.element = editor.renderer.$gutter; this.lines = editor.renderer.$gutterLayer.$lines; this.activeRowIndex = null; this.activeLane = null; this.annotationTooltip = this.editor.$mouseHandler.$tooltip; } addListener() { this.element.addEventListener("keydown", this.$onGutterKeyDown.bind(this)); this.element.addEventListener("focusout", this.$blurGutter.bind(this)); this.editor.on("mousewheel", this.$blurGutter.bind(this)); } removeListener() { this.element.removeEventListener("keydown", this.$onGutterKeyDown.bind(this)); this.element.removeEventListener("focusout", this.$blurGutter.bind(this)); this.editor.off("mousewheel", this.$blurGutter.bind(this)); } $onGutterKeyDown(e) { // if the tooltip is open, we only want to respond to commands to close it (like a modal) if (this.annotationTooltip.isOpen) { e.preventDefault(); if (e.keyCode === keys["escape"]) this.annotationTooltip.hide(); return; } // If focus is on the gutter element, set focus to nearest gutter icon on enter press. if (e.target === this.element) { if (e.keyCode != keys["enter"]) {return;} e.preventDefault(); // Scroll if the cursor is not currently within the viewport. var row = this.editor.getCursorPosition().row; if (!this.editor.isRowVisible(row)) this.editor.scrollToLine(row, true, true); // After scrolling is completed, find the nearest gutter icon and set focus to it. setTimeout( /** @this {GutterKeyboardHandler} */ function () { var index = this.$rowToRowIndex(this.gutterLayer.$cursorCell.row); var nearestFoldLaneWidgetIndex = this.$findNearestFoldLaneWidget(index); var nearestAnnotationIndex = this.$findNearestAnnotation(index); if (nearestFoldLaneWidgetIndex === null && nearestAnnotationIndex === null) return; var futureActiveRowIndex = this.$findClosestNumber(nearestFoldLaneWidgetIndex, nearestAnnotationIndex, index); if (futureActiveRowIndex === nearestFoldLaneWidgetIndex) { this.activeLane = "fold"; this.activeRowIndex = nearestFoldLaneWidgetIndex; if(this.$isCustomWidgetVisible(nearestFoldLaneWidgetIndex)){ this.$focusCustomWidget(this.activeRowIndex); return; } else { this.$focusFoldWidget(this.activeRowIndex); return; } } else { this.activeRowIndex = nearestAnnotationIndex; this.activeLane = "annotation"; this.$focusAnnotation(this.activeRowIndex); return; } }.bind(this), 10); return; } // After here, foucs is on a gutter icon and we want to interact with them. this.$handleGutterKeyboardInteraction(e); // Wait until folding is completed and then signal gutterkeydown to the editor. setTimeout(function() { // Signal to the editor that a key is pressed inside the gutter. this.editor._signal("gutterkeydown", new GutterKeyboardEvent(e, this)); }.bind(this), 10); } $handleGutterKeyboardInteraction(e) { // Prevent tabbing when interacting with the gutter icons. if (e.keyCode === keys["tab"]){ e.preventDefault(); return; } // If focus is on a gutter icon, set focus to gutter on escape press. if (e.keyCode === keys["escape"]) { e.preventDefault(); this.$blurGutter(); this.element.focus(); this.lane = null; return; } if (e.keyCode === keys["up"]) { e.preventDefault(); switch (this.activeLane){ case "fold": this.$moveFoldWidgetUp(); break; case "annotation": this.$moveAnnotationUp(); break; } return; } if (e.keyCode === keys["down"]) { e.preventDefault(); switch (this.activeLane){ case "fold": this.$moveFoldWidgetDown(); break; case "annotation": this.$moveAnnotationDown(); break; } return; } // Try to switch from fold widgets to annotations. if (e.keyCode === keys["left"]){ e.preventDefault(); this.$switchLane("annotation"); return; } // Try to switch from annotations to fold widgets. if (e.keyCode === keys["right"]){ e.preventDefault(); this.$switchLane("fold"); return; } if (e.keyCode === keys["enter"] || e.keyCode === keys["space"]){ e.preventDefault(); switch (this.activeLane) { case "fold": var row = this.$rowIndexToRow(this.activeRowIndex); var customWidget = this.editor.session.$gutterCustomWidgets[row]; if (customWidget) { if (customWidget.callbacks && customWidget.callbacks.onClick) { customWidget.callbacks.onClick(e, row); } } else if (this.gutterLayer.session.foldWidgets[row] === 'start') { this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex), e); // After folding, check that the right fold widget is still in focus. // If not (e.g. folding close to bottom of doc), put right widget in focus. setTimeout( /** @this {GutterKeyboardHandler} */ function () { if (this.$rowIndexToRow(this.activeRowIndex) !== row) { this.$blurFoldWidget(this.activeRowIndex); this.activeRowIndex = this.$rowToRowIndex(row); this.$focusFoldWidget(this.activeRowIndex); } }.bind(this), 10); break; } else if (this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)] === 'end') { /* TO DO: deal with 'end' fold widgets */ break; } return; case "annotation": this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex)); this.annotationTooltip.$fromKeyboard = true; break; } return; } } $blurGutter() { if (this.activeRowIndex !== null){ switch (this.activeLane){ case "fold": this.$blurFoldWidget(this.activeRowIndex); this.$blurCustomWidget(this.activeRowIndex); break; case "annotation": this.$blurAnnotation(this.activeRowIndex); break; } } if (this.annotationTooltip.isOpen) this.annotationTooltip.hide(); return; } $isFoldWidgetVisible(index) { var isRowFullyVisible = this.editor.isRowFullyVisible(this.$rowIndexToRow(index)); var isIconVisible = this.$getFoldWidget(index).style.display !== "none"; return isRowFullyVisible && isIconVisible; } $isCustomWidgetVisible(index) { var isRowFullyVisible = this.editor.isRowFullyVisible(this.$rowIndexToRow(index)); var isIconVisible = !!this.$getCustomWidget(index); return isRowFullyVisible && isIconVisible; } $isAnnotationVisible(index) { var isRowFullyVisible = this.editor.isRowFullyVisible(this.$rowIndexToRow(index)); var isIconVisible = this.$getAnnotation(index).style.display !== "none"; return isRowFullyVisible && isIconVisible; } $getFoldWidget(index) { var cell = this.lines.get(index); var element = cell.element; return element.childNodes[1]; } $getCustomWidget(index) { var cell = this.lines.get(index); var element = cell.element; return element.childNodes[3]; } $getAnnotation(index) { var cell = this.lines.get(index); var element = cell.element; return element.childNodes[2]; } // Given an index, find the nearest index with a widget in fold lane $findNearestFoldLaneWidget(index) { // If custom widget exists at index, return index if (this.$isCustomWidgetVisible(index)) return index; // If fold widget exists at index, return index. if (this.$isFoldWidgetVisible(index)) return index; // else, find the nearest index with widget within viewport. var i = 0; while (index - i > 0 || index + i < this.lines.getLength() - 1){ i++; if (index - i >= 0 && this.$isCustomWidgetVisible(index - i)) return index - i; if (index + i <= this.lines.getLength() - 1 && this.$isCustomWidgetVisible(index + i)) return index + i; if (index - i >= 0 && this.$isFoldWidgetVisible(index - i)) return index - i; if (index + i <= this.lines.getLength() - 1 && this.$isFoldWidgetVisible(index + i)) return index + i; } // If there are no widgets within the viewport, return null. return null; } // Given an index, find the nearest index with an annotation. $findNearestAnnotation(index) { // If annotation exists at index, return index. if (this.$isAnnotationVisible(index)) return index; // else, find the nearest index with annotation within viewport. var i = 0; while (index - i > 0 || index + i < this.lines.getLength() - 1){ i++; if (index - i >= 0 && this.$isAnnotationVisible(index - i)) return index - i; if (index + i <= this.lines.getLength() - 1 && this.$isAnnotationVisible(index + i)) return index + i; } // If there are no annotations within the viewport, return null. return null; } $focusFoldWidget(index) { if (index == null) return; var foldWidget = this.$getFoldWidget(index); foldWidget.classList.add(this.editor.renderer.keyboardFocusClassName); foldWidget.focus(); } $focusCustomWidget(index) { if (index == null) return; var customWidget = this.$getCustomWidget(index); if (customWidget) { customWidget.classList.add(this.editor.renderer.keyboardFocusClassName); customWidget.focus(); } } $focusAnnotation(index) { if (index == null) return; var annotation = this.$getAnnotation(index); annotation.classList.add(this.editor.renderer.keyboardFocusClassName); annotation.focus(); } $blurFoldWidget(index) { var foldWidget = this.$getFoldWidget(index); foldWidget.classList.remove(this.editor.renderer.keyboardFocusClassName); foldWidget.blur(); } $blurCustomWidget(index) { var customWidget = this.$getCustomWidget(index); if (customWidget) { customWidget.classList.remove(this.editor.renderer.keyboardFocusClassName); customWidget.blur(); } } $blurAnnotation(index) { var annotation = this.$getAnnotation(index); annotation.classList.remove(this.editor.renderer.keyboardFocusClassName); annotation.blur(); } $moveFoldWidgetUp() { var index = this.activeRowIndex; while (index > 0){ index--; if (this.$isFoldWidgetVisible(index) || this.$isCustomWidgetVisible(index)){ this.$blurFoldWidget(this.activeRowIndex); this.$blurCustomWidget(this.activeRowIndex); this.activeRowIndex = index; if (this.$isFoldWidgetVisible(index)) { this.$focusFoldWidget(this.activeRowIndex); } else { this.$focusCustomWidget(this.activeRowIndex); } return; } } return; } $moveFoldWidgetDown() { var index = this.activeRowIndex; while (index < this.lines.getLength() - 1){ index++; if (this.$isFoldWidgetVisible(index) || this.$isCustomWidgetVisible(index)){ this.$blurFoldWidget(this.activeRowIndex); this.$blurCustomWidget(this.activeRowIndex); this.activeRowIndex = index; if (this.$isFoldWidgetVisible(index)) { this.$focusFoldWidget(this.activeRowIndex); } else { this.$focusCustomWidget(this.activeRowIndex); } return; } } return; } $moveAnnotationUp() { var index = this.activeRowIndex; while (index > 0){ index--; if (this.$isAnnotationVisible(index)){ this.$blurAnnotation(this.activeRowIndex); this.activeRowIndex = index; this.$focusAnnotation(this.activeRowIndex); return; } } return; } $moveAnnotationDown() { var index = this.activeRowIndex; while (index < this.lines.getLength() - 1){ index++; if (this.$isAnnotationVisible(index)){ this.$blurAnnotation(this.activeRowIndex); this.activeRowIndex = index; this.$focusAnnotation(this.activeRowIndex); return; } } return; } $findClosestNumber(num1, num2, target) { if (num1 === null) return num2; if (num2 === null) return num1; return (Math.abs(target - num1) <= Math.abs(target - num2)) ? num1 : num2; } $switchLane(desinationLane){ switch (desinationLane) { case "annotation": if (this.activeLane === "annotation") {break;} var annotationIndex = this.$findNearestAnnotation(this.activeRowIndex); if (annotationIndex == null) {break;} this.activeLane = "annotation"; this.$blurFoldWidget(this.activeRowIndex); this.$blurCustomWidget(this.activeRowIndex); this.activeRowIndex = annotationIndex; this.$focusAnnotation(this.activeRowIndex); break; case "fold": if (this.activeLane === "fold") {break;} var foldLaneWidgetIndex = this.$findNearestFoldLaneWidget(this.activeRowIndex); if (foldLaneWidgetIndex === null) {break;} this.activeLane = "fold"; this.$blurAnnotation(this.activeRowIndex); this.activeRowIndex = foldLaneWidgetIndex; if (this.$isCustomWidgetVisible(foldLaneWidgetIndex)) { this.$focusCustomWidget(this.activeRowIndex); } else { this.$focusFoldWidget(this.activeRowIndex); } break; } return; } // Convert row index (viewport space) to row (document space). $rowIndexToRow(index) { var cell = this.lines.get(index); if (cell) return cell.row; return null; } // Convert row (document space) to row index (viewport space). $rowToRowIndex(row) { for (var i = 0; i < this.lines.getLength(); i++){ var cell = this.lines.get(i); if (cell.row == row) return i; } return null; } } exports.GutterKeyboardHandler = GutterKeyboardHandler; /* * Custom Ace gutter keyboard event */ class GutterKeyboardEvent { constructor(domEvent, gutterKeyboardHandler) { this.gutterKeyboardHandler = gutterKeyboardHandler; this.domEvent = domEvent; } /** * Returns the key that was presssed. * * @return {string} the key that was pressed. */ getKey() { return keys.keyCodeToString(this.domEvent.keyCode); } /** * Returns the row in the gutter that was focused after the keyboard event was handled. * * @return {number} the key that was pressed. */ getRow() { return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex); } /** * Returns whether focus is on the annotation lane after the keyboard event was handled. * * @return {boolean} true if focus was on the annotation lane after the keyboard event. */ isInAnnotationLane() { return this.gutterKeyboardHandler.activeLane === "annotation"; } /** * Returns whether focus is on the fold lane after the keyboard event was handled. * * @return {boolean} true if focus was on the fold lane after the keyboard event. */ isInFoldLane() { return this.gutterKeyboardHandler.activeLane === "fold"; } } exports.GutterKeyboardEvent = GutterKeyboardEvent; ================================================ FILE: src/keyboard/gutter_handler_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; require("../multi_select"); require("../theme/textmate"); var user = require("../test/user"); var Editor = require("../editor").Editor; var Mode = require("../mode/java").Mode; var VirtualRenderer = require("../virtual_renderer").VirtualRenderer; var assert = require("../test/assertions"); var lang = require("../lib/lang"); function findVisibleTooltip() { const tooltips = document.body.querySelectorAll(".ace_gutter-tooltip"); for (let i = 0; i < tooltips.length; i++) { if (window.getComputedStyle(tooltips[i]).display === "block") { return tooltips[i]; } } return null; } module.exports = { setUp : function() { this.editor = new Editor(new VirtualRenderer()); this.editor.container.style.position = "absolute"; this.editor.container.style.height = "500px"; this.editor.container.style.width = "500px"; this.editor.container.style.left = "50px"; this.editor.container.style.top = "10px"; document.body.appendChild(this.editor.container); }, "test: keyboard code folding: basic functionality" : async function(done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.setOption("enableKeyboardAccessibility", true); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var toggler = lines.cells[0].element.querySelector(".ace_fold-widget"); // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); // Focus on the fold widget. user.type("Enter"); await lang.sleep(20); assert.equal(document.activeElement, lines.cells[0].element.childNodes[1]); // Click the fold widget. user.type("Enter"); await lang.sleep(20); // Check that code is folded. editor.renderer.$loop._flush(); assert.ok(/ace_closed/.test(toggler.className)); assert.equal(lines.cells[1].element.textContent, "52"); // After escape focus should be back to the gutter. user.type("Escape"); assert.equal(document.activeElement, editor.renderer.$gutter); done(); }, "test: keyboard code folding: multiple folds" : async function(done) { var editor = this.editor; var value = "\n x {" + "\n".repeat(5) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.setOption("enableKeyboardAccessibility", true); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); assert.equal(lines.cells[2].element.textContent, "3"); // Focus on the fold widgets. user.type("Enter"); await lang.sleep(20); assert.equal(document.activeElement, lines.cells[1].element.childNodes[1]); // Click the first fold widget. user.type("Enter"); await lang.sleep(20); // Check that code is folded. editor.renderer.$loop._flush(); assert.equal(lines.cells[2].element.textContent, "8"); // Move to the next fold widget. user.type("Down"); assert.equal(document.activeElement, lines.cells[3].element.childNodes[1]); assert.equal(lines.cells[4].element.textContent, "10"); // Click the fold widget. user.type("Enter"); await lang.sleep(20); // Check that code is folded. assert.equal(lines.cells[4].element.textContent, "15"); // Move back up one fold widget. user.type("Up"); assert.equal(document.activeElement, lines.cells[1].element.childNodes[1]); done(); }, "test: keyboard annotation: basic functionality" : async function(done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("enableKeyboardAccessibility", true); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "error test", type: "error"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); // Focus on the annotation. user.type("Enter"); await lang.sleep(20); user.type("Left"); assert.equal(document.activeElement, lines.cells[0].element.childNodes[2]); // Click annotation. user.type("Enter"); await lang.sleep(20); // Check annotation is rendered. editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/error test/.test(tooltip.textContent)); // Press escape to dismiss the tooltip. user.type("Escape"); // After escape again focus should be back to the gutter. user.type("Escape"); assert.equal(document.activeElement, editor.renderer.$gutter); done(); }, "test: keyboard annotation: multiple annotations" : async function(done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("enableKeyboardAccessibility", true); editor.setValue(value, -1); editor.session.setAnnotations([ {row: 1, column: 0, text: "error test", type: "error"}, {row: 2, column: 0, text: "warning test", type: "warning"} ]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); // Focus on the annotation. user.type("Enter"); await lang.sleep(20); user.type("Left"); assert.equal(document.activeElement, lines.cells[1].element.childNodes[2]); // Click annotation. user.type("Enter"); await lang.sleep(20); // Check annotation is rendered. editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/error test/.test(tooltip.textContent)); // Press escape to dismiss the tooltip. user.type("Escape"); // Press down to move to next annotation. user.type("Down"); assert.equal(document.activeElement, lines.cells[2].element.childNodes[2]); // Click annotation. user.type("Enter"); await lang.sleep(20); // Check annotation is rendered. editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/warning test/.test(tooltip.textContent)); // Press escape to dismiss the tooltip. user.type("Escape"); // Move back up one annotation. user.type("Up"); assert.equal(document.activeElement, lines.cells[1].element.childNodes[2]); // Move back to the folds, focus should be on the fold on line 1. user.type("Right"); assert.equal(document.activeElement, lines.cells[0].element.childNodes[1]); done(); }, "test: keyboard annotation: no folds" : async function(done) { var editor = this.editor; var value = "x\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("enableKeyboardAccessibility", true); editor.setValue(value, -1); editor.session.setAnnotations([{row: 1, column: 0, text: "error test", type: "error"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); // Focus on gutter interaction. user.type("Enter"); await lang.sleep(20); // Focus should be on the annotation directly. assert.equal(document.activeElement, lines.cells[1].element.childNodes[2]); done(); }, "test: aria attributes mode with getFoldWidgetRange" : function() { var editor = this.editor; var value = "x {" + "\n".repeat(5) + "}"; editor.session.setMode(new Mode()); editor.setOption("enableKeyboardAccessibility", true); editor.setValue(value, -1); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var toggler = lines.cells[0].element.querySelector(".ace_fold-widget"); assert.equal(toggler.getAttribute("aria-label"), "Toggle code folding, rows 1 through 6"); assert.equal(toggler.getAttribute("aria-expanded"), "true"); assert.equal(toggler.getAttribute("title"), "Fold code"); editor.session.$toggleFoldWidget(0, {}); editor.renderer.$loop._flush(); assert.equal(toggler.getAttribute("aria-label"), "Toggle code folding, rows 1 through 6"); assert.equal(toggler.getAttribute("aria-expanded"), "false"); assert.equal(toggler.getAttribute("title"), "Unfold code"); }, "test: aria attributes mode without getFoldWidgetRange" : function() { var editor = this.editor; var value = "x {" + "\n".repeat(5) + "}"; var mode = new Mode(); mode.foldingRules.getFoldWidgetRange = function(session, foldStyle, row) { return null; }; editor.session.setMode(mode); editor.setOption("enableKeyboardAccessibility", true); editor.setValue(value, -1); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var toggler = lines.cells[0].element.querySelector(".ace_fold-widget"); assert.equal(toggler.getAttribute("aria-label"), "Toggle code folding, row 1"); assert.equal(toggler.getAttribute("aria-expanded"), "true"); assert.equal(toggler.getAttribute("title"), "Fold code"); }, "test: should signal keyboard event" : async function(done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("enableKeyboardAccessibility", true); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "error test", type: "error"}]); var row, isAnnotation, isFold, key; editor.on("gutterkeydown", function(event) { row = event.getRow(); isAnnotation = event.isInAnnotationLane(); isFold = event.isInFoldLane(); key = event.getKey(); }); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); // Focus on the annotation. user.type("Enter"); await lang.sleep(20); user.type("Left"); assert.equal(document.activeElement, lines.cells[0].element.childNodes[2]); await lang.sleep(20); assert.equal(row, 0); assert.equal(isAnnotation, true); assert.equal(isFold, false); assert.equal(key, "left"); done(); }, "test: switching lanes with the custom widget should work" : async function(done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("enableKeyboardAccessibility", true); editor.setValue(value, -1); editor.session.setAnnotations([ {row: 1, column: 0, text: "error test", type: "error"}, {row: 2, column: 0, text: "warning test", type: "warning"} ]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); editor.renderer.$gutterLayer.$addCustomWidget(1, { className: "ace_users_css", label: "Open_label", title: "Open_title", }); // Focus on the annotation. user.type("Enter"); await lang.sleep(20); user.type("Left"); assert.equal(document.activeElement, lines.cells[1].element.childNodes[2]); // Click annotation. user.type("Enter"); await lang.sleep(20); // Check annotation is rendered. editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/error test/.test(tooltip.textContent)); // Press escape to dismiss the tooltip. user.type("Escape"); // Switch lane move to custom widget user.type("Right"); assert.equal(document.activeElement, lines.cells[1].element.childNodes[3]); // Move back to the annotations, focus should be on the annotation on line 1. user.type("Left"); assert.equal(document.activeElement, lines.cells[1].element.childNodes[2]); done(); }, "test: moving up and down to custom widget and checking onclick callback as well" : async function(done) { var editor = this.editor; var value = "\n x {" + "\n".repeat(5) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.setOption("enableKeyboardAccessibility", true); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); assert.equal(lines.cells[2].element.textContent, "3"); let firstCallbackCalledCount=0; const firstCallback = (e) =>{ firstCallbackCalledCount++; e.stopPropagation(); }; editor.renderer.$gutterLayer.$addCustomWidget(2, { className: "ace_users_css", label: "Open_label", title: "Open_title", callbacks: { onClick: firstCallback } }); // Focus on the fold widgets. user.type("Enter"); await lang.sleep(20); assert.equal(document.activeElement, lines.cells[1].element.childNodes[1]); // Move down to the custom widget. user.type("Down"); assert.equal(document.activeElement, lines.cells[2].element.childNodes[3]); user.type("Enter"); assert.equal(firstCallbackCalledCount, 1); // Move up to the previous fold widget. user.type("Up"); assert.equal(document.activeElement, lines.cells[1].element.childNodes[1]); done(); }, "test: add several custom widgets" : function() { var editor = this.editor; var value = "x {" + "\n".repeat(5) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.execCommand("toggleFoldWidget"); editor.renderer.$loop._flush(); editor.renderer.$gutterLayer.$addCustomWidget(100, { className: "widget1", }); editor.renderer.$gutterLayer.$addCustomWidget(4, { className: "widget2", }); editor.renderer.$loop._flush(); assert.ok(!editor.container.querySelector(".widget1")); assert.ok(editor.container.querySelector(".widget2")); editor.navigateTo(100, 0); editor.renderer.scrollCursorIntoView(); editor.renderer.$loop._flush(); assert.ok(editor.container.querySelector(".widget1")); assert.ok(!editor.container.querySelector(".widget2")); }, tearDown : function() { this.editor.destroy(); document.body.removeChild(this.editor.container); } }; require("../test/run")(module); ================================================ FILE: src/keyboard/hash_handler.js ================================================ "use strict"; /** * @typedef {import("../../ace-internal").Ace.Command} Command * @typedef {import("../../ace-internal").Ace.CommandLike} CommandLike */ /** @type {any} */var keyUtil = require("../lib/keys"); var useragent = require("../lib/useragent"); var KEY_MODS = keyUtil.KEY_MODS; /** * @typedef {"win" | "mac"} Platform */ class MultiHashHandler { /** * @param {Record | Command[]} [config] * @param {Platform} [platform] */ constructor(config, platform) { this.$init(config, platform, false); } /** * @param {Record | Command[]} config * @param {Platform} [platform] * @param {boolean} [$singleCommand] */ $init(config, platform, $singleCommand) { this.platform = platform || (useragent.isMac ? "mac" : "win"); /**@type {Record}*/ this.commands = {}; this.commandKeyBinding = {}; this.addCommands(config); this.$singleCommand = $singleCommand; } /** * @param {Command} command */ addCommand(command) { if (this.commands[command.name]) this.removeCommand(command); this.commands[command.name] = command; if (command.bindKey) this._buildKeyHash(command); } /** * @param {Command | string} command * @param {boolean} [keepCommand] */ removeCommand(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]; } } } } /** * @param {string | { win?: string; mac?: string; position?:number}} key * @param {CommandLike | string} command * @param {number} [position] */ bindKey(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 || /**@type{string}*/(key)}); /**@type{string}*/(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); } /** * @param {string} keyId * @param {any} command * @param {number} position */ _addCommandToBinding(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); } } /** * @param {Record | Command[]} [commands] */ addCommands(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); } /** * @param {Record} commands */ removeCommands(commands) { Object.keys(commands).forEach(function(name) { this.removeCommand(commands[name]); }, this); } /** * @param {Record} keyList */ bindKeys(keyList) { Object.keys(keyList).forEach(function(key) { this.bindKey(key, keyList[key]); }, this); } _buildKeyHash(command) { this.bindKey(command.bindKey, command); } /** * Accepts keys in the form ctrl+Enter or ctrl-Enter * keys without modifiers or shift only * @param {string} keys * @returns {{key: string, hashId: number} | false} */ parseKeys(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}; } /** * @param {number} hashId * @param {string} keyString * @returns {Command} */ findKeyCommand(hashId, keyString) { var key = KEY_MODS[hashId] + keyString; return this.commandKeyBinding[key]; } /** * @param {any} data * @param {number} hashId * @param {string} keyString * @param {number} keyCode * @returns {{command: string} | void} */ handleKeyboard(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}; } /** * @param {any} [editor] * @param {any} [data] * @returns {string} */ getStatusText(editor, data) { return data.$keyChain || ""; } } function getPosition(command) { return typeof command == "object" && command.bindKey && command.bindKey.position || (command.isDefault ? -100 : 0); } class HashHandler extends MultiHashHandler { /** * @param {Record | Command[]} [config] * @param {Platform} [platform] */ constructor(config, platform) { super(config, platform); this.$singleCommand = true; } } HashHandler.call = function(thisArg, config, platform) { MultiHashHandler.prototype.$init.call(thisArg, config, platform, true); }; MultiHashHandler.call = function(thisArg, config, platform) { MultiHashHandler.prototype.$init.call(thisArg, config, platform, false); }; exports.HashHandler = HashHandler; exports.MultiHashHandler = MultiHashHandler; ================================================ FILE: src/keyboard/keybinding.js ================================================ "use strict"; /** * @typedef {import("../editor").Editor} Editor * @typedef {import("../../ace-internal").Ace.KeyboardHandler} KeyboardHandler */ var keyUtil = require("../lib/keys"); var event = require("../lib/event"); class KeyBinding { /** * @param {Editor} editor */ constructor(editor) { this.$editor = editor; this.$data = {editor: editor}; /**@type {(KeyboardHandler)[]}*/ this.$handlers = []; this.setDefaultHandler(editor.commands); } /** * @param {KeyboardHandler} kb */ setDefaultHandler(kb) { this.removeKeyboardHandler(this.$defaultHandler); this.$defaultHandler = kb; this.addKeyboardHandler(kb, 0); } /** * @param {KeyboardHandler} kb */ setKeyboardHandler(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); } /** * @param {KeyboardHandler & {attach?: (editor: any) => void, detach?: (editor: any) => void;}} [kb] * @param {number} [pos] */ addKeyboardHandler(kb, pos) { if (!kb) return; // @ts-ignore if (typeof kb == "function" && !kb.handleKeyboard) // @ts-ignore 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); } /** * @param {KeyboardHandler & {attach?: (editor: any) => void, detach?: (editor: any) => void;}} kb * @returns {boolean} */ removeKeyboardHandler(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; } /** * @return {KeyboardHandler} */ getKeyboardHandler() { return this.$handlers[this.$handlers.length - 1]; } getStatusText() { var data = this.$data; var editor = data.editor; return this.$handlers.map(function(h) { return h.getStatusText && h.getStatusText(editor, data) || ""; }).filter(Boolean).join(" "); } $callKeyboardHandlers(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( // @ts-expect-error TODO: could be wrong arguments amount this.$data, hashId, keyString, keyCode, e ); if (!toExecute || !toExecute.command) continue; // allow keyboardHandler to consume keys if (toExecute.command == "null") { success = true; } else { // @ts-expect-error //TODO: potential wrong arguments amount 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; } /** * @param {any} e * @param {number} hashId * @param {number} keyCode * @return {boolean} * @internal */ onCommandKey(e, hashId, keyCode) { var keyString = keyUtil.keyCodeToString(keyCode); return this.$callKeyboardHandlers(hashId, keyString, keyCode, e); } /** * @param {string} text * @return {boolean} * @internal */ onTextInput(text) { return this.$callKeyboardHandlers(-1, text); } } exports.KeyBinding = KeyBinding; ================================================ FILE: src/keyboard/keybinding_test.js ================================================ "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"); } }; require("../test/run")(module); ================================================ FILE: src/keyboard/sublime.js ================================================ "use strict"; var HashHandler = require("../keyboard/hash_handler").HashHandler; function moveBySubWords(editor, direction, extend) { var selection = editor.selection; var row = selection.lead.row; var column = selection.lead.column; var line = editor.session.getLine(row); if (!line[column + direction]) { var method = (extend ? "selectWord" : "moveCursorShortWord") + (direction == 1 ? "Right" : "Left"); return editor.selection[method](); } if (direction == -1) column--; while (line[column]) { var type = getType(line[column]) + getType(line[column + direction]); column += direction; if (direction == 1) { if (type == "WW" && getType(line[column + 1]) == "w") break; } else { if (type == "wW") { if (getType(line[column - 1]) == "W") { column -= 1; break; } else { continue; } } if (type == "Ww") break; } if (/w[s_oW]|_[sWo]|o[s_wW]|s[W]|W[so]/.test(type)) break; } if (direction == -1) column++; if (extend) editor.selection.moveCursorTo(row, column); else editor.selection.moveTo(row, column); function getType(x) { if (!x) return "-"; if (/\s/.test(x)) return "s"; if (x == "_") return "_"; if (x.toUpperCase() == x && x.toLowerCase() != x) return "W"; if (x.toUpperCase() != x && x.toLowerCase() == x) return "w"; return "o"; } } exports.handler = new HashHandler(); exports.handler.addCommands([{ name: "find_all_under", exec: function(editor) { if (editor.selection.isEmpty()) editor.selection.selectWord(); editor.findAll(); }, readOnly: true }, { name: "find_under", exec: function(editor) { if (editor.selection.isEmpty()) editor.selection.selectWord(); editor.findNext(); }, readOnly: true }, { name: "find_under_prev", exec: function(editor) { if (editor.selection.isEmpty()) editor.selection.selectWord(); editor.findPrevious(); }, readOnly: true }, { name: "find_under_expand", exec: function(editor) { editor.selectMore(1, false, true); }, scrollIntoView: "animate", readOnly: true }, { name: "find_under_expand_skip", exec: function(editor) { editor.selectMore(1, true, true); }, scrollIntoView: "animate", readOnly: true }, { name: "delete_to_hard_bol", exec: function(editor) { var pos = editor.selection.getCursor(); editor.session.remove({ start: { row: pos.row, column: 0 }, end: pos }); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "delete_to_hard_eol", exec: function(editor) { var pos = editor.selection.getCursor(); editor.session.remove({ start: pos, end: { row: pos.row, column: Infinity } }); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "moveToWordStartLeft", exec: function(editor) { editor.selection.moveCursorLongWordLeft(); editor.clearSelection(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "moveToWordEndRight", exec: function(editor) { editor.selection.moveCursorLongWordRight(); editor.clearSelection(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "selectToWordStartLeft", exec: function(editor) { var sel = editor.selection; sel.$moveSelection(sel.moveCursorLongWordLeft); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "selectToWordEndRight", exec: function(editor) { var sel = editor.selection; sel.$moveSelection(sel.moveCursorLongWordRight); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "selectSubWordRight", exec: function(editor) { moveBySubWords(editor, 1, true); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectSubWordLeft", exec: function(editor) { moveBySubWords(editor, -1, true); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "moveSubWordRight", exec: function(editor) { moveBySubWords(editor, 1); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "moveSubWordLeft", exec: function(editor) { moveBySubWords(editor, -1); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }]); [{ bindKey: { mac: "cmd-k cmd-backspace|cmd-backspace", win: "ctrl-shift-backspace|ctrl-k ctrl-backspace" }, name: "removetolinestarthard" }, { bindKey: { mac: "cmd-k cmd-k|cmd-delete|ctrl-k", win: "ctrl-shift-delete|ctrl-k ctrl-k" }, name: "removetolineendhard" }, { bindKey: { mac: "cmd-shift-d", win: "ctrl-shift-d" }, name: "duplicateSelection" }, { bindKey: { mac: "cmd-l", win: "ctrl-l" }, name: "expandtoline" }, { bindKey: {mac: "cmd-shift-a", win: "ctrl-shift-a"}, name: "expandSelection", args: {to: "tag"} }, { bindKey: {mac: "cmd-shift-j", win: "ctrl-shift-j"}, name: "expandSelection", args: {to: "indentation"} }, { bindKey: {mac: "ctrl-shift-m", win: "ctrl-shift-m"}, name: "expandSelection", args: {to: "brackets"} }, { bindKey: {mac: "cmd-shift-space", win: "ctrl-shift-space"}, name: "expandSelection", args: {to: "scope"} }, { bindKey: { mac: "ctrl-cmd-g", win: "alt-f3" }, name: "find_all_under" }, { bindKey: { mac: "alt-cmd-g", win: "ctrl-f3" }, name: "find_under" }, { bindKey: { mac: "shift-alt-cmd-g", win: "ctrl-shift-f3" }, name: "find_under_prev" }, { bindKey: { mac: "cmd-g", win: "f3" }, name: "findnext" }, { bindKey: { mac: "shift-cmd-g", win: "shift-f3" }, name: "findprevious" }, { bindKey: { mac: "cmd-d", win: "ctrl-d" }, name: "find_under_expand" }, { bindKey: { mac: "cmd-k cmd-d", win: "ctrl-k ctrl-d" }, name: "find_under_expand_skip" }, /* fold */ { bindKey: { mac: "cmd-alt-[", win: "ctrl-shift-[" }, name: "toggleFoldWidget" }, { bindKey: { mac: "cmd-alt-]", win: "ctrl-shift-]" }, name: "unfold" }, { bindKey: { mac: "cmd-k cmd-0|cmd-k cmd-j", win: "ctrl-k ctrl-0|ctrl-k ctrl-j" }, name: "unfoldall" }, { bindKey: { mac: "cmd-k cmd-1", win: "ctrl-k ctrl-1" }, name: "foldOther", args: { level: 1 } }, /* move */ { bindKey: { win: "ctrl-left", mac: "alt-left" }, name: "moveToWordStartLeft" }, { bindKey: { win: "ctrl-right", mac: "alt-right" }, name: "moveToWordEndRight" }, { bindKey: { win: "ctrl-shift-left", mac: "alt-shift-left" }, name: "selectToWordStartLeft" }, { bindKey: { win: "ctrl-shift-right", mac: "alt-shift-right" }, name: "selectToWordEndRight" }, // subwords { bindKey: {mac: "ctrl-alt-shift-right|ctrl-shift-right", win: "alt-shift-right"}, name: "selectSubWordRight" }, { bindKey: {mac: "ctrl-alt-shift-left|ctrl-shift-left", win: "alt-shift-left"}, name: "selectSubWordLeft" }, { bindKey: {mac: "ctrl-alt-right|ctrl-right", win: "alt-right"}, name: "moveSubWordRight" }, { bindKey: {mac: "ctrl-alt-left|ctrl-left", win: "alt-left"}, name: "moveSubWordLeft" }, { bindKey: { mac: "ctrl-m", win: "ctrl-m" }, name: "jumptomatching", args: { to: "brackets" } }, { bindKey: { mac: "ctrl-f6", win: "ctrl-f6" }, name: "goToNextError" }, { bindKey: { mac: "ctrl-shift-f6", win: "ctrl-shift-f6" }, name: "goToPreviousError" }, { bindKey: { mac: "ctrl-o" }, name: "splitline" }, { bindKey: {mac: "ctrl-shift-w", win: "alt-shift-w"}, name: "surrowndWithTag" },{ bindKey: {mac: "cmd-alt-.", win: "alt-."}, name: "close_tag" }, { bindKey: { mac: "cmd-j", win: "ctrl-j" }, name: "joinlines" }, { bindKey: {mac: "ctrl--", win: "alt--"}, name: "jumpBack" }, { bindKey: {mac: "ctrl-shift--", win: "alt-shift--"}, name: "jumpForward" }, { bindKey: { mac: "cmd-k cmd-l", win: "ctrl-k ctrl-l" }, name: "tolowercase" }, { bindKey: { mac: "cmd-k cmd-u", win: "ctrl-k ctrl-u" }, name: "touppercase" }, { bindKey: {mac: "cmd-shift-v", win: "ctrl-shift-v"}, name: "paste_and_indent" }, { bindKey: {mac: "cmd-k cmd-v|cmd-alt-v", win: "ctrl-k ctrl-v"}, name: "paste_from_history" }, { bindKey: { mac: "cmd-shift-enter", win: "ctrl-shift-enter" }, name: "addLineBefore" }, { bindKey: { mac: "cmd-enter", win: "ctrl-enter" }, name: "addLineAfter" }, { bindKey: { mac: "ctrl-shift-k", win: "ctrl-shift-k" }, name: "removeline" }, { bindKey: { mac: "ctrl-alt-up", win: "ctrl-up" }, name: "scrollup" }, { bindKey: { mac: "ctrl-alt-down", win: "ctrl-down" }, name: "scrolldown" }, { bindKey: { mac: "cmd-a", win: "ctrl-a" }, name: "selectall" }, { bindKey: { linux: "alt-shift-down", mac: "ctrl-shift-down", win: "ctrl-alt-down" }, name: "addCursorBelow" }, { bindKey: { linux: "alt-shift-up", mac: "ctrl-shift-up", win: "ctrl-alt-up" }, name: "addCursorAbove" }, { bindKey: { mac: "cmd-k cmd-c|ctrl-l", win: "ctrl-k ctrl-c" }, name: "centerselection" }, { bindKey: { mac: "f5", win: "f9" }, name: "sortlines" }, { bindKey: {mac: "ctrl-f5", win: "ctrl-f9"}, name: "sortlines", args: {caseSensitive: true} }, { bindKey: { mac: "cmd-shift-l", win: "ctrl-shift-l" }, name: "splitSelectionIntoLines" }, { bindKey: { mac: "ctrl-cmd-down", win: "ctrl-shift-down" }, name: "movelinesdown" }, { bindKey: { mac: "ctrl-cmd-up", win: "ctrl-shift-up" }, name: "movelinesup" }, { bindKey: { mac: "alt-down", win: "alt-down" }, name: "modifyNumberDown" }, { bindKey: { mac: "alt-up", win: "alt-up" }, name: "modifyNumberUp" }, { bindKey: { mac: "cmd-/", win: "ctrl-/" }, name: "togglecomment" }, { bindKey: { mac: "cmd-alt-/", win: "ctrl-shift-/" }, name: "toggleBlockComment" }, { bindKey: { linux: "ctrl-alt-q", mac: "ctrl-q", win: "ctrl-q" }, name: "togglerecording" }, { bindKey: { linux: "ctrl-alt-shift-q", mac: "ctrl-shift-q", win: "ctrl-shift-q" }, name: "replaymacro" }, { bindKey: { mac: "ctrl-t", win: "ctrl-t" }, name: "transpose" } ].forEach(function(binding) { var command = exports.handler.commands[binding.name]; if (command) command.bindKey = binding.bindKey; exports.handler.bindKey(binding.bindKey, command || binding.name); }); ================================================ FILE: src/keyboard/sublime_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; require("../multi_select"); var EditSession = require("./../edit_session").EditSession; var Editor = require("../editor").Editor; var Range = require("./../range").Range; var MockRenderer = require("./../test/mockrenderer").MockRenderer; var assert = require("./../test/assertions"); var handler = require("./sublime").handler; var editor; function initEditor(docString) { var doc = new EditSession(docString.split("\n")); editor = new Editor(new MockRenderer(), doc); editor.setKeyboardHandler(handler); } module.exports = { "test: move by subwords": function() { initEditor("\n abcDefGHKLmn_op ++ xyz$\nt"); [0, 3, 6, 9, 12, 15, 18, 21, 25, 26, 0, 1, 1].forEach(function(col) { assert.equal(editor.selection.lead.column, col); editor.execCommand(handler.commands.moveSubWordRight); }); [1, 0, 26, 25, 22, 19, 16, 12, 9, 6, 3, 0, 0].forEach(function(col) { assert.equal(editor.selection.lead.column, col); editor.execCommand(handler.commands.moveSubWordLeft); }); } }; require("../test/run")(module); ================================================ FILE: src/keyboard/textarea.js ================================================ "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: src/keyboard/textinput.js ================================================ "use strict"; var event = require("../lib/event"); var nls = require("../config").nls; var useragent = require("../lib/useragent"); var dom = require("../lib/dom"); var lang = require("../lib/lang"); var clipboard = require("../clipboard"); var BROKEN_SETDATA = useragent.isChrome < 18; var USE_IE_MIME_TYPE = useragent.isIE; var HAS_FOCUS_ARGS = useragent.isChrome > 63; var MAX_LINE_LENGTH = 400; /** * * @type {{[key: string]: any}} */ var KEYS = require("../lib/keys"); var MODS = KEYS.KEY_MODS; var isIOS = useragent.isIOS; var valueResetRegex = isIOS ? /\s/ : /\n/; var isMobile = useragent.isMobile; class TextInput { /** * @param {HTMLElement} parentNode * @param {import("../editor").Editor} host */ constructor(parentNode, host) { this.host = host; /**@type {HTMLTextAreaElement & {msGetInputContext?: () => {compositionStartOffset: number}, getInputContext?: () => {compositionStartOffset: number}}}*/ this.text = dom.createElement("textarea"); this.text.className = "ace_text-input"; this.text.setAttribute("wrap", "off"); this.text.setAttribute("autocomplete", "off"); this.text.setAttribute("autocorrect", "off"); this.text.setAttribute("autocapitalize", "off"); this.text.setAttribute("spellcheck", "false"); this.text.style.opacity = "0"; parentNode.insertBefore(this.text, parentNode.firstChild); /**@type{boolean|string}*/this.copied = false; this.pasted = false; /**@type {(boolean|Object) & {context?: any, useTextareaForIME?: boolean, selectionStart?: number, markerRange?: any}}} */ this.inComposition = false; this.sendingText = false; this.tempStyle = ''; if (!isMobile) this.text.style.fontSize = "1px"; this.commandMode = false; this.ignoreFocusEvents = false; this.lastValue = ""; this.lastSelectionStart = 0; this.lastSelectionEnd = 0; this.lastRestoreEnd = 0; this.rowStart = Number.MAX_SAFE_INTEGER; this.rowEnd = Number.MIN_SAFE_INTEGER; this.numberOfExtraLines = 0; // FOCUS // ie9 throws error if document.activeElement is accessed too soon try { this.$isFocused = document.activeElement === this.text; } catch (e) { } this.cancelComposition = this.cancelComposition.bind(this); this.setAriaOptions({role: "textbox"}); event.addListener(this.text, "blur", (e) => { if (this.ignoreFocusEvents) return; host.onBlur(e); this.$isFocused = false; }, host); event.addListener(this.text, "focus", (e) => { if (this.ignoreFocusEvents) return; this.$isFocused = true; if (useragent.isEdge) { // on edge focus event is fired even if document itself is not focused try { if (!document.hasFocus()) return; } catch (e) { } } host.onFocus(e); if (useragent.isEdge) setTimeout(this.resetSelection.bind(this)); else this.resetSelection(); }, host); /**@type {boolean | string}*/this.$focusScroll = false; host.on("beforeEndOperation", () => { var curOp = host.curOp; var commandName = curOp && curOp.command && curOp.command.name; if (commandName == "insertstring") return; var isUserAction = commandName && (curOp.docChanged || curOp.selectionChanged); if (this.inComposition && isUserAction) { // exit composition from commands other than insertstring this.lastValue = this.text.value = ""; this.onCompositionEnd(); } // sync value of textarea this.resetSelection(); }); // if cursor changes position, we need to update the label with the correct row host.on("changeSelection", this.setAriaLabel.bind(this)); this.resetSelection = isIOS ? this.$resetSelectionIOS : this.$resetSelection; if (this.$isFocused) host.onFocus(); this.inputHandler = null; this.afterContextMenu = false; event.addCommandKeyListener(this.text, (e, hashId, keyCode) => { // ignore command events during composition as they will // either be handled by ime itself or fired again after ime end if (this.inComposition) return; return host.onCommandKey(e, hashId, keyCode); }, host); event.addListener(this.text, "select", this.onSelect.bind(this), host); event.addListener(this.text, "input", this.onInput.bind(this), host); event.addListener(this.text, "cut", this.onCut.bind(this), host); event.addListener(this.text, "copy", this.onCopy.bind(this), host); event.addListener(this.text, "paste", this.onPaste.bind(this), host); // Opera has no clipboard events if (!('oncut' in this.text) || !('oncopy' in this.text) || !('onpaste' in this.text)) { event.addListener(parentNode, "keydown", (e) => { if ((useragent.isMac && !e.metaKey) || !e.ctrlKey) return; switch (e.keyCode) { case 67: this.onCopy(e); break; case 86: this.onPaste(e); break; case 88: this.onCut(e); break; } }, host); } this.syncComposition = lang.delayedCall(this.onCompositionUpdate.bind(this), 50).schedule.bind(null, null); //TODO: check this event.addListener(this.text, "compositionstart", this.onCompositionStart.bind(this), host); event.addListener(this.text, "compositionupdate", this.onCompositionUpdate.bind(this), host); event.addListener(this.text, "keyup", this.onKeyup.bind(this), host); event.addListener(this.text, "keydown", this.syncComposition.bind(this), host); event.addListener(this.text, "compositionend", this.onCompositionEnd.bind(this), host); this.closeTimeout; event.addListener(this.text, "mouseup", this.$onContextMenu.bind(this), host); event.addListener(this.text, "mousedown", (e) => { e.preventDefault(); this.onContextMenuClose(); }, host); event.addListener(host.renderer.scroller, "contextmenu", this.$onContextMenu.bind(this), host); event.addListener(this.text, "contextmenu", this.$onContextMenu.bind(this), host); if (isIOS) this.addIosSelectionHandler(parentNode, host, this.text); } /** * @internal * @param {HTMLElement} parentNode * @param {import("../editor").Editor} host * @param {HTMLTextAreaElement} text */ addIosSelectionHandler(parentNode, host, text) { var typingResetTimeout = null; var typing = false; text.addEventListener("keydown", function (e) { if (typingResetTimeout) clearTimeout(typingResetTimeout); typing = true; }, true); text.addEventListener("keyup", function (e) { typingResetTimeout = setTimeout(function () { typing = false; }, 100); }, true); // IOS doesn't fire events for arrow keys, but this unique hack changes everything! var detectArrowKeys = (e) => { if (document.activeElement !== text) return; if (typing || this.inComposition || host.$mouseHandler.isMousePressed) return; if (this.copied) { return; } var selectionStart = text.selectionStart; var selectionEnd = text.selectionEnd; var key = null; var modifier = 0; // console.log(selectionStart, selectionEnd); if (selectionStart == 0) { key = KEYS.up; } else if (selectionStart == 1) { key = KEYS.home; } else if (selectionEnd > this.lastSelectionEnd && this.lastValue[selectionEnd] == "\n") { key = KEYS.end; } else if (selectionStart < this.lastSelectionStart && this.lastValue[selectionStart - 1] == " ") { key = KEYS.left; modifier = MODS.option; } else if (selectionStart < this.lastSelectionStart || (selectionStart == this.lastSelectionStart && this.lastSelectionEnd != this.lastSelectionStart && selectionStart == selectionEnd)) { key = KEYS.left; } else if (selectionEnd > this.lastSelectionEnd && this.lastValue.slice(0, selectionEnd).split( "\n").length > 2) { key = KEYS.down; } else if (selectionEnd > this.lastSelectionEnd && this.lastValue[selectionEnd - 1] == " ") { key = KEYS.right; modifier = MODS.option; } else if (selectionEnd > this.lastSelectionEnd || (selectionEnd == this.lastSelectionEnd && this.lastSelectionEnd != this.lastSelectionStart && selectionStart == selectionEnd)) { key = KEYS.right; } if (selectionStart !== selectionEnd) modifier |= MODS.shift; if (key) { var result = host.onCommandKey({}, modifier, key); if (!result && host.commands) { key = KEYS.keyCodeToString(key); var command = host.commands.findKeyCommand(modifier, key); if (command) host.execCommand(command); } this.lastSelectionStart = selectionStart; this.lastSelectionEnd = selectionEnd; this.resetSelection(""); } }; // On iOS, "selectionchange" can only be attached to the document object... document.addEventListener("selectionchange", detectArrowKeys); host.on("destroy", function () { document.removeEventListener("selectionchange", detectArrowKeys); }); } onContextMenuClose() { clearTimeout(this.closeTimeout); this.closeTimeout = setTimeout(() => { if (this.tempStyle) { this.text.style.cssText = this.tempStyle; this.tempStyle = ''; } this.host.renderer.$isMousePressed = false; if (this.host.renderer.$keepTextAreaAtCursor) this.host.renderer.$moveTextAreaToCursor(); }, 0); } $onContextMenu(e) { this.host.textInput.onContextMenu(e); this.onContextMenuClose(); } /** * @internal * @param e */ onKeyup(e) { // workaround for a bug in ie where pressing esc silently moves selection out of textarea if (e.keyCode == 27 && this.text.value.length < this.text.selectionStart) { if (!this.inComposition) this.lastValue = this.text.value; this.lastSelectionStart = this.lastSelectionEnd = -1; this.resetSelection(); } this.syncComposition(); } // COMPOSITION /** * @internal */ cancelComposition() { // force end composition this.ignoreFocusEvents = true; this.text.blur(); this.text.focus(); this.ignoreFocusEvents = false; } /** * @internal */ onCompositionStart(e) { if (this.inComposition || !this.host.onCompositionStart || this.host.$readOnly) return; this.inComposition = {}; if (this.commandMode) return; if (e.data) this.inComposition.useTextareaForIME = false; setTimeout(this.onCompositionUpdate.bind(this), 0); this.host._signal("compositionStart"); this.host.on("mousedown", this.cancelComposition); //TODO: var range = this.host.getSelectionRange(); range.end.row = range.start.row; range.end.column = range.start.column; this.inComposition.markerRange = range; this.inComposition.selectionStart = this.lastSelectionStart; this.host.onCompositionStart(this.inComposition); if (this.inComposition.useTextareaForIME) { this.lastValue = this.text.value = ""; this.lastSelectionStart = 0; this.lastSelectionEnd = 0; } else { if (this.text.msGetInputContext) this.inComposition.context = this.text.msGetInputContext(); if (this.text.getInputContext) this.inComposition.context = this.text.getInputContext(); } } /** * @internal */ onCompositionUpdate() { if (!this.inComposition || !this.host.onCompositionUpdate || this.host.$readOnly) return; if (this.commandMode) return this.cancelComposition(); if (this.inComposition.useTextareaForIME) { this.host.onCompositionUpdate(this.text.value); } else { var data = this.text.value; this.sendText(data); if (this.inComposition.markerRange) { if (this.inComposition.context) { this.inComposition.markerRange.start.column = this.inComposition.selectionStart = this.inComposition.context.compositionStartOffset; } this.inComposition.markerRange.end.column = this.inComposition.markerRange.start.column + this.lastSelectionEnd - this.inComposition.selectionStart + this.lastRestoreEnd; } } } /** * @internal */ onCompositionEnd(e) { if (!this.host.onCompositionEnd || this.host.$readOnly) return; this.inComposition = false; this.host.onCompositionEnd(); this.host.off("mousedown", this.cancelComposition); // note that resetting value of textarea at this point doesn't always work // because textarea value can be silently restored if (e) this.onInput(); } /** * @internal */ onCut(e) { this.doCopy(e, true); } /** * @internal */ onCopy(e) { this.doCopy(e, false); } /** * @internal */ onPaste(e) { var data = this.handleClipboardData(e); if (clipboard.pasteCancelled()) return; if (typeof data == "string") { if (data) this.host.onPaste(data, e); if (useragent.isIE) setTimeout(this.resetSelection); event.preventDefault(e); } else { this.text.value = ""; this.pasted = true; } } /** * @internal * @param {ClipboardEvent} e * @param {boolean} isCut */ doCopy(e, isCut) { var data = this.host.getCopyText(); if (!data) return event.preventDefault(e); if (this.handleClipboardData(e, data)) { if (isIOS) { this.resetSelection(data); this.copied = data; setTimeout(() => { this.copied = false; }, 10); } isCut ? this.host.onCut() : this.host.onCopy(); event.preventDefault(e); } else { this.copied = true; this.text.value = data; this.text.select(); setTimeout(() => { this.copied = false; this.resetSelection(); isCut ? this.host.onCut() : this.host.onCopy(); }); } } /** * * @internal * @param {ClipboardEvent} e * @param {string} [data] * @param {boolean} [forceIEMime] */ handleClipboardData(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 this.handleClipboardData(e, data, true); } } /** * @internal * @param e */ onInput(e) { if (this.inComposition) return this.onCompositionUpdate(); if (e && e.inputType) { if (e.inputType == "historyUndo") return this.host.execCommand("undo"); if (e.inputType == "historyRedo") return this.host.execCommand("redo"); } var data = this.text.value; var inserted = this.sendText(data, true); if (data.length > MAX_LINE_LENGTH + 100 || valueResetRegex.test(inserted) || isMobile && this.lastSelectionStart < 1 && this.lastSelectionStart == this.lastSelectionEnd) { this.resetSelection(); } } /** * @internal * @param {string} value * @param {boolean} [fromInput] * @return {string} */ sendText(value, fromInput) { if (this.afterContextMenu) this.afterContextMenu = false; if (this.pasted) { this.resetSelection(); if (value) this.host.onPaste(value); this.pasted = false; return ""; } else { var selectionStart = this.text.selectionStart; var selectionEnd = this.text.selectionEnd; var extendLeft = this.lastSelectionStart; var extendRight = this.lastValue.length - this.lastSelectionEnd; var inserted = value; var restoreStart = value.length - selectionStart; var restoreEnd = value.length - selectionEnd; var i = 0; while (extendLeft > 0 && this.lastValue[i] == value[i]) { i++; extendLeft--; } inserted = inserted.slice(i); i = 1; while (extendRight > 0 && this.lastValue.length - i > this.lastSelectionStart - 1 && this.lastValue[this.lastValue.length - i] == value[value.length - i]) { i++; extendRight--; } restoreStart -= i - 1; restoreEnd -= i - 1; var endIndex = inserted.length - i + 1; if (endIndex < 0) { extendLeft = -endIndex; endIndex = 0; } inserted = inserted.slice(0, endIndex); // composition update can be called without any change if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd) return ""; this.sendingText = true; // some android keyboards converts two spaces into sentence end, which is not useful for code var shouldReset = false; if (useragent.isAndroid && inserted == ". ") { inserted = " "; shouldReset = true; } if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || this.commandMode) { this.host.onTextInput(inserted); } else { this.host.onTextInput(inserted, { extendLeft: extendLeft, extendRight: extendRight, restoreStart: restoreStart, restoreEnd: restoreEnd }); } this.sendingText = false; this.lastValue = value; this.lastSelectionStart = selectionStart; this.lastSelectionEnd = selectionEnd; this.lastRestoreEnd = restoreEnd; return shouldReset ? "\n" : inserted; } } /** * @internal * @param e */ onSelect(e) { if (this.inComposition) return; var isAllSelected = (text) => { return text.selectionStart === 0 && text.selectionEnd >= this.lastValue.length && text.value === this.lastValue && this.lastValue && text.selectionEnd !== this.lastSelectionEnd; }; if (this.copied) { this.copied = false; } else if (isAllSelected(this.text)) { this.host.selectAll(); this.resetSelection(); } else if (isMobile && this.text.selectionStart != this.lastSelectionStart) { this.resetSelection(); } } $resetSelectionIOS(value) { if (!this.$isFocused || (this.copied && !value) || this.sendingText) return; if (!value) value = ""; var newValue = "\n ab" + value + "cde fg\n"; if (newValue != this.text.value) this.text.value = this.lastValue = newValue; var selectionStart = 4; var selectionEnd = 4 + (value.length || (this.host.selection.isEmpty() ? 0 : 1)); if (this.lastSelectionStart != selectionStart || this.lastSelectionEnd != selectionEnd) { this.text.setSelectionRange(selectionStart, selectionEnd); } this.lastSelectionStart = selectionStart; this.lastSelectionEnd = selectionEnd; } $resetSelection() { if (this.inComposition || this.sendingText) return; // modifying selection of blured textarea can focus it (chrome mac/linux) if (!this.$isFocused && !this.afterContextMenu) return; // see https://github.com/ajaxorg/ace/issues/2114 // this prevents infinite recursion on safari 8 this.inComposition = true; var selectionStart = 0; var selectionEnd = 0; var line = ""; // Convert from row,column position to the linear position with respect to the current // block of lines in the textarea. var positionToSelection = (row, column) => { var selection = column; for (var i = 1; i <= row - this.rowStart && i < 2 * this.numberOfExtraLines + 1; i++) { selection += this.host.session.getLine(row - i).length + 1; } return selection; }; if (this.host.session) { var selection = this.host.selection; var range = selection.getRange(); var row = selection.cursor.row; // We keep 2*numberOfExtraLines + 1 lines in the textarea, if the new active row // is within the current block of lines in the textarea we do nothing. If the new row // is one row above or below the current block, move up or down to the next block of lines. // If the new row is further than 1 row away from the current block grab a new block centered // around the new row. if (row === this.rowEnd + 1) { this.rowStart = this.rowEnd + 1; this.rowEnd = this.rowStart + 2 * this.numberOfExtraLines; } else if (row === this.rowStart - 1) { this.rowEnd = this.rowStart - 1; this.rowStart = this.rowEnd - 2 * this.numberOfExtraLines; } else if (row < this.rowStart - 1 || row > this.rowEnd + 1) { this.rowStart = row > this.numberOfExtraLines ? row - this.numberOfExtraLines : 0; this.rowEnd = row > this.numberOfExtraLines ? row + this.numberOfExtraLines : 2 * this.numberOfExtraLines; } var lines = []; for (var i = this.rowStart; i <= this.rowEnd; i++) { lines.push(this.host.session.getLine(i)); } line = lines.join('\n'); selectionStart = positionToSelection(range.start.row, range.start.column); selectionEnd = positionToSelection(range.end.row, range.end.column); if (range.start.row < this.rowStart) { var prevLine = this.host.session.getLine(this.rowStart - 1); selectionStart = range.start.row < this.rowStart - 1 ? 0 : selectionStart; selectionEnd += prevLine.length + 1; line = prevLine + "\n" + line; } else if (range.end.row > this.rowEnd) { var nextLine = this.host.session.getLine(this.rowEnd + 1); selectionEnd = range.end.row > this.rowEnd + 1 ? nextLine.length : range.end.column; selectionEnd += line.length + 1; line = line + "\n" + nextLine; } else if (isMobile && row > 0) { line = "\n" + line; selectionEnd += 1; selectionStart += 1; } if (line.length > MAX_LINE_LENGTH) { if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) { line = line.slice(0, MAX_LINE_LENGTH); } else { line = "\n"; if (selectionStart == selectionEnd) { selectionStart = selectionEnd = 0; } else { selectionStart = 0; selectionEnd = 1; } } } var newValue = line + "\n\n"; if (newValue != this.lastValue) { this.text.value = this.lastValue = newValue; this.lastSelectionStart = this.lastSelectionEnd = newValue.length; } } // contextmenu on mac may change the selection if (this.afterContextMenu) { this.lastSelectionStart = this.text.selectionStart; this.lastSelectionEnd = this.text.selectionEnd; } // on firefox this throws if textarea is hidden if (this.lastSelectionEnd != selectionEnd || this.lastSelectionStart != selectionStart || this.text.selectionEnd != this.lastSelectionEnd // on ie edge selectionEnd changes silently after the initialization ) { try { this.text.setSelectionRange(selectionStart, selectionEnd); this.lastSelectionStart = selectionStart; this.lastSelectionEnd = selectionEnd; } catch (e) { } } this.inComposition = false; } /** * @param {import("../editor").Editor} newHost */ setHost(newHost) { this.host = newHost; } /** * Sets the number of extra lines in the textarea to improve screen reader compatibility. * Extra lines can help screen readers perform better when reading text. * * @param {number} number - The number of extra lines to add. Must be non-negative. */ setNumberOfExtraLines(number) { this.rowStart = Number.MAX_SAFE_INTEGER; this.rowEnd = Number.MIN_SAFE_INTEGER; if (number < 0) { this.numberOfExtraLines = 0; return; } this.numberOfExtraLines = number; } setAriaLabel() { var ariaLabel = ""; if (this.host.$textInputAriaLabel) { ariaLabel += `${this.host.$textInputAriaLabel}, `; } if (this.host.session) { var row = this.host.session.selection.cursor.row; ariaLabel += nls("text-input.aria-label", "Cursor at row $0", [row + 1]); } this.text.setAttribute("aria-label", ariaLabel); } /** * @param {import("../../ace-internal").Ace.TextInputAriaOptions} options */ setAriaOptions(options) { if (options.activeDescendant) { this.text.setAttribute("aria-haspopup", "true"); this.text.setAttribute("aria-autocomplete", options.inline ? "both" : "list"); this.text.setAttribute("aria-activedescendant", options.activeDescendant); } else { this.text.setAttribute("aria-haspopup", "false"); this.text.setAttribute("aria-autocomplete", "both"); this.text.removeAttribute("aria-activedescendant"); } if (options.role) { this.text.setAttribute("role", options.role); } if (options.setLabel) { this.text.setAttribute("aria-roledescription", nls("text-input.aria-roledescription", "editor")); this.setAriaLabel(); } } focus() { // On focusing on the textarea, read active row number to assistive tech. this.setAriaOptions({ setLabel: this.host.renderer.enableKeyboardAccessibility }); if (this.tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == "browser") return this.text.focus( {preventScroll: true}); var top = this.text.style.top; this.text.style.position = "fixed"; this.text.style.top = "0px"; try { var isTransformed = this.text.getBoundingClientRect().top != 0; } catch (e) { // getBoundingClientRect on IE throws error if element is not in the dom tree return; } var ancestors = []; if (isTransformed) { var t = this.text.parentElement; while (t && t.nodeType == 1) { ancestors.push(t); t.setAttribute("ace_nocontext", "true"); if (!t.parentElement && t.getRootNode) t = t.getRootNode()["host"]; else t = t.parentElement; } } this.text.focus({preventScroll: true}); if (isTransformed) { ancestors.forEach(function (p) { p.removeAttribute("ace_nocontext"); }); } setTimeout(() => { this.text.style.position = ""; if (this.text.style.top == "0px") this.text.style.top = top; }, 0); } blur() { this.text.blur(); } isFocused() { return this.$isFocused; } setInputHandler(cb) { this.inputHandler = cb; } getInputHandler() { return this.inputHandler; } getElement() { return this.text; } /** * allows to ignore composition (used by vim keyboard handler in the normal mode) * this is useful on mac, where with some keyboard layouts (e.g swedish) ^ starts composition * @param {boolean} value */ setCommandMode(value) { this.commandMode = value; this.text.readOnly = false; } setReadOnly(readOnly) { if (!this.commandMode) this.text.readOnly = readOnly; } setCopyWithEmptySelection(value) { } onContextMenu(e) { this.afterContextMenu = true; this.resetSelection(); this.host._emit("nativecontextmenu", { target: this.host, domEvent: e }); this.moveToMouse(e, true); } /** * @param e * @param {boolean} bringToFront */ moveToMouse(e, bringToFront) { if (!this.tempStyle) this.tempStyle = this.text.style.cssText; this.text.style.cssText = (bringToFront ? "z-index:100000;" : "") + (useragent.isIE ? "opacity:0.1;" : "") + "text-indent: -" + (this.lastSelectionStart + this.lastSelectionEnd) * this.host.renderer.characterWidth * 0.5 + "px;"; var rect = this.host.container.getBoundingClientRect(); var style = dom.computedStyle(this.host.container); var top = rect.top + (parseInt(style.borderTopWidth) || 0); var left = rect.left + (parseInt(style.borderLeftWidth) || 0); var maxTop = rect.bottom - top - this.text.clientHeight - 2; var move = (e) => { dom.translate(this.text, e.clientX - left - 2, Math.min(e.clientY - top - 2, maxTop)); }; move(e); if (e.type != "mousedown") return; this.host.renderer.$isMousePressed = true; clearTimeout(this.closeTimeout); // on windows context menu is opened after mouseup if (useragent.isWin) event.capture(this.host.container, move, this.onContextMenuClose.bind(this)); } destroy() { if (this.text.parentElement) this.text.parentElement.removeChild(this.text); } } exports.TextInput = TextInput; exports.$setUserAgentForTests = function (_isMobile, _isIOS) { isMobile = _isMobile; isIOS = _isIOS; }; ================================================ FILE: src/keyboard/textinput_test.js ================================================ /*global CustomEvent*/ "use strict"; require("../test/mockdom"); var assert = require("../test/assertions"); var clipboard = require("../clipboard"); var setUserAgentForTests = require("./textinput").$setUserAgentForTests; var ace = require("../ace"); var editor, changes, textarea, copiedValue; var MouseEvent = function(type, opts) { var e = document.createEvent("MouseEvents"); e.initMouseEvent("mouse" + type, true, true, window, opts.detail, opts.x, opts.y, opts.x, opts.y, opts.ctrl, opts.alt, opts.shift, opts.meta, opts.button || 0, opts.relatedTarget); return e; }; function sendEvent(type, data) { if (!data) data = {}; if (typeof data == "function") return data(); var event = new CustomEvent(type); if (/cut|copy|paste/.test(type)) { event.clipboardData = { getData: function() { return copiedValue; }, setData: function(mime, text) { copiedValue = text; } }; } for (var i in data.key || {}) event[i] = data.key[i]; data.modifier && data.modifier.split("-").map(function(m) { if (m) event[m + "Key"] = true; }); if (data.data) event.data = data.data; if (/input|select|composition/.test(type) || data.key && /Esc/.test(data.key.key)) { if (data.value != null) textarea.value = data.value; if (data.range) textarea.setSelectionRange(data.range[0], data.range[1]); } textarea.dispatchEvent(event); if (data.value != null) assert.equal(textarea.value, data.value); if (data.range != null) { assert.equal(textarea.selectionStart, data.range[0]); assert.equal(textarea.selectionEnd, data.range[1]); if (/\n\n$/.test(textarea.value) && (!data.key || data.key.keyCode != 27)) { assert.ok(textarea.selectionEnd < textarea.value.length); } } editor.resize(true); } module.exports = { setUp: function() { if (editor) this.tearDown(); setUserAgentForTests(false, false); editor = ace.edit(null); document.body.appendChild(editor.container); editor.container.style.height = "200px"; editor.container.style.width = "300px"; editor.container.style.position = "absolute"; editor.container.style.outline = "solid"; editor.resize(true); editor.on("change", function(e) { changes.push(e); }); editor.setOption("useTextareaForIME", true); textarea = editor.textInput.getElement(); changes = []; editor.focus(); }, tearDown: function() { if (editor) { editor.destroy(); editor.container.remove(); editor = textarea = null; } }, "test: simple text input": function() { [ { _: "input", range: [1,1], value: "a\n\n"}, { _: "input", range: [2,2], value: "aa\n\n"}, { _: "input", range: [3,3], value: "aaa\n\n"}, { _: "keydown", range: [0,0], value: "aaa\n\n", key: { code: "Home", key: "Home", keyCode: 36}}, { _: "input", range: [1,1], value: "aaaa\n\n"}, { _: "input", range: [2,2], value: "aaaaa\n\n"}, { _: "keydown", range: [1,2], value: "aaaaa\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}, modifier: "shift-"}, { _: "input", range: [2,2], value: "aaaaa\n\n"} ].forEach(function(data) { sendEvent(data._, data); }); editor.resize(true); assert.equal(changes.filter(function(d) { return d.action == "insert"; }).length, 6); assert.equal(changes.filter(function(d) { return d.action == "remove"; }).length, 1); }, "test: mobile text deletion": function() { editor.setValue("x x", -1); editor.execCommand("gotoright", {times: 4}); editor.resize(true); [ { _: "keydown", range: [4,4], value: "x x\n\n"}, { _: "input", range: [3,3], value: "x x\n\n"}, { _: "keyup", range: [3,3], value: "x x\n\n"}, { _: "keydown", range: [3,3], value: "x x\n\n"}, { _: "input", range: [3,3], value: "x x\n\n"}, { _: "keyup", range: [3,3], value: "x x\n\n"} ].forEach(function(data) { sendEvent(data._, data); }); editor.resize(true); assert.equal(editor.getValue(), "x x"); }, "test: mobile text deletion at the line start": function() { setUserAgentForTests(true, false); editor.destroy(); editor = ace.edit(editor.container); textarea = editor.textInput.getElement(); editor.resize(true); editor.focus(); editor.setValue("\nxy", 1); editor.execCommand("gotoleft"); editor.resize(true); [ { _: "keydown", range: [2,2], value: "\nxy\n\n"}, { _: "input", range: [1,1], value: "\ny\n\n"}, { _: "keyup", range: [1,1], value: "\ny\n\n"}, { _: "keydown", range: [1,1], value: "\ny\n\n"}, { _: "input", range: [0,0], value: "y\n\n"}, { _: "keyup", range: [0,0], value: "y\n\n"} ].forEach(function(data) { sendEvent(data._, data); }); editor.resize(true); assert.equal(editor.getValue(), "y"); }, "test: composition with visible textarea": function() { var data = [ // select ll { _: "keydown", range: [4,4], value: "hello\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}}, { _: "keydown", range: [4,4], value: "hello\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"}, { _: "keydown", range: [3,4], value: "hello\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}, modifier: "shift-"}, { _: "keydown", range: [2,4], value: "hello\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}, modifier: "shift-"}, // start composition { _: "keydown", range: [2,4], value: "hello\n\n", key: { code: "KeyK", key: "Process", keyCode: 229}}, { _: "compositionstart", range: [0,0], value: ""}, { _: "compositionupdate", range: [0,0], value: ""}, { _: "input", range: [1,1], value: "k"}, { _: "keyup", range: [1,1], value: "k", key: { code: "KeyK", key: "k", keyCode: 75}}, { _: "keydown", range: [1,1], value: "k", key: { code: "KeyI", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [0,1], value: "k"}, { _: "input", range: [1,1], value: "き"}, { _: "keyup", range: [1,1], value: "き", key: { code: "KeyI", key: "i", keyCode: 73}}, { _: "keydown", range: [1,1], value: "き", key: { code: "KeyM", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [0,1], value: "き"}, { _: "input", range: [2,2], value: "きm"}, { _: "keyup", range: [2,2], value: "きm", key: { code: "KeyM", key: "m", keyCode: 77}}, { _: "keydown", range: [2,2], value: "きm", key: { code: "KeyO", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [0,2], value: "きm"}, { _: "input", range: [2,2], value: "きも"}, { _: "keyup", range: [2,2], value: "きも", key: { code: "KeyO", key: "o", keyCode: 79}}, { _: "keydown", range: [2,2], value: "きも", key: { code: "KeyN", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [0,2], value: "きも"}, { _: "input", range: [3,3], value: "きもn"}, { _: "keyup", range: [3,3], value: "きもn", key: { code: "KeyN", key: "n", keyCode: 78}}, { _: "keydown", range: [3,3], value: "きもn", key: { code: "KeyO", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [0,3], value: "きもn"}, { _: "input", range: [3,3], value: "きもの"}, { _: "keyup", range: [3,3], value: "きもの", key: { code: "KeyO", key: "o", keyCode: 79}}, { _: "keydown", range: [3,3], value: "きもの", key: { code: "Enter", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [0,3], value: "きもの"}, { _: "input", range: [3,3], value: "きもの"}, function() { assert.ok(editor.renderer.$composition); assert.ok(Math.abs(parseFloat(textarea.style.width) - editor.renderer.characterWidth * 6) < 1); assert.ok(Math.abs(parseFloat(textarea.style.height) - (editor.renderer.lineHeight)) < 1); assert.ok(Math.abs(parseFloat(textarea.style.top)) < 1); assert.ok(/ace_composition/.test(textarea.className)); }, { _: "compositionend", range: [3,3], value: "きもの"}, { _: "keydown", range: [3,3], value: "きもの", key: { code: "KeyK", key: "Process", keyCode: 229}}, { _: "compositionstart", range: [0,0], value: ""}, { _: "compositionupdate", range: [0,0], value: ""}, { _: "input", range: [1,1], value: "k"}, { _: "keyup", range: [1,1], value: "k", key: { code: "KeyK", key: "k", keyCode: 75}}, { _: "keydown", range: [1,1], value: "k", key: { code: "Enter", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [0,1], value: "k"}, { _: "input", range: [1,1], value: "k"}, { _: "compositionend", range: [1,1], value: "k"}, { _: "keydown", range: [1,1], value: "k", key: { code: "Enter", key: "Enter", keyCode: 13}}, { _: "keypress", range: [1,1], value: "k", key: { code: "Enter", key: "Enter", keyCode: 13}}, { _: "input", range: [0,0], value: "o\n\n"}, { _: "select", range: [0,0], value: "o\n\n"}, { _: "keyup", range: [0,0], value: "o\n\n", key: { code: "Enter", key: "Enter", keyCode: 13}}, { _: "keydown", range: [0,0], value: "o\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "input", range: [1,1], value: " o\n\n"}, { _: "keyup", range: [1,1], value: " o\n\n", key: { code: "Space", key: " ", keyCode: 32}}, { _: "keydown", range: [1,1], value: " o\n\n", key: { code: "KeyK", key: "Process", keyCode: 229}}, { _: "compositionstart", range: [0,0], value: ""}, { _: "compositionupdate", range: [0,0], value: ""}, { _: "input", range: [1,1], value: "k"}, { _: "keyup", range: [1,1], value: "k", key: { code: "KeyK", key: "k", keyCode: 75}}, { _: "keydown", range: [1,1], value: "k", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"}, { _: "keydown", range: [1,1], value: "k", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"}, { _: "keydown", range: [1,1], value: "k", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"}, { _: "keydown", range: [1,1], value: "k", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"}, { _: "keydown", range: [1,1], value: "k", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"}, { _: "keydown", range: [1,1], value: "k", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"}, { _: "keydown", range: [1,1], value: "k", key: { code: "KeyZ", key: "Process", keyCode: 229}, modifier: "ctrl-"}, { _: "compositionupdate", range: [0,1], value: "k"}, { _: "input", range: [0,0], value: ""}, { _: "compositionend", range: [0,0], value: ""}, { _: "keyup", range: [0,0], value: "", key: { code: "KeyZ", key: "z", keyCode: 90}, modifier: "ctrl-"}, { _: "keyup", range: [0,0], value: "", key: { code: "ControlLeft", key: "Control", keyCode: 17}} ]; editor.setValue("hello", 1); editor.setOption("useTextareaForIME", true); data.forEach(function(data) { sendEvent(data._, data); }); assert.ok(!editor.renderer.$composition); assert.notOk(/ace_composition/.test(textarea.className)); }, "test: composition with hidden textarea": function() { var data = [ { _: "keydown", range: [4,4], value: "hello\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}}, { _: "select", range: [4,4], value: "hello\n\n"}, { _: "keyup", range: [4,4], value: "hello\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}}, { _: "keydown", range: [4,4], value: "hello\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"}, { _: "keydown", range: [3,4], value: "hello\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}, modifier: "shift-"}, { _: "select", range: [3,4], value: "hello\n\n"}, { _: "keyup", range: [3,4], value: "hello\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}, modifier: "shift-"}, { _: "keydown", range: [2,4], value: "hello\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}, modifier: "shift-"}, { _: "select", range: [2,4], value: "hello\n\n"}, { _: "keyup", range: [2,4], value: "hello\n\n", key: { code: "ArrowLeft", key: "ArrowLeft", keyCode: 37}, modifier: "shift-"}, { _: "keyup", range: [2,4], value: "hello\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}}, { _: "keydown", range: [2,4], value: "hello\n\n", key: { code: "KeyK", key: "Process", keyCode: 229}}, { _: "compositionstart", range: [2,4], value: "hello\n\n"}, { _: "compositionupdate", range: [2,4], value: "hello\n\n"}, { _: "input", range: [3,3], value: "heko\n\n"}, { _: "keyup", range: [3,3], value: "heko\n\n", key: { code: "KeyK", key: "k", keyCode: 75}}, { _: "keydown", range: [3,3], value: "heko\n\n", key: { code: "KeyI", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [2,3], value: "heko\n\n"}, { _: "input", range: [3,3], value: "heきo\n\n"}, { _: "keyup", range: [3,3], value: "heきo\n\n", key: { code: "KeyI", key: "i", keyCode: 73}}, { _: "keydown", range: [3,3], value: "heきo\n\n", key: { code: "KeyM", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [2,3], value: "heきo\n\n"}, { _: "input", range: [4,4], value: "heきmo\n\n"}, { _: "keyup", range: [4,4], value: "heきmo\n\n", key: { code: "KeyM", key: "m", keyCode: 77}}, { _: "keydown", range: [4,4], value: "heきmo\n\n", key: { code: "KeyO", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [2,4], value: "heきmo\n\n"}, { _: "input", range: [4,4], value: "heきもo\n\n"}, { _: "keyup", range: [4,4], value: "heきもo\n\n", key: { code: "KeyO", key: "o", keyCode: 79}}, { _: "keydown", range: [4,4], value: "heきもo\n\n", key: { code: "KeyN", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [2,4], value: "heきもo\n\n"}, { _: "input", range: [5,5], value: "heきもno\n\n"}, { _: "keyup", range: [5,5], value: "heきもno\n\n", key: { code: "KeyN", key: "n", keyCode: 78}}, { _: "keydown", range: [5,5], value: "heきもno\n\n", key: { code: "KeyO", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [2,5], value: "heきもno\n\n"}, { _: "input", range: [5,5], value: "heきものo\n\n"}, { _: "keyup", range: [5,5], value: "heきものo\n\n", key: { code: "KeyO", key: "o", keyCode: 79}}, { _: "keydown", range: [5,5], value: "heきものo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [2,5], value: "heきものo\n\n"}, { _: "input", range: [4,4], value: "he着物o\n\n"}, { _: "keyup", range: [4,4], value: "he着物o\n\n", key: { code: "Space", key: " ", keyCode: 32}}, { _: "keydown", range: [4,4], value: "he着物o\n\n", key: { code: "Enter", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [2,4], value: "he着物o\n\n"}, { _: "input", range: [4,4], value: "he着物o\n\n"}, function() { assert.ok(editor.renderer.$composition); assert.ok(textarea.style.fontSize, "1px"); assert.notOk(/ace_composition/.test(textarea.className)); assert.ok(/composition_marker/.test(editor.renderer.$markerBack.element.innerHTML)); assert.notOk(/ace_composition/.test(textarea.className)); assert.equal(textarea.style.height, "1px"); assert.equal(textarea.style.top, editor.renderer.lineHeight + 2 + "px"); }, { _: "compositionend", range: [4,4], value: "he着物o\n\n"}, { _: "keydown", range: [4,4], value: "he着物o\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "input", range: [5,5], value: "he着物 o\n\n"}, { _: "keyup", range: [5,5], value: "he着物 o\n\n", key: { code: "Space", key: " ", keyCode: 32}}, { _: "keydown", range: [5,5], value: "he着物 o\n\n", key: { code: "KeyK", key: "Process", keyCode: 229}}, { _: "compositionstart", range: [5,5], value: "he着物 o\n\n"}, { _: "compositionupdate", range: [5,5], value: "he着物 o\n\n"}, { _: "input", range: [6,6], value: "he着物 ko\n\n"}, { _: "keyup", range: [6,6], value: "he着物 ko\n\n", key: { code: "KeyK", key: "k", keyCode: 75}}, { _: "keydown", range: [6,6], value: "he着物 ko\n\n", key: { code: "KeyA", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,6], value: "he着物 ko\n\n"}, { _: "input", range: [6,6], value: "he着物 かo\n\n"}, { _: "keyup", range: [6,6], value: "he着物 かo\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keydown", range: [6,6], value: "he着物 かo\n\n", key: { code: "KeyT", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,6], value: "he着物 かo\n\n"}, { _: "input", range: [7,7], value: "he着物 かto\n\n"}, { _: "keyup", range: [7,7], value: "he着物 かto\n\n", key: { code: "KeyT", key: "t", keyCode: 84}}, { _: "keydown", range: [7,7], value: "he着物 かto\n\n", key: { code: "KeyA", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,7], value: "he着物 かto\n\n"}, { _: "input", range: [7,7], value: "he着物 かたo\n\n"}, { _: "keyup", range: [7,7], value: "he着物 かたo\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keydown", range: [7,7], value: "he着物 かたo\n\n", key: { code: "KeyN", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,7], value: "he着物 かたo\n\n"}, { _: "input", range: [8,8], value: "he着物 かたno\n\n"}, { _: "keyup", range: [8,8], value: "he着物 かたno\n\n", key: { code: "KeyN", key: "n", keyCode: 78}}, { _: "keydown", range: [8,8], value: "he着物 かたno\n\n", key: { code: "KeyA", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,8], value: "he着物 かたno\n\n"}, { _: "input", range: [8,8], value: "he着物 かたなo\n\n"}, { _: "keyup", range: [8,8], value: "he着物 かたなo\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keydown", range: [8,8], value: "he着物 かたなo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,8], value: "he着物 かたなo\n\n"}, { _: "input", range: [6,6], value: "he着物 刀o\n\n"}, { _: "keyup", range: [6,6], value: "he着物 刀o\n\n", key: { code: "Space", key: " ", keyCode: 32}}, { _: "keydown", range: [6,6], value: "he着物 刀o\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,6], value: "he着物 刀o\n\n"}, { _: "input", range: [8,8], value: "he着物 過多なo\n\n"}, { _: "keyup", range: [8,8], value: "he着物 過多なo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "keydown", range: [8,8], value: "he着物 過多なo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,8], value: "he着物 過多なo\n\n"}, { _: "input", range: [8,8], value: "he着物 夥多なo\n\n"}, { _: "keyup", range: [8,8], value: "he着物 夥多なo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "keydown", range: [8,8], value: "he着物 夥多なo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,8], value: "he着物 夥多なo\n\n"}, { _: "input", range: [8,8], value: "he着物 かたなo\n\n"}, { _: "keyup", range: [8,8], value: "he着物 かたなo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "keydown", range: [8,8], value: "he着物 かたなo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,8], value: "he着物 かたなo\n\n"}, { _: "input", range: [8,8], value: "he着物 カタナo\n\n"}, { _: "keyup", range: [8,8], value: "he着物 カタナo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "keydown", range: [8,8], value: "he着物 カタナo\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,8], value: "he着物 カタナo\n\n"}, { _: "input", range: [6,6], value: "he着物 刀o\n\n"}, { _: "keyup", range: [6,6], value: "he着物 刀o\n\n", key: { code: "Space", key: "Process", keyCode: 229}}, { _: "keydown", range: [6,6], value: "he着物 刀o\n\n", key: { code: "Enter", key: "Process", keyCode: 229}}, { _: "compositionupdate", range: [5,6], value: "he着物 刀o\n\n"}, { _: "input", range: [6,6], value: "he着物 刀o\n\n"}, { _: "compositionend", range: [6,6], value: "he着物 刀o\n\n"} ]; editor.setValue("hello", 1); editor.setOption("useTextareaForIME", false); data.forEach(function(data) { sendEvent(data._, data); }); assert.ok(!editor.renderer.$composition); assert.notOk(/ace_composition/.test(textarea.className)); }, "test: korean composition": function() { var data = [ { _: "input", range: [1,1], value: "ㅁ\n\n", key: { key: "a", keyCode: 229}}, { _: "compositionstart", range: [1,1], value: "ㅁ\n\n"}, { _: "select", range: [0,1], value: "ㅁ\n\n"}, { _: "compositionupdate", range: [0,1], value: "ㅁ\n\n"}, { _: "input", range: [0,1], value: "ㅁ\n\n"}, { _: "keyup", range: [0,1], value: "ㅁ\n\n", key: { key: "a", keyCode: 65}}, { _: "keydown", range: [0,1], value: "ㅁ\n\n", key: { key: "p", keyCode: 229}}, { _: "select", range: [0,1], value: "메\n\n"}, { _: "compositionupdate", range: [0,1], value: "메\n\n"}, function() { assert.equal(editor.getValue(), "메"); }, { _: "input", range: [0,1], value: "메\n\n"}, { _: "keyup", range: [0,1], value: "메\n\n", key: { key: "p", keyCode: 80}}, { _: "keydown", range: [0,1], value: "메\n\n", key: { key: "t", keyCode: 229}}, { _: "select", range: [0,1], value: "멧\n\n"}, { _: "compositionupdate", range: [0,1], value: "멧\n\n"}, function() { assert.equal(editor.getValue(), "멧"); }, { _: "input", range: [0,1], value: "멧\n\n"}, { _: "keyup", range: [0,1], value: "멧\n\n", key: { key: "t", keyCode: 84}}, { _: "keydown", range: [0,1], value: "멧\n\n", key: { key: "a", keyCode: 229}}, { _: "compositionend", range: [2,2], value: "멧ㅁ\n\n"}, { _: "compositionstart", range: [2,2], value: "멧ㅁ\n\n"}, { _: "select", range: [1,2], value: "멧ㅁ\n\n"}, { _: "compositionupdate", range: [1,2], value: "멧ㅁ\n\n"}, { _: "input", range: [1,2], value: "멧ㅁ\n\n"}, { _: "keyup", range: [1,2], value: "멧ㅁ\n\n", key: { key: "a", keyCode: 65}}, { _: "keydown", range: [1,2], value: "멧ㅁ\n\n", key: { key: "t", keyCode: 229}}, { _: "compositionend", range: [3,3], value: "멧ㅁㅅ\n\n"}, { _: "compositionstart", range: [3,3], value: "멧ㅁㅅ\n\n"}, { _: "select", range: [2,3], value: "멧ㅁㅅ\n\n"}, { _: "compositionupdate", range: [2,3], value: "멧ㅁㅅ\n\n"}, { _: "input", range: [2,3], value: "멧ㅁㅅ\n\n"}, { _: "keyup", range: [2,3], value: "멧ㅁㅅ\n\n", key: { key: "t", keyCode: 84}}, { _: "keydown", range: [2,3], value: "멧ㅁㅅ\n\n", key: { key: "p", keyCode: 229}}, { _: "select", range: [2,3], value: "멧ㅁ세\n\n"}, { _: "compositionupdate", range: [2,3], value: "멧ㅁ세\n\n"}, { _: "input", range: [2,3], value: "멧ㅁ세\n\n"}, { _: "keyup", range: [2,3], value: "멧ㅁ세\n\n", key: { key: "p", keyCode: 80}}, { _: "keydown", range: [2,3], value: "멧ㅁ세\n\n", key: { key: "a", keyCode: 229}}, { _: "select", range: [2,3], value: "멧ㅁ셈\n\n"}, { _: "compositionupdate", range: [2,3], value: "멧ㅁ셈\n\n"}, function() { assert.equal(editor.getValue(), "멧ㅁ셈"); }, { _: "input", range: [2,3], value: "멧ㅁ셈\n\n"}, { _: "keyup", range: [2,3], value: "멧ㅁ셈\n\n", key: { key: "a", keyCode: 65}}, { _: "keydown", range: [2,3], value: "멧ㅁ셈\n\n", key: { key: "a", keyCode: 229}}, { _: "compositionend", range: [4,4], value: "멧ㅁ셈ㅁ\n\n"} ]; editor.setValue("", 1); editor.setOption("useTextareaForIME", false); data.forEach(function(data) { sendEvent(data._, data); }); assert.ok(!editor.renderer.$composition); assert.notOk(/ace_composition/.test(textarea.className)); assert.equal(editor.getValue(), "멧ㅁ셈ㅁ"); }, "test: selection synchronization": function() { editor.session.setValue("juhu\nkinners\n"); [ { _: "keydown", range: [1,1], value: "juhu\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}}, { _: "keydown", range: [2,2], value: "juhu\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}}, { _: "keydown", range: [2,2], value: "juhu\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"}, { _: "keydown", range: [2,3], value: "juhu\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,4], value: "juhu\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,5], value: "juhu\nkinners\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,6], value: "juhu\nkinners\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,7], value: "juhu\nkinners\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,8], value: "juhu\nkinners\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [0,8], value: "kinners\n\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}, modifier: "shift-"}, { _: "keydown", range: [0,0], value: "\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}}, { _: "keydown", range: [0,0], value: "\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"}, { _: "keydown", range: [3,8], value: "kinners\n\n\n", key: { code: "ArrowUp", key: "ArrowUp", keyCode: 38}, modifier: "shift-"}, { _: "keydown", range: [3,12], value: "juhu\nkinners\n\n", key: { code: "ArrowUp", key: "ArrowUp", keyCode: 38}, modifier: "shift-"} ].forEach(function(data) { sendEvent(data._, data); }); // test overflow editor.session.setValue("0123456789".repeat(80)); editor.execCommand("gotoright"); editor.execCommand("selectright"); assert.equal([textarea.value.length, textarea.selectionStart, textarea.selectionEnd].join(","), "402,1,2"); editor.execCommand("gotolineend"); assert.equal([textarea.value.length, textarea.selectionStart, textarea.selectionEnd].join(","), "3,0,0"); editor.execCommand("selectleft"); assert.equal([textarea.value.length, textarea.selectionStart, textarea.selectionEnd].join(","), "3,0,1"); }, "test: selection synchronization with extra lines enabled": function() { editor.textInput.setNumberOfExtraLines(1); editor.session.setValue("line1\nline2\nline3\nline4\nline5\nline6\n"); [ { _: "keydown", range: [1,1], value: "line1\nline2\nline3\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}}, { _: "keydown", range: [2,2], value: "line1\nline2\nline3\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}}, { _: "keydown", range: [2,2], value: "line1\nline2\nline3\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"}, { _: "keydown", range: [2,3], value: "line1\nline2\nline3\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,4], value: "line1\nline2\nline3\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,5], value: "line1\nline2\nline3\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,6], value: "line1\nline2\nline3\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,7], value: "line1\nline2\nline3\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,8], value: "line1\nline2\nline3\n\n", key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}, modifier: "shift-"}, { _: "keydown", range: [2,14], value: "line1\nline2\nline3\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}, modifier: "shift-"}, { _: "keydown", range: [2,2], value: "line4\nline5\nline6\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}}, { _: "keydown", range: [2,2], value: "line4\nline5\nline6\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"}, { _: "keydown", range: [14,20], value: "line1\nline2\nline3\nline4\n\n", key: { code: "ArrowUp", key: "ArrowUp", keyCode: 38}, modifier: "shift-"}, { _: "keydown", range: [8,8], value: "line1\nline2\nline3\n\n", key: { code: "ArrowUp", key: "ArrowUp", keyCode: 38}}, { _: "keydown", range: [14,14], value: "line1\nline2\nline3\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}}, { _: "keydown", range: [2,8], value: "line3\nline4\nline5\nline6\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}, modifier: "shift-"} ].forEach(function(data) { sendEvent(data._, data); }); // test overflow editor.session.setValue("0123456789".repeat(80)); editor.execCommand("gotoright"); editor.execCommand("selectright"); assert.equal([textarea.value.length, textarea.selectionStart, textarea.selectionEnd].join(","), "402,1,2"); editor.execCommand("gotolineend"); assert.equal([textarea.value.length, textarea.selectionStart, textarea.selectionEnd].join(","), "3,0,0"); editor.execCommand("selectleft"); assert.equal([textarea.value.length, textarea.selectionStart, textarea.selectionEnd].join(","), "3,0,1"); }, "test: chinese ime on ie": function() { editor.setOption("useTextareaForIME", false); [ { _: "keydown", range: [0,0], value: "\n\n", key: { key: "Backspace", keyCode: 8}}, { _: "keyup", range: [0,0], value: "\n\n", key: { key: "Backspace", keyCode: 8}}, { _: "keydown", range: [0,0], value: "\n\n", key: { key: "k", keyCode: 229}}, { _: "compositionstart", range: [0,0], value: "\n\n"}, { _: "compositionupdate", range: [1,1], value: "k\n\n"}, { _: "input", range: [1,1], value: "k\n\n"}, { _: "keyup", range: [1,1], value: "k\n\n", key: { key: "k", keyCode: 75}}, { _: "keydown", range: [1,1], value: "k\n\n", key: { key: "i", keyCode: 229}}, { _: "compositionupdate", range: [2,2], value: "ki\n\n"}, { _: "input", range: [2,2], value: "ki\n\n"}, { _: "keyup", range: [2,2], value: "ki\n\n", key: { key: "i", keyCode: 73}}, { _: "keydown", range: [2,2], value: "ki\n\n", key: { key: "i", keyCode: 229}}, { _: "compositionupdate", range: [3,3], value: "kii\n\n"}, { _: "input", range: [3,3], value: "kii\n\n"}, { _: "keyup", range: [3,3], value: "kii\n\n", key: { key: "i", keyCode: 73}}, { _: "keydown", range: [3,3], value: "kii\n\n", key: { key: "i", keyCode: 229}}, { _: "compositionupdate", range: [4,4], value: "kiii\n\n"}, { _: "input", range: [4,4], value: "kiii\n\n"}, { _: "keyup", range: [4,4], value: "kiii\n\n", key: { key: "i", keyCode: 73}}, { _: "keydown", range: [4,4], value: "kiii\n\n", key: { key: "2", keyCode: 229}}, { _: "compositionupdate", range: [4,4], value: "开iii\n\n"}, { _: "input", range: [4,4], value: "开iii\n\n"}, { _: "keyup", range: [4,4], value: "开iii\n\n", key: { key: "2", keyCode: 98}}, { _: "keydown", range: [4,4], value: "开iii\n\n", key: { key: "Backspace", keyCode: 229}}, { _: "compositionupdate", range: [3,3], value: "开ii\n\n"}, { _: "input", range: [3,3], value: "开ii\n\n"}, { _: "keyup", range: [3,3], value: "开ii\n\n", key: { key: "Backspace", keyCode: 8}}, { _: "keydown", range: [3,3], value: "开ii\n\n", key: { key: "r", keyCode: 229}}, { _: "compositionupdate", range: [4,4], value: "开iir\n\n"}, { _: "input", range: [4,4], value: "开iir\n\n"}, { _: "keyup", range: [4,4], value: "开iir\n\n", key: { key: "r", keyCode: 82}}, { _: "keydown", range: [4,4], value: "开iir\n\n", key: { key: "d", keyCode: 229}}, { _: "compositionupdate", range: [5,5], value: "开iird\n\n"}, { _: "input", range: [5,5], value: "开iird\n\n"}, { _: "keyup", range: [5,5], value: "开iird\n\n", key: { key: "d", keyCode: 68}}, { _: "keydown", range: [5,5], value: "开iird\n\n", key: { key: "Spacebar", keyCode: 229}}, { _: "compositionend", range: [5,5], value: "开iird\n\n"}, { _: "keyup", range: [5,5], value: "开iird\n\n", key: { key: "Spacebar", keyCode: 32}}, { _: "keyup", range: [5,5], value: "开iird\n\n", key: { key: "Spacebar", keyCode: 32}}, { _: "keydown", range: [5,5], value: "开iird\n\n", key: { key: "i", keyCode: 229}}, { _: "compositionstart", range: [5,5], value: "开iird\n\n"}, { _: "compositionupdate", range: [6,6], value: "开iirdi\n\n"}, { _: "input", range: [6,6], value: "开iirdi\n\n"}, { _: "keyup", range: [6,6], value: "开iirdi\n\n", key: { key: "i", keyCode: 73}}, { _: "keydown", range: [6,6], value: "开iirdi\n\n", key: { key: "i", keyCode: 229}}, { _: "compositionupdate", range: [7,7], value: "开iirdii\n\n"}, { _: "input", range: [7,7], value: "开iirdii\n\n"}, { _: "keyup", range: [7,7], value: "开iirdii\n\n", key: { key: "i", keyCode: 73}}, { _: "keydown", range: [7,7], value: "开iirdii\n\n", key: { key: "Backspace", keyCode: 229}}, { _: "compositionupdate", range: [6,6], value: "开iirdi\n\n"}, { _: "input", range: [6,6], value: "开iirdi\n\n"}, { _: "keyup", range: [6,6], value: "开iirdi\n\n", key: { key: "Backspace", keyCode: 8}}, { _: "keydown", range: [6,6], value: "开iirdi\n\n", key: { key: "r", keyCode: 229}}, { _: "compositionupdate", range: [7,7], value: "开iirdir\n\n"}, { _: "input", range: [7,7], value: "开iirdir\n\n"}, { _: "keyup", range: [7,7], value: "开iirdir\n\n", key: { key: "r", keyCode: 82}}, { _: "keydown", range: [7,7], value: "开iirdir\n\n", key: { key: "e", keyCode: 229}}, { _: "compositionupdate", range: [8,8], value: "开iirdire\n\n"}, { _: "input", range: [8,8], value: "开iirdire\n\n"}, { _: "keyup", range: [8,8], value: "开iirdire\n\n", key: { key: "e", keyCode: 69}}, { _: "keydown", range: [8,8], value: "开iirdire\n\n", key: { key: "Backspace", keyCode: 229}}, { _: "compositionupdate", range: [7,7], value: "开iirdir\n\n"}, { _: "input", range: [7,7], value: "开iirdir\n\n"}, { _: "keyup", range: [7,7], value: "开iirdir\n\n", key: { key: "Backspace", keyCode: 8}}, { _: "keydown", range: [7,7], value: "开iirdir\n\n", key: { key: "Backspace", keyCode: 229}}, { _: "compositionupdate", range: [6,6], value: "开iirdi\n\n"}, { _: "input", range: [6,6], value: "开iirdi\n\n"}, { _: "keyup", range: [6,6], value: "开iirdi\n\n", key: { key: "Backspace", keyCode: 8}}, { _: "keydown", range: [6,6], value: "开iirdi\n\n", key: { key: "Backspace", keyCode: 229}}, { _: "compositionend", range: [5,5], value: "开iird\n\n"}, { _: "input", range: [5,5], value: "开iird\n\n"}, { _: "keyup", range: [5,5], value: "开iird\n\n", key: { key: "Backspace", keyCode: 8}}, { _: "keyup", range: [5,5], value: "开iird\n\n", key: { key: "Backspace", keyCode: 8}}, { _: "keydown", range: [5,5], value: "开iird\n\n", key: { key: "d", keyCode: 229}}, { _: "compositionstart", range: [5,5], value: "开iird\n\n"}, { _: "compositionupdate", range: [6,6], value: "开iirdd\n\n"}, { _: "input", range: [6,6], value: "开iirdd\n\n"}, { _: "keyup", range: [6,6], value: "开iirdd\n\n", key: { key: "d", keyCode: 68}}, { _: "keydown", range: [6,6], value: "开iirdd\n\n", key: { key: "d", keyCode: 229}}, { _: "compositionupdate", range: [7,7], value: "开iirddd\n\n"}, { _: "input", range: [7,7], value: "开iirddd\n\n"}, { _: "keyup", range: [7,7], value: "开iirddd\n\n", key: { key: "d", keyCode: 68}}, { _: "keydown", range: [7,7], value: "开iirddd\n\n", key: { key: "d", keyCode: 229}}, { _: "compositionupdate", range: [8,8], value: "开iirdddd\n\n"}, { _: "input", range: [8,8], value: "开iirdddd\n\n"}, { _: "keyup", range: [8,8], value: "开iirdddd\n\n", key: { key: "d", keyCode: 68}}, { _: "keydown", range: [8,8], value: "开iirdddd\n\n", key: { key: "d", keyCode: 229}}, { _: "compositionupdate", range: [9,9], value: "开iirddddd\n\n"}, { _: "input", range: [9,9], value: "开iirddddd\n\n"}, { _: "keyup", range: [9,9], value: "开iirddddd\n\n", key: { key: "d", keyCode: 68}}, { _: "keydown", range: [9,9], value: "开iirddddd\n\n", key: { key: "d", keyCode: 229}}, { _: "compositionupdate", range: [10,10], value: "开iirdddddd\n\n"}, { _: "input", range: [10,10], value: "开iirdddddd\n\n"}, { _: "keyup", range: [10,10], value: "开iirdddddd\n\n", key: { key: "d", keyCode: 68}}, { _: "keydown", range: [10,10], value: "开iirdddddd\n\n", key: { key: "d", keyCode: 229}}, { _: "compositionupdate", range: [11,11], value: "开iird大大dddd\n\n"}, { _: "input", range: [11,11], value: "开iird大大dddd\n\n"}, { _: "keyup", range: [11,11], value: "开iird大大dddd\n\n", key: { key: "d", keyCode: 68}}, { _: "keydown", range: [11,11], value: "开iird大大dddd\n\n", key: { key: "1", keyCode: 229}}, { _: "compositionupdate", range: [11,11], value: "开iird大大得到当地\n\n"}, { _: "input", range: [11,11], value: "开iird大大得到当地\n\n"}, { _: "keyup", range: [11,11], value: "开iird大大得到当地\n\n", key: { key: "1", keyCode: 97}}, { _: "keydown", range: [11,11], value: "开iird大大得到当地\n\n", key: { key: "Esc", keyCode: 229}}, function() { assert.equal(editor.getValue(), "开iird大大得到当地"); }, { _: "compositionend", range: [5,5], value: "开iird\n\n"}, { _: "input", range: [5,5], value: "开iird\n\n"}, { _: "keyup", range: [5,5], value: "开iird\n\n", key: { key: "Esc", keyCode: 27}}, { _: "keyup", range: [5,5], value: "开iird\n\n", key: { key: "Esc", keyCode: 27}}, { _: "keydown", range: [5,5], value: "开iird\n\n", key: { key: "Esc", keyCode: 27}}, { _: "keypress", range: [2,2], value: "\n\n", key: { key: "Esc", keyCode: 27}}/*, { _: "keyup", range: [4,4], value: "\n\n", key: { key: "Esc", keyCode: 27}}, { _: "keydown", range: [4,4], value: "\n\n", key: { key: "4", keyCode: 229}}, { _: "compositionstart", range: [4,4], value: "\n\n"}, { _: "compositionend", range: [1,1], value: "4\n\n"}, { _: "input", range: [1,1], value: "4\n\n"}, { _: "keyup", range: [1,1], value: "4\n\n", key: { key: "4", keyCode: 100}}, { _: "keyup", range: [1,1], value: "4\n\n", key: { key: "4", keyCode: 100}},*/ ].forEach(function(data, i) { sendEvent(data._, data); }); assert.equal(editor.getValue(), "开iird"); }, "test: backspace during composition": function() { editor.setValue("lxx\n", 1); editor.execCommand("golineup"); editor.selection.moveTo(0, 1); editor.setOption("useTextareaForIME", true); [ { _: "keydown", range: [0,0], value: "xx\n\n", key: { code: "Backspace", key: "Backspace", keyCode: 8}}, function() { assert.equal(editor.getValue(), "xx\n"); }, { _: "keydown", range: [0,0], value: "xx\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keypress", range: [0,0], value: "xx\n\n", key: { code: "KeyA", key: "a", keyCode: 97}}, { _: "input", data: "a", inputType: "insertText", range: [1,1], value: "axx\n\n"}, { _: "keyup", range: [1,1], value: "axx\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keydown", range: [1,1], value: "axx\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keypress", range: [1,1], value: "axx\n\n", key: { code: "KeyA", key: "a", keyCode: 97}}, { _: "input", data: "a", inputType: "insertText", range: [2,2], value: "aaxx\n\n"}, { _: "keyup", range: [2,2], value: "aaxx\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keydown", range: [2,2], value: "aaxx\n\n", key: { code: "AltRight", key: "Alt", keyCode: 18}, modifier: "alt-"}, { _: "keydown", range: [2,2], value: "aaxx\n\n", key: { code: "KeyI", key: "Dead", keyCode: 73}, modifier: "alt-"}, { _: "compositionstart", data: "", range: [0,0], value: ""}, function() { editor.textInput.getElement().value = "ˆ"; }, { _: "compositionupdate", data: "ˆ", range: [0,0], value: ""}, { _: "input", data: "ˆ", inputType: "insertCompositionText", range: [1,1], value: "ˆ"}, { _: "keyup", range: [1,1], value: "ˆ", key: { code: "KeyI", key: "ˆ", keyCode: 73}, modifier: "alt-"}, { _: "keyup", range: [1,1], value: "ˆ", key: { code: "AltRight", key: "Alt", keyCode: 18}}, { _: "keydown", range: [1,1], value: "ˆ", key: { code: "Backspace", key: "Backspace", keyCode: 8}}, { _: "compositionend", data: "ˆ", range: [1,1], value: "ˆ"}, { _: "input", data: "ˆ", inputType: "insertCompositionText", range: [1,1], value: "ˆ"}, { _: "keydown", range: [2,2], value: "aaxx\n\n", key: { code: "Backspace", key: "Backspace", keyCode: 8}}, { _: "keyup", range: [2,2], value: "aaxx\n\n", key: { code: "Backspace", key: "Backspace", keyCode: 8}}, { _: "keydown", range: [2,2], value: "aaxx\n\n", key: { code: "AltRight", key: "Alt", keyCode: 18}, modifier: "alt-"}, { _: "keydown", range: [2,2], value: "aaxx\n\n", key: { code: "KeyI", key: "Dead", keyCode: 73}, modifier: "alt-"}, { _: "compositionstart", data: "", range: [0,0], value: ""}, { _: "compositionupdate", data: "ˆ", range: [0,0], value: ""}, function() { editor.textInput.getElement().value = "ˆ"; }, { _: "input", data: "ˆ", inputType: "insertCompositionText", range: [1,1], value: "ˆ"}, { _: "keyup", range: [1,1], value: "ˆ", key: { code: "KeyI", key: "ˆ", keyCode: 73}, modifier: "alt-"}, { _: "keyup", range: [1,1], value: "ˆ", key: { code: "AltRight", key: "Alt", keyCode: 18}}, { _: "keydown", range: [1,1], value: "ˆ", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"}, { _: "keyup", range: [1,1], value: "ˆ", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}}, { _: "keydown", range: [1,1], value: "ˆ", key: { code: "Delete", key: "Delete", keyCode: 46}}, { _: "compositionend", data: "ˆ", range: [1,1], value: "ˆ"}, { _: "input", data: "ˆ", inputType: "insertCompositionText", range: [1,1], value: "ˆ"}, { _: "keydown", range: [3,3], value: "aaˆx\n\n", key: { code: "Delete", key: "Delete", keyCode: 46}}, { _: "select", range: [3,3], value: "aaˆx\n\n"}, { _: "keyup", range: [3,3], value: "aaˆx\n\n", key: { code: "Delete", key: "Delete", keyCode: 46}} ].forEach(function(data, i) { sendEvent(data._, data); }); assert.equal(editor.getValue(), "aaˆx\n"); }, "test: mac pressAndHold on firefox": function() { editor.setOption("useTextareaForIME", true); [ { _: "keydown", range: [0,0], value: "\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keypress", range: [0,0], value: "\n\n", key: { code: "KeyA", key: "a", keyCode: 97}}, { _: "input", inputType: "insertText", range: [1,1], value: "a\n\n"}, { _: "keydown", range: [1,1], value: "a\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keyup", range: [1,1], value: "a\n\n", key: { code: "KeyA", key: "a", keyCode: 65}}, { _: "keydown", range: [1,1], value: "a\n\n", key: { code: "Digit1", key: "1", keyCode: 49}}, { _: "keyup", range: [1,1], value: "a\n\n", key: { code: "Digit1", key: "1", keyCode: 49}}, { _: "compositionstart", data: "a", range: [0,1], value: "a\n\n"}, { _: "compositionupdate", range: [0,1], value: "a\n\n"}, { _: "compositionend", range: [1,1], value: "à\n\n"}, { _: "input", inputType: "insertCompositionText", range: [1,1], value: "à\n\n"} ].forEach(function(data, i) { sendEvent(data._, data); }); assert.equal(editor.getValue(), "à"); }, "test: contextmenu": function() { var value = "juhu\nkinners\n"; editor.setValue(value); editor.execCommand("gotoright"); editor.resize(true); var target = editor.renderer.getMouseEventTarget(); // select all textarea.setSelectionRange(0, 1000); textarea.dispatchEvent(new CustomEvent("select")); assert.ok(editor.getSelectedText(), value); // delete target.dispatchEvent(MouseEvent("down", {x: 0, y: 0, button: 2})); target.dispatchEvent(new CustomEvent("contextmenu")); textarea.value = textarea.value.slice(textarea.selectionEnd); textarea.setSelectionRange(0, 0); textarea.dispatchEvent(new CustomEvent("input")); assert.equal(editor.getValue(), ""); }, "test clipboard": function() { copiedValue = "x"; sendEvent("paste"); assert.equal(editor.getValue(), "x"); copiedValue = "--"; sendEvent("copy"); assert.equal(copiedValue, "--"); editor.setOption("copyWithEmptySelection", true); sendEvent("copy"); assert.equal(copiedValue, "x\n"); editor.setValue("1\n2", -1); sendEvent("paste"); assert.equal(editor.getValue(), "x\n1\n2"); textarea.select(); sendEvent("select"); sendEvent("cut"); assert.equal(copiedValue, "x\n1\n2"); editor.setValue("0", 1); sendEvent("paste"); assert.equal(editor.getValue(), "0x\n1\n2"); editor.setValue(""); clipboard.cancel(); sendEvent("paste"); assert.equal(editor.getValue(), ""); }, "test inputType undo": function() { editor.execCommand("insertstring", "x"); assert.equal(editor.getValue(), "x"); sendEvent("input", {key: {inputType: "historyUndo"}}); assert.equal(editor.getValue(), ""); sendEvent("input", {key: {inputType: "historyRedo"}}); assert.equal(editor.getValue(), "x"); }, "test: text input aria label without extra label set": function() { editor.setValue("x x", -1); editor.setOption('enableKeyboardAccessibility', true); editor.renderer.$loop._flush(); let text = editor.container.querySelector(".ace_text-input"); assert.equal(text.getAttribute("aria-label"), "Cursor at row 1"); }, "test: text input aria label updated on focus": function() { editor.setValue("x x\ny y", -1); editor.setOption('enableKeyboardAccessibility', true); editor.renderer.$loop._flush(); let text = editor.container.querySelector(".ace_text-input"); assert.equal(text.getAttribute("aria-label"), "Cursor at row 1"); editor.focus(); sendEvent("keydown", {key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}}); editor.renderer.$loop._flush(); editor.blur(); editor.focus(); assert.equal(text.getAttribute("aria-label"), "Cursor at row 2"); }, "test: text input aria label with extra label set": function() { editor.setValue("x x", -1); editor.setOption('textInputAriaLabel', "super cool editor"); editor.setOption('enableKeyboardAccessibility', true); editor.renderer.$loop._flush(); let text = editor.container.querySelector(".ace_text-input"); assert.equal(text.getAttribute("aria-label"), "super cool editor, Cursor at row 1"); }, "test: text input aria label updated on cursor move": function() { editor.setValue("line1\nline2\nline3", -1); editor.setOption('enableKeyboardAccessibility', true); editor.renderer.$loop._flush(); let text = editor.container.querySelector(".ace_text-input"); assert.equal(text.getAttribute("aria-label"), "Cursor at row 1"); editor.focus(); sendEvent("keydown", {key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}}); sendEvent("keydown", {key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}}); sendEvent("keydown", {key: { code: "ArrowRight", key: "ArrowRight", keyCode: 39}}); editor.renderer.$loop._flush(); assert.equal(text.getAttribute("aria-label"), "Cursor at row 3"); }, }; require("../test/run")(module); ================================================ FILE: src/keyboard/vim.js ================================================ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/5/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 instantiation * 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. */ '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 domLib = 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; var hardWrap = require("../ext/hardwrap").hardWrap; require("../multi_select"); var CodeMirror = function(ace) { this.ace = ace; this.state = {}; this.marks = {}; this.options = {}; 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"); }, goLineLeft: function(cm) { cm.ace.selection.moveCursorLineStart(); }, goLineRight: function(cm) { cm.ace.selection.moveCursorLineEnd(); } }; CodeMirror.keyMap = {}; CodeMirror.addClass = CodeMirror.rmClass = function() {}; CodeMirror.e_stop = CodeMirror.e_preventDefault = event.stopEvent; CodeMirror.keyName = function(e) { var key = (KEYS[e.keyCode] || e.key || ""); 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 (!map) map = "default"; if (typeof map == "string") map = CodeMirror.keyMap[map] || CodeMirror.keyMap['default']; 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.findMatchingTag = function (cm, head) { return cm.findMatchingTag(head); } CodeMirror.findEnclosingTag = function (cm, head) { }; 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) { if (this.$lineHandleChanges) { this.$lineHandleChanges.push(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 (!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") { if (this.state.dialog) this.ace.curOp.command.scrollIntoView = this.ace.curOp.vimDialogScroll; 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; } if (query == "\\n") { query = "\n"; isRegexp = false; } 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); last = range; return last && [!last.isEmpty()]; }, 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; // workaround for session.replace not handling negative rows var range = new Range(s.line, s.ch, e.line, e.ch); this.ace.session.$clipRangeToDocument(range); return this.ace.session.replace(range, text); }; this.replaceSelection = this.replaceSelections = function(p) { var strings = Array.isArray(p) && p; var sel = this.ace.selection; if (this.ace.inVirtualSelectionMode) { this.ace.session.replace(sel.getRange(), strings ? p[0] || "": p ); 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], strings ? p[i] || "" : p); 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.container; }; 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; case 'keyMap': this.state.$keyMap = val; return; break; default: name = optMap[name]; } if (name) this.ace.setOption(name, val); }; this.getOption = function(name) { var val; var aceOpt = optMap[name]; if (aceOpt) val = this.ace.getOption(aceOpt); switch (name) { case 'indentWithTabs': name = optMap[name]; return !val; case 'keyMap': return this.state.$keyMap || 'vim'; } 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, -1); }; 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.findMatchingTag = function (pos) { var m = this.ace.session.getMatchingTags(toAcePos(pos)); if (!m) return; return { open: { from: toCmPos(m.openTag.start), to: toCmPos(m.openTag.end) }, close: { from: toCmPos(m.closeTag.start), to: toCmPos(m.closeTag.end) } }; }; 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.textInput.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; var tokenRe = /paren|text|operator|tag/; if (dir == 1) { var m = this.ace.session.$findClosingBracket(re.slice(1, 2), toAcePos(pos), tokenRe); } else { var m = this.ace.session.$findOpeningBracket(re.slice(-2, -1), {row: pos.line, column: pos.ch + 1}, tokenRe); if (!m && options.bracketRegex && options.bracketRegex.test(this.getLine(pos.line)[pos.ch - 1])) { m = {row: pos.line, column: pos.ch - 1}; } } return m && {pos: toCmPos(m)}; }; this.refresh = function() { return this.ace.resize(true); }; this.getMode = function() { return { name : this.getOption("mode") }; }; this.execCommand = function(name) { if (CodeMirror.commands.hasOwnProperty(name)) return CodeMirror.commands[name](this); if (name == "indentAuto") return this.ace.execCommand("autoindent"); console.log(name + " is not implemented"); }; this.getLineNumber = function(handle) { var deltas = this.$lineHandleChanges; if (!deltas) return null; var row = handle.row; for (var i = 0; i < deltas.length; i++) { var delta = deltas[i]; if (delta.start.row != delta.end.row) { if (delta.action[0] == "i") { if (delta.start.row < row) row += delta.end.row - delta.start.row; } else { if (delta.start.row < row) { if (row < delta.end.row || row == delta.end.row && delta.start.column > 0) { return null; } row -= delta.end.row - delta.start.row; } } } } return row; }; this.getLineHandle = function(row) { if (!this.$lineHandleChanges) this.$lineHandleChanges = []; return {text: this.ace.session.getLine(row), row: row}; }; this.releaseLineHandles = function() { this.$lineHandleChanges = undefined; }; this.getLastEditEnd = function() { var undoManager = this.ace.session.$undoManager; if (undoManager && undoManager.$lastDelta) return toCmPos(undoManager.$lastDelta.end); }; }).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; }; domLib.importCssString(`.normal-mode .ace_cursor{ border: none; background-color: rgba(255,0,0,0.5); } .normal-mode .ace_hidden-cursors .ace_cursor{ background-color: transparent; border: 1px solid red; opacity: 0.7 } .ace_dialog { position: absolute; left: 0; right: 0; background: inherit; z-index: 15; padding: .1em .8em; overflow: hidden; color: inherit; } .ace_dialog-top { border-bottom: 1px solid #444; top: 0; } .ace_dialog-bottom { border-top: 1px solid #444; bottom: 0; } .ace_dialog input { border: none; outline: none; background: transparent; width: 20em; color: inherit; font-family: monospace; }`, "vimMode", false); (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; this.state.dialog = dialog; function close(newVal) { if (typeof newVal == 'string') { inp.value = newVal; } else { if (closed) return; if (newVal && newVal.type == "blur") { if (document.activeElement === inp) return; } if (me.state.dialog == dialog) { me.state.dialog = null; me.focus(); } closed = true; dialog.remove(); if (options.onClose) options.onClose(dialog); // ace_patch{ var cm = me; if (cm.state.vim) { cm.state.vim.status = null; cm.ace._signal("changeStatus"); cm.ace.renderer.$loop.schedule(cm.ace.renderer.CHANGE_CURSOR); } // ace_patch} } } var inp = dialog.getElementsByTagName("input")[0], button; if (inp) { if (options.value) { inp.value = options.value; if (options.selectValueOnOpen !== 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 == 13) callback(inp.value); if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { CodeMirror.e_stop(e); close(); } }); 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.remove(); } CodeMirror.on(dialog, 'click', function(e) { CodeMirror.e_preventDefault(e); close(); }); if (duration) doneTimer = setTimeout(close, duration); return close; }); })(); var Pos = CodeMirror.Pos; function updateSelectionForSurrogateCharacters(cm, curStart, curEnd) { // start and character position when no selection // is the same in visual mode, and differs in 1 character in normal mode if (curStart.line === curEnd.line && curStart.ch >= curEnd.ch - 1) { var text = cm.getLine(curStart.line); var charCode = text.charCodeAt(curStart.ch); if (0xD800 <= charCode && charCode <= 0xD8FF) { curEnd.ch += 1; } } return {start: curStart, end: curEnd}; } 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: 'g', type: 'keyToKey', toKeys: 'gk' }, { keys: 'g', type: 'keyToKey', toKeys: 'gj' }, { keys: '', type: 'keyToKey', toKeys: 'l' }, { keys: '', type: 'keyToKey', toKeys: 'h'}, { keys: '', type: 'keyToKey', toKeys: 'x' }, { keys: '', type: 'keyToKey', toKeys: 'W' }, { keys: '', type: 'keyToKey', toKeys: 'B' }, { keys: '', type: 'keyToKey', toKeys: 'w' }, { keys: '', type: 'keyToKey', toKeys: 'b' }, { 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: '', type: 'keyToKey', toKeys: '' }, // ipad keyboard sends C-Esc instead of C-[ { 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' }, { keys: '', type: 'keyToKey', toKeys: 'i', context: 'normal'}, { keys: '', type: 'action', action: 'toggleOverwrite', context: 'insert' }, // 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: 'moveBySentence', motionArgs: { forward: false }}, { keys: ')', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: 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: "g$", type: "motion", motion: "moveToEndOfDisplayLine"}, {keys: "g^", type: "motion", motion: "moveToStartOfDisplayLine"}, {keys: "g0", type: "motion", motion: "moveToStartOfDisplayLine"}, { 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: 'indentAuto' }, { 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 }}, { keys: 'gn', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: true }}, { keys: 'gN', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: false }}, { keys: 'gq', type: 'operator', operator: 'hardWrap' }, { keys: 'gw', type: 'operator', operator: 'hardWrap', operatorArgs: {keepCursor: 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: 'expandToLine', motionArgs: { linewise: 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: 'moveToStartOfLine', context: 'insert' }, { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' }, //ignore C-w in normal mode { keys: '', type: 'idle', context: 'normal' }, // 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: 'gi', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'lastEdit' }, context: 'normal' }, { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' }, { keys: 'gI', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'bol'}, 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: 'gJ', type: 'action', action: 'joinLines', actionArgs: { keepSpaces: true }, 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 }, context: 'normal'}, { keys: 'R', type: 'operator', operator: 'change', operatorArgs: { linewise: true, fullLine: true }, context: 'visual', exitVisualBlock: 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: '', type: 'action', action: 'insertRegister', context: 'insert', isEdit: true }, { keys: '', type: 'action', action: 'oneNormalCommand', context: 'insert' }, { 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: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }}, { keys: 'z-', 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}}, { keys: '', type: 'action', action: 'indent', actionArgs: { indentRight: true }, context: 'insert' }, { keys: '', type: 'action', action: 'indent', actionArgs: { indentRight: false }, context: 'insert' }, // 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' } ]; var defaultKeymapLength = defaultKeymap.length; /** * 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: 'omap', shortName: 'om' }, { name: 'noremap', shortName: 'no' }, { name: 'nnoremap', shortName: 'nn' }, { name: 'vnoremap', shortName: 'vn' }, { name: 'inoremap', shortName: 'ino' }, { name: 'onoremap', shortName: 'ono' }, { name: 'unmap' }, { name: 'mapclear', shortName: 'mapc' }, { name: 'nmapclear', shortName: 'nmapc' }, { name: 'vmapclear', shortName: 'vmapc' }, { name: 'imapclear', shortName: 'imapc' }, { name: 'omapclear', shortName: 'omapc' }, { name: 'write', shortName: 'w' }, { name: 'undo', shortName: 'u' }, { name: 'redo', shortName: 'red' }, { name: 'set', shortName: 'se' }, { name: 'setlocal', shortName: 'setl' }, { name: 'setglobal', shortName: 'setg' }, { name: 'sort', shortName: 'sor' }, { name: 'substitute', shortName: 's', possiblyAsync: true }, { name: 'startinsert', shortName: 'start' }, { name: 'nohlsearch', shortName: 'noh' }, { name: 'yank', shortName: 'y' }, { name: 'delmarks', shortName: 'delm' }, { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, { name: 'vglobal', shortName: 'v' }, { name: 'delete', shortName: 'd' }, { name: 'join', shortName: 'j' }, { name: 'normal', shortName: 'norm' }, { name: 'global', shortName: 'g' } ]; /** * Langmap * Determines how to interpret keystrokes in Normal and Visual mode. * Useful for people who use a different keyboard layout than QWERTY */ var langmap = parseLangmap(''); 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; if (highlightTimeout) clearTimeout(highlightTimeout); } 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); }]; var validMarks = ['<', '>']; var validRegisters = ['-', '"', '.', ':', '_', '/', '+']; var latinCharRegex = /^\w$/ var upperCaseChars; try { upperCaseChars = new RegExp("^[\\p{Lu}]$", "u"); } catch (_) { upperCaseChars = /^[A-Z]$/; } 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 upperCaseChars.test(k); } function isWhiteSpaceString(k) { return (/^\s*$/).test(k); } function isEndOfSentenceSymbol(k) { return '.?!'.indexOf(k) != -1; } 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) { return new Error('Unknown option: ' + name); } if (option.type == 'boolean') { if (value && value !== true) { return new 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) { return new 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); } }); defineOption('textwidth', 80, 'number', ['tw'], function(width, cm) { // Option is local. Do nothing for global. if (cm === undefined) { return; } // The 'filetype' option proxies to the CodeMirror 'mode' option. if (width === undefined) { var value = cm.getOption('textwidth'); return value; } else { var column = Math.round(width); if (column > 1) { cm.setOption('textwidth', column); } } }); 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; } function find(cm, offset) { var oldPointer = pointer; var mark = move(cm, offset); pointer = oldPointer; return mark && mark.find(); } return { cachedCursor: undefined, //used for # and * jumps add: add, find: find, 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) { var template = dom('span', {class: 'cm-vim-message'}, 'recording @' + registerName); this.onRecordingDone = cm.openDialog(template, 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: {}, insertMode: false, insertModeReturn: 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: {}, // Whether the next character should be interpreted literally // Necassary for correct implementation of f, r etc. // in terms of langmaps. expectLiteralNext: false }; } 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. lastCharacterSearch: {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 = { enterVimMode: enterVimMode, leaveVimMode: leaveVimMode, buildKeyMap: function() { // TODO: Convert keymap into dictionary format for fast lookup. }, // Testing hook, though it might be useful to expose the register // controller anyway. 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) { return exCommandDispatcher.unmap(lhs, ctx); }, // Non-recursive map function. // NOTE: This will not create mappings to key maps that aren't present // in the default key map. See TODO at bottom of function. noremap: function(lhs, rhs, ctx) { exCommandDispatcher.map(lhs, rhs, ctx, true); }, // Remove all user-defined mappings for the provided context. mapclear: function(ctx) { // Partition the existing keymap into user-defined and true defaults. var actualLength = defaultKeymap.length, origLength = defaultKeymapLength; var userKeymap = defaultKeymap.slice(0, actualLength - origLength); defaultKeymap = defaultKeymap.slice(actualLength - origLength); if (ctx) { // If a specific context is being cleared, we need to keep mappings // from all other contexts. for (var i = userKeymap.length - 1; i >= 0; i--) { var mapping = userKeymap[i]; if (ctx !== mapping.context) { if (mapping.context) { this._mapCommand(mapping); } else { // `mapping` applies to all contexts so create keymap copies // for each context except the one being cleared. var contexts = ['normal', 'insert', 'visual']; for (var j in contexts) { if (contexts[j] !== ctx) { var newMapping = {}; for (var key in mapping) { newMapping[key] = mapping[key]; } newMapping.context = contexts[j]; this._mapCommand(newMapping); } } } } } } }, langmap: updateLangmap, vimKeyFromEvent: vimKeyFromEvent, // 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(); } }, multiSelectHandleKey: multiSelectHandleKey, /** * 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 == '') { if (vim.visualMode) { // Get back to normal mode. exitVisualMode(cm); } else if (vim.insertMode) { // Get back to normal mode. exitInsertMode(cm); } else { // We're already in normal mode. Let '' be handled normally. return; } clearInputState(cm); return true; } } function handleKeyInsertMode() { if (handleEsc()) { return true; } vim.inputState.keyBuffer.push(key); var keys = vim.inputState.keyBuffer.join(""); var keysAreChars = key.length == 1; var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert'); var changeQueue = vim.inputState.changeQueue; if (match.type == 'none') { clearInputState(cm); return false; } else if (match.type == 'partial') { if (match.expectLiteralNext) vim.expectLiteralNext = true; if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } lastInsertModeKeyTimer = keysAreChars && window.setTimeout( function() { if (vim.insertMode && vim.inputState.keyBuffer.length) { clearInputState(cm); } }, getOption('insertModeEscKeysTimeout')); if (keysAreChars) { var selections = cm.listSelections(); if (!changeQueue || changeQueue.removed.length != selections.length) changeQueue = vim.inputState.changeQueue = new ChangeQueue; changeQueue.inserted += key; for (var i = 0; i < selections.length; i++) { var from = cursorMin(selections[i].anchor, selections[i].head); var to = cursorMax(selections[i].anchor, selections[i].head); var text = cm.getRange(from, cm.state.overwrite ? offsetCursor(to, 0, 1) : to); changeQueue.removed[i] = (changeQueue.removed[i] || "") + text; } } return !keysAreChars; } vim.expectLiteralNext = false; if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } if (match.command && changeQueue) { var selections = cm.listSelections(); for (var i = 0; i < selections.length; i++) { var here = selections[i].head; cm.replaceRange(changeQueue.removed[i] || "", offsetCursor(here, 0, -changeQueue.inserted.length), here, '+input'); } vimGlobalState.macroModeState.lastInsertModeChanges.changes.pop(); } if (!match.command) clearInputState(cm); return match.command; } function handleKeyNonInsertMode() { if (handleMacroRecording() || handleEsc()) { return true; } vim.inputState.keyBuffer.push(key); var keys = vim.inputState.keyBuffer.join(""); 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 mainKey = keysMatcher[2] || keysMatcher[1]; if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) { // multikey operators act linewise by repeating only the last character mainKey = vim.inputState.operatorShortcut; } var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context); if (match.type == 'none') { clearInputState(cm); return false; } else if (match.type == 'partial') { if (match.expectLiteralNext) vim.expectLiteralNext = true; return true; } else if (match.type == 'clear') { clearInputState(cm); return true; } vim.expectLiteralNext = false; vim.inputState.keyBuffer.length = 0; 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 !vim.insertMode && key.length === 1 ? function() { return true; } : 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(cm, command.toKeys, command); } 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 (!vimApi.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 }; var keyToKeyStack = []; var noremap = false; var virtualPrompt; function sendKeyToPrompt(key) { if (key[0] == "<") { var lowerKey = key.toLowerCase().slice(1, -1); var parts = lowerKey.split('-'); lowerKey = parts.pop() || ''; if (lowerKey == 'lt') key = '<'; else if (lowerKey == 'space') key = ' '; else if (lowerKey == 'cr') key = '\n'; else if (vimToCmKeyMap[lowerKey]) { var value = virtualPrompt.value; var event = { key: vimToCmKeyMap[lowerKey], target: { value: value, selectionEnd: value.length, selectionStart: value.length } } if (virtualPrompt.onKeyDown) { virtualPrompt.onKeyDown(event, virtualPrompt.value, close); } if (virtualPrompt && virtualPrompt.onKeyUp) { virtualPrompt.onKeyUp(event, virtualPrompt.value, close); } return; } } if (key == '\n') { var prompt = virtualPrompt; virtualPrompt = null; prompt.onClose && prompt.onClose(prompt.value); } else { virtualPrompt.value = (virtualPrompt.value || '') + key; } function close(value) { if (typeof value == 'string') { virtualPrompt.value = value; } else { virtualPrompt = null; } } } function doKeyToKey(cm, keys, fromKey) { var noremapBefore = noremap; // prevent infinite recursion. if (fromKey) { if (keyToKeyStack.indexOf(fromKey) != -1) return; keyToKeyStack.push(fromKey); noremap = fromKey.noremap != false; } try { var vim = maybeInitVimState(cm); var keyRe = /<(?:[CSMA]-)*\w+>|./gi; var match; // Pull off one command key, which is either a single character // or a special sequence wrapped in '<' and '>', e.g. ''. while ((match = keyRe.exec(keys))) { var key = match[0]; var wasInsert = vim.insertMode; if (virtualPrompt) { sendKeyToPrompt(key); continue; } var result = vimApi.handleKey(cm, key, 'mapping'); if (!result && wasInsert && vim.insertMode) { if (key[0] == "<") { var lowerKey = key.toLowerCase().slice(1, -1); var parts = lowerKey.split('-'); lowerKey = parts.pop() || ''; if (lowerKey == 'lt') key = '<'; else if (lowerKey == 'space') key = ' '; else if (lowerKey == 'cr') key = '\n'; else if (vimToCmKeyMap.hasOwnProperty(lowerKey)) { // todo support codemirror keys in insertmode vimToCmKeyMap key = vimToCmKeyMap[lowerKey]; sendCmKey(cm, key); continue; } else { key = key[0]; keyRe.lastIndex = match.index + 1; } } cm.replaceSelection(key); } } } finally { keyToKeyStack.pop(); noremap = keyToKeyStack.length ? noremapBefore : false; if (!keyToKeyStack.length && virtualPrompt) { var promptOptions = virtualPrompt; virtualPrompt = null; showPrompt(cm, promptOptions); } } } var specialKey = { Return: 'CR', Backspace: 'BS', 'Delete': 'Del', Escape: 'Esc', Insert: 'Ins', ArrowLeft: 'Left', ArrowRight: 'Right', ArrowUp: 'Up', ArrowDown: 'Down', Enter: 'CR', ' ': 'Space' }; var ignoredKeys = { Shift: 1, Alt: 1, Command: 1, Control: 1, CapsLock: 1, AltGraph: 1, Dead: 1, Unidentified: 1 }; var vimToCmKeyMap = {}; 'Left|Right|Up|Down|End|Home'.split('|').concat(Object.keys(specialKey)).forEach(function(x) { vimToCmKeyMap[(specialKey[x] || '').toLowerCase()] = vimToCmKeyMap[x.toLowerCase()] = x; }); function vimKeyFromEvent(e, vim) { var key = e.key; if (ignoredKeys[key]) return; 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.metaKey) { name += 'M-'; } // on mac many characters are entered as option- combos // (e.g. on swiss keyboard { is option-8) // so we ignore lonely A- modifier for keypress event on mac if (CodeMirror.isMac && e.altKey && !e.metaKey && !e.ctrlKey) { name = name.slice(2); } if ((name || key.length > 1) && e.shiftKey) { name += 'S-'; } if (vim && !vim.expectLiteralNext && key.length == 1) { if (langmap.keymap && key in langmap.keymap) { if (langmap.remapCtrl != false || !name) key = langmap.keymap[key]; } else if (key.charCodeAt(0) > 255) { var code = e.code && e.code.slice(-1) || ""; if (!e.shiftKey) code = code.toLowerCase(); if (code) key = code; } } name += key; if (name.length > 1) { name = '<' + name + '>'; } return name; }; // langmap support function updateLangmap(langmapString, remapCtrl) { if (langmap.string !== langmapString) { langmap = parseLangmap(langmapString); } langmap.remapCtrl = remapCtrl; } function parseLangmap(langmapString) { // From :help langmap /* The 'langmap' option is a list of parts, separated with commas. Each part can be in one of two forms: 1. A list of pairs. Each pair is a "from" character immediately followed by the "to" character. Examples: "aA", "aAbBcC". 2. A list of "from" characters, a semi-colon and a list of "to" characters. Example: "abc;ABC" */ let keymap = {}; if (!langmapString) return { keymap: keymap, string: '' }; function getEscaped(list) { return list.split(/\\?(.)/).filter(Boolean); } langmapString.split(/((?:[^\\,]|\\.)+),/).map(part => { if (!part) return; const semicolon = part.split(/((?:[^\\;]|\\.)+);/); if (semicolon.length == 3) { const from = getEscaped(semicolon[1]); const to = getEscaped(semicolon[2]); if (from.length !== to.length) return; // skip over malformed part for (let i = 0; i < from.length; ++i) keymap[from[i]] = to[i]; } else if (semicolon.length == 1) { const pairs = getEscaped(part); if (pairs.length % 2 !== 0) return; // skip over malformed part for (let i = 0; i < pairs.length; i += 2) keymap[pairs[i]] = pairs[i + 1]; } }); return { keymap: keymap, string: langmapString }; } defineOption('langmap', undefined, 'string', ['lmap'], function(name, cm) { // The 'filetype' option proxies to the CodeMirror 'mode' option. if (name === undefined) { return langmap.string; } else { updateLangmap(name); } }); // 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. this.changeQueue = null; // For restoring text used by insert mode keybindings } 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(); cm.state.vim.expectLiteralNext = false; CodeMirror.signal(cm, 'vim-command-done', reason); } function ChangeQueue() { this.removed = []; this.inserted = ""; } /* * 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; 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(); registers['+'] = new Register(); } RegisterController.prototype = { pushText: function(registerName, operator, text, linewise, blockwise) { // The black hole register, "_, means delete/yank to nowhere. if (registerName === '_') return; 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); } if (registerName === '+' && typeof navigator !== 'undefined' && typeof navigator.clipboard !== 'undefined' && typeof navigator.clipboard.readText === 'function') { navigator.clipboard.writeText(text); } // 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) || latinCharRegex.test(name)); }, shiftNumericRegisters_: function() { for (var i = 9; i >= 2; i--) { this.registers[i] = this.getRegister('' + (i - 1)); } } }; function HistoryController() { this.historyBuffer = []; this.iterator = 0; 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', expectLiteralNext: matches.partial.length == 1 && matches.partial[0].keys.slice(-11) == '' // langmap literal logic }; } 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) == '' || bestMatch.keys.slice(-10) == '') { var character = lastChar(keys); if (!character || character.length > 1) return {type: 'clear'}; 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 (command.keys.length > 1) { inputState.operatorShortcut = command.keys; } if (command.exitVisualBlock) { vim.visualBlock = false; updateCmSelection(cm); } 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) { //ace_patch 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 = vimKeyFromEvent(e), up, offset; if (keyName == '' || keyName == '') { up = keyName == '' ? true : false; offset = e.target ? e.target.selectionEnd : 0; query = vimGlobalState.searchHistoryController.nextMatch(query, up) || ''; close(query); if (offset && e.target) e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length); } else if (keyName && keyName != '' && keyName != '') { 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 = vimKeyFromEvent(e); if (keyName == '' || keyName == '' || keyName == '' || (keyName == '' && 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 == '' || keyName == '') { CodeMirror.e_stop(e); } else if (keyName == '') { // 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: '(JavaScript regexp)', onKeyUp: onPromptKeyUp, onKeyDown: onPromptKeyDown }); } break; case 'wordUnderCursor': var word = expandWordUnderCursor(cm, {noSymbol: true}); var isKeyword = true; if (!word) { word = expandWordUnderCursor(cm, {noSymbol: false}); isKeyword = false; } if (!word) { showConfirm(cm, 'No word under cursor'); clearInputState(cm); 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); if (cm.state.vim) clearInputState(cm); } function onPromptKeyDown(e, input, close) { var keyName = vimKeyFromEvent(e), up, offset; if (keyName == '' || keyName == '' || keyName == '' || (keyName == '' && input == '')) { vimGlobalState.exCommandHistoryController.pushInput(input); vimGlobalState.exCommandHistoryController.reset(); CodeMirror.e_stop(e); clearInputState(cm); close(); cm.focus(); } if (keyName == '' || keyName == '') { CodeMirror.e_stop(e); up = keyName == '' ? true : false; offset = e.target ? e.target.selectionEnd : 0; input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || ''; close(input); if (offset && e.target) e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length); } else if (keyName == '') { // Ctrl-U clears input. CodeMirror.e_stop(e); close(''); } else if (keyName && keyName != '' && keyName != '') { 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, selectValueOnOpen: false}); } else { showPrompt(cm, { onClose: onPromptClose, prefix: ':', onKeyDown: onPromptKeyDown}); } } }, evalInput: function(cm, vim) { // If the motion command 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, inputState); 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, oldHead); } if (newAnchor) { newAnchor = clipCursorToContent(cm, newAnchor); } 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) { if (cm.ace.curOp) cm.ace.curOp.vimDialogScroll = "center-animate"; // ace_patch newHead = clipCursorToContent(cm, newHead, oldHead); 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 = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } else if (lastSel.visualBlock) { // Blockwise Visual mode: The same number of lines and columns. newHead = new 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 = new 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 = new 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'; var newPositions = updateSelectionForSurrogateCharacters(cm, curStart, curEnd); cmSel = makeCmSelection(cm, { anchor: newPositions.start, head: newPositions.end }, 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 = new 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; var newPositions = updateSelectionForSurrogateCharacters(cm, curStart, curEnd); cmSel = makeCmSelection(cm, { anchor: newPositions.start, head: newPositions.end }, 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; macroModeState.lastInsertModeChanges.visualBlock = vim.visualBlock ? vim.sel.head.line - vim.sel.anchor.line : 0; } }; /** * 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 new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToMiddleLine: function(cm) { var range = getUserVisibleLines(cm); var line = Math.floor((range.top + range.bottom) * 0.5); return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToBottomLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; return new 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 new 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); }, /** * Find and select the next occurrence of the search query. If the cursor is currently * within a match, then find and select the current match. Otherwise, find the next occurrence in the * appropriate direction. * * This differs from `findNext` in the following ways: * * 1. Instead of only returning the "from", this returns a "from", "to" range. * 2. If the cursor is currently inside a search match, this selects the current match * instead of the next match. * 3. If there is no associated operator, this will turn on visual mode. */ findAndSelectNextInclusive: function(cm, _head, motionArgs, vim, prevInputState) { var state = getSearchState(cm); var query = state.getQuery(); if (!query) { return; } var prev = !motionArgs.forward; prev = (state.isReversed()) ? !prev : prev; // next: [from, to] | null var next = findNextFromAndToInclusive(cm, prev, query, motionArgs.repeat, vim); // No matches. if (!next) { return; } // If there's an operator that will be executed, return the selection. if (prevInputState.operator) { return next; } // At this point, we know that there is no accompanying operator -- let's // deal with visual mode in order to select an appropriate match. var from = next[0]; // For whatever reason, when we use the "to" as returned by searchcursor.js directly, // the resulting selection is extended by 1 char. Let's shrink it so that only the // match is selected. var to = new Pos(next[1].line, next[1].ch - 1); if (vim.visualMode) { // If we were in visualLine or visualBlock mode, get out of it. if (vim.visualLine || vim.visualBlock) { vim.visualLine = false; vim.visualBlock = false; CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""}); } // If we're currently in visual mode, we should extend the selection to include // the search result. var anchor = vim.sel.anchor; if (anchor) { if (state.isReversed()) { if (motionArgs.forward) { return [anchor, from]; } return [anchor, to]; } else { if (motionArgs.forward) { return [anchor, to]; } return [anchor, from]; } } } else { // Let's turn visual mode on. vim.visualMode = true; vim.visualLine = false; vim.visualBlock = false; CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""}); } return prev ? [to, from] : [from, to]; }, goToMark: function(cm, _head, motionArgs, vim) { var pos = getMarkPos(cm, vim, motionArgs.selectedCharacter); if (pos) { 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, new Pos(sel.anchor.line, sel.head.ch)), clipCursorToContent(cm, new 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 = new 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 new 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 go to line begin or line end when cursor at first/last line and // move to previous/next line is triggered. if (line < first && cur.line == first){ return this.moveToStartOfLine(cm, head, motionArgs, vim); } else if (line > last && cur.line == last){ return moveToEol(cm, head, motionArgs, vim, true); } // 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(new Pos(line, endCh),'div').left; return new 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(new 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); }, moveBySentence: function(cm, head, motionArgs) { var dir = motionArgs.forward ? 1 : -1; return findSentence(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; 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, head); 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) || 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) { return moveToEol(cm, head, motionArgs, vim, false); }, 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 new 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; for (; ch < lineText.length; ch++) { symbol = lineText.charAt(ch); if (symbol && isMatchableSymbol(symbol)) { var style = cm.getTokenTypeAt(new Pos(line, ch + 1)); if (style !== "string" && style !== "comment") { break; } } } if (ch < lineText.length) { // Only include angle brackets in analysis if they are being matched. var re = /[<>]/.test(lineText[ch]) ? /[(){}[\]<>]/ : /[(){}[\]]/; //ace_patch? var matched = cm.findMatchingBracket(new Pos(line, ch+1), {bracketRegex: re}); return matched.to; } else { return cursor; } }, moveToStartOfLine: function(_cm, head) { return new 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 new Pos(lineNum, findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); }, moveToStartOfDisplayLine: function(cm) { cm.execCommand("goLineLeft"); return cm.getCursor(); }, moveToEndOfDisplayLine: function(cm) { cm.execCommand("goLineRight"); var head = cm.getCursor(); if (head.sticky == "before") head.ch--; return head; }, textObjectManipulation: function(cm, head, motionArgs, vim) { // TODO: lots of possible exceptions that can be thrown here. Try da( // outside of a () block. var mirroredPairs = {'(': ')', ')': '(', '{': '}', '}': '{', '[': ']', ']': '[', '<': '>', '>': '<'}; var selfPaired = {'\'': true, '"': 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, move; if (mirroredPairs[character]) { move = true; tmp = selectCompanionObject(cm, head, character, inclusive); if (!tmp) { var sc = cm.getSearchCursor(new RegExp("\\" + character, "g"), head) if (sc.find()) { tmp = selectCompanionObject(cm, sc.from(), character, inclusive); } } } else if (selfPaired[character]) { move = true; tmp = findBeginningAndEnd(cm, head, character, inclusive); } else if (character === 'W' || character === 'w') { var repeat = motionArgs.repeat || 1; while (repeat-- > 0) { var repeated = expandWordUnderCursor(cm, { inclusive, innerWord: !inclusive, bigWord: character === 'W', noSymbol: character === 'W', multiline: true }, tmp && tmp.end); if (repeated) { if (!tmp) tmp = repeated; tmp.end = repeated.end; } } } 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 if (character === 't') { tmp = expandTagUnderCursor(cm, head, inclusive); } else if (character === 's') { // account for cursor on end of sentence symbol var content = cm.getLine(head.line); if (head.ch > 0 && isEndOfSentenceSymbol(content[head.ch])) { head.ch -= 1; } var end = getSentence(cm, head, motionArgs.repeat, 1, inclusive) var start = getSentence(cm, head, motionArgs.repeat, -1, inclusive) // closer vim behaviour, 'a' only takes the space after the sentence if there is one before and after if (isWhiteSpaceString(cm.getLine(start.line)[start.ch]) && isWhiteSpaceString(cm.getLine(end.line)[end.ch -1])) { start = {line: start.line, ch: start.ch + 1} } tmp = {start: start, end: end}; } if (!tmp) { // No valid text object, don't move. return null; } if (!cm.state.vim.visualMode) { return [tmp.start, tmp.end]; } else { return expandSelection(cm, tmp.start, tmp.end, move); } }, repeatLastCharacterSearch: function(cm, head, motionArgs) { var lastSearch = vimGlobalState.lastCharacterSearch; 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; var anchor = ranges[0].anchor, head = ranges[0].head; if (!vim.visualMode) { 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); } } if (args.linewise) { anchor = new Pos(anchor.line, findFirstNonWhiteSpaceCharacter(cm.getLine(anchor.line))); if (head.line > anchor.line) { head = new Pos(head.line - 1, Number.MAX_VALUE) } } cm.replaceRange('', anchor, head); finalHead = anchor; } else if (args.fullLine) { head.ch = Number.MAX_VALUE; head.line--; cm.setSelection(anchor, head) text = cm.getSelection(); cm.replaceSelection(""); 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 = new 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 = cursorMin(ranges[0].head, 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; // 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 (vim.visualBlock) { var tabSize = cm.getOption('tabSize'); var indent = cm.getOption('indentWithTabs') ? '\t' : ' '.repeat(tabSize); var cursor; for (var i = ranges.length - 1; i >= 0; i--) { cursor = cursorMin(ranges[i].anchor, ranges[i].head); if (args.indentRight) { cm.replaceRange(indent.repeat(repeat), cursor, cursor); } else { var text = cm.getLine(cursor.line); var end = 0; for (var j = 0; j < repeat; j++) { var ch = text[cursor.ch + end]; if (ch == '\t') { end++; } else if (ch == ' ') { end++; for (var k = 1; k < indent.length; k++) { ch = text[cursor.ch + end]; if (ch !== ' ') break; end++; } } else { break } } cm.replaceRange('', cursor, offsetCursor(cursor, 0, end)); } } return cursor; } else if (cm.indentMore) { for (var j = 0; j < repeat; j++) { if (args.indentRight) cm.indentMore(); else cm.indentLess(); } } else { var startLine = ranges[0].anchor.line; var endLine = vim.visualBlock ? ranges[ranges.length - 1].anchor.line : ranges[0].head.line; 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); }, indentAuto: function(cm, _args, ranges) { cm.execCommand("indentAuto"); return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); }, hardWrap: function(cm, operatorArgs, ranges, oldAnchor, newHead) { if (!cm.hardWrap) return; var from = ranges[0].anchor.line; var to = ranges[0].head.line; if (operatorArgs.linewise) to--; var endRow = cm.hardWrap({from: from, to: to}); if (endRow > from && operatorArgs.linewise) endRow--; return operatorArgs.keepCursor ? oldAnchor : new Pos(endRow, 0); }, 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(new Pos(lineNum, 0), 'local'); var height = cm.getScrollInfo().clientHeight; var y = charCoords.top; switch (actionArgs.position) { case 'center': y = charCoords.bottom - height / 2; break; case 'bottom': var lineLastCharPos = new Pos(lineNum, cm.getLine(lineNum).length - 1); var lineLastCharCoords = cm.charCoords(lineLastCharPos, 'local'); var lineHeight = lineLastCharCoords.bottom - y; y = y - height + lineHeight 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; } else { macroModeState.latestRegister = registerName; } while(repeat--){ executeMacroRegister(cm, vim, macroModeState, registerName); } }, enterMacroRecordMode: function(cm, actionArgs) { var macroModeState = vimGlobalState.macroModeState; var registerName = actionArgs.selectedCharacter; if (vimGlobalState.registerController.isValidRegister(registerName)) { macroModeState.enterMacroRecordMode(cm, registerName); } }, toggleOverwrite: function(cm) { if (!cm.state.overwrite) { cm.toggleOverwrite(true); cm.setOption('keyMap', 'vim-replace'); CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"}); } else { cm.toggleOverwrite(false); cm.setOption('keyMap', 'vim-insert'); CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"}); } }, 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 = new Pos(head.line, lineLength(cm, head.line)); } else if (insertAt == 'bol') { head = new Pos(head.line, 0); } else if (insertAt == 'charAfter') { var newPosition = updateSelectionForSurrogateCharacters(cm, head, offsetCursor(head, 0, 1)); head = newPosition.end; } else if (insertAt == 'firstNonBlank') { var newPosition = updateSelectionForSurrogateCharacters(cm, head, motions.moveToFirstNonWhiteSpaceCharacter(cm, head)); head = newPosition.end; } else if (insertAt == 'startOfSelectedArea') { if (!vim.visualMode) return; if (!vim.visualBlock) { if (sel.head.line < sel.anchor.line) { head = sel.head; } else { head = new Pos(sel.anchor.line, 0); } } else { head = new 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.visualMode) return; if (!vim.visualBlock) { if (sel.head.line >= sel.anchor.line) { head = offsetCursor(sel.head, 0, 1); } else { head = new Pos(sel.anchor.line, 0); } } else { head = new Pos( Math.min(sel.head.line, sel.anchor.line), Math.max(sel.head.ch, sel.anchor.ch) + 1); height = Math.abs(sel.head.line - sel.anchor.line) + 1; } } else if (insertAt == 'inplace') { if (vim.visualMode){ return; } } else if (insertAt == 'lastEdit') { head = getLastEditPos(cm) || head; } 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.toggleOverwrite(false); 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); if (vim.insertEnd) vim.insertEnd.clear(); vim.insertEnd = cm.setBookmark(head, {insertLeft: true}); 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, new Pos(anchor.line, anchor.ch + repeat - 1)); var newPosition = updateSelectionForSurrogateCharacters(cm, anchor, head) vim.sel = { anchor: newPosition.start, head: newPosition.end }; 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, new Pos(curStart.line + repeat - 1, Infinity)); } var finalCh = 0; for (var i = curStart.line; i < curEnd.line; i++) { finalCh = lineLength(cm, curStart.line); var text = ''; var nextStartCh = 0; if (!actionArgs.keepSpaces) { var nextLine = cm.getLine(curStart.line + 1); nextStartCh = nextLine.search(/\S/); if (nextStartCh == -1) { nextStartCh = nextLine.length; } else { text = " "; } } cm.replaceRange(text, new Pos(curStart.line, finalCh), new Pos(curStart.line + 1, nextStartCh)); } var curFinalPos = clipCursorToContent(cm, new 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', new 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 register = vimGlobalState.registerController.getRegister( actionArgs.registerName); var fallback = () => { var text = register.toString(); this.continuePaste(cm, actionArgs, vim, text, register); } if (actionArgs.registerName === '+' && typeof navigator !== 'undefined' && typeof navigator.clipboard !== 'undefined' && typeof navigator.clipboard.readText === 'function') { navigator.clipboard.readText().then((value) => { this.continuePaste(cm, actionArgs, vim, value, register); }, () => { fallback() }) } else { fallback() } }, continuePaste: function(cm, actionArgs, vim, text, register) { var cur = copyCursor(cm.getCursor()); 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 (blockwise) { text = text.split('\n'); if (linewise) { text.pop(); } for (var i = 0; i < text.length; i++) { text[i] = (text[i] == '') ? ' ' : text[i]; } cur.ch += actionArgs.after ? 1 : 0; cur.ch = Math.min(lineLength(cm, cur.line), cur.ch); } else if (linewise) { 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 { cur.ch += actionArgs.after ? 1 : 0; } var curPosFinal; 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 = new 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', new Pos(line, 0)); } var lastCh = lineLength(cm, line); if (lastCh < cur.ch) { extendLineToColumn(cm, line, cur.ch); } } cm.setCursor(cur); selectBlock(cm, new 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) { var line = actionArgs.after ? cur.line + 1 : cur.line; curPosFinal = new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); } else { curPosFinal = copyCursor(cur); if (!/\n/.test(text)) { curPosFinal.ch += text.length - (actionArgs.after ? 1 : 0); } } } } 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(clipCursorToContent(cm, cm.getCursor('start'))); }); }, redo: function(cm, actionArgs) { repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)(); }, setRegister: function(_cm, actionArgs, vim) { vim.inputState.registerName = actionArgs.selectedCharacter; }, insertRegister: function(cm, actionArgs, vim) { var registerName = actionArgs.selectedCharacter; var register = vimGlobalState.registerController.getRegister(registerName); var text = register && register.toString(); if (text) { cm.replaceSelection(text); } }, oneNormalCommand: function(cm, actionArgs, vim) { exitInsertMode(cm, true); vim.insertModeReturn = true; CodeMirror.on(cm, 'vim-command-done', function handler() { if (vim.visualMode) return; if (vim.insertModeReturn) { vim.insertModeReturn = false; if (!vim.insertMode) { actions.enterInsertMode(cm, {}, vim); } } CodeMirror.off(cm, 'vim-command-done', handler); }); }, 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 = new Pos(curStart.line, replaceTo); } var newPositions = updateSelectionForSurrogateCharacters(cm, curStart, curEnd); curStart = newPositions.start; curEnd = newPositions.end; 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 surrogate characters with selected character replaceWithStr = replaceWithStr.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, replaceWith); //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(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, replaceWith); 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 = /(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi; var match; var start; var end; var numberStr; while ((match = re.exec(lineStr)) !== null) { start = match.index; end = start + match[0].length; if (cur.ch < end)break; } if (!actionArgs.backtrack && (end <= cur.ch))return; if (match) { var baseStr = match[2] || match[4] var digits = match[3] || match[5] var increment = actionArgs.increase ? 1 : -1; var base = {'0b': 2, '0': 8, '': 10, '0x': 16}[baseStr.toLowerCase()]; var number = parseInt(match[1] + digits, base) + (increment * actionArgs.repeat); numberStr = number.toString(base); var zeroPadding = baseStr ? new Array(digits.length - numberStr.length + 1 + match[1].length).join('0') : '' if (numberStr.charAt(0) === '-') { numberStr = '-' + baseStr + zeroPadding + numberStr.substr(1); } else { numberStr = baseStr + zeroPadding + numberStr; } var from = new Pos(cur.line, start); var to = new Pos(cur.line, end); cm.replaceRange(numberStr, from, to); } else { return; } cm.setCursor(new 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 */); }, indent: function(cm, actionArgs) { cm.indentLine(cm.getCursor().line, actionArgs.indentRight); }, 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 * and is not inside surrogate pair * If includeLineBreak is true, then allow cur.ch == lineLength. */ function clipCursorToContent(cm, cur, oldCur) { var vim = cm.state.vim; var includeLineBreak = vim.insertMode || vim.visualMode; var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); var text = cm.getLine(line); var maxCh = text.length - 1 + Number(!!includeLineBreak); var ch = Math.min(Math.max(0, cur.ch), maxCh); // prevent cursor from entering surrogate pair var charCode = text.charCodeAt(ch); if (0xDC00 <= charCode && charCode <= 0xDFFF) { var direction = 1; if (oldCur && oldCur.line == line && oldCur.ch > ch) { direction = -1; } ch +=direction; if (ch > maxCh) ch -=2; } return new 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 new Pos(cur.line + offsetLine, cur.ch + offsetCh); } 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. if (inputState.operator) context = "operatorPending"; var match, partial = [], full = []; // if currently expanded key comes from a noremap, searcg only in default keys var startIndex = noremap ? keyMap.length - defaultKeymapLength : 0; for (var i = startIndex; 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) { const isLastCharacter = mapped.slice(-11) == ''; const isLastRegister = mapped.slice(-10) == ''; if (isLastCharacter || isLastRegister) { // Last character matches anything. var prefixLen = mapped.length - (isLastCharacter ? 11 : 10); 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 = /^.*(<[^>]+>)$/.exec(keys); var selectedCharacter = match ? match[1] : keys.slice(-1); if (selectedCharacter.length > 1){ switch(selectedCharacter){ case '': selectedCharacter='\n'; break; case '': selectedCharacter=' '; break; default: selectedCharacter=''; break; } } return selectedCharacter; } function repeatFn(cm, fn, repeat) { return function() { for (var i = 0; i < repeat; i++) { fn(cm); } }; } function copyCursor(cur) { return new 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(new 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); } 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 = new 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 = new Pos(i, selectionStart.ch); var head = new 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 = new Pos(selectionStart.line, 0); selectionEnd = new 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, move) { var sel = cm.state.vim.sel; var head = move ? start: sel.head; var anchor = move ? start: 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 = new 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); } 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), fromCh = anchor.ch, bottom = Math.max(anchor.line, head.line), toCh = head.ch; if (fromCh < toCh) { toCh += 1 } else { fromCh += 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: new Pos(top + i, fromCh), head: new Pos(top + i, toCh) }); } 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; if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); } // 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 whitespace. 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, innerWord, bigWord, noSymbol, multiline}, cursor) { var cur = cursor || getHead(cm); var line = cm.getLine(cur.line); var endLine = line; var startLineNumber = cur.line var endLineNumber = startLineNumber; var idx = cur.ch; var wordOnNextLine; // Seek to first word or non-whitespace character, depending on if // noSymbol is true. var test = noSymbol ? wordCharTest[0] : bigWordCharTest [0]; if (innerWord && /\s/.test(line.charAt(idx))) { test = function(ch) { return /\s/.test(ch); }; } else { while (!test(line.charAt(idx))) { idx++; if (idx >= line.length) { if (!multiline) return null; idx--; wordOnNextLine = findWord(cm, cur, true, bigWord, true); break } } 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(start)) && start >= 0) { start--; } start++; if (wordOnNextLine) { end = wordOnNextLine.to; endLineNumber = wordOnNextLine.line; endLine = cm.getLine(endLineNumber); if (!endLine && end == 0) end++; } else { while (test(line.charAt(end)) && end < line.length) { end++; } } if (inclusive) { // If present, include all whitespace after word. // Otherwise, include all whitespace before word, except indentation. var wordEnd = end; var startsWithSpace = cur.ch <= start && /\s/.test(line.charAt(cur.ch)); if (!startsWithSpace) { while (/\s/.test(endLine.charAt(end)) && end < endLine.length) { end++; } } if (wordEnd == end || startsWithSpace) { var wordStart = start; while (/\s/.test(line.charAt(start - 1)) && start > 0) { start--; } if (!start && !startsWithSpace) { start = wordStart; } } } return { start: new Pos(startLineNumber, start), end: new Pos(endLineNumber, end) }; } /** * Depends on the following: * * - editor mode should be htmlmixedmode / xml * - mode/xml/xml.js should be loaded * - addon/fold/xml-fold.js should be loaded * * If any of the above requirements are not true, this function noops. * * This is _NOT_ a 100% accurate implementation of vim tag text objects. * The following caveats apply (based off cursory testing, I'm sure there * are other discrepancies): * * - Does not work inside comments: * ``` * * ``` * - Does not work when tags have different cases: * ``` *
    broken
    * ``` * - Does not work when cursor is inside a broken tag: * ``` *
    * ``` */ function expandTagUnderCursor(cm, head, inclusive) { var cur = head; if (!CodeMirror.findMatchingTag || !CodeMirror.findEnclosingTag) { return { start: cur, end: cur }; } var tags = CodeMirror.findMatchingTag(cm, head) || CodeMirror.findEnclosingTag(cm, head); if (!tags || !tags.open || !tags.close) { return { start: cur, end: cur }; } if (inclusive) { return { start: tags.open.from, end: tags.close.to }; } return { start: tags.open.to, end: tags.close.from }; } function recordJumpPosition(cm, oldCur, newCur) { if (!cursorEqual(oldCur, newCur)) { vimGlobalState.jumpList.add(cm, oldCur, newCur); } } function recordLastCharacterSearch(increment, args) { vimGlobalState.lastCharacterSearch.increment = increment; vimGlobalState.lastCharacterSearch.forward = args.forward; vimGlobalState.lastCharacterSearch.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 new 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; } } /** * @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 = new 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 new Pos(lastWord.line, lastWord.from); } else if (forward && wordEnd) { return new 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 new Pos(lastWord.line, lastWord.to); } else { // b return new Pos(lastWord.line, lastWord.from); } } function moveToEol(cm, head, motionArgs, vim, keepHPos) { var cur = head; var retval= new Pos(cur.line + motionArgs.repeat - 1, Infinity); var end=cm.clipPos(retval); end.ch--; if (!keepHPos) { vim.lastHPos = Infinity; vim.lastHSPos = cm.charCoords(end,'div').left; } return retval; } function moveToCharacter(cm, repeat, forward, character, head) { var cur = head || 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 new 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, new Pos(line, repeat - 1)); } function updateMark(cm, vim, markName, pos) { if (!inArray(markName, validMarks) && !latinCharRegex.test(markName)) { 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 }; } /** * Based on {@link findSentence}. The internal functions have the same names, * but their behaviour is different. findSentence() crosses line breaks and * is used for jumping to sentence beginnings before or after the current cursor position, * whereas getSentence() is for getting the beginning or end of the sentence * at the current cursor position, either including (a) or excluding (i) whitespace. */ function getSentence(cm, cur, repeat, dir, inclusive /*includes whitespace*/) { /* Takes an index object { line: the line string, ln: line number, pos: index in line, dir: direction of traversal (-1 or 1) } and modifies the pos member to represent the next valid position or sets the line to null if there are no more valid positions. */ function nextChar(curr) { if (curr.pos + curr.dir < 0 || curr.pos + curr.dir >= curr.line.length) { curr.line = null; } else { curr.pos += curr.dir; } } /* Performs one iteration of traversal in forward direction Returns an index object of the sentence end */ function forward(cm, ln, pos, dir) { var line = cm.getLine(ln); var curr = { line: line, ln: ln, pos: pos, dir: dir, }; if (curr.line === "") { return { ln: curr.ln, pos: curr.pos }; } var lastSentencePos = curr.pos; // Move one step to skip character we start on nextChar(curr); while (curr.line !== null) { lastSentencePos = curr.pos; if (isEndOfSentenceSymbol(curr.line[curr.pos])) { if (!inclusive) { return { ln: curr.ln, pos: curr.pos + 1 }; } else { nextChar(curr); while (curr.line !== null ) { if (isWhiteSpaceString(curr.line[curr.pos])) { lastSentencePos = curr.pos; nextChar(curr) } else { break; } } return { ln: curr.ln, pos: lastSentencePos + 1 }; } } nextChar(curr); } return { ln: curr.ln, pos: lastSentencePos + 1 }; } /* Performs one iteration of traversal in reverse direction Returns an index object of the sentence start */ function reverse(cm, ln, pos, dir) { var line = cm.getLine(ln); var curr = { line: line, ln: ln, pos: pos, dir: dir, } if (curr.line === "") { return { ln: curr.ln, pos: curr.pos }; } var lastSentencePos = curr.pos; // Move one step to skip character we start on nextChar(curr); while (curr.line !== null) { if (!isWhiteSpaceString(curr.line[curr.pos]) && !isEndOfSentenceSymbol(curr.line[curr.pos])) { lastSentencePos = curr.pos; } else if (isEndOfSentenceSymbol(curr.line[curr.pos]) ) { if (!inclusive) { return { ln: curr.ln, pos: lastSentencePos }; } else { if (isWhiteSpaceString(curr.line[curr.pos + 1])) { return { ln: curr.ln, pos: curr.pos + 1 }; } else { return { ln: curr.ln, pos: lastSentencePos }; } } } nextChar(curr); } curr.line = line if (inclusive && isWhiteSpaceString(curr.line[curr.pos])) { return { ln: curr.ln, pos: curr.pos }; } else { return { ln: curr.ln, pos: lastSentencePos }; } } var curr_index = { ln: cur.line, pos: cur.ch, }; while (repeat > 0) { if (dir < 0) { curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir); } else { curr_index = forward(cm, curr_index.ln, curr_index.pos, dir); } repeat--; } return new Pos(curr_index.ln, curr_index.pos); } function findSentence(cm, cur, repeat, dir) { /* Takes an index object { line: the line string, ln: line number, pos: index in line, dir: direction of traversal (-1 or 1) } and modifies the line, ln, and pos members to represent the next valid position or sets them to null if there are no more valid positions. */ function nextChar(cm, idx) { if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) { idx.ln += idx.dir; if (!isLine(cm, idx.ln)) { idx.line = null; idx.ln = null; idx.pos = null; return; } idx.line = cm.getLine(idx.ln); idx.pos = (idx.dir > 0) ? 0 : idx.line.length - 1; } else { idx.pos += idx.dir; } } /* Performs one iteration of traversal in forward direction Returns an index object of the new location */ function forward(cm, ln, pos, dir) { var line = cm.getLine(ln); var stop = (line === ""); var curr = { line: line, ln: ln, pos: pos, dir: dir, } var last_valid = { ln: curr.ln, pos: curr.pos, } var skip_empty_lines = (curr.line === ""); // Move one step to skip character we start on nextChar(cm, curr); while (curr.line !== null) { last_valid.ln = curr.ln; last_valid.pos = curr.pos; if (curr.line === "" && !skip_empty_lines) { return { ln: curr.ln, pos: curr.pos, }; } else if (stop && curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) { return { ln: curr.ln, pos: curr.pos, }; } else if (isEndOfSentenceSymbol(curr.line[curr.pos]) && !stop && (curr.pos === curr.line.length - 1 || isWhiteSpaceString(curr.line[curr.pos + 1]))) { stop = true; } nextChar(cm, curr); } /* Set the position to the last non whitespace character on the last valid line in the case that we reach the end of the document. */ var line = cm.getLine(last_valid.ln); last_valid.pos = 0; for(var i = line.length - 1; i >= 0; --i) { if (!isWhiteSpaceString(line[i])) { last_valid.pos = i; break; } } return last_valid; } /* Performs one iteration of traversal in reverse direction Returns an index object of the new location */ function reverse(cm, ln, pos, dir) { var line = cm.getLine(ln); var curr = { line: line, ln: ln, pos: pos, dir: dir, } var last_valid = { ln: curr.ln, pos: null, }; var skip_empty_lines = (curr.line === ""); // Move one step to skip character we start on nextChar(cm, curr); while (curr.line !== null) { if (curr.line === "" && !skip_empty_lines) { if (last_valid.pos !== null) { return last_valid; } else { return { ln: curr.ln, pos: curr.pos }; } } else if (isEndOfSentenceSymbol(curr.line[curr.pos]) && last_valid.pos !== null && !(curr.ln === last_valid.ln && curr.pos + 1 === last_valid.pos)) { return last_valid; } else if (curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) { skip_empty_lines = false; last_valid = { ln: curr.ln, pos: curr.pos } } nextChar(cm, curr); } /* Set the position to the first non whitespace character on the last valid line in the case that we reach the beginning of the document. */ var line = cm.getLine(last_valid.ln); last_valid.pos = 0; for(var i = 0; i < line.length; ++i) { if (!isWhiteSpaceString(line[i])) { last_valid.pos = i; break; } } return last_valid; } var curr_index = { ln: cur.line, pos: cur.ch, }; while (repeat > 0) { if (dir < 0) { curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir); } else { curr_index = forward(cm, curr_index.ln, curr_index.pos, dir); } repeat--; } return new Pos(curr_index.ln, curr_index.pos); } // TODO: perhaps this finagling of start and end positions belongs // in codemirror/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(new Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp}); end = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp}); if (!start || !end) return null; 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; } // otherwise if the cursor is currently on the closing symbol else if (firstIndex < cur.ch && chars[cur.ch] == symb) { var stringAfter = /string/.test(cm.getTokenTypeAt(offsetCursor(head, 0, 1))); var stringBefore = /string/.test(cm.getTokenTypeAt(head)); var isStringStart = stringAfter && !stringBefore if (!isStringStart) { 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: new Pos(cur.line, start), end: new 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 splitBySlash(argString) { return splitBySeparator(argString, '/'); } function findUnescapedSlashes(argString) { return findUnescapedSeparators(argString, '/'); } function splitBySeparator(argString, separator) { var slashes = findUnescapedSeparators(argString, separator) || []; 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 findUnescapedSeparators(str, separator) { if (!separator) separator = '/'; var escapeNextChar = false; var slashes = []; for (var i = 0; i < str.length; i++) { var c = str.charAt(i); if (!escapeNextChar && c == separator) { 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) ? 'im' : 'm'); return regexp; } /** * dom - Document Object Manipulator * Usage: * dom(''|[, ...{|<$styles>}||'']) * Examples: * dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'})) * dom(document.head, dom('script', 'alert("hello!")')) * Not supported: * dom('p', ['arrays are objects'], Error('objects specify attributes')) */ function dom(n) { if (typeof n === 'string') n = document.createElement(n); for (var a, i = 1; i < arguments.length; i++) { if (!(a = arguments[i])) continue; if (typeof a !== 'object') a = document.createTextNode(a); if (a.nodeType) n.appendChild(a); else for (var key in a) { if (!Object.prototype.hasOwnProperty.call(a, key)) continue; if (key[0] === '$') n.style[key.slice(1)] = a[key]; else n.setAttribute(key, a[key]); } } return n; } function showConfirm(cm, template) { var pre = dom('div', {$color: 'red', $whiteSpace: 'pre', class: 'cm-vim-message'}, template); if (cm.openNotification) { cm.openNotification(pre, {bottom: true, duration: 5000}); } else { alert(pre.innerText); } } function makePrompt(prefix, desc) { return dom('div', {$display: 'flex'}, dom('span', {$fontFamily: 'monospace', $whiteSpace: 'pre', $flex: 1}, prefix, dom('input', {type: 'text', autocorrect: 'off', autocapitalize: 'off', spellcheck: 'false', $width: '100%'})), desc && dom('span', {$color: '#888'}, desc)); } function showPrompt(cm, options) { if (keyToKeyStack.length) { if (!options.value) options.value = ''; virtualPrompt = options; return; } var template = makePrompt(options.prefix, options.desc); if (cm.openDialog) { cm.openDialog(template, options.onClose, { onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, bottom: true, selectValueOnOpen: false, value: options.value }); } else { var shortText = ''; if (typeof options.prefix != "string" && options.prefix) shortText += options.prefix.textContent; if (options.desc) shortText += " " + options.desc; options.onClose(prompt(shortText, '')); } } 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 }; } var highlightTimeout = 0; function highlightSearchMatches(cm, query) { clearTimeout(highlightTimeout); var searchState = getSearchState(cm); searchState.highlightTimeout = highlightTimeout; highlightTimeout = setTimeout(function() { if (!cm.state.vim) return; var searchState = getSearchState(cm); searchState.highlightTimeout = null; 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); } }, 50); } 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)) { var lastEndPos = prev ? cursor.from() : cursor.to(); found = cursor.find(prev); if (found && !found[0] && cursorEqual(cursor.from(), lastEndPos)) { if (cm.getLine(lastEndPos.line).length == lastEndPos.ch) 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) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); if (!cursor.find(prev)) { return; } } } return cursor.from(); }); } /** * Pretty much the same as `findNext`, except for the following differences: * * 1. Before starting the search, move to the previous search. This way if our cursor is * already inside a match, we should return the current match. * 2. Rather than only returning the cursor's from, we return the cursor's from and to as a tuple. */ function findNextFromAndToInclusive(cm, prev, query, repeat, vim) { if (repeat === undefined) { repeat = 1; } return cm.operation(function() { var pos = cm.getCursor(); var cursor = cm.getSearchCursor(query, pos); // Go back one result to ensure that if the cursor is currently a match, we keep it. var found = cursor.find(!prev); // If we haven't moved, go back one more (similar to if i==0 logic in findNext). if (!vim.visualMode && found && cursorEqual(cursor.from(), pos)) { cursor.find(!prev); } for (var i = 0; i < repeat; i++) { 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) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); if (!cursor.find(prev)) { return; } } } return [cursor.from(), cursor.to()]; }); } function clearSearchHighlight(cm) { var state = getSearchState(cm); if (state.highlightTimeout) { clearTimeout(state.highlightTimeout); state.highlightTimeout = null; } 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 (typeof end == 'number') { 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} } function getMarkPos(cm, vim, markName) { if (markName == '\'' || markName == '`') { return vimGlobalState.jumpList.find(cm, -1) || new Pos(0, 0); } else if (markName == '.') { return getLastEditPos(cm); } var mark = vim.marks[markName]; return mark && mark.find(); } function getLastEditPos(cm) { if (cm.getLastEditEnd) { return cm.getLastEditEnd(); } // for old cm var done = cm.doc.history.done; for (var i = done.length; i--;) { if (done[i].changes) { return copyCursor(done[i].changes[0].to); } } } 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(); 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.toString()); throw e; } if (vim.visualMode) { exitVisualMode(cm); } 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. doKeyToKey(cm, command.toKeys, command); 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.toString()); 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); } } if (result.line == undefined) { if (cm.state.vim.visualMode) { var pos = getMarkPos(cm, cm.state.vim, '<'); result.selectionLine = pos && pos.line; pos = getMarkPos(cm, cm.state.vim, '>'); result.selectionLineEnd = pos && pos.line; } else { result.selectionLine = cm.getCursor().line; } } else { result.selectionLine = result.line; result.selectionLineEnd = result.lineEnd; } // 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) { // Absolute line number plus offset (N+M or N-M) is probably a typo, // not something the user actually wanted. (NB: vim does allow this.) return parseInt(numberMatch[1], 10) - 1; } switch (inputStream.next()) { case '.': return this.parseLineSpecOffset_(inputStream, cm.getCursor().line); case '$': return this.parseLineSpecOffset_(inputStream, cm.lastLine()); case '\'': var markName = inputStream.next(); var markPos = getMarkPos(cm, cm.state.vim, markName); if (!markPos) throw new Error('Mark not set'); return this.parseLineSpecOffset_(inputStream, markPos.line); case '-': case '+': inputStream.backUp(1); // Offset is relative to current line if not otherwise specified. return this.parseLineSpecOffset_(inputStream, cm.getCursor().line); default: inputStream.backUp(1); return undefined; } }, parseLineSpecOffset_: function(inputStream, line) { var offsetMatch = inputStream.match(/^([+-])?(\d+)/); if (offsetMatch) { var offset = parseInt(offsetMatch[2], 10); if (offsetMatch[1] == "-") { line -= offset; } else { line += offset; } } return line; }, 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, noremap) { 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 { // Key to key or ex mapping var mapping = { keys: lhs, type: 'keyToKey', toKeys: rhs, noremap: !!noremap }; 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 true; } } 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.splice(i, 1); return true; } } } } }; 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, defaultOnly) { 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, defaultOnly); }, 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'); }, omap: function(cm, params) { this.map(cm, params, 'operatorPending'); }, noremap: function(cm, params) { this.map(cm, params, undefined, true); }, inoremap: function(cm, params) { this.map(cm, params, 'insert', true); }, nnoremap: function(cm, params) { this.map(cm, params, 'normal', true); }, vnoremap: function(cm, params) { this.map(cm, params, 'visual', true); }, onoremap: function(cm, params) { this.map(cm, params, 'operatorPending', true); }, unmap: function(cm, params, ctx) { var mapArgs = params.args; if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) { if (cm) { showConfirm(cm, 'No such mapping: ' + params.input); } } }, mapclear: function(cm, params) { vimApi.mapclear(); }, imapclear: function(cm, params) { vimApi.mapclear('insert'); }, nmapclear: function(cm, params) { vimApi.mapclear('normal'); }, vmapclear: function(cm, params) { vimApi.mapclear('visual'); }, omapclear: function(cm, params) { vimApi.mapclear('operatorPending'); }, 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; var forceToggle = 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; } else if (optionName.charAt(optionName.length - 1) == '!') { optionName = optionName.substring(0, optionName.length - 1); forceToggle = 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) { if (forceToggle) { value = !getOption(optionName, cm, setCfg); } else if (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 instanceof Error) { showConfirm(cm, oldValue.message); } else if (oldValue === true || oldValue === false) { showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName); } else { showConfirm(cm, ' ' + optionName + '=' + oldValue); } } else { var setOptionReturn = setOption(optionName, value, cm, setCfg); if (setOptionReturn instanceof Error) { showConfirm(cm, setOptionReturn.message); } } }, 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----------\n\n'; if (!regArgs) { for (var registerName in registers) { var text = registers[registerName].toString(); if (text.length) { regInfo += '"' + registerName + ' ' + text + '\n' } } } 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() + '\n' } } showConfirm(cm, regInfo); }, sort: function(cm, params) { var reverse, ignoreCase, unique, number, pattern; 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(/([dinuox]+)?\s*(\/.+\/)?\s*/); if (!opts && !args.eol()) { return 'Invalid arguments'; } if (opts[1]) { ignoreCase = opts[1].indexOf('i') != -1; unique = opts[1].indexOf('u') != -1; var decimal = opts[1].indexOf('d') != -1 || opts[1].indexOf('n') != -1 && 1; var hex = opts[1].indexOf('x') != -1 && 1; var octal = opts[1].indexOf('o') != -1 && 1; if (decimal + hex + octal > 1) { return 'Invalid arguments'; } number = decimal && 'decimal' || hex && 'hex' || octal && 'octal'; } if (opts[2]) { pattern = new RegExp(opts[2].substr(1, opts[2].length - 2), ignoreCase ? 'i' : ''); } } } 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 = new Pos(lineStart, 0); var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd)); var text = cm.getRange(curStart, curEnd).split('\n'); var numberRegex = pattern ? pattern : (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 || pattern) { for (var i = 0; i < text.length; i++) { var matchPart = pattern ? text[i].match(pattern) : null; if (matchPart && matchPart[0] != '') { numPart.push(matchPart); } else if (!pattern && 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; } function comparePatternFn(a, b) { if (reverse) { var tmp; tmp = a; a = b; b = tmp; } if (ignoreCase) { a[0] = a[0].toLowerCase(); b[0] = b[0].toLowerCase(); } return (a[0] < b[0]) ? -1 : 1; } numPart.sort(pattern ? comparePatternFn : compareFn); if (pattern) { for (var i = 0; i < numPart.length; i++) { numPart[i] = numPart[i].input; } } else if (!number) { 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); }, vglobal: function(cm, params) { // global inspects params.commandName this.global(cm, params); }, normal: function(cm, params) { var argString = params.argString; if (argString && argString[0] == '!') { argString = argString.slice(1); noremap = true; } argString = argString.trimStart(); if (!argString) { showConfirm(cm, 'Argument is required.'); return; } var line = params.line; if (typeof line == 'number') { var lineEnd = isNaN(params.lineEnd) ? line : params.lineEnd; for (var i = line; i <= lineEnd; i++) { cm.setCursor(i, 0); doKeyToKey(cm, params.argString.trimStart()); if (cm.state.vim.insertMode) { exitInsertMode(cm, true); } } } else { doKeyToKey(cm, params.argString.trimStart()); if (cm.state.vim.insertMode) { exitInsertMode(cm, true); } } }, 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; } var inverted = params.commandName[0] === 'v'; if (argString[0] === '!' && params.commandName[0] === 'g') { inverted = true; argString = argString.slice(1); } // 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 = []; for (var i = lineStart; i <= lineEnd; i++) { var line = cm.getLine(i); var matched = query.test(line); if (matched !== inverted) { matchedLines.push(cmd ? cm.getLineHandle(i) : line); } } // if there is no [cmd], just display the list of matched lines if (!cmd) { showConfirm(cm, matchedLines.join('\n')); return; } var index = 0; var nextCommand = function() { if (index < matchedLines.length) { var lineHandle = matchedLines[index++]; var lineNum = cm.getLineNumber(lineHandle); if (lineNum == null) { nextCommand(); return; } var command = (lineNum + 1) + cmd; exCommandDispatcher.processCommand(cm, command, { callback: nextCommand }); } else if (cm.releaseLineHandles) { cm.releaseLineHandles(); } }; 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 ? splitBySeparator(argString, argString[0]) : []; 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]; if (getOption('pcre') && regexPart !== '') { regexPart = new RegExp(regexPart).source; //normalize not escaped characters } replacePart = tokens[1]; if (replacePart !== undefined) { if (getOption('pcre')) { replacePart = unescapeRegexReplace(replacePart.replace(/([^\\])&/g,"$1$$&")); } 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; } if (flagsPart.indexOf('g') != -1) { global = true; } if (getOption('pcre')) { regexPart = regexPart + '/' + flagsPart; } else { regexPart = regexPart.replace(/\//g, "\\/") + '/' + 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, new Pos(lineStart, 0)); var cursor = cm.getSearchCursor(query, startPos); doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); }, startinsert: function(cm, params) { doKeyToKey(cm, params.argString == '!' ? 'A' : 'i', {}); }, 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 if (cm.save) { // Saves to text area if no save command is defined and cm.save() is available. cm.save(); } }, nohlsearch: function(cm) { clearSearchHighlight(cm); }, yank: function (cm) { var cur = copyCursor(cm.getCursor()); var line = cur.line; var lineText = cm.getLine(line); vimGlobalState.registerController.pushText( '0', 'yank', lineText, true, true); }, delete: function(cm, params) { var line = params.selectionLine; var lineEnd = isNaN(params.selectionLineEnd) ? line : params.selectionLineEnd; operators.delete(cm, {linewise: true}, [ { anchor: new Pos(line, 0), head: new Pos(lineEnd + 1, 0) } ]); }, join: function(cm, params) { var line = params.selectionLine; var lineEnd = isNaN(params.selectionLineEnd) ? line : params.selectionLineEnd; cm.setCursor(new Pos(line, 0)); actions.joinLines(cm, {repeat: lineEnd - line}, cm.state.vim); }, 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, modifiedLineNumber, joined; 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); var unmodifiedLineNumber = searchCursor.to().line; searchCursor.replace(newText); modifiedLineNumber = searchCursor.to().line; lineEnd += modifiedLineNumber - unmodifiedLineNumber; joined = modifiedLineNumber < unmodifiedLineNumber; } function findNextValidMatch() { var lastMatchTo = lastPos && copyCursor(searchCursor.to()); var match = searchCursor.findNext(); if (match && !match[0] && lastMatchTo && cursorEqual(searchCursor.from(), lastMatchTo)) { match = searchCursor.findNext(); } return match; } function next() { // The below only loops to skip over multiple occurrences on the same // line when 'global' is not true. while(findNextValidMatch() && isInRange(searchCursor.from(), lineStart, lineEnd)) { if (!global && searchCursor.from().line == modifiedLineNumber && !joined) { 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 = vimKeyFromEvent(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 '': case '': case '': 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: dom('span', 'replace with ', dom('strong', replaceWith), ' (y/n/a/q/l)'), onKeyDown: onPromptKeyDown }); } function exitInsertMode(cm, keepCursor) { var vim = cm.state.vim; var macroModeState = vimGlobalState.macroModeState; var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.'); var isPlaying = macroModeState.isPlaying; var lastChange = macroModeState.lastInsertModeChanges; if (!isPlaying) { cm.off('change', onChange); if (vim.insertEnd) vim.insertEnd.clear(); vim.insertEnd = null; 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; if (!keepCursor) { cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1); } cm.setOption('keyMap', 'vim'); cm.setOption('disableInput', true); 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'); 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); vimApi.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) { var vim = cm.state.vim; while(changeObj) { lastChange.expectCursorActivityForChange = true; if (lastChange.ignoreCount > 1) { lastChange.ignoreCount--; } else if (changeObj.origin == '+input' || changeObj.origin == 'paste' || changeObj.origin === undefined /* only in testing */) { var selectionCount = cm.listSelections().length; if (selectionCount > 1) lastChange.ignoreCount = selectionCount; var text = changeObj.text.join('\n'); if (lastChange.maybeReset) { lastChange.changes = []; lastChange.maybeReset = false; } if (text) { if (cm.state.overwrite && !/\n/.test(text)) { lastChange.changes.push([text]); } else { if (text.length > 1) { var insertEnd = vim && vim.insertEnd && vim.insertEnd.find() var cursor = cm.getCursor(); if (insertEnd && insertEnd.line == cursor.line) { var offset = insertEnd.ch - cursor.ch; if (offset > 0 && offset < text.length) { lastChange.changes.push([text, offset]); text = ''; } } } if (text) 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; if (vim.insertEnd) vim.insertEnd.clear(); vim.insertEnd = cm.setBookmark(cm.getCursor(), {insertLeft: true}); } } else if (!cm.curOp.isVimOp) { handleExternalSelection(cm, vim); } } function handleExternalSelection(cm, vim, keepHPos) { 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 && !keepHPos) { // 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, e) { this.keyName = keyName; this.key = e.key; this.ctrlKey = e.ctrlKey; this.altKey = e.altKey; this.metaKey = e.metaKey; this.shiftKey = e.shiftKey; } /** * 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 ? CodeMirror.keyName(e) : e.key; if (!keyName) { return; } if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) { if (lastChange.maybeReset) { lastChange.changes = []; lastChange.maybeReset = false; } lastChange.changes.push(new InsertModeKey(keyName, e)); } } /** * 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); } } 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 sendCmKey(cm, key) { CodeMirror.lookupKey(key, 'vim-insert', function keyHandler(binding) { if (typeof binding == 'string') { CodeMirror.commands[binding](cm); } else { binding(cm); } return true; }); } function repeatInsertModeChanges(cm, changes, repeat) { var head = cm.getCursor('head'); var visualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.visualBlock; if (visualBlock) { // Set up block selection again for repeating the changes. selectForInsert(cm, head, visualBlock + 1); repeat = cm.listSelections().length; cm.setCursor(head); } for (var i = 0; i < repeat; i++) { if (visualBlock) { cm.setCursor(offsetCursor(head, i, 0)); } for (var j = 0; j < changes.length; j++) { var change = changes[j]; if (change instanceof InsertModeKey) { sendCmKey(cm, change.keyName, change); } else if (typeof change == "string") { cm.replaceSelection(change); } else { var start = cm.getCursor(); var end = offsetCursor(start, 0, change[0].length - (change[1] || 0)); cm.replaceRange(change[0], start, change[1] ? start: end); cm.setCursor(end); } } } if (visualBlock) { cm.setCursor(offsetCursor(head, 0, 1)); } } // multiselect support // Initialize Vim and make it available as an API. CodeMirror.Vim = vimApi; var specialKeyAce = {'return':'CR',backspace:'BS','delete':'Del',esc:'Esc', left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space',insert: 'Ins', home:'Home',end:'End',pageup:'PageUp',pagedown:'PageDown', enter: 'CR' }; function lookupKey(hashId, key, e, vim) { if (key.length > 1 && key[0] == "n") { key = key.replace("numpad", ""); } key = specialKeyAce[key] || key; var name = ''; if (e.ctrlKey) { name += 'C-'; } if (e.altKey) { name += 'A-'; } if ((name || key.length > 1) && e.shiftKey) { name += 'S-'; } if (vim && !vim.expectLiteralNext && key.length == 1) { if (langmap.keymap && key in langmap.keymap) { if (langmap.remapCtrl !== false || !name) key = langmap.keymap[key]; } else if (key.charCodeAt(0) > 255) { var code = e.code && e.code.slice(-1) || ""; if (!e.shiftKey) code = code.toLowerCase(); if (code) key = code; } } name += key; if (name.length > 1) { name = '<' + name + '>'; } return name; } var handleKey = vimApi.handleKey.bind(vimApi); vimApi.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) { if (key == "insertEnd") return; 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 = vimApi.maybeInitVimState_(cm); var visualBlock = vim.visualBlock || vim.wasInVisualBlock; var wasMultiselect = cm.ace.inMultiSelectMode; if (vim.wasInVisualBlock && !wasMultiselect) { vim.wasInVisualBlock = false; } else if (wasMultiselect && vim.visualBlock) { vim.wasInVisualBlock = true; } if (key == '' && !vim.insertMode && !vim.visualMode && wasMultiselect) { cm.ace.exitMultiSelectMode(); } else if (visualBlock || !wasMultiselect || cm.ace.inVirtualSelectionMode) { isHandled = vimApi.handleKey(cm, key, origin); } else { var old = cloneVimState(vim); var changeQueueList = vim.inputState.changeQueueList || []; cm.operation(function() { cm.curOp.isVimOp = true; var index = 0; cm.ace.forEachSelection(function() { var sel = cm.ace.selection; cm.state.vim.lastHPos = sel.$desiredColumn == null ? sel.lead.column : sel.$desiredColumn; cm.state.vim.inputState.changeQueue = changeQueueList[index]; 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; // TODO why does cm.virtualSelectionMode check index? if (cm.ace.inVirtualSelectionMode) { changeQueueList[index] = cm.state.vim.inputState.changeQueue; } if (cm.virtualSelectionMode()) { cm.state.vim = cloneVimState(old); } index++; }); if (cm.curOp.cursorActivity && !isHandled) cm.curOp.cursorActivity = false; vim.status = cm.state.vim.status; cm.state.vim = vim; vim.inputState.changeQueueList = changeQueueList; vim.inputState.changeQueue = null; }, true); } // some commands may bring visualMode and selection out of sync if (isHandled && !vim.visualMode && !vim.insert && vim.visualMode != cm.somethingSelected()) { handleExternalSelection(cm, vim, true); } return isHandled; } resetVimGlobalState(); exports.CodeMirror = CodeMirror; var getVim = vimApi.maybeInitVimState_; exports.handler = { $id: "ace/keyboard/vim", drawCursor: function(element, 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; } domLib.translate(element, left, top); domLib.setStyle(element.style, "width", w + "px"); domLib.setStyle(element.style, "height", h + "px"); }, $getDirectionForHighlight: function (editor) { var cm = editor.state.cm; var vim = getVim(cm); if (!vim.insertMode) { return editor.session.selection.isBackwards() || editor.session.selection.isEmpty(); } }, handleKeyboard: function(data, hashId, key, keyCode, e) { var editor = data.editor; var cm = editor.state.cm; var vim = getVim(cm); if (keyCode == -1) return; // in non-insert mode we try to find the ascii key corresponding to the text in textarea // this is needed because in languages that use latin alphabet we want to get the key that browser sends to the textarea // and in non if (!vim.insertMode) { if (hashId == -1) { if (key.charCodeAt(0) > 0xFF) { if (data.inputKey) { key = data.inputKey; if (key && data.inputHash == 4) key = key.toUpperCase(); } } data.inputChar = key; } else if (hashId == 4 || hashId == 0) { if (data.inputKey == key && data.inputHash == hashId && data.inputChar) { // on mac text input doesn't repeat key = data.inputChar; hashId = -1 } else { data.inputChar = null; data.inputKey = key; data.inputHash = hashId; } } else { data.inputChar = data.inputKey = null; } } if (cm.state.overwrite && vim.insertMode && key == "backspace" && hashId == 0) { return {command: "gotoleft"} } // ctrl-c is special it both exits mode and copies text if (key == "c" && hashId == 1) { // key == "ctrl-c" if (!useragent.isMac && editor.getCopyText()) { editor.once("copy", function() { if (vim.insertMode) editor.selection.clearSelection(); else cm.operation(function() { exitVisualMode(cm); }); }); return {command: "null", passEvent: true}; } } if (key == "esc" && !vim.insertMode && !vim.visualMode && !cm.ace.inMultiSelectMode) { var searchState = getSearchState(cm); var overlay = searchState.getOverlay(); if (overlay) cm.removeOverlay(overlay); } if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) { var insertMode = vim.insertMode; var name = lookupKey(hashId, key, e || {}, vim); 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; enterVimMode(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; updateInputMode(); cm._signal("changeStatus"); }); function updateInputMode() { var isIntsert = getVim(cm).insertMode; cm.ace.renderer.setStyle("normal-mode", !isIntsert); editor.textInput.setCommandMode(!isIntsert); // without this press and hodl popup in mac is shown in normal mode editor.renderer.$keepTextAreaAtCursor = isIntsert; editor.renderer.$blockCursor = !isIntsert; } updateInputMode(); editor.renderer.$cursorLayer.drawCursor = this.drawCursor.bind(cm); }, detach: function(editor) { var cm = editor.state.cm; leaveVimMode(cm); cm.destroy(); editor.state.cm = null; editor.$vimModeHandler = null; editor.renderer.$cursorLayer.drawCursor = null; editor.renderer.setStyle("normal-mode", false); editor.textInput.setCommandMode(false); editor.renderer.$keepTextAreaAtCursor = true; }, 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; } }; vimApi.defineOption({ name: "wrap", set: function(value, cm) { if (cm) {cm.ace.setOption("wrap", value)} }, type: "boolean" }, false); vimApi.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" } } ); defaultKeymap.push({ keys: 'gq', type: 'operator', operator: 'hardWrap' }); vimApi.defineOperator("hardWrap", function(cm, operatorArgs, ranges, oldAnchor, newHead) { var anchor = ranges[0].anchor.line; var head = ranges[0].head.line; if (operatorArgs.linewise) head--; hardWrap(cm.ace, {startRow: anchor, endRow: head}); return Pos(head, 0); }); defineOption('textwidth', undefined, 'number', ['tw'], function(width, cm) { // Option is local. Do nothing for global. if (cm === undefined) { return; } // The 'filetype' option proxies to the CodeMirror 'mode' option. if (width === undefined) { var value = cm.ace.getOption('printMarginColumn'); return value; } else { var column = Math.round(width); if (column > 1) { cm.ace.setOption('printMarginColumn', column); } } }); 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)]); }; defaultKeymapLength = defaultKeymap.length; // ace_patch exports.handler.defaultKeymap = defaultKeymap; exports.handler.actions = actions; exports.Vim = vimApi; ================================================ FILE: src/keyboard/vim_ace_test.js ================================================ /*global CustomEvent*/ "use strict"; var assert = require("./../test/assertions"); var Range = require("../range").Range; require("./../test/mockdom"); var ace = require("../ace"); var vim = require("./vim"); var editor, changes, textarea; var user = require("../test/user"); function testSelection(editor, data) { assert.equal(getSelection(editor) + "", data + ""); } 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 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 testValue(editor, value) { assert.equal(editor.getValue(), value); } function applyEvent(data) { if (typeof data == "function") return data(); var type = data._; var event = new CustomEvent(type); for (var i in data.key || {}) event[i] = data.key[i]; data.modifier && data.modifier.split("-").map(function(m) { if (m) event[m + "Key"] = true; }); if (/input|select|composition/.test(type)) { textarea.value = data.value; textarea.setSelectionRange(data.range[0], data.range[1]); } textarea.dispatchEvent(event); if (data.value != null) assert.equal(textarea.value, data.value); if (data.range != null) { assert.equal(textarea.selectionStart, data.range[0]); assert.equal(textarea.selectionEnd, data.range[1]); } editor.resize(true); } function scrollTop() { editor.endOperation(); editor.renderer.$loop._flush(); return editor.renderer.scrollTop / editor.renderer.lineHeight; } module.exports = { setUp: function() { if (!editor) { editor = ace.edit(null); document.body.appendChild(editor.container); editor.container.style.height = "200px"; editor.container.style.width = "300px"; editor.container.style.position = "absolute"; editor.container.style.outline = "solid"; editor.resize(true); editor.on("change", function(e) { changes.push(e); }); editor.setKeyboardHandler(vim.handler); } textarea = editor.textInput.getElement(); changes = []; editor.focus(); }, tearDown: function() { if (editor) { editor.destroy(); editor.container.remove(); editor = textarea = null; } }, "test: multiselect and composition": function() { editor.setValue("hello world\n\thello world"); editor.execCommand("gotoend"); [ { _: "keydown", range: [12,12], value: "\thello world\n\n", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"}, { _: "keydown", range: [12,12], value: "\thello world\n\n", key: { code: "AltLeft", key: "Alt", keyCode: 18}, modifier: "ctrl-alt-"}, { _: "keydown", range: [6,11], value: "hello world\n\n", key: { code: "KeyL", key: "fi", keyCode: 76}, modifier: "ctrl-alt-"}, { _: "keydown", range: [6,11], value: "hello world\n\n", key: { code: "KeyC", key: "c", keyCode: 67}}, { _: "input", range: [7,7], value: "hello c\n\n"}, { _: "keydown", range: [7,7], value: "hello c\n\n", key: { code: "KeyX", key: "x", keyCode: 88}}, { _: "input", range: [8,8], value: "hello cx\n\n"}, { _: "keydown", range: [6,6], value: "hello x\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}}, { _: "keydown", range: [6,6], value: "hello x\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"}, { _: "keydown", range: [6,6], value: "hello x\n\n", key: { code: "BracketRight", key: "Dead", keyCode: 229}, modifier: "shift-"}, { _: "compositionstart", range: [6,6], value: "hello x\n\n"}, { _: "compositionupdate", range: [6,6], value: "hello x\n\n"}, { _: "compositionend", range: [7,7], value: "hello ^x\n\n"}, { _: "input", range: [7,7], value: "hello ^x\n\n"}, function() { testSelection(editor, [[0,0],[1,1]]); }, { _: "keydown", range: [7,7], value: "hello ^x\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}}, { _: "keydown", key: { code: "KeyH", key: "˛", keyCode: 72}, modifier: "ctrl-alt-"}, { _: "keydown", range: [1,6], value: "\thello x\n\n", key: { code: "AltRight", key: "Alt", keyCode: 18}, modifier: "alt-"}, { _: "keydown", range: [1,6], value: "\thello x\n\n", key: { code: "Digit4", key: "$", keyCode: 52}, modifier: "alt-"}, { _: "input", range: [2,2], value: "\t$ x\n\n"}, function() { testSelection(editor, [[1,5,1,8], [0,4,0,7]]); }, { _: "keydown", key: { code: "Escape", key: "Escape", keyCode: 27}}, function() { testSelection(editor, [[1,7],[0,6]]); }, { _: "keydown", key: { code: "Escape", key: "Escape", keyCode: 27}}, ].forEach(function(data) { applyEvent(data); }); assert.equal(editor.getValue(), "hello x\n\thello x"); }, "test: vim virtual selection": function() { editor.setValue("hello world\n\thello world"); editor.execCommand("gotoend"); [ { _: "keydown", range: [12,12], value: "\thello world\n\n", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"}, { _: "keydown", range: [12,12], value: "\thello world\n\n", key: { code: "AltLeft", key: "Alt", keyCode: 18}, modifier: "ctrl-alt-"}, { _: "keydown", range: [6,11], value: "hello world\n\n", key: { code: "KeyL", key: "fi", keyCode: 76}, modifier: "ctrl-alt-"}, { _: "keydown", range: [6,11], value: "hello world\n\n", key: { code: "KeyC", key: "c", keyCode: 67}}, { _: "input", range: [7,7], value: "hello c\n\n"}, { _: "keydown", range: [7,7], value: "hello c\n\n", key: { code: "KeyX", key: "x", keyCode: 88}}, { _: "input", range: [8,8], value: "hello cx\n\n"}, { _: "keydown", range: [6,6], value: "hello x\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}}, { _: "keydown", range: [6,6], value: "hello x\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"}, { _: "keydown", range: [6,6], value: "hello x\n\n", key: { code: "BracketRight", key: "Dead", keyCode: 229}, modifier: "shift-"}, { _: "compositionstart", range: [6,6], value: "hello x\n\n"}, { _: "compositionupdate", range: [6,6], value: "hello x\n\n"}, { _: "compositionend", range: [7,7], value: "hello ^x\n\n"}, { _: "input", range: [7,7], value: "hello ^x\n\n"}, function() { testSelection(editor, [[0,0],[1,1]]); }, { _: "keydown", range: [7,7], value: "hello ^x\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}}, { _: "keydown", key: { code: "KeyH", key: "˛", keyCode: 72}, modifier: "ctrl-alt-"}, { _: "keydown", range: [1,6], value: "\thello x\n\n", key: { code: "AltRight", key: "Alt", keyCode: 18}, modifier: "alt-"}, { _: "keydown", range: [1,6], value: "\thello x\n\n", key: { code: "Digit4", key: "$", keyCode: 52}, modifier: "alt-"}, { _: "input", range: [2,2], value: "\t$ x\n\n"}, function() { testSelection(editor, [[1,5,1,8], [0,4,0,7]]); }, { _: "keydown", key: { code: "Escape", key: "Escape", keyCode: 27}}, function() { testSelection(editor, [[1,7],[0,6]]); }, { _: "keydown", key: { code: "Escape", key: "Escape", keyCode: 27}}, ].forEach(function(data) { applyEvent(data); }); assert.equal(editor.getValue(), "hello x\n\thello x"); }, "test: vim visual selection": function() { editor.setValue("xxx\nccc\n\nzzz\nccc"); setSelection(editor, [2,0]); [ { _: "input", range: [1,1], value: "V\n\n"}, { _: "keyup", range: [1,1], value: "V\n\n", key: { code: "KeyV", key: "V", keyCode: 86}, modifier: "shift-"}, { _: "keyup", range: [1,1], value: "V\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}}, { _: "keydown", range: [1,1], value: "V\n\n", key: { code: "KeyK", key: "k", keyCode: 75}}, { _: "keypress", range: [1,1], value: "V\n\n", key: { code: "KeyK", key: "k", keyCode: 107}}, { _: "input", range: [2,2], value: "Vk\n\n"}, { _: "keyup", range: [2,2], value: "Vk\n\n", key: { code: "KeyK", key: "k", keyCode: 75}}, { _: "keydown", range: [2,2], value: "Vk\n\n", key: { code: "KeyC", key: "c", keyCode: 67}}, { _: "keypress", range: [2,2], value: "Vk\n\n", key: { code: "KeyC", key: "c", keyCode: 99}}, { _: "input", range: [3,3], value: "Vkc\n\n"}, { _: "keyup", range: [3,3], value: "Vkc\n\n", key: { code: "KeyC", key: "c", keyCode: 67}}, { _: "keydown", range: [3,3], value: "Vkc\n\n", key: { code: "KeyO", key: "o", keyCode: 79}}, { _: "keypress", range: [3,3], value: "Vkc\n\n", key: { code: "KeyO", key: "o", keyCode: 111}}, { _: "input", range: [4,4], value: "Vkco\n\n"}, { _: "keyup", range: [4,4], value: "Vkco\n\n", key: { code: "KeyO", key: "o", keyCode: 79}}, function() { testValue(editor, "xxx\nozzz\nccc") testSelection(editor, [1,1]) }, { _: "keydown", range: [0,0], value: "ozzz\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}}, { _: "keyup", range: [0,0], value: "ozzz\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}}, { _: "keydown", range: [0,0], value: "ozzz\n\n", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"}, { _: "keydown", range: [0,1], value: "ozzz\n\n", key: { code: "KeyV", key: "v", keyCode: 86}, modifier: "ctrl-"}, { _: "select", range: [0,1], value: "ozzz\n\n"}, { _: "keyup", range: [0,1], value: "ozzz\n\n", key: { code: "KeyV", key: "v", keyCode: 86}, modifier: "ctrl-"}, { _: "keyup", range: [0,1], value: "ozzz\n\n", key: { code: "ControlLeft", key: "Control", keyCode: 17}}, { _: "keydown", range: [0,1], value: "ccc\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}}, { _: "select", range: [0,1], value: "ccc\n\n"}, { _: "keyup", range: [0,1], value: "ccc\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}}, function() { testValue(editor, "xxx\nozzz\nccc") testSelection(editor, [[2,1,2,0],[1,1,1,0]]) }, { _: "keydown", range: [0,1], value: "ccc\n\n", key: { code: "Period", key: ".", keyCode: 190}}, { _: "keypress", range: [0,1], value: "ccc\n\n", key: { code: "Period", key: ".", keyCode: 46}}, { _: "input", range: [1,1], value: ".cc\n\n"}, { _: "keyup", range: [1,1], value: ".cc\n\n", key: { code: "Period", key: ".", keyCode: 190}}, function() { testValue(editor, "xxx\no"); testSelection(editor, [1,0]); } ].forEach(function(data) { applyEvent(data); }); }, "test vim gq": function() { editor.setValue( "1\n2\nhello world\n" + "xxx ".repeat(20) + "\nyyy" + "\n\nnext\nparagraph" ); editor.selection.moveTo(2,5) editor.focus() user.type("gqgq") assert.deepEqual(editor.getCursorPosition(), {row: 2, column: 0}) assert.equal(editor.session.getLine(2), "hello world") user.type("gqj") assert.deepEqual(editor.getCursorPosition(), {row: 3, column: 0}) assert.equal(editor.session.getLine(3), "xxx xxx xxx ") user.type("gq}") assert.deepEqual(editor.getCursorPosition(), {row: 4, column: 0}) assert.equal(editor.session.getLine(3), "xxx xxx xxx yyy") user.type("gqG") user.type("gqgg") user.type(":set tw=15\n") user.type("gg") user.type("V") user.type("gq") assert.equal(editor.session.getLine(0), "1 2 hello world") assert.equal(editor.session.getLine(5), "xxx xxx xxx xxx yyy") user.type(":6\n") user.type("gqq") assert.equal(editor.session.getLine(6), "yyy") }, "test vim search": function() { editor.renderer.setOption("animatedScroll", false); editor.setValue( "very\nlong\n\ntext\n".repeat(10) + "needle " + "some\nmore\ntext\n".repeat(6), -1 ); editor.focus(); var screenSize = editor.renderer.layerConfig.height / editor.renderer.lineHeight; user.type("Escape", "gg"); assert.equal(scrollTop(), 0); user.type("/", "needle"); assert.ok(scrollTop() > 40 - screenSize); editor.endOperation(); user.type("Escape"); assert.equal(scrollTop(), 0); user.type("/", "needle", "Enter"); assert.ok(scrollTop() > 40 - screenSize); assert.ok(scrollTop() < 40); user.type("6", "/", "more", "Enter"); editor.endOperation(); assert.ok(scrollTop() > 40 + 16 - screenSize); }, "test: vim normal mode brackets highlighting": function () { editor.setValue("{((hello, world))}"); editor.focus(); var handler = editor.getKeyboardHandler(); var vimDirectionFunc = handler && handler.$getDirectionForHighlight; assert.ok(vimDirectionFunc); var values = [ {isBackwards: true, anchorRow: 0, anchorColumn: 0, cursorRow: 0, cursorColumn: 0, startRow: 0, startColumn: 17, endRow: 0, endColumn: 18}, {isBackwards: true, anchorRow: 0, anchorColumn: 2, cursorRow: 0, cursorColumn: 2, startRow: 0, startColumn: 15, endRow: 0, endColumn: 16}, {isBackwards: false, anchorRow: 0, anchorColumn: 15, cursorRow: 0, cursorColumn: 17, startRow: 0, startColumn: 1, endRow: 0, endColumn: 2}, {isBackwards: true, anchorRow: 0, anchorColumn: 17, cursorRow: 0, cursorColumn: 16, startRow: 0, startColumn: 1, endRow: 0, endColumn: 2} ]; values.forEach((el) => { editor.session.selection.$setSelection(el.anchorRow, el.anchorColumn, el.cursorRow, el.cursorColumn); var isBackwards = vimDirectionFunc(editor); assert.ok(isBackwards === el.isBackwards); var ranges = editor.session.getMatchingBracketRanges({ row: el.cursorRow, column: el.cursorColumn }, isBackwards); assert.range(ranges[1], el.startRow, el.startColumn, el.endRow, el.endColumn); }); }, "test: gotoline": function () { editor.renderer.setOption("animatedScroll", false); editor.setValue( "very\nlong\n\ntext\n".repeat(20), -1 ); editor.focus(); var screenSize = editor.renderer.layerConfig.height / editor.renderer.lineHeight; assert.equal(scrollTop(), 0); user.type(":30", "Enter"); editor.endOperation(); assert.ok(scrollTop() > 30 - screenSize); assert.ok(scrollTop() < 30); } }; require("../test/run")(module); ================================================ FILE: src/keyboard/vim_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } 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 CSSMode = require("./../mode/css").Mode; var XMLMode = require("./../mode/xml").Mode; var VirtualRenderer = require("./../virtual_renderer").VirtualRenderer; var assert = require("./../test/assertions"); var keys = require("./../lib/keys"); var vim = require("./vim"); var isAce = true; var el = document.createElement("div"); el.style.position = "fixed"; el.style.left = "320px"; el.style.top = "30px"; el.style.width = "500px"; el.style.height = "300px"; document.body.appendChild(el); var phantom = window.name == "nodejs"; var renderer = new VirtualRenderer(el); var editor = window.editor = new Editor(renderer); editor.session.setUndoManager(new UndoManager()); var modes = { js: new JavaScriptMode(), css: new CSSMode(), xml: new XMLMode() }; editor.setOptions({ useWorker: false, behavioursEnabled: false, }); function CodeMirror(place, opts) { if (!editor.container.parentNode) { document.body.appendChild(editor.container); } var cm = editor.state && editor.state.cm; if (cm && cm.state.currentNotificationClose) cm.state.currentNotificationClose(); if (cm) cm.focus(); editor.setKeyboardHandler(null); editor.setKeyboardHandler(vim.handler); cm = editor.state.cm; if (opts.value != null) editor.session.setValue(opts.value); editor.setOption("indentedSoftWrap", false); editor.setOption("wrap", opts.lineWrapping); editor.setOption("useSoftTabs", !opts.indentWithTabs); editor.setOption("mode", opts.mode ? modes[opts.mode] : modes.js); 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; } 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 = true; // ace_patch} function eqCursorPos(a, b) { if (a.line != b.line || a.ch != b.ch) throw failure( "Expected cursor position " + JSON.stringify([a.line, a.ch]) + " to be equal to " + JSON.stringify([b.line, b.ch]), eqCursorPos ); } function eq(a, b, _reason) { if(a != b) throw failure("Expected " + a + " to be equal to " + b, eq); } function is(a) { if (!a) throw failure("Expected " + a + " to be truthy", is); } function failure(message, root) { var error = new Error(message); if (Error.captureStackTrace) Error.captureStackTrace(error, root); return error; } var Pos = CodeMirror.Pos; CodeMirror.Vim.suppressErrorLogging = true; var isOldCodeMirror = /^5\./.test(CodeMirror.version); 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() { var 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 foldingStart = lines[7]; var foldingEnd = lines[11]; var word1 = { start: new Pos(wordLine.line, 1), end: new Pos(wordLine.line, 5) }; var word2 = { start: new Pos(wordLine.line, word1.end.ch + 2), end: new Pos(wordLine.line, word1.end.ch + 4) }; var word3 = { start: new Pos(bigWordLine.line, 1), end: new Pos(bigWordLine.line, 5) }; var bigWord1 = word1; var bigWord2 = word2; var bigWord3 = { start: new Pos(bigWordLine.line, 1), end: new Pos(bigWordLine.line, 7) }; var bigWord4 = { start: new Pos(bigWordLine.line, bigWord1.end.ch + 3), end: new Pos(bigWordLine.line, bigWord1.end.ch + 7) }; var oChars = [ new Pos(charLine.line, 1), new Pos(charLine.line, 3), new Pos(charLine.line, 7) ]; var pChars = [ new Pos(charLine.line, 2), new Pos(charLine.line, 4), new Pos(charLine.line, 6), new Pos(charLine.line, 8) ]; var numChars = [ new Pos(charLine.line, 10), new Pos(charLine.line, 12), new Pos(charLine.line, 14), new Pos(charLine.line, 16), new Pos(charLine.line, 18)]; var parens1 = { start: new Pos(bracesLine.line, 1), end: new Pos(bracesLine.line, 3) }; var squares1 = { start: new Pos(bracesLine.line, 5), end: new Pos(bracesLine.line, 7) }; var curlys1 = { start: new Pos(bracesLine.line, 9), end: new Pos(bracesLine.line, 11) }; var seekOutside = { start: new Pos(seekBraceLine.line, 1), end: new Pos(seekBraceLine.line, 16) }; var seekInside = { start: new Pos(seekBraceLine.line, 14), end: new Pos(seekBraceLine.line, 11) }; var foldingRangeDown = { start: new Pos(foldingStart.line, 3), end: new Pos(foldingEnd.line, 0) }; var foldingRangeUp = { start: new Pos(foldingEnd.line, 0), end: new Pos(foldingStart.line, 0) }; function copyCursor(cur) { return new Pos(cur.line, cur.ch); } function forEach(arr, func) { for (var i = 0; i < arr.length; i++) { func(arr[i], i, arr); } } function vimKeyToKeyName(key) { return key.replace(/[CS]-|CR|BS/g, function(part) { return {"C-": "Ctrl-", "S-": "Shift-", CR: "Return", BS: "Backspace"}[part]; }); } 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, async function(done) { var place = document.createElement("testground"); //ace_patch place.style.visibility = "visible"; var cm = CodeMirror(place, vimOpts); var vim = CodeMirror.Vim.maybeInitVimState_(cm); CodeMirror.Vim.mapclear(); cm.focus(); // workaround for cm5 slow polling in blurred window Object.defineProperty(cm.state, "focused", { set: function(e) {}, get: function() { return document.activeElement == cm.getInputField(); } }); var helpers = { doKeys: function() { var args = arguments[0] if (!Array.isArray(args)) { args = arguments; } for (var i = 0; i < args.length; i++) { var key = args[i]; if (key.length > 1 && key[0] == "<" && key.slice(-1) == ">") { key = vimKeyToKeyName(key.slice(1, -1)); } typeKey(key); } }, doEx: function(command) { helpers.doKeys(':', command, '\n'); }, assertCursorAt: function(line, ch) { var pos; if (ch == null && typeof line.line == 'number') { pos = line; } else { pos = makeCursor(line, ch); } eqCursorPos(cm.getCursor(), pos); }, getRegisterController: function() { return CodeMirror.Vim.getRegisterController(); }, getNotificationText: function() { var container = cm.getWrapperElement().querySelector(".cm-vim-message"); return container && container.textContent; } }; CodeMirror.Vim.resetVimGlobalState_(); var successful = false; try { await run(cm, vim, helpers); successful = true; } finally { if (successful && !verbose) { cm.getWrapperElement().remove(); } done(successful ? null : true); } }, expectedFail); }; 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) { endPos = makeCursor(endPos[0], endPos[1]); startPos = makeCursor(startPos[0], startPos[1]); testVim(name, function(cm, vim, helpers) { CodeMirror.Vim.resetVimGlobalState_(); 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_/', ['/', 'dialog\n', ''], [2,3], [2,3]); testJumplist('jumplist_?', ['?', 'dialog\n', ''], [2,3], [2,3]); testJumplist('jumplist_skip_deleted_mark', ['*', 'n', 'n', 'k', 'd', 'k', '', '', ''], [0,2], [0,2]); testJumplist('jumplist_skip_deleted_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 = new Pos(0, 0); } cm.setCursor(startPos); helpers.doKeys(keys); helpers.assertCursorAt(endPos); }); } function testMotionWithFolding(name, keys, endPos, startPos) { testVim(name, function (cm, vim, helpers) { cm.foldCode(startPos); cm.foldCode(endPos); cm.setCursor(startPos); helpers.doKeys(keys); helpers.assertCursorAt(endPos) }) } function makeCursor(line, ch) { return new Pos(line, ch); } function offsetCursor(cur, offsetLine, offsetCh) { return new Pos(cur.line + offsetLine, 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('Space', 'Space', 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('keepHPos', ['5', 'j', 'j', '7', 'k'], makeCursor(8, 12), makeCursor(12, 12)); testMotion('keepHPosEol', ['$', '2', 'j'], makeCursor(2, 18)); 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('$', ['v', '$'], makeCursor(0, lines[0].length), makeCursor(0, 1)); 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); // Motion with folding tests testMotionWithFolding('j_with_folding', 'j', foldingRangeDown.end, foldingRangeDown.start); testMotionWithFolding('k_with_folding', 'k', foldingRangeUp.end, foldingRangeUp.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(new Pos(1, lines[1].length - 1)); helpers.doKeys(['j']); // After moving down, we should be at Eol of line 3 helpers.assertCursorAt(new Pos(2, 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(new Pos(3, 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(new Pos(5, 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 intentionally long. It tests movements of gj and gk over wrapped lines. Starts on the end of this line, then makes 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) { 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 = new Pos(0, (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.ch != 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: 'Thislineisintentionallylongtotestmovementofgjandgkoverwrappedlines.' }); testVim('g0_g$', function(cm, vim, helpers) { cm.setSize(120); var topLeftCharCoords = cm.charCoords(makeCursor(0, 0)); cm.setCursor(0, 4); helpers.doKeys('g', 'Down'); var secondLineCoords = cm.charCoords(cm.getCursor()); is(secondLineCoords.top > topLeftCharCoords.top); is(secondLineCoords.left > topLeftCharCoords.left); helpers.doKeys('g', '0'); var start = cm.getCursor(); var startCoords = cm.charCoords(start); is(start.ch != 0); is(startCoords.left == topLeftCharCoords.left); is(secondLineCoords.top === startCoords.top); is(secondLineCoords.left > startCoords.left); helpers.doKeys('g', '$'); var end = cm.getCursor(); var endCoords = cm.charCoords(end); is(startCoords.left < endCoords.left); is(startCoords.top == endCoords.top); is(start.ch < end.ch && end.ch < cm.getValue().length / 2); is(/\.$/.test(cm.getValue())); helpers.doKeys('$', 'g', '0', 'd', 'g', '$'); is(!/\.$/.test(cm.getValue())); },{ lineNumbers: false, lineWrapping:true, value: 'This line is long to test movement of g$ and g0 over wrapped lines...' }); 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('(', function(cm, vim, helpers) { cm.setCursor(6, 23); helpers.doKeys('('); helpers.assertCursorAt(6, 14); helpers.doKeys('2', '('); helpers.assertCursorAt(5, 0); helpers.doKeys('('); helpers.assertCursorAt(4, 0); helpers.doKeys('('); helpers.assertCursorAt(3, 0); helpers.doKeys('('); helpers.assertCursorAt(2, 0); helpers.doKeys('('); helpers.assertCursorAt(0, 0); helpers.doKeys('('); helpers.assertCursorAt(0, 0); }, { value: 'sentence1.\n\n\nsentence2\n\nsentence3. sentence4\n sentence5? sentence6!' }); testVim(')', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('2', ')'); helpers.assertCursorAt(3, 0); helpers.doKeys(')'); helpers.assertCursorAt(4, 0); helpers.doKeys(')'); helpers.assertCursorAt(5, 0); helpers.doKeys(')'); helpers.assertCursorAt(5, 11); helpers.doKeys(')'); helpers.assertCursorAt(6, 14); helpers.doKeys(')'); helpers.assertCursorAt(6, 23); helpers.doKeys(')'); helpers.assertCursorAt(6, 23); }, { value: 'sentence1.\n\n\nsentence2\n\nsentence3. sentence4\n sentence5? sentence6!' }); 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'); eqCursorPos(new Pos(7, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(12, 0), cm.getCursor('head')); helpers.doKeys('i', 'p'); eqCursorPos(new Pos(7, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(13, 1), cm.getCursor('head')); helpers.doKeys('2', 'i', 'p'); eqCursorPos(new Pos(7, 0), cm.getCursor('anchor')); eqCursorPos(new 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'); eqCursorPos(new Pos(16, 1), cm.getCursor('head')); // ap inside empty space cm.setCursor(10, 0); helpers.doKeys('', 'v', 'a', 'p'); eqCursorPos(new Pos(7, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(13, 1), cm.getCursor('head')); helpers.doKeys('a', 'p'); eqCursorPos(new Pos(7, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(16, 1), cm.getCursor('head')); cm.setCursor(13, 0); helpers.doKeys('v', 'a', 'p'); eqCursorPos(new Pos(13, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(14, 0), cm.getCursor('head')); cm.setCursor(16, 0); helpers.doKeys('v', 'a', 'p'); eqCursorPos(new Pos(14, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(16, 1), cm.getCursor('head')); cm.setCursor(0, 0); helpers.doKeys('v', 'a', 'p'); eqCursorPos(new Pos(0, 0), cm.getCursor('anchor')); eqCursorPos(new 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' }); testVim('sentence_selections', function(cm, vim, helpers) { // vis at beginning of line cm.setCursor(0, 0); helpers.doKeys('v', 'i', 's'); eqCursorPos(new Pos(0, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(0, 14), cm.getCursor('head')); // vas at beginning of line cm.setCursor(0, 0); helpers.doKeys('v', 'a', 's'); eqCursorPos(new Pos(0, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(0, 15), cm.getCursor('head')); // vis on sentence end cm.setCursor(0, 13); helpers.doKeys('v', 'i', 's'); eqCursorPos(new Pos(0, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(0, 14), cm.getCursor('head')); // vas on sentence end cm.setCursor(0, 13); helpers.doKeys('v', 'a', 's'); eqCursorPos(new Pos(0, 0), cm.getCursor('anchor')); eqCursorPos(new Pos(0, 15), cm.getCursor('head')); // vis at sentence end, no whitespace after it cm.setCursor(1, 18); helpers.doKeys('v', 'i', 's'); eqCursorPos(new Pos(1, 13), cm.getCursor('anchor')); eqCursorPos(new Pos(1, 19), cm.getCursor('head')); // vas at sentence end, no whitespace after it cm.setCursor(1, 18); helpers.doKeys('v', 'a', 's'); eqCursorPos(new Pos(1, 12), cm.getCursor('anchor')); eqCursorPos(new Pos(1, 19), cm.getCursor('head')); // vis at sentence beginning, on whitespace cm.setCursor(0, 14); helpers.doKeys('v', 'i', 's'); eqCursorPos(new Pos(0, 14), cm.getCursor('anchor')); eqCursorPos(new Pos(0, 29), cm.getCursor('head')); cm.setCursor(0, 0); helpers.doKeys('d', 'i', 's'); var register = helpers.getRegisterController().getRegister(); eq('Test sentence.', register.toString()); // return to original value helpers.doKeys('u') cm.setCursor(0, 0); helpers.doKeys('d', 'a', 's'); register = helpers.getRegisterController().getRegister(); eq('Test sentence. ', register.toString()); // return to original value helpers.doKeys('u') cm.setCursor(1, 20); helpers.doKeys('c', 'a', 's', ''); register = helpers.getRegisterController().getRegister(); eq('Test.', register.toString()); // return to original value helpers.doKeys('u') cm.setCursor(3, 11); helpers.doKeys('y', 'a', 's'); register = helpers.getRegisterController().getRegister(); eq('This is more text. ', register.toString()); cm.setCursor(3, 31); helpers.doKeys('y', 'a', 's'); register = helpers.getRegisterController().getRegister(); eq(' No end of sentence symbol', register.toString()); }, { value: 'Test sentence. Test question?\nAgain.Never. Again.Test.\n\nHello. This is more text. No end of sentence symbol\n' }); testVim('w_text_object_repeat', function(cm, vim, helpers) { cm.setCursor(0, 2); helpers.doKeys('v', '3', 'a', 'w'); eq('w1 ++ w_2 ', cm.getSelection()); helpers.doKeys('', 'v', 'a', 'w'); eq(' \n w3', cm.getSelection()); helpers.doKeys('2', 'a', 'w'); eq(' \n w3 xx \n', cm.getSelection()); helpers.doKeys('a', 'w'); eq(' \n w3 xx \n\nw4', cm.getSelection()); cm.setValue(" w0 word1 word2 word3 word4") cm.setCursor(0, 8); helpers.doKeys('c', '3', 'a', 'w'); eq(' w0 word4', cm.getValue()); }, { value: ' w1 ++ w_2 \n w3 xx \n\nw4\nword5\nword6' }); // 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); eqCursorPos(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); eqCursorPos(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); eqCursorPos(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('', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq(' word1 \n', register.toString()); is(register.linewise); helpers.assertCursorAt(0, 0); }, { 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('', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq(' word1 \n', register.toString()); is(register.linewise); helpers.assertCursorAt(0, 0); }, { 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); eqCursorPos(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); eqCursorPos(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); eqCursorPos(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(new Pos(0, 0), new Pos(1, 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(new Pos(0, 0), new Pos(2, 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(new Pos(0, 0), new Pos(2, 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(new Pos(0, 0), new Pos(6, 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" }); testVim('cG', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('c', 'G', 'inserted'); eq('inserted', cm.getValue()); helpers.assertCursorAt(0, 8); cm.setValue(" indented\nlines"); helpers.doKeys('', 'c', 'G', 'inserted'); eq(' inserted', cm.getValue()); }, { value: 'line1\nline2\n'}); // 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); eqCursorPos(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(new Pos(0, 0), new Pos(6, 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); eqCursorPos(curStart, cm.getCursor()); }); testVim('2dd_blank_P', function(cm, vim, helpers) { helpers.doKeys('2', 'd', 'd', 'P'); eq('\na\n\n', cm.getValue()); }, { value: '\na\n\n' }); // 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); eqCursorPos(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(new Pos(0, 0), new Pos(6, 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'); helpers.doKeys('hello'); eq('1hello\n5hello\nahellofg', cm.getValue()); helpers.doKeys(''); cm.setCursor(2, 3); helpers.doKeys('', '2', 'k', 'h', 'C'); helpers.doKeys('world'); 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'); helpers.doKeys('fo'); 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('I_visual_block_replay', function(cm, vim, helpers) { cm.setCursor(0, 2); helpers.doKeys('', '2', 'j', 'l', 'I'); helpers.doKeys('+-') eq('12+-34\n56+-78\nab+-cdefg\nxyz', cm.getValue()); helpers.doKeys(''); // ensure that repeat location doesn't depend on last selection cm.setCursor(3, 2); helpers.doKeys('g', 'v') eq("+-34\n+-78\n+-cd", cm.getSelection()) cm.setCursor(0, 3); helpers.doKeys('', '1', 'j', '2', 'l'); eq("-34\n-78", cm.getSelection()); cm.setCursor(0, 0); eq("", cm.getSelection()); helpers.doKeys('g', 'v'); eq("-34\n-78", cm.getSelection()); cm.setCursor(1, 1); helpers.doKeys('.'); eq('12+-34\n5+-6+-78\na+-b+-cdefg\nx+-yz', cm.getValue()); }, {value: '1234\n5678\nabcdefg\nxyz'}); testVim('visual_block_backwards', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('3', 'l'); helpers.doKeys('', '2', 'j', '2', ''); eq('123\n678\nbcd', cm.getSelection()); helpers.doKeys('A'); helpers.assertCursorAt(0, 4); helpers.doKeys('A', ''); helpers.assertCursorAt(0, 4); helpers.doKeys('g', 'v'); eq('123\n678\nbcd', cm.getSelection()); helpers.doKeys('x'); helpers.assertCursorAt(0, 1); helpers.doKeys('g', 'v'); eq('A4 \nA9 \nAef', cm.getSelection()); }, {value: '01234 line 1\n56789 line 2\nabcdefg line 3\nline 4'}); 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'); helpers.doKeys('hello{'); eq('1hello{\n5hello{\nahello{fg\n', cm.getValue()); helpers.doKeys(''); cm.setCursor(2, 3); helpers.doKeys('', '1', 'k', 'h', 'S'); helpers.doKeys('world'); eq('1hello{\n world\n', cm.getValue()); }, {value: '1234\n5678\nabcdefg\n'}); // Test mode change event. It should only fire once per mode transition. testVim('on_mode_change', async function(cm, vim, helpers) { var modeHist = []; function callback(arg) { var subMode = arg.subMode ? ':' + arg.subMode : ''; modeHist.push(arg.mode + subMode); } helpers.doKeys('', ''); cm.on('vim-mode-change', callback); async function test(key, mode) { modeHist.length = 0; helpers.doKeys(key); if (key == '' && !isOldCodeMirror) await delay(0); eq(modeHist.join(';'), mode); } test('v', 'visual'); test('c', 'insert'); test('', 'normal'); test('', 'visual:blockwise'); test('I', 'insert'); test('', 'normal'); test('R', 'replace'); test('x', ''); test('', 'normal'); test('v', 'visual'); test('V', 'visual:linewise'); test('', 'visual:blockwise'); test('v', 'visual'); await test('', 'normal'); test('a', 'insert'); test('', 'normal'); test('v', 'visual'); test(':', ''); // Event for Command-line mode not implemented. test('y\n', 'normal'); test(":startinsert\n", "insert"); }); // 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); eqCursorPos(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); eqCursorPos(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'); eqCursorPos(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'); eqCursorPos(makeCursor(0, 3), cm.getCursor()); cm.setCursor(makeCursor(0, 4)); helpers.doKeys('g', 'u', 'i', 'w'); eq(cm.getValue(), 'wa wb Xx wc wd'); eqCursorPos(makeCursor(0, 3), cm.getCursor()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); cm.setCursor(curStart); cm.setValue('abc efg\nxyz'); helpers.doKeys('g', 'U', 'g', 'U'); eq(cm.getValue(), 'ABC EFG\nxyz'); helpers.doKeys('g', 'u', 'u'); eq(cm.getValue(), 'abc efg\nxyz'); eqCursorPos(makeCursor(0, 0), cm.getCursor()); helpers.doKeys('g', 'U', '2', 'U'); eq(cm.getValue(), 'ABC EFG\nXYZ'); }, { 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'); if (!isOldCodeMirror) helpers.assertCursorAt(2, 0); eq('ve\n\nsome\nsugar', cm.getValue()); helpers.doKeys(''); helpers.assertCursorAt(2, 0); eq('ve\n\nome\nugar', cm.getValue()); helpers.doKeys('.'); helpers.assertCursorAt(2, 0); 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 }); testVim('=', function(cm, vim, helpers) { cm.setCursor(0, 3); helpers.doKeys('', 'j', 'j'); var expectedValue = 'word1\nword2\nword3'; helpers.doKeys('='); eq(expectedValue, cm.getValue()); }, { value: ' word1\n word2\n word3', indentUnit: 2 }); testVim('>', 'j', 'j'); helpers.doKeys('4', '>'); eq(' word 1\n word 2\n word 3', cm.getValue()); helpers.doKeys('g', 'v', '14', '<'); eq(' word1\n word2\n word3', cm.getValue()); }, { value: ' word1\n word2\n word3', indentUnit: 2 }); // Edit tests function testEdit(name, before, pos, edit, after, opts) { if (!opts) opts = {}; opts.value = before; 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()); }, opts); } // 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.'); testEdit('diw_space_word1', 'foo \t\n\tbar.', /\t/, 'diw', 'foo\n\tbar.'); testEdit('diw_space_word2', 'foo +bar.', / /, 'diw', 'foo+bar.'); testEdit('diw_space_word3', ' foo bar.', / /, 'diw', 'foo bar.'); // 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'); testEdit('diW_space_word2', 'foo +bar.', / /, 'diW', 'foo+bar.'); // 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'); testEdit('di`', 'foo `bAr` baz', /`/, 'di`', 'foo `` baz'); testEdit('di>', 'foo baz', /', 'foo <> baz'); testEdit('da<', 'foo baz', /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'); // deleting tag objects testEdit('dat_noop', 'hello', /n/, 'dat', 'hello',{ mode: 'css' }); testEdit('dat_open_tag', 'hello', /n/, 'dat', '', { mode: 'xml' }); testEdit('dat_inside_tag', 'hello', /l/, 'dat', '', { mode: 'xml' }); testEdit('dat_close_tag', 'hello', /\//, 'dat', '', { mode: 'xml' }); testEdit('dit_open_tag', 'hello', /n/, 'dit', '', { mode: 'xml' }); testEdit('dit_inside_tag', 'hello', /l/, 'dit', '', { mode: 'xml' }); testEdit('dit_close_tag', 'hello', /\//, 'dit', '', { mode: 'xml' }); 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}'); testSelection('va{outside', 'xa{\n\tbar\n\t}b', /x/, 'va{', '{\n\tbar\n\t}'); testVim('ci" for two strings', function(cm, vim, helpers) { cm.setCursor(0, 11); helpers.doKeys('c', 'i', '"'); eq(' "": "string2";', cm.getValue()); helpers.doKeys('', 'u', 'f', '"', ''); helpers.doKeys('c', 'i', '"'); eq(' "string1""string2";', cm.getValue()); helpers.doKeys('', 'u', 'f', '"'); helpers.doKeys('c', 'i', '"'); eq(' "string1": "";', cm.getValue()); }, {value: ' "string1": "string2";'}); testVim('mouse_select', function(cm, vim, helpers) { cm.setSelection(new Pos(0, 2), new 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); eqCursorPos(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(' word1\n', register.toString()); is(register.linewise); helpers.assertCursorAt(0, 3); }, { value: ' word1\nword2\n word3' }); testVim('Yy_blockwise', function(cm, vim, helpers) { helpers.doKeys('', 'j', '2', 'l', 'Y'); helpers.doKeys('G', 'p', 'g', 'g'); helpers.doKeys('', 'j', '2', 'l', 'y'); helpers.assertCursorAt(0, 0); helpers.doKeys('$', 'p'); eq('123456123\n123456123\n123456\n123456', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('123\n123', register.toString()); is(register.blockwise); helpers.assertCursorAt(0, 6); helpers.doKeys('$', 'j', 'p'); helpers.doKeys('$', 'j', 'P'); eq("123456123\n123456123123\n123456 121233\n123456 123", cm.getValue()); }, { value: '123456\n123456\n' }); 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('insert_ctrl_o', function(cm, vim, helpers) { helpers.doKeys('i'); is(vim.insertMode); helpers.doKeys(''); is(!vim.insertMode); helpers.doKeys('3', 'w'); is(vim.insertMode); eqCursorPos(makeCursor(0, 14), cm.getCursor()); eq('vim-insert', cm.getOption('keyMap')); }, { value: 'one two three here' }); testVim('insert_ctrl_u', function(cm, vim, helpers) { var curStart = makeCursor(0, 10); cm.setCursor(curStart); helpers.doKeys('a'); helpers.doKeys(''); eq('', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1/word2', register.toString()); is(!register.linewise); var curEnd = makeCursor(0, 0); eqCursorPos(curEnd, cm.getCursor()); eq('vim-insert', cm.getOption('keyMap')); }, { value: 'word1/word2' }); testVim('insert_ctrl_w', function(cm, vim, helpers) { var curStart = makeCursor(0, 10); cm.setCursor(curStart); helpers.doKeys('a'); helpers.doKeys(''); eq('word1/', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word2', register.toString()); is(!register.linewise); var curEnd = makeCursor(0, 6); eqCursorPos(curEnd, cm.getCursor()); eq('vim-insert', cm.getOption('keyMap')); }, { value: 'word1/word2' }); testVim('normal_ctrl_w', function(cm, vim, helpers) { var curStart = makeCursor(0, 3); cm.setCursor(curStart); helpers.doKeys(''); eq('word', cm.getValue()); var curEnd = makeCursor(0, 3); helpers.assertCursorAt(0,3); eqCursorPos(curEnd, cm.getCursor()); eq('vim', cm.getOption('keyMap')); }, {value: 'word'}); 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 with surrogate characters', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('a'); helpers.doKeys('test'); helpers.doKeys(''); eq('😀test', cm.getValue()); }, {value: '😀'}); 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 with surrogate characters', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('i'); helpers.doKeys('test'); helpers.doKeys(''); eq('test😀', cm.getValue()); }, { value: '😀' }); testVim('i_repeat', function(cm, vim, helpers) { helpers.doKeys('3', 'i'); helpers.doKeys('test') 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'); helpers.doKeys('z') helpers.doKeys('Backspace', 'Backspace'); helpers.doKeys(''); eq('abe', cm.getValue()); helpers.assertCursorAt(0, 1); }, { value: 'abcde' }); testVim('insert', function(cm, vim, helpers) { helpers.doKeys('i'); eq('vim-insert', cm.getOption('keyMap')); eq(false, cm.state.overwrite); helpers.doKeys(''); eq('vim-replace', cm.getOption('keyMap')); eq(true, cm.state.overwrite); helpers.doKeys(''); eq('vim-insert', cm.getOption('keyMap')); eq(false, cm.state.overwrite); }); testVim('i_backspace', function(cm, vim, helpers) { cm.setCursor(0, 10); helpers.doKeys('i'); helpers.doKeys('Backspace'); helpers.assertCursorAt(0, 9); eq('012345678', cm.getValue()); }, { value: '0123456789'}); testVim('i_overwrite_backspace', function(cm, vim, helpers) { cm.setCursor(0, 10); helpers.doKeys('i'); helpers.doKeys(''); helpers.doKeys('Backspace'); helpers.assertCursorAt(new Pos(0, 9, "after")); eq('0123456789', cm.getValue()); }, { value: '0123456789'}); testVim('i_forward_delete', function(cm, vim, helpers) { cm.setCursor(0, 3); helpers.doKeys('i'); helpers.doKeys('Delete'); helpers.assertCursorAt(0, 3); eq('A124\nBCD', cm.getValue()); helpers.doKeys('Delete'); helpers.assertCursorAt(0, 3); eq('A12\nBCD', cm.getValue()); helpers.doKeys('Delete'); helpers.assertCursorAt(0, 3); eq('A12BCD', cm.getValue()); }, { value: 'A1234\nBCD'}); testVim('forward_delete', function(cm, vim, helpers) { cm.setCursor(0, 3); helpers.doKeys(''); helpers.assertCursorAt(0, 3); eq('A124\nBCD', cm.getValue()); helpers.doKeys(''); helpers.assertCursorAt(0, 2); eq('A12\nBCD', cm.getValue()); helpers.doKeys(''); helpers.assertCursorAt(0, 1); eq('A1\nBCD', cm.getValue()); }, { value: 'A1234\nBCD'}); 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'); helpers.doKeys('hello'); 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'); helpers.doKeys('test') 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'); helpers.doKeys('hello'); 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'); helpers.doKeys('test') 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('gJ', function(cm, vim, helpers) { cm.setCursor(0, 4); helpers.doKeys('g', 'J'); eq('word1word2 \n word3', cm.getValue()); helpers.assertCursorAt(0, 5); helpers.doKeys('g', 'J'); eq('word1word2 word3', cm.getValue()); helpers.assertCursorAt(0, 11); }, { value: 'word1\nword2 \n word3' }); testVim('gi', function(cm, vim, helpers) { cm.setCursor(1, 5); helpers.doKeys('g', 'I'); helpers.doKeys('a', 'a', '', 'k'); eq('12\naa xxxx', cm.getValue()); helpers.assertCursorAt(0, 1); helpers.doKeys('g', 'i'); helpers.assertCursorAt(1, 2); eq('vim-insert', cm.getOption('keyMap')); }, { value: '12\n xxxx' }); 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(0, 2); helpers.doKeys('y', 'e', 'p'); eq('__aabcbc\ndef_', cm.getValue()); helpers.assertCursorAt(0, 5); helpers.doKeys('u'); // helpers.assertCursorAt(0, 2); // TODO undo should return to the same position }, { 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(0, 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(0, 1); helpers.doKeys('y', 'e', 'P'); eq('_abcabc\ndef__', cm.getValue()); helpers.assertCursorAt(0, 4); helpers.doKeys('u'); // helpers.assertCursorAt(0, 1); // TODO undo should return to the same position }, { 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'); cm.setValue("ox"); helpers.doKeys('r', ''); eq('ox', cm.getValue()); helpers.doKeys('r', ''); eq('ox', cm.getValue()); helpers.doKeys('r', ''); eq('\nx', cm.getValue()); }, { value: 'wordet\nanother' }); testVim('r with surrogate characters', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('r', 'u'); eq('u', cm.getValue()); }, { value: '😀' }); testVim('r_visual_block', function(cm, vim, helpers) { cm.ace.setOptions({tabSize: 4, useSoftTabs: false}); // ace_patch TODO 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('\t\t'); helpers.doKeys(''); helpers.doKeys('', 'h', 'h', 'r', 'r'); eq('1 l\n5 l\nalllefg\nrrrrrrrr', cm.getValue()); }, {value: '1234\n5678\nabcdefg', indentWithTabs: true}); testVim('r_visual with surrogate characters', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('v', 'r', 'u'); eq('u', cm.getValue()); }, { value: '😀' }); testVim('r_visual_block with surrogate characters', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('', 'r', 'u'); eq('u', cm.getValue()); }, { value: '😀' }); 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('R_visual', function(cm, vim, helpers) { helpers.doKeys('', 'j', 'R', '0', ''); eq('0\nb33\nc44\nc55', cm.getValue()); helpers.doKeys('2', 'j', '.'); eq('0\nb33\n0', cm.getValue()); helpers.doKeys('k', 'v', 'R', '1', ''); eq('0\n1\n0', cm.getValue()); helpers.doKeys('k', '.'); eq('1\n1\n0', cm.getValue()); helpers.doKeys('p'); eq('1\n0\n1\n0', cm.getValue()); }, {value: 'a11\na22\nb33\nc44\nc55'}); 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('mark\'', function(cm, vim, helpers) { // motions that do not update jumplist cm.setCursor(2, 2); helpers.doKeys('`', '\''); helpers.assertCursorAt(0, 0); helpers.doKeys('j', '3', 'l'); helpers.doKeys('`', '`'); helpers.assertCursorAt(2, 2); helpers.doKeys('`', '`'); helpers.assertCursorAt(1, 3); // motions that update jumplist helpers.doKeys('/', '=', '\n'); helpers.assertCursorAt(6, 20); helpers.doKeys('`', '`'); helpers.assertCursorAt(1, 3); helpers.doKeys('\'', '\''); helpers.assertCursorAt(6, 2); helpers.doKeys('\'', '`'); helpers.assertCursorAt(1, 1); // edits helpers.doKeys('g', 'I', '\n', '', 'l'); // the column may be different depending on editor behavior in insert mode var ch = cm.getCursor().ch; helpers.doKeys('`', '`'); helpers.assertCursorAt(7, 2); helpers.doKeys('`', '`'); helpers.assertCursorAt(2, ch); }); testVim('mark.', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('O', 'testing', ''); cm.setCursor(3, 3); helpers.doKeys('\'', '.'); helpers.assertCursorAt(0, 0); cm.setCursor(4, 4); helpers.doKeys('`', '.'); helpers.assertCursorAt(0, 6); }); 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); eqCursorPos(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'); eqCursorPos(new Pos(2, 2), cm.getCursor('head')); eqCursorPos(new Pos(3, 3), cm.getCursor('anchor')); helpers.doKeys('k'); eqCursorPos(new Pos(1, 2), cm.getCursor('head')); eqCursorPos(new 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'); eqCursorPos(new Pos(2, 3), cm.getCursor('head')); eqCursorPos(new Pos(1, 2), cm.getCursor('anchor')); helpers.doKeys('j'); eqCursorPos(new Pos(3, 3), cm.getCursor('head')); eqCursorPos(new 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', ''); eqCursorPos(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', ''); eqCursorPos(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_join_blank', function(cm, vim, helpers) { var initialValue = cm.getValue(); helpers.doKeys('G', 'V', 'g', 'g', 'J'); eq('1 2 5 6', cm.getValue()); is(!vim.visualMode); helpers.doKeys('u'); eq(initialValue, cm.getValue()); helpers.doKeys('G', 'V', 'g', 'g', 'g', 'J'); eq('1 \t2\t 5 6', cm.getValue()); helpers.doKeys('u'); eq(cm.getCursor().line, 0); eq(initialValue, cm.getValue()); helpers.doKeys('J', 'J', 'J'); helpers.assertCursorAt(0, 3); helpers.doKeys('J'); helpers.assertCursorAt(0, 4); eq('1 2 5\n 6\n', cm.getValue()); helpers.doKeys('u'); eq('1 2\n5\n 6\n', cm.getValue()); }, { value: '1 \n\t2\n\t \n\n5\n 6\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); eqCursorPos(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); eqCursorPos(makeCursor(1, 0), cm.getCursor('anchor')); helpers.doKeys('v'); cm.setCursor(2, 0); helpers.doKeys('v', 'l', 'l', 'g', 'v'); helpers.assertCursorAt(1, 4); eqCursorPos(makeCursor(1, 0), cm.getCursor('anchor')); helpers.doKeys('g', 'v'); helpers.assertCursorAt(2, 3); eqCursorPos(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'); eqCursorPos(new Pos(1, 2), vim.sel.anchor); eqCursorPos(new 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'); eqCursorPos(new Pos(2, 1), vim.sel.anchor); eqCursorPos(new 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_normal surrogate character', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('s'); helpers.doKeys('test'); helpers.doKeys(''); eq('test', cm.getValue()); }, { value: '😀' }); 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('d with surrogate character', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('v'); helpers.doKeys('d'); helpers.doKeys(''); eq('', cm.getValue()); }, { value: '😀' }); 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'); eqCursorPos(new Pos(3, 3), vim.sel.anchor); eqCursorPos(new Pos(0, 1), vim.sel.head); helpers.doKeys('O'); eqCursorPos(new Pos(3, 1), vim.sel.anchor); eqCursorPos(new Pos(0, 3), vim.sel.head); helpers.doKeys('o'); eqCursorPos(new Pos(0, 3), vim.sel.anchor); eqCursorPos(new 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'); helpers.doEx('registers'); is(/a\s+register/.test(helpers.getNotificationText())); }, { 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, 0); helpers.doKeys(''); helpers.doKeys('d', 'd', 'd', 'd'); helpers.assertCursorAt(0, 0); helpers.doKeys('S'); is(vim.insertMode); eq('', cm.getValue()); }, { value: 'aa{\n bb\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) { helpers.doKeys('2', 'd', '/', 'match', '\n'); helpers.assertCursorAt(0, 0); eq('match \n next', cm.getValue()); helpers.doKeys('d', ':', '2', '\n'); // TODO eq(' next', cm.getValue()); }, { value: 'text match match \n next' }); testVim('/ and n/N', function(cm, vim, helpers) { helpers.doKeys('/', 'match', '\n'); 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', '/', 'match', '\n'); helpers.assertCursorAt(1, 6); }, { value: 'match nope match \n nope Match' }); testVim('/ and gn selects the appropriate word', function(cm, vim, helpers) { helpers.doKeys('/', 'match', '\n'); helpers.assertCursorAt(0, 11); // gn should highlight the the current word while it is within a match. // gn when cursor is in beginning of match helpers.doKeys('gn', ''); helpers.assertCursorAt(0, 15); // gn when cursor is at end of match helpers.doKeys('gn', ''); helpers.doKeys(''); helpers.assertCursorAt(0, 15); // consecutive gns should extend the selection helpers.doKeys('gn'); helpers.assertCursorAt(0, 16); helpers.doKeys('gn'); helpers.assertCursorAt(1, 11); // we should have selected the second and third "match" helpers.doKeys('d'); eq('match nope ', cm.getValue()); }, { value: 'match nope match \n nope Match' }); testVim('/ and gN selects the appropriate word', function(cm, vim, helpers) { helpers.doKeys('/', 'match', '\n'); helpers.assertCursorAt(0, 11); // gN when cursor is at beginning of match helpers.doKeys('gN', ''); helpers.assertCursorAt(0, 11); // gN when cursor is at end of match helpers.doKeys('e', 'gN', ''); helpers.assertCursorAt(0, 11); // consecutive gNs should extend the selection helpers.doKeys('gN'); helpers.assertCursorAt(0, 11); helpers.doKeys('gN'); helpers.assertCursorAt(0, 0); // we should have selected the first and second "match" helpers.doKeys('d'); eq(' \n nope Match', cm.getValue()); }, { value: 'match nope match \n nope Match' }) testVim('/ and gn with an associated operator', function(cm, vim, helpers) { helpers.doKeys('/', 'match', '\n'); helpers.assertCursorAt(0, 11); helpers.doKeys('c', 'gn', 'changed', ''); // change the current match. eq('match nope changed \n nope Match', cm.getValue()); // change the next match. helpers.doKeys('.'); eq('match nope changed \n nope changed', cm.getValue()); // change the final match. helpers.doKeys('.'); eq('changed nope changed \n nope changed', cm.getValue()); }, { value: 'match nope match \n nope Match' }); testVim('/ and gN with an associated operator', function(cm, vim, helpers) { helpers.doKeys('/', 'match', '\n'); helpers.assertCursorAt(0, 11); helpers.doKeys('c', 'gN', 'changed', ''); // change the current match. eq('match nope changed \n nope Match', cm.getValue()); // change the next match. helpers.doKeys('.'); eq('changed nope changed \n nope Match', cm.getValue()); // change the final match. helpers.doKeys('.'); eq('changed nope changed \n nope changed', cm.getValue()); }, { value: 'match nope match \n nope Match' }); testVim('/_case', function(cm, vim, helpers) { helpers.doKeys('/', 'Match', '\n'); helpers.assertCursorAt(1, 6); }, { value: 'match nope match \n nope Match' }); testVim('/_2_pcre', function(cm, vim, helpers) { CodeMirror.Vim.setOption('pcre', true); helpers.doKeys('/', '(word){2}', '\n'); 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); helpers.doKeys('/', '\\(word\\)\\{2}', '\n'); 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) { helpers.doKeys('/', 'aa', '\n'); 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) { helpers.doKeys('?', 'aa', '\n'); helpers.assertCursorAt(1, 3); helpers.doKeys('n'); helpers.assertCursorAt(0, 4); helpers.doKeys('n'); helpers.assertCursorAt(0, isOldCodeMirror ? 1 : 0); }, { value: 'aaa aa \n a aa'}); testVim('/_greedy', function(cm, vim, helpers) { helpers.doKeys('/', 'a+', '\n'); 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) { helpers.doKeys('?', 'a+', '\n'); 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) { helpers.doKeys('/', 'a*', '\n'); 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) { helpers.doKeys('?', 'a*', '\n'); 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); // ace_patch helpers.doKeys('n'); helpers.assertCursorAt(0, 0); }, { value: 'aaa aa\n aa'}); testVim('? and n/N', function(cm, vim, helpers) { helpers.doKeys('?', 'match', '\n'); 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', '?', 'match', '\n'); helpers.assertCursorAt(0, 11); }, { value: 'match nope match \n nope Match' }); testVim('? and gn selects the appropriate word', function(cm, vim, helpers) { helpers.doKeys('?', 'match', '\n', 'n'); helpers.assertCursorAt(0, 11); // gn should highlight the the current word while it is within a match. // gn when cursor is in beginning of match helpers.doKeys('gn', ''); helpers.assertCursorAt(0, 11); // gn when cursor is at end of match helpers.doKeys('e', 'gn', ''); helpers.assertCursorAt(0, 11); // consecutive gns should extend the selection helpers.doKeys('gn'); helpers.assertCursorAt(0, 11); helpers.doKeys('gn'); helpers.assertCursorAt(0, 0); // we should have selected the first and second "match" helpers.doKeys('d'); eq(' \n nope Match', cm.getValue()); }, { value: 'match nope match \n nope Match' }); testVim('? and gN selects the appropriate word', function(cm, vim, helpers) { helpers.doKeys('?', 'match', '\n', 'n'); helpers.assertCursorAt(0, 11); // gN when cursor is at beginning of match helpers.doKeys('gN', ''); helpers.assertCursorAt(0, 15); // gN when cursor is at end of match helpers.doKeys('gN', ''); helpers.assertCursorAt(0, 15); // consecutive gNs should extend the selection helpers.doKeys('gN'); helpers.assertCursorAt(0, 16); helpers.doKeys('gN'); helpers.assertCursorAt(1, 11); // we should have selected the second and third "match" helpers.doKeys('d'); eq('match nope ', cm.getValue()); }, { value: 'match nope match \n nope Match' }) testVim('? and gn with an associated operator', function(cm, vim, helpers) { helpers.doKeys('?', 'match', '\n', 'n'); helpers.assertCursorAt(0, 11); helpers.doKeys('c', 'gn', 'changed', ''); // change the current match. eq('match nope changed \n nope Match', cm.getValue()); // change the next match. helpers.doKeys('.'); eq('changed nope changed \n nope Match', cm.getValue()); // change the final match. helpers.doKeys('.'); eq('changed nope changed \n nope changed', cm.getValue()); }, { value: 'match nope match \n nope Match' }); testVim('? and gN with an associated operator', function(cm, vim, helpers) { helpers.doKeys('?', 'match', '\n', 'n'); helpers.assertCursorAt(0, 11); helpers.doKeys('c', 'gN', 'changed', ''); // change the current match. eq('match nope changed \n nope Match', cm.getValue()); // change the next match. helpers.doKeys('.'); eq('match nope changed \n nope changed', cm.getValue()); // change the final match. helpers.doKeys('.'); eq('changed nope changed \n nope changed', cm.getValue()); }, { 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'); helpers.doKeys('foo') helpers.doKeys(''); eq(helpers.getNotificationText(), 'recording @a'); helpers.doKeys('q', '@', 'a'); eq(helpers.getNotificationText(), null); eq('foofoo', cm.getValue()); }, { value: ''}); testVim('macro_insert_repeat', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'a', '$', 'a'); helpers.doKeys('larry.') helpers.doKeys(''); helpers.doKeys('a'); helpers.doKeys('curly.') helpers.doKeys(''); helpers.doKeys('q'); helpers.doKeys('a'); helpers.doKeys('moe.') 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'); helpers.doKeys('/', 'e', '\n', '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'); helpers.doKeys('/', 'e', '\n'); helpers.doKeys('/', 't', '\n', '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_last_run_macro', function (cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'a', 'C', 'a', '', 'q'); helpers.doKeys('q', 'b', 'C', 'b', '', 'q'); helpers.doKeys('@', 'a'); helpers.doKeys('d', 'd'); helpers.doKeys('@', '@'); eq('a', cm.getValue()); }, { value: ''}); testVim('macro_parens', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'z', 'i'); helpers.doKeys('(') helpers.doKeys(''); helpers.doKeys('e', 'a'); helpers.doKeys(')') 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'); helpers.doKeys('I ') helpers.doKeys(''); helpers.doKeys('q'); helpers.doKeys('e'); // Now replace the macro with something else. helpers.doKeys('q', 'z', 'a'); helpers.doKeys('.') 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('macro_yank_tick', function(cm, vim, helpers) { cm.setCursor(0, 0); // Start recording a macro into the \' register. helpers.doKeys('q', '\''); helpers.doKeys('y', '', '', '', '', 'p'); helpers.assertCursorAt(0,4); eq('the tex parrot', cm.getValue()); }, { value: 'the ex parrot'}); testVim('yank_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('"', 'a', 'y', 'y'); helpers.doKeys('j', '"', 'b', 'y', 'y'); helpers.doEx('registers'); var text = helpers.getNotificationText(); is(/a\s+foo/.test(text)); is(/b\s+bar/.test(text)); }, { value: 'foo\nbar'}); testVim('yank_visual_block', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('', 'l', 'j', '"', 'a', 'y'); helpers.doEx('registers'); is(/a\s+oo\nar/.test(helpers.getNotificationText())); }, { 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'); helpers.doEx('registers'); var text = helpers.getNotificationText(); is(/a\s+foo\nbar/.test(text)); is(/"\s+foo\nbar/.test(text)); }, { 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'); helpers.doEx('registers'); var text = helpers.getNotificationText(); is(/a\s+foobar/.test(text)); is(/"\s+foobar/.test(text)); }, { 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'); helpers.doEx('registers'); var text = helpers.getNotificationText(); is(/a\s+foo\nbar/.test(text)); is(/"\s+foo\nbar/.test(text)); }, { 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'); helpers.doEx('registers'); var text = helpers.getNotificationText(); is(/a\s+foo\nbar/.test(text)); is(/"\s+foo\nbar/.test(text)); }, { value: 'foo\nbar'}); testVim('black_hole_register', function(cm,vim,helpers) { helpers.doKeys('g', 'g', 'y', 'G'); helpers.doEx('registers'); var registersText = helpers.getNotificationText(); helpers.doKeys('"', '_', 'd', 'G'); helpers.doEx('registers'); eq(registersText, helpers.getNotificationText(), 'One or more registers were modified'); helpers.doKeys('"', '_', 'p'); eq('', cm.getValue()); }, { value: 'foo\nbar'}); testVim('macro_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'a', 'i'); helpers.doKeys('gangnam') helpers.doKeys(''); helpers.doKeys('q'); helpers.doKeys('q', 'b', 'o'); helpers.doKeys('style') helpers.doKeys(''); helpers.doKeys('q'); helpers.doEx('registers'); var text = helpers.getNotificationText(); is(/a\s+i/.test(text)); is(/b\s+o/.test(text)); }, { value: ''}); testVim('._register', function(cm,vim,helpers) { cm.setCursor(0,0); helpers.doKeys('i'); helpers.doKeys('foo') helpers.doKeys(''); helpers.doEx('registers'); is(/\.\s+foo/.test(helpers.getNotificationText())); }, {value: ''}); testVim(':_register', function(cm,vim,helpers) { helpers.doEx('bar'); helpers.doEx('registers'); is(/:\s+bar/.test(helpers.getNotificationText())); }, {value: ''}); testVim('registers_html_encoding', function(cm,vim,helpers) { helpers.doKeys('y', 'y'); helpers.doEx('registers'); is(/"\s+'}); testVim('search_register_escape', function(cm, vim, helpers) { // Check that the register is restored if the user escapes rather than confirms. helpers.doKeys('/', 'waldo', '\n'); helpers.doKeys('/', 'foo', ''); helpers.doEx('registers'); var text = helpers.getNotificationText(); is(/waldo/.test(text)); is(!/foo/.test(text)); }, {value: ''}); testVim('search_register', function(cm, vim, helpers) { helpers.doKeys('/', 'foo', '\n'); helpers.doEx('registers'); is(/\/\s+foo/.test(helpers.getNotificationText())); }, {value: ''}); testVim('search_history', function(cm, vim, helpers) { helpers.doKeys('/', 'this', '\n'); helpers.doKeys('/', 'checks', '\n'); helpers.doKeys('/', 'search', '\n'); helpers.doKeys('/', 'history', '\n'); helpers.doKeys('/', 'checks', '\n'); helpers.doKeys('/'); helpers.doKeys('Up'); eq(document.activeElement.value, 'checks'); helpers.doKeys('Up'); eq(document.activeElement.value, 'history'); helpers.doKeys('Up'); eq(document.activeElement.value, 'search'); helpers.doKeys('Up'); eq(document.activeElement.value, 'this'); helpers.doKeys('Down'); eq(document.activeElement.value, 'search'); }, {value: ''}); testVim('exCommand_history', function(cm, vim, helpers) { helpers.doEx('registers'); helpers.doEx('sort'); helpers.doEx('map'); helpers.doEx('invalid'); helpers.doKeys(':'); helpers.doKeys('Up'); eq(document.activeElement.value, 'invalid'); helpers.doKeys('Up'); eq(document.activeElement.value, 'map'); helpers.doKeys('Up'); eq(document.activeElement.value, 'sort'); helpers.doKeys('Up'); eq(document.activeElement.value, 'registers'); helpers.doKeys('', ':'); helpers.doKeys('s'); eq(document.activeElement.value, 's'); helpers.doKeys('Up'); eq(document.activeElement.value, 'sort'); }, {value: ''}); testVim('search_clear', function(cm, vim, helpers) { helpers.doKeys('/', 'foo'); eq(document.activeElement.value, 'foo'); helpers.doKeys(''); eq(document.activeElement.value, ''); }); testVim('exCommand_clear', function(cm, vim, helpers) { helpers.doKeys(':', 'foo'); eq(document.activeElement.value, 'foo'); helpers.doKeys(''); eq(document.activeElement.value, ''); }); testVim('._normal', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('2', 'd', 'w'); helpers.doKeys('.'); eq('5 6', cm.getValue()); helpers.doKeys('a'); cm.operation(function() { cm.curOp.isVimOp = true; cm.replaceSelection("()"); var pos = cm.getCursor(); pos.ch--; cm.setCursor(pos); }); helpers.doKeys('x', 'y', ''); helpers.doKeys('.'); eq('5(xy(xy)) 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'); helpers.doKeys('test') helpers.doKeys(''); helpers.doKeys('.'); eq('testestt', cm.getValue()); helpers.assertCursorAt(0, 6); helpers.doKeys('O'); helpers.doKeys('xyz') helpers.doKeys('Backspace'); helpers.doKeys('Down'); helpers.doKeys(''); helpers.doKeys('.'); eq('xy\nxy\ntestestt', cm.getValue()); helpers.assertCursorAt(1, 1); }, { value: ''}); testVim('._startinsert', function(cm, vim, helpers) { helpers.doEx('map i x'); helpers.doKeys('i'); eq('', cm.getValue()); helpers.doEx('start'); helpers.doKeys('test'); helpers.doKeys(''); helpers.doKeys('.'); eq('testestt', cm.getValue()); helpers.assertCursorAt(0, 6); helpers.doEx('start!'); helpers.doKeys('xyz'); eq('testesttxyz', cm.getValue()); helpers.assertCursorAt(0, 11); }, { value: 'x'}); testVim('._insert_repeat', function(cm, vim, helpers) { helpers.doKeys('i'); helpers.doKeys('test') 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'); helpers.doKeys('te') 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'); helpers.doKeys('z') 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'); helpers.doKeys('z') 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'); helpers.doKeys('z') 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'); helpers.doKeys('test') 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'); helpers.doKeys('test'); 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.doKeys('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.doKeys('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('._replace_repeat', function(cm, vim, helpers) { helpers.doKeys('R'); cm.replaceRange('123', cm.getCursor(), offsetCursor(cm.getCursor(), 0, 3)); cm.setCursor(0, 3); helpers.doKeys(''); helpers.doKeys('2', '.'); eq('12123123\nabcdefg', cm.getValue()); helpers.assertCursorAt(0, 7); cm.setCursor(1, 0); helpers.doKeys('.'); eq('12123123\n123123g', cm.getValue()); helpers.doKeys('l', '"', '.', 'p'); eq('12123123\n123123g123', cm.getValue()); }, { value: 'abcdef\nabcdefg'}); 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('vFT', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('v', 'f', '1'); helpers.assertCursorAt(0, 2); helpers.doKeys('2', 't', ' '); helpers.assertCursorAt(0, 8); eqCursorPos(new Pos(0, 0), cm.getCursor('anchor')); helpers.doKeys(''); eqCursorPos(new Pos(0, 7), cm.getCursor('anchor')); helpers.doKeys('v', 'F', '3'); helpers.assertCursorAt(0, 3); eqCursorPos(new Pos(0, 8), cm.getCursor('anchor')); helpers.doKeys('T', '1'); helpers.assertCursorAt(0, 2); helpers.doKeys('F', '1'); helpers.assertCursorAt(0, 1); helpers.doKeys('F', '1'); helpers.assertCursorAt(0, 0); }, { value: '1123 123 123'}); testVim('page_motions', function(cm, vim, helpers) { var value = "x".repeat(200).split("").map((_, i)=>i).join("\n"); cm.setValue(value); cm.refresh(); var lines = 10; var textHeight = cm.defaultTextHeight(); cm.setSize(600, lines*textHeight); cm.setCursor(100, 0); cm.refresh(); helpers.doKeys(''); helpers.assertCursorAt(95, 0); helpers.doKeys(''); helpers.assertCursorAt(90, 0); helpers.doKeys(''); helpers.doKeys(''); helpers.assertCursorAt(100, 0); cm.refresh(); helpers.doKeys(''); cm.refresh(); helpers.assertCursorAt(110, 0); helpers.doKeys(''); cm.refresh(); helpers.assertCursorAt(100, 0); eq(value, cm.getValue()); }); testVim('HML', function(cm, vim, helpers) { cm.refresh(); var lines = 35; var textHeight = cm.defaultTextHeight(); cm.setSize(600, lines*textHeight); cm.setCursor(120, 0); cm.ace.renderer.scrollCursorIntoView(); 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 = []; var cursorIndexVals = []; forEach(['zb','zz','zt','z-','z.','z'], function(e, idx){ var lineNum = 250; var lines = 35; testVim(e, function(cm, vim, helpers) { cm.refresh(); var k1 = e[0]; var k2 = e.substring(1); var textHeight = cm.defaultTextHeight(); cm.setSize(600, lines*textHeight); cm.setCursor(lineNum, 1); var originalCursorIndex = cm.indexFromPos(cm.getCursor()); helpers.doKeys(k1, k2); zVals[idx] = cm.getScrollInfo().top; cursorIndexVals[idx] = { before: originalCursorIndex, after: cm.indexFromPos(cm.getCursor()) }; }, { value: (function(){ return new Array(500).join('12\n'); })()}); }); testVim('zb_to_bottom', function(cm, vim, helpers){ cm.refresh(); 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(new Pos(lineNum, 0), 'local').bottom); }, { value: (function(){ return new Array(500).join('\n'); })()}); testVim('zt_to_top', function(cm, vim, helpers){ cm.refresh(); var lineNum = 250; cm.setSize(600, 35*cm.defaultTextHeight()); cm.setCursor(lineNum, 0); helpers.doKeys('z', 't'); eq(cm.getScrollInfo().top, cm.charCoords(new Pos(lineNum, 0), 'local').top); }, { value: (function(){ return new Array(500).join('\n'); })()}); testVim('zb', function(cm, vim, helpers){ eq(zVals[2], zVals[5]); }); testVim('zt_no_cursor_change', function(cm, vim, helpers){ var cursorIndexes = cursorIndexVals[2]; eq(cursorIndexes.before, cursorIndexes.after); }); testVim('z_cursor_change', function(cm, vim, helpers){ var cursorIndexes = cursorIndexVals[5]; eq(cursorIndexes.before, 751); eq(cursorIndexes.after, 750); }); testVim('zz_no_cursor_change', function(cm, vim, helpers){ var cursorIndexes = cursorIndexVals[1]; eq(cursorIndexes.before, cursorIndexes.after); }); testVim('z._cursor_change', function(cm, vim, helpers){ var cursorIndexes = cursorIndexVals[4]; eq(cursorIndexes.before, 751); eq(cursorIndexes.after, 750); }); testVim('zb_no_cursor_change', function(cm, vim, helpers){ var cursorIndexes = cursorIndexVals[0]; eq(cursorIndexes.before, cursorIndexes.after); }); testVim('z-_cursor_change', function(cm, vim, helpers){ var cursorIndexes = cursorIndexVals[3]; eq(cursorIndexes.before, 751); eq(cursorIndexes.after, 750); }); var moveTillCharacterSandbox = 'The quick brown fox \n'; testVim('moveTillCharacter', function(cm, vim, helpers){ cm.setCursor(0, 0); // Search for the 'q'. helpers.doKeys('/', 'q', '\n'); 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 '|'. helpers.doKeys('/', '|', '\n'); 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.setSize(320, 200); cm.setCursor(0, 0); cm.refresh(); // ctrl-y at the top of the file should have no effect. helpers.doKeys(''); eq(0, cm.getCursor().line); cm.refresh(); prevScrollInfo = cm.getScrollInfo(); helpers.doKeys(''); eq(1, cm.getCursor().line); cm.refresh(); is(prevScrollInfo.top < cm.getScrollInfo().top); // Jump to the end of the sandbox. cm.setCursor(1000, 0); cm.refresh(); 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}); testVim('i_indent_right', function(cm, vim, helpers) { cm.setCursor(0, 3); var expectedValue = ' word1\nword2\nword3 '; helpers.doKeys('i', ''); eq(expectedValue, cm.getValue()); helpers.assertCursorAt(0, 5); }, { value: ' word1\nword2\nword3 ', indentUnit: 2 }); testVim('i_indent_left', function(cm, vim, helpers) { cm.setCursor(0, 3); var expectedValue = ' word1\nword2\nword3 '; helpers.doKeys('i', ''); eq(expectedValue, cm.getValue()); helpers.assertCursorAt(0, 1); }, { value: ' word1\nword2\nword3 ', indentUnit: 2 }); // 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_go_to_mark', function(cm, vim, helpers) { cm.setCursor(3, 0); helpers.doKeys('m', 'a'); cm.setCursor(0, 0); helpers.doEx('\'a'); helpers.assertCursorAt(3, 0); }, { value: 'a\nb\nc\nd\ne\n'}); testVim('ex_go_to_line_offset', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doEx('+3'); helpers.assertCursorAt(3, 0); helpers.doEx('-1'); helpers.assertCursorAt(2, 0); helpers.doEx('.2'); helpers.assertCursorAt(4, 0); helpers.doEx('.-3'); helpers.assertCursorAt(1, 0); }, { value: 'a\nb\nc\nd\ne\n'}); testVim('ex_go_to_mark_offset', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('m', 'a'); cm.setCursor(0, 0); helpers.doEx('\'a1'); helpers.assertCursorAt(3, 0); helpers.doEx('\'a-1'); helpers.assertCursorAt(1, 0); helpers.doEx('\'a+2'); helpers.assertCursorAt(4, 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_delete', function(cm, vim, helpers) { helpers.doKeys("j"); helpers.doEx('delete'); eq('l 1\nl 3\nl 4\n', cm.getValue()); helpers.doEx('d'); eq('l 1\nl 4\n', cm.getValue()); }, { value: 'l 1\nl 2\nl 3\nl 4\n'}); 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('.9\n.8\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('z\ny\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_pattern_alpha', function(cm, vim, helpers) { helpers.doEx('sort /[a-z]/'); eq('a3\nb2\nc1\ny\nz', cm.getValue()); }, { value: 'z\ny\nc1\nb2\na3'}); testVim('ex_sort_pattern_alpha_reverse', function(cm, vim, helpers) { helpers.doEx('sort! /[a-z]/'); eq('z\ny\nc1\nb2\na3', cm.getValue()); }, { value: 'z\ny\nc1\nb2\na3'}); testVim('ex_sort_pattern_alpha_ignoreCase', function(cm, vim, helpers) { helpers.doEx('sort i/[a-z]/'); eq('a3\nb2\nC1\nY\nz', cm.getValue()); }, { value: 'z\nY\nC1\nb2\na3'}); testVim('ex_sort_pattern_alpha_longer', function(cm, vim, helpers) { helpers.doEx('sort /[a-z]+/'); eq('a\naa\nab\nade\nadele\nadelle\nadriana\nalex\nalexandra\nb\nc\ny\nz', cm.getValue()); }, { value: 'z\nab\naa\nade\nadelle\nalexandra\nalex\nadriana\nadele\ny\nc\nb\na'}); testVim('ex_sort_pattern_alpha_only', function(cm, vim, helpers) { helpers.doEx('sort /^[a-z]$/'); eq('z1\ny2\na3\nb\nc', cm.getValue()); }, { value: 'z1\ny2\na3\nc\nb'}); testVim('ex_sort_pattern_alpha_only_reverse', function(cm, vim, helpers) { helpers.doEx('sort! /^[a-z]$/'); eq('c\nb\nz1\ny2\na3', cm.getValue()); }, { value: 'z1\ny2\na3\nc\nb'}); testVim('ex_sort_pattern_alpha_num', function(cm, vim, helpers) { helpers.doEx('sort /[a-z][0-9]/'); eq('c\nb\na3\ny2\nz1', cm.getValue()); }, { value: 'z1\ny2\na3\nc\nb'}); // test for :global command testVim('ex_global', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doEx('g/one/s//two'); eq('two one\n two one\n two one', cm.getValue()); helpers.doEx('1,2g/two/s//one'); eq('one one\n one one\n two one', cm.getValue()); helpers.doEx('g/^ /'); eq(' one one\n two one', helpers.getNotificationText()); }, {value: 'one one\n one one\n one one'}); testVim('ex_normal', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doEx('g/one/normal cw 1Esc>$i$'); helpers.doKeys("rt"); eq(' 1 on$e\nxx\n 1 on$e\n 1 on$t', cm.getValue()); helpers.doKeys('/', '<', '\n'); helpers.doKeys('x', 'x', 'p'); eq(' 1sEc> on$e\nxx\n 1 on$e\n 1 on$t', cm.getValue()); cm.setCursor(0, 0); helpers.doEx('map k j'); helpers.doEx('normal kkk'); helpers.assertCursorAt(3, 0); helpers.doEx('normal! kkk'); helpers.assertCursorAt(0, 0); }, {value: 'one one\nxx\none one\none one'}); testVim('ex_global_substitute_join', function(cm, vim, helpers) { helpers.doEx('g/o/s/\\n/;'); eq('one;two\nthree\nfour;five\n', cm.getValue()); }, {value: 'one\ntwo\nthree\nfour\nfive\n'}); testVim('ex_global_substitute_split', function(cm, vim, helpers) { helpers.doEx('g/e/s/[or]/\\n'); eq('\nne\ntwo\nth\nee\nfour\nfive\n', cm.getValue()); }, {value: 'one\ntwo\nthree\nfour\nfive\n'}); testVim('ex_global_delete', function(cm, vim, helpers) { helpers.doEx('g/e/d\\n'); eq('two\nfour\nsix\n---', cm.getValue()); helpers.doKeys('u'); helpers.doEx('g/e/g/v/d\\n'); eq('one\ntwo\nthree\nfour\nsix\nnine\n---', cm.getValue()); }, {value: 'one\ntwo\nthree\nfour\nfive\nsix\nseven\nnine\n---'}); testVim('ex_global_confirm', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doEx('g/one/s//two/gc'); helpers.doKeys('n'); helpers.doKeys('y'); helpers.doKeys('a'); helpers.doKeys('q'); helpers.doKeys('y'); 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'}); // test for :vglobal command testVim('ex_vglobal', function(cm, vim, helpers) { helpers.doEx('v/e/s/o/e'); eq('one\n twe\n three\n feur\n five\n', cm.getValue()); helpers.doEx('v/[vw]'); eq('one\n three\n feur\n', helpers.getNotificationText()); }, {value: 'one\n two\n three\n four\n five\n'}); // 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_alternate_separator', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doEx('s#o/e#two#g'); eq('o/e o/e\n two two', cm.getValue()); }, { value: 'o/e o/e\n o/e o/e'}); // ace_patch{ testVim('ex_substitute_with_newline (\\n)', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doEx('s/\\.\\s/.\\n/'); eq('a. b. c.\n1.\n2. 3.', cm.getValue()); }, { value: 'a. b. c.\n1. 2. 3.'}); testVim('ex_substitute_all_in_range_with_newline (\\n)', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doEx('1,2s/\\.\\s/.\\n/g'); eq('a.\nb.\nc.\n1.\n2.\n3.', cm.getValue()); }, { value: 'a. b. c.\n1. 2. 3.'}); testVim('ex_substitute_all_in_range_with_newline (\\r)', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doEx('1,2s/\\.\\s/.\\r/g'); eq('a.\rb.\rc.\r1.\r2.\r3.', cm.getValue()); }, { value: 'a. b. c.\r1. 2. 3.'}); testVim('ex_substitute_all_in_range_with_multiple newlines (\\r)', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doEx('1,2s/\\.\\s/.\\r\\r/g'); eq('a.\r\rb.\r\rc.\r1.\r\r2.\r\r3.', cm.getValue()); }, { value: 'a. b. c.\r1. 2. 3.'}); // ace_patch} 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_range_current_to_input', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doEx('.,3s/\\d/0/g'); eq('1\n0\n0\n4', cm.getValue()); }, { value: '1\n2\n3\n4' }); testVim('ex_substitute_range_input_to_current', function(cm, vim, helpers) { cm.setCursor(3, 0); helpers.doEx('2,.s/\\d/0/g'); eq('1\n0\n0\n0\n5', cm.getValue()); }, { value: '1\n2\n3\n4\n5' }); testVim('ex_substitute_range_offset', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doEx('-1,+1s/\\d/0/g'); eq('1\n0\n0\n0\n5', cm.getValue()); }, { value: '1\n2\n3\n4\n5' }); testVim('ex_substitute_range_implicit_offset', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doEx('.1,.3s/\\d/0/g'); eq('1\n0\n0\n0\n5', cm.getValue()); }, { value: '1\n2\n3\n4\n5' }); testVim('ex_substitute_to_eof', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doEx('.,$s/\\d/0/g'); eq('1\n2\n0\n0\n0', cm.getValue()); }, { value: '1\n2\n3\n4\n5' }); testVim('ex_substitute_to_relative_eof', function(cm, vim, helpers) { cm.setCursor(4, 0); helpers.doEx('2,$-2s/\\d/0/g'); eq('1\n0\n0\n4\n5', cm.getValue()); }, { value: '1\n2\n3\n4\n5' }); testVim('ex_substitute_range_mark', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('ma'); cm.setCursor(0, 0); helpers.doEx('.,\'as/\\d/0/g'); eq('0\n0\n0\n4\n5', cm.getValue()); }, { value: '1\n2\n3\n4\n5' }); testVim('ex_substitute_range_mark_offset', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('ma'); cm.setCursor(0, 0); helpers.doEx('\'a-1,\'a+1s/\\d/0/g'); eq('1\n0\n0\n0\n5', cm.getValue()); }, { value: '1\n2\n3\n4\n5' }); 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.doKeys(':'); eq(document.activeElement.value, "'<,'>"); helpers.doKeys('s/\\d/0/g', '\n'); 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); helpers.doKeys('/', '1\n'); 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_forward_slash_regex', { value: 'forward slash \/ was here', expectedValue: 'forward slash was here', expr: '%s#\\/##g', noPcreExpr: '%s#/##g'}); testVim("ex_substitute_ampersand_pcre", function(cm, vim, helpers) { cm.setCursor(0, 0); CodeMirror.Vim.setOption('pcre', true); helpers.doEx('%s/foo/namespace.&/'); eq("namespace.foo", cm.getValue()); }, { value: 'foo' }); testVim("ex_substitute_ampersand_multiple_pcre", function(cm, vim, helpers) { cm.setCursor(0, 0); CodeMirror.Vim.setOption('pcre', true); helpers.doEx('%s/f.o/namespace.&/'); eq("namespace.foo\nnamespace.fzo", cm.getValue()); }, { value: 'foo\nfzo' }); testVim("ex_escaped_ampersand_should_not_substitute_pcre", function(cm, vim, helpers) { cm.setCursor(0, 0); CodeMirror.Vim.setOption('pcre', true); helpers.doEx('%s/foo/namespace.\\&/'); eq("namespace.&", cm.getValue()); }, { value: 'foo' }); 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_dollar_assertion', { value: 'one,two \n three,four', expectedValue: 'one,two ,\n three,four,', expr: '%s/$/,/g'}); testSubstitute('ex_substitute_dollar_assertion_empty_lines', { value: '\n\n\n\n\n\n', expectedValue: ';\n;\n;\n;\n;\n;\n;', expr: '%s/$/;/g'}); testSubstitute('ex_substitute_dollar_literal', { value: 'one$two\n$three\nfour$\n$', expectedValue: 'one,two\n,three\nfour,\n,', expr: '%s/\\$/,/g'}); testSubstitute('ex_substitute_newline_match', { value: 'one,two \n three,four', expectedValue: 'one,two , three,four', expr: '%s/\\n/,/g'}); testSubstitute('ex_substitute_newline_join_global', { value: 'one,two \n three,four \n five \n six', expectedValue: 'one,two \n three,four , five \n six', expr: '2s/\\n/,/g'}); testSubstitute('ex_substitute_newline_join_noglobal', { value: 'one,two \n three,four \n five \n six\n', expectedValue: 'one,two \n three,four , five , six\n', expr: '2,3s/\\n/,/'}); testSubstitute('ex_substitute_newline_replacement', { value: 'one,two, \n three,four,', expectedValue: 'one\ntwo\n \n three\nfour\n', expr: '%s/,/\\n/g'}); testSubstitute('ex_substitute_newline_multiple_splits', { value: 'one,two, \n three,four,five,six, \n seven,', expectedValue: 'one,two, \n three\nfour\nfive\nsix\n \n seven,', expr: '2s/,/\\n/g'}); testSubstitute('ex_substitute_newline_first_occurrences', { value: 'one,two, \n three,four,five,six, \n seven,', expectedValue: 'one\ntwo, \n three\nfour,five,six, \n seven\n', expr: '%s/,/\\n/'}); 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/'}); testSubstitute('ex_substitute_optional', { value: 'aaa aa\n aa', expectedValue: ' <> \n<> ', expr: '%s/(a*)/<$1>/g', noPcreExpr: '%s/\\(a*\\)/<\\1>/g'}); testSubstitute('ex_substitute_empty_match', { value: 'aaa aa\n aa\nbb\n', expectedValue: ' \n \nbb<>\n<>', expr: '%s/(a+|$)/<$1>/g', noPcreExpr: '%s/\\(a+\\|$\\)/<\\1>/g'}); testSubstitute('ex_substitute_empty_or_match', { value: '1234\n567\n89\n0\n', expectedValue: '<12><34>\n<56>7<>\n<89>\n0<>\n<>', expr: '%s/(..|$)/<$1>/g', noPcreExpr: '%s/\\(..\\|$\\)/<\\1>/g'}); function testSubstituteConfirm(name, command, initialValue, expectedValue, keys, finalPos) { testVim(name, function(cm, vim, helpers) { helpers.doEx(command); for (var i = 0; i < keys.length; i++) { helpers.doKeys(keys.charAt(i)) } eq(expectedValue, cm.getValue()); helpers.assertCursorAt(finalPos); }, { 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) { helpers.doKeys('?', 'match', '\n'); 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('ex_yank', function (cm, vim, helpers) { var curStart = makeCursor(3, 0); cm.setCursor(curStart); helpers.doEx('y'); var register = helpers.getRegisterController().getRegister(); var line = cm.getLine(3); eq(line + '\n', register.toString()); }); testVim('set_boolean', function(cm, vim, helpers) { CodeMirror.Vim.defineOption('testoption', true, 'boolean'); // Test default value is set. is(CodeMirror.Vim.getOption('testoption')); // Test fail to set to non-boolean var result = CodeMirror.Vim.setOption('testoption', '5'); is(result instanceof Error); // 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')); is(!cm.state.currentNotificationClose); // Test fail to set to non-boolean helpers.doEx('set testoption=22'); is(cm.state.currentNotificationClose); // Test setOption helpers.doEx('set notestoption'); is(!CodeMirror.Vim.getOption('testoption')); // Test toggle with ! helpers.doEx('set notestoption!'); is(CodeMirror.Vim.getOption('testoption')); helpers.doEx('set notestoption!'); is(!CodeMirror.Vim.getOption('testoption')); helpers.doEx('set testoption!'); is(CodeMirror.Vim.getOption('testoption')); helpers.doEx('set testoption!'); 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')); // Test no fail to set non-string. var result = CodeMirror.Vim.setOption('testoption', true); is(!result); // Test fail to set 'notestoption' result = CodeMirror.Vim.setOption('notestoption', 'b'); is(result instanceof Error); // 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')); // Test fail to set 'notestopt' is(!cm.state.currentNotificationClose); helpers.doEx('set notestopt=b'); is(cm.state.currentNotificationClose); // 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')); // Test fail to set 'notestopt' is(!cm.state.currentNotificationClose); helpers.doEx('set notestopt=b'); is(cm.state.currentNotificationClose); // 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); }); testVim('map_prompt', function(cm, vim, helpers) { function highlighted() { return vim.searchState_ && (vim.searchState_.getOverlay() || vim.searchState_.highlightTimeout); } is(!highlighted()); helpers.doKeys('/a\n'); helpers.doKeys('i'); is(highlighted()); helpers.doKeys(''); helpers.doEx('nohl'); is(!highlighted()); helpers.assertCursorAt(1, 2); helpers.doEx('nnoremap i :nohlixx'); helpers.doEx('map :sayhi ihi'); helpers.doEx('map j :sayhi/b'); helpers.doKeys('/1\n'); helpers.assertCursorAt(1, 1); helpers.doKeys('j'); eq(cm.getWrapperElement().querySelector("input").value, "ab"); helpers.doKeys(''); is(highlighted()); helpers.doKeys('i'); is(!highlighted()); eq(cm.getValue(), ' 0 xyz\n hi1 xx'); 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_omap', function(cm, vim, helpers) { helpers.doKeys('0', 'w', 'd', 'w'); eq(cm.getValue(), 'hello world'); helpers.doKeys('u'); helpers.doKeys(':', 'omap w $\n'); helpers.doKeys( '0', 'w'); helpers.assertCursorAt(0, 6); helpers.doKeys('d', 'w'); eq(cm.getValue(), 'hello '); }, {value: 'hello unfair world'}); testVim('ex_nmap', function(cm, vim, helpers) { cm.setCursor(0, 3); helpers.doEx('nmap k gj'); helpers.doKeys('k'); helpers.assertCursorAt(1, 3); helpers.doKeys('d', 'k'); eq(cm.getValue(), 'world'); helpers.doKeys('u'); cm.setCursor(1, 3); helpers.doEx('map k gj'); helpers.doKeys('d', 'k'); eq(cm.getValue(), 'hello\nunfld'); helpers.assertCursorAt(1, 3); helpers.doKeys(''); helpers.assertCursorAt(0, 3); }, {value: 'hello\nunfair\nworld'}); 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'); helpers.doKeys('f', 'o'); eq('1fo4\n5fo8\nafodefg', cm.getValue()); helpers.doKeys('j', 'j'); cm.setCursor(0, 0); helpers.doKeys('.'); eq('foo4\nfoo8\nfoodefg', cm.getValue()); helpers.doKeys('R', 'x', 'j', 'j'); eq('xoo4\nfoo8\nfoodefg', cm.getValue()); helpers.doKeys('i'); cm.setSelections([ {head: makeCursor(0, 0), anchor: makeCursor(0, 1)}, {head: makeCursor(1, 0), anchor: makeCursor(1, 2)} ]); helpers.doKeys('j'); eq('joo4\njo8\nfoodefg', cm.getValue()); helpers.doKeys('j'); eq('xoo4\nfoo8\nfoodefg', cm.getValue()); if (cm.forEachSelection) { cm.setSelections([ {head: makeCursor(0, 2), anchor: makeCursor(0, 2)}, {head: makeCursor(1, 2), anchor: makeCursor(1, 2)}, {head: makeCursor(2, 4), anchor: makeCursor(2, 4)} ]); helpers.doKeys('R', 'x'); eq('xox4\nfox8\nfoodxfg', cm.getValue()); helpers.doKeys('j'); eq('xoxj\nfoxj\nfoodxjg', cm.getValue()); helpers.doKeys('k'); eq('xox4\nfox8\nfoodxfg', cm.getValue()); eq(3, cm.listSelections().length); } }, { 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'); }); // Testing ex-commands with non-alpha names. testVim('ex_special_names', function(cm, vim, helpers) { var ran,val; var cmds = ['!','!!','#','&','*','<','=','>','@','@@','~','regtest1','RT2']; cmds.forEach(function(name){ CodeMirror.Vim.defineEx(name,'',function(cm,params){ ran=params.commandName; val=params.argString; }); helpers.doEx(':'+name); eq(ran,name,'Running ex-command failed'); helpers.doEx(':'+name+' x'); eq(val,' x','Running ex-command with param failed: '+name); if(/^\W+$/.test(name)){ helpers.doEx(':'+name+'y'); eq(val,'y','Running ex-command with param failed: '+name); } else{ helpers.doEx(':'+name+'-y'); eq(val,'-y','Running ex-command with param failed: '+name); } if(name!=='!'){ helpers.doEx(':'+name+'!'); eq(ran,name,'Running ex-command with bang failed'); eq(val,'!','Running ex-command with bang failed: '+name); helpers.doEx(':'+name+'!z'); eq(ran,name,'Running ex-command with bang & param failed'); eq(val,'!z','Running ex-command with bang & param failed: '+name); } }); }); // 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' }); testVim('map in normal mode', function(cm, vim, helpers) { CodeMirror.Vim.noremap('', 'i', 'normal'); helpers.doKeys(''); is(vim.insertMode, "Didn't switch to insert mode."); helpers.doKeys(''); is(!vim.insertMode, "Didn't switch to normal mode."); }); testVim('noremap', function(cm, vim, helpers) { helpers.doEx('noremap ; l'); helpers.doEx('map l $'); helpers.doEx('map q l'); helpers.doKeys('l'); helpers.assertCursorAt(0, 4); cm.setCursor(0, 0); helpers.doKeys('q'); helpers.assertCursorAt(0, 4); cm.setCursor(0, 0); eq('wOrd1', cm.getValue()); // Mapping should work in normal mode. helpers.doKeys(';', 'r', '1'); eq('w1rd1', cm.getValue()); // Mapping will not work in insert mode because of no current fallback // keyToKey mapping support. helpers.doKeys('i', ';', ''); eq('w;1rd1', cm.getValue()); // unmap all mappings helpers.doEx('mapclear'); cm.setCursor(0, 0); helpers.doKeys('l'); helpers.assertCursorAt(0, 1); // map key to itself helpers.doKeys('x', 'p', 'l'); eq('w1;rd1', cm.getValue()); helpers.doEx('noremap x "_x'); helpers.doKeys('x', 'p'); eq('w1;d;1', cm.getValue()); helpers.doEx('mapclear'); }, { value: 'wOrd1' }); // noremap should capture all mappings of the rhs testVim('noremap_all_mappings', function(cm, vim, helpers) { // mapping to 'u' should undo in normal mode and lowercase in visual mode CodeMirror.Vim.noremap('a', 'u'); helpers.doKeys('y', 'y', 'p'); eq('HeY\nHeY', cm.getValue()); // undo helpers.doKeys('a'); eq('HeY', cm.getValue()); // lowercase helpers.doKeys('V', 'a'); eq('hey', cm.getValue()); }, { value: 'HeY' }); testVim('noremap_swap', function(cm, vim, helpers) { CodeMirror.Vim.noremap('i', 'a', 'normal'); CodeMirror.Vim.noremap('a', 'i', 'normal'); cm.setCursor(0, 0); // 'a' should act like 'i'. helpers.doKeys('a'); eqCursorPos(new Pos(0, 0), cm.getCursor()); // ...and 'i' should act like 'a'. helpers.doKeys('', 'i'); eqCursorPos(new Pos(0, 1), cm.getCursor()); }, { value: 'foo' }); testVim('noremap_map_interaction', function(cm, vim, helpers) { // noremap should clobber map CodeMirror.Vim.map(';', 'l'); CodeMirror.Vim.noremap(';', 'l'); CodeMirror.Vim.map('l', 'j'); cm.setCursor(0, 0); helpers.doKeys(';'); eqCursorPos(new Pos(0, 1), cm.getCursor()); helpers.doKeys('l'); eqCursorPos(new Pos(1, 1), cm.getCursor()); // map should be able to point to a noremap CodeMirror.Vim.map('m', ';'); helpers.doKeys('m'); eqCursorPos(new Pos(1, 2), cm.getCursor()); }, { value: 'wOrd1\nwOrd2' }); testVim('noremap_map_interaction2', function(cm, vim, helpers) { // map should point to the most recent noremap CodeMirror.Vim.noremap(';', 'l'); CodeMirror.Vim.map('m', ';'); CodeMirror.Vim.noremap(';', 'h'); cm.setCursor(0, 0); helpers.doKeys('l'); eqCursorPos(new Pos(0, 1), cm.getCursor()); helpers.doKeys('m'); eqCursorPos(new Pos(0, 0), cm.getCursor()); }, { value: 'wOrd1\nwOrd2' }); testVim('gq_and_gw', function(cm, vim, helpers) { cm.setValue( "1\n2\nhello world\n" + "xxx ".repeat(20) + "\nyyy" + "\n\nnext\nparagraph" ); cm.setCursor(2,5); helpers.doKeys("gqgq"); helpers.assertCursorAt(2, 0); eq(cm.getLine(2), "hello world"); helpers.doKeys("gqj"); helpers.assertCursorAt(3, 0); eq(cm.getLine(3), "xxx xxx xxx ") helpers.doKeys("gq}") helpers.assertCursorAt(4, 0); eq(cm.getLine(3), "xxx xxx xxx yyy") helpers.doKeys("gqG"); helpers.doKeys("gqgg"); helpers.doKeys(":set tw=15\n"); helpers.doKeys("gg", "V", "gq"); eq(cm.getLine(0), "1 2 hello world"); eq(cm.getLine(5), "xxx xxx xxx xxx yyy"); helpers.doKeys(":6\n"); helpers.doKeys("gqq"); eq(cm.getLine(6), "yyy"); }, { value: 'wOrd1\nwOrd2' }); testVim('updateStatus', function(cm, vim, helpers) { var keys = ''; CodeMirror.on(cm, 'vim-keypress', function(key) { keys = keys + key; }); CodeMirror.on(cm, 'vim-command-done', function(e) { keys = ''; }); // ace_patch helpers.doKeys('d'); eq(vim.status, 'd'); helpers.doKeys('/', 'match', '\n'); eq(vim.status, null); helpers.assertCursorAt(0, 0); helpers.doKeys('d'); eq(vim.status, 'd'); helpers.doKeys('/', ''); eq(vim.status, null); helpers.doKeys('d'); eq(vim.status, 'd'); helpers.doKeys(':'); eq(vim.status, 'd:'); helpers.doKeys(''); eq(vim.status, null); }, { value: 'text match match \n next' }); // Test event handlers testVim('beforeSelectionChange', function(cm, vim, helpers) { cm.setCursor(0, 100); eqCursorPos(cm.getCursor('head'), cm.getCursor('anchor')); }, { value: 'abc' }); testVim('increment_binary', function(cm, vim, helpers) { cm.setCursor(0, 4); helpers.doKeys(''); eq('0b001', cm.getValue()); helpers.doKeys(''); eq('0b010', cm.getValue()); helpers.doKeys(''); eq('0b001', cm.getValue()); helpers.doKeys(''); eq('0b000', cm.getValue()); cm.setCursor(0, 0); helpers.doKeys(''); eq('0b001', cm.getValue()); helpers.doKeys(''); eq('0b010', cm.getValue()); helpers.doKeys(''); eq('0b001', cm.getValue()); helpers.doKeys(''); eq('0b000', cm.getValue()); }, { value: '0b000' }); testVim('increment_octal', function(cm, vim, helpers) { cm.setCursor(0, 2); helpers.doKeys(''); eq('001', cm.getValue()); helpers.doKeys(''); eq('002', cm.getValue()); helpers.doKeys(''); eq('003', cm.getValue()); helpers.doKeys(''); eq('004', cm.getValue()); helpers.doKeys(''); eq('005', cm.getValue()); helpers.doKeys(''); eq('006', cm.getValue()); helpers.doKeys(''); eq('007', cm.getValue()); helpers.doKeys(''); eq('010', cm.getValue()); helpers.doKeys(''); eq('007', cm.getValue()); helpers.doKeys(''); eq('006', cm.getValue()); helpers.doKeys(''); eq('005', cm.getValue()); helpers.doKeys(''); eq('004', cm.getValue()); helpers.doKeys(''); eq('003', cm.getValue()); helpers.doKeys(''); eq('002', cm.getValue()); helpers.doKeys(''); eq('001', cm.getValue()); helpers.doKeys(''); eq('000', cm.getValue()); cm.setCursor(0, 0); helpers.doKeys(''); eq('001', cm.getValue()); helpers.doKeys(''); eq('002', cm.getValue()); helpers.doKeys(''); eq('001', cm.getValue()); helpers.doKeys(''); eq('000', cm.getValue()); }, { value: '000' }); testVim('increment_decimal', function(cm, vim, helpers) { cm.setCursor(0, 2); helpers.doKeys(''); eq('101', cm.getValue()); helpers.doKeys(''); eq('102', cm.getValue()); helpers.doKeys(''); eq('103', cm.getValue()); helpers.doKeys(''); eq('104', cm.getValue()); helpers.doKeys(''); eq('105', cm.getValue()); helpers.doKeys(''); eq('106', cm.getValue()); helpers.doKeys(''); eq('107', cm.getValue()); helpers.doKeys(''); eq('108', cm.getValue()); helpers.doKeys(''); eq('109', cm.getValue()); helpers.doKeys(''); eq('110', cm.getValue()); helpers.doKeys(''); eq('109', cm.getValue()); helpers.doKeys(''); eq('108', cm.getValue()); helpers.doKeys(''); eq('107', cm.getValue()); helpers.doKeys(''); eq('106', cm.getValue()); helpers.doKeys(''); eq('105', cm.getValue()); helpers.doKeys(''); eq('104', cm.getValue()); helpers.doKeys(''); eq('103', cm.getValue()); helpers.doKeys(''); eq('102', cm.getValue()); helpers.doKeys(''); eq('101', cm.getValue()); helpers.doKeys(''); eq('100', cm.getValue()); cm.setCursor(0, 0); helpers.doKeys(''); eq('101', cm.getValue()); helpers.doKeys(''); eq('102', cm.getValue()); helpers.doKeys(''); eq('101', cm.getValue()); helpers.doKeys(''); eq('100', cm.getValue()); }, { value: '100' }); testVim('increment_decimal_single_zero', function(cm, vim, helpers) { helpers.doKeys(''); eq('1', cm.getValue()); helpers.doKeys(''); eq('2', cm.getValue()); helpers.doKeys(''); eq('3', cm.getValue()); helpers.doKeys(''); eq('4', cm.getValue()); helpers.doKeys(''); eq('5', cm.getValue()); helpers.doKeys(''); eq('6', cm.getValue()); helpers.doKeys(''); eq('7', cm.getValue()); helpers.doKeys(''); eq('8', cm.getValue()); helpers.doKeys(''); eq('9', cm.getValue()); helpers.doKeys(''); eq('10', cm.getValue()); helpers.doKeys(''); eq('9', cm.getValue()); helpers.doKeys(''); eq('8', cm.getValue()); helpers.doKeys(''); eq('7', cm.getValue()); helpers.doKeys(''); eq('6', cm.getValue()); helpers.doKeys(''); eq('5', cm.getValue()); helpers.doKeys(''); eq('4', cm.getValue()); helpers.doKeys(''); eq('3', cm.getValue()); helpers.doKeys(''); eq('2', cm.getValue()); helpers.doKeys(''); eq('1', cm.getValue()); helpers.doKeys(''); eq('0', cm.getValue()); cm.setCursor(0, 0); helpers.doKeys(''); eq('1', cm.getValue()); helpers.doKeys(''); eq('2', cm.getValue()); helpers.doKeys(''); eq('1', cm.getValue()); helpers.doKeys(''); eq('0', cm.getValue()); }, { value: '0' }); testVim('increment_hexadecimal', function(cm, vim, helpers) { cm.setCursor(0, 2); helpers.doKeys(''); eq('0x1', cm.getValue()); helpers.doKeys(''); eq('0x2', cm.getValue()); helpers.doKeys(''); eq('0x3', cm.getValue()); helpers.doKeys(''); eq('0x4', cm.getValue()); helpers.doKeys(''); eq('0x5', cm.getValue()); helpers.doKeys(''); eq('0x6', cm.getValue()); helpers.doKeys(''); eq('0x7', cm.getValue()); helpers.doKeys(''); eq('0x8', cm.getValue()); helpers.doKeys(''); eq('0x9', cm.getValue()); helpers.doKeys(''); eq('0xa', cm.getValue()); helpers.doKeys(''); eq('0xb', cm.getValue()); helpers.doKeys(''); eq('0xc', cm.getValue()); helpers.doKeys(''); eq('0xd', cm.getValue()); helpers.doKeys(''); eq('0xe', cm.getValue()); helpers.doKeys(''); eq('0xf', cm.getValue()); helpers.doKeys(''); eq('0x10', cm.getValue()); helpers.doKeys(''); eq('0x0f', cm.getValue()); helpers.doKeys(''); eq('0x0e', cm.getValue()); helpers.doKeys(''); eq('0x0d', cm.getValue()); helpers.doKeys(''); eq('0x0c', cm.getValue()); helpers.doKeys(''); eq('0x0b', cm.getValue()); helpers.doKeys(''); eq('0x0a', cm.getValue()); helpers.doKeys(''); eq('0x09', cm.getValue()); helpers.doKeys(''); eq('0x08', cm.getValue()); helpers.doKeys(''); eq('0x07', cm.getValue()); helpers.doKeys(''); eq('0x06', cm.getValue()); helpers.doKeys(''); eq('0x05', cm.getValue()); helpers.doKeys(''); eq('0x04', cm.getValue()); helpers.doKeys(''); eq('0x03', cm.getValue()); helpers.doKeys(''); eq('0x02', cm.getValue()); helpers.doKeys(''); eq('0x01', cm.getValue()); helpers.doKeys(''); eq('0x00', cm.getValue()); cm.setCursor(0, 0); helpers.doKeys(''); eq('0x01', cm.getValue()); helpers.doKeys(''); eq('0x02', cm.getValue()); helpers.doKeys(''); eq('0x01', cm.getValue()); helpers.doKeys(''); eq('0x00', cm.getValue()); }, { value: '0x0' }); testVim('option_key_on_mac', function(cm, vim, helpers) { CodeMirror.isMac = true; helpers.assertCursorAt(0, 0); typeKey.optionTextInput('9', '}'); helpers.assertCursorAt(3, 0); typeKey.optionTextInput('8', '{'); helpers.assertCursorAt(0, 0); CodeMirror.isMac = false; }, { value: '0\n1\n2\n\n\n3\n4\n' }); !isOldCodeMirror && testVim('copy', async function(cm, vim, helpers) { helpers.doKeys('v', 'e'); is(vim.visualMode); typeKey.clipboard.$data = ''; helpers.doKeys(''); eq(typeKey.clipboard.$data, 'hello'); await delay(0); is(!vim.visualMode); helpers.doKeys('w', 'i', ''); is(vim.insertMode); helpers.doKeys(''); is(vim.insertMode); eq(typeKey.clipboard.$data, 'world'); helpers.doKeys(''); // ace_patch is(!vim.insertMode); }, { value: 'hello world' }) testVim('_insert_mode', function(cm, vim, helpers) { helpers.assertCursorAt(0, 0); helpers.doKeys('d', 'w', 'A'); helpers.doKeys('', '-'); eq('456 123 ', cm.getValue()); }, { value: '123 456 ' }); // // test correct langmap function // const dvorakLangmap = "'q,\\,w,.e,pr,yt,fy,gu,ci,ro,lp,/[,=],aa,os,ed,uf,ig,dh,hj,tk,nl,s\\;,-',\\;z,qx,jc,kv,xb,bn,mm,w\\,,v.,z/,[-,]=,\"Q,E,PR,YT,FY,GU,CI,RO,LP,?{,+},AA,OS,ED,UF,IG,DH,HJ,TK,NL,S:,_\",:Z,QX,JC,KV,XB,BN,MM,W<,V>,Z?"; // this test makes sure that remapping works on an example binding testVim('langmap_dd', function(cm, vim, helpers) { CodeMirror.Vim.langmap(dvorakLangmap); cm.setCursor(0, 3); var expectedBuffer = cm.getRange(new Pos(0, 0), new Pos(1, 0)); var expectedLineCount = cm.lineCount() - 1; helpers.doKeys('e', 'e'); eq(expectedLineCount, cm.lineCount()); var register = helpers.getRegisterController().getRegister(); eq(expectedBuffer, register.toString()); is(register.linewise); helpers.assertCursorAt(0, lines[1].textStart); }); // this test serves two functions: // - make sure that "dd" is **not** interpreted as delete line (correct unmapping) // - make sure that "dd" **is** interpreted as move left twice (correct mapping) testVim('langmap_hh', function(cm, vim, helpers) { CodeMirror.Vim.langmap(dvorakLangmap); const startPos = word1.end; const endPos = offsetCursor(word1.end, 0, -2); cm.setCursor(startPos); helpers.doKeys('d', 'd'); helpers.assertCursorAt(endPos); }); // this test serves two functions: // - make sure tha the register is properly remapped so that special registers aren't mixed up // - make sure that recording and replaying macros works without "double remapping" testVim('langmap_qqddq@q', function(cm, vim, helpers) { CodeMirror.Vim.langmap(dvorakLangmap); cm.setCursor(0, 3); var expectedBuffer = cm.getRange(new Pos(1, 0), new Pos(2, 0)); var expectedLineCount = cm.lineCount() - 2; helpers.doKeys('\'\'', 'e', 'e', '\'', '@\''); eq(expectedLineCount, cm.lineCount()); var register = helpers.getRegisterController().getRegister(); eq(expectedBuffer, register.toString()); is(register.linewise); helpers.assertCursorAt(0, lines[2].textStart); }); // this test makes sure that directives are interpreted literally testVim('langmap_fd', function(cm, vim, helpers) { CodeMirror.Vim.langmap(dvorakLangmap); cm.setCursor(0, 0); helpers.doKeys('u', 'd'); helpers.assertCursorAt(0, 4); }); // this test makes sure that markers work properly testVim('langmap_mark', function(cm, vim, helpers) { CodeMirror.Vim.langmap(dvorakLangmap); cm.setCursor(2, 2); helpers.doKeys('m', '\''); cm.setCursor(0, 0); helpers.doKeys('`', '\''); helpers.assertCursorAt(2, 2); cm.setCursor(2, 0); cm.replaceRange(' h', cm.getCursor()); cm.setCursor(0, 0); helpers.doKeys('-', '\''); helpers.assertCursorAt(2, 3); }); // check that ctrl remapping works properly testVim('langmap_visual_block', function(cm, vim, helpers) { CodeMirror.Vim.langmap(dvorakLangmap); cm.setCursor(0, 1); helpers.doKeys('', '2', 'h', 'n', 'n', 'n', 'j'); helpers.doKeys('hello'); eq('1hello\n5hello\nahellofg', cm.getValue()); helpers.doKeys(''); cm.setCursor(2, 3); helpers.doKeys('', '2', 't', 'd', 'J'); helpers.doKeys('world'); eq('1hworld\n5hworld\nahworld', cm.getValue()); }, {value: '1234\n5678\nabcdefg'}); // check that ctrl remapping can be disabled testVim('langmap_visual_block_no_ctrl_remap', function(cm, vim, helpers) { CodeMirror.Vim.langmap(dvorakLangmap, false); cm.setCursor(0, 1); helpers.doKeys('', '2', 'h', 'n', 'n', 'n', 'j'); helpers.doKeys('hello'); eq('1hello\n5hello\nahellofg', cm.getValue()); helpers.doKeys(''); cm.setCursor(2, 3); helpers.doKeys('', '2', 't', 'd', 'J'); helpers.doKeys('world'); eq('1hworld\n5hworld\nahworld', cm.getValue()); }, {value: '1234\n5678\nabcdefg'}); async function delay(t) { return await new Promise(resolve => setTimeout(resolve, t)); } var typeKey = function() { var keyCodeToKey = {}; var keyCodeToCode = {}; var alias = {}; alias.Ctrl = "Control"; alias.Option = "Alt"; alias.Cmd = alias.Super = alias.Meta = "Command"; var controlKeys = { Shift: 16, Control: 17, Alt: 18, Meta: 224, Command: 224, Backspace:8, Tab:9, Return: 13, Enter: 13, Pause: 19, Escape: 27, PageUp: 33, PageDown: 34, End: 35, Home: 36, Left: 37, Up: 38, Right: 39, Down: 40, Insert: 45, Delete: 46, ArrowLeft: 37, ArrowUp: 38, ArrowRight: 39, ArrowDown: 40, }; var shiftedKeys = {}; var printableKeys = {}; var specialKeys = { Backquote: [192, "`", "~"], Minus: [189, "-", "_"], Equal: [187, "=", "+"], BracketLeft: [219, "[", "{"], Backslash: [220, "\\", "|"], BracketRight: [221, "]", "}"], Semicolon: [186, ";", ":"], Quote: [222, "'", '"'], Comma: [188, ",", "<"], Period: [190, ".", ">"], Slash: [191, "/", "?"], Space: [32, " ", " "], NumpadAdd: [107, "+"], NumpadDecimal: [110, "."], NumpadSubtract: [109, "-"], NumpadDivide: [111, "/"], NumpadMultiply: [106, "*"] }; for (var i in specialKeys) { var key = specialKeys[i]; printableKeys[i] = printableKeys[key[1]] = shiftedKeys[key[2]] = key[0]; keyCodeToCode[key[0]] = i; keyCodeToKey[key[0]] = key[1]; keyCodeToKey["s-" + key[0]] = key[2]; } for (var i = 0; i < 10; i++) { var shifted = "!@#$%^&*()"[i]; printableKeys[i] = shiftedKeys[shifted] = 48 + i; keyCodeToCode[48 + i] = "Digit" + i; keyCodeToKey[48 + i] = i.toString(); keyCodeToKey["s-" + (48 + i)] = shifted; } for (var i = 65; i < 91; i++) { var chr = String.fromCharCode(i + 32); printableKeys[chr] = shiftedKeys[chr.toUpperCase()] = i; keyCodeToCode[i] = "Key" + chr.toUpperCase(); keyCodeToKey[i] = chr; keyCodeToKey["s-" + i] = chr.toUpperCase(); } for (var i = 1; i < 13; i++) { controlKeys["F" + i] = 111 + i; } for (var i in controlKeys) { keyCodeToKey[controlKeys[i]] = i; keyCodeToCode[controlKeys[i]] = i; } controlKeys["\t"] = controlKeys.Tab; controlKeys["\n"] = controlKeys.Return; controlKeys.Del = controlKeys.Delete; controlKeys.Esc = controlKeys.Escape; controlKeys.Ins = controlKeys.Insert; var shift = false; var ctrl = false; var meta = false; var alt = false; function reset() { shift = ctrl = meta = alt = false; } function updateModifierStates(keyCode) { if (keyCode == controlKeys.Shift) return shift = true; if (keyCode == controlKeys.Control) return ctrl = true; if (keyCode == controlKeys.Meta) return meta = true; if (keyCode == controlKeys.Alt) return alt = true; } function sendKey(letter, options) { var keyCode = controlKeys[letter] || printableKeys[letter] || shiftedKeys[letter]; var isModifier = updateModifierStates(keyCode); var text = letter; var isTextInput = true; if (ctrl || alt || meta) { isTextInput = false; } else if (controlKeys[letter]) { if (keyCode == controlKeys.Return) { text = "\n"; isTextInput = true; } else { isTextInput = false; } } else if (shift) { text = text.toUpperCase(); } if (keyCodeToKey[keyCode] != text && keyCodeToKey["s-" + keyCode] == text) { shift = true; } var key = keyCodeToKey[(shift ? "s-" : "") + keyCode]; if (options && options.macAltText) { alt = true; text = key = options.macAltText; isTextInput = true; } var target = document.activeElement; var prevented = emit("keydown", true); if (isModifier) return; if (!prevented && isTextInput) prevented = emit("keypress", true); if (!prevented && ctrl && !alt && !meta && letter == "c") emitClipboard("copy"); if (!prevented) updateTextInput(); emit("keyup", true); function emitClipboard(eventType) { var data = {bubbles: true, cancelable:true}; var event = new KeyboardEvent(eventType, data); event.clipboardData = { setData: function(mime, text) { type.clipboard.$data = text; }, getData: function() { return type.clipboard.$data; }, clearData: function() {}, }; target.dispatchEvent(event); } function emit(type, bubbles) { var el = document.activeElement; var data = {bubbles: bubbles, cancelable:true}; data.charCode = text.charCodeAt(0); data.keyCode = type == "keypress" ? data.charCode : keyCode; data.which = data.keyCode; data.shiftKey = shift || (shiftedKeys[text] && !printableKeys[text]); data.ctrlKey = ctrl; data.altKey = alt; data.metaKey = meta; data.key = key; data.code = keyCodeToCode[keyCode]; var event = new KeyboardEvent(type, data); var el = document.activeElement; el.dispatchEvent(event); return event.defaultPrevented; } function updateTextInput() { if (!isTextInput && keyCode == controlKeys.Return) { text = "\n"; } if (target._handleInputEventForTest) { if (!isTextInput) return; return target._handleInputEventForTest(text); } var isTextarea = "selectionStart" in target && typeof target.value == "string"; if (!isTextarea) return; var start = target.selectionStart; var end = target.selectionEnd; var value = target.value; if (!isTextInput) { if (keyCode == controlKeys.Backspace) { if (start != end) start = Math.max(start - 1, 0); } else if (keyCode == controlKeys.Delete) { if (start != end) end = Math.min(end + 1, value.length); } else { return; } } var newValue = value.slice(0, start) + text + value.slice(end); var newStart = start + text.length; var newEnd = newStart; if (newValue != value || newStart != start || newEnd != end) { target.value = newValue; target.setSelectionRange(newStart, newEnd); emit("input", false); } } } function type() { var keys = Array.prototype.slice.call(arguments); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (Array.isArray(key)) { type.apply(null, key); continue; } reset(); if (key.length > 1) { var isKeyName = controlKeys[key] || printableKeys[key] || shiftedKeys[key]; if (!isKeyName) { var parts = key.split("-"); var modifiers = parts.slice(0, parts.length - 1).map(function(part) { return controlKeys[alias[part] || part]; }); var isValid = modifiers.length && modifiers.every(updateModifierStates); if (!isValid) { type.apply(null, key.split("")); continue; } key = parts.pop(); parts.forEach(function(part) { var keyCode = controlKeys[part]; updateModifierStates(keyCode); }); } } sendKey(key); } } // emulates option-9 inputting } on mac swiss keyboard type.optionTextInput = function(letter, altText) { reset(); sendKey(letter, {macAltText: altText}); }; type.clipboard = {}; return type; }(); require("../test/run")(module); ================================================ FILE: src/keyboard/vscode.js ================================================ "use strict"; var HashHandler = require("../keyboard/hash_handler").HashHandler; var config = require("../config"); exports.handler = new HashHandler(); exports.handler.$id = "ace/keyboard/vscode"; exports.handler.addCommands([{ name: "toggleWordWrap", exec: function(editor) { var wrapUsed = editor.session.getUseWrapMode(); editor.session.setUseWrapMode(!wrapUsed); }, readOnly: true }, { name: "navigateToLastEditLocation", exec: function(editor) { var lastDelta = editor.session.getUndoManager().$lastDelta; var range = (lastDelta.action == "remove")? lastDelta.start: lastDelta.end; editor.moveCursorTo(range.row, range.column); editor.clearSelection(); } }, { name: "replaceAll", exec: function (editor) { if (!editor.searchBox) { config.loadModule("ace/ext/searchbox", function(e) { e.Search(editor, true); }); } else { if (editor.searchBox.active === true && editor.searchBox.replaceOption.checked === true) { editor.searchBox.replaceAll(); } } } }, { name: "replaceOne", exec: function (editor) { if (!editor.searchBox) { config.loadModule("ace/ext/searchbox", function(e) { e.Search(editor, true); }); } else { if (editor.searchBox.active === true && editor.searchBox.replaceOption.checked === true) { editor.searchBox.replace(); } } } }, { name: "selectAllMatches", exec: function (editor) { if (!editor.searchBox) { config.loadModule("ace/ext/searchbox", function(e) { e.Search(editor, false); }); } else { if (editor.searchBox.active === true) { editor.searchBox.findAll(); } } } }, { name: "toggleFindCaseSensitive", exec: function (editor) { config.loadModule("ace/ext/searchbox", function(e) { e.Search(editor, false); var sb = editor.searchBox; sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked; sb.$syncOptions(); }); } }, { name: "toggleFindInSelection", exec: function (editor) { config.loadModule("ace/ext/searchbox", function(e) { e.Search(editor, false); var sb = editor.searchBox; sb.searchOption.checked = !sb.searchRange; sb.setSearchRange(sb.searchOption.checked && sb.editor.getSelectionRange()); sb.$syncOptions(); }); } }, { name: "toggleFindRegex", exec: function (editor) { config.loadModule("ace/ext/searchbox", function(e) { e.Search(editor, false); var sb = editor.searchBox; sb.regExpOption.checked = !sb.regExpOption.checked; sb.$syncOptions(); }); } }, { name: "toggleFindWholeWord", exec: function (editor) { config.loadModule("ace/ext/searchbox", function(e) { e.Search(editor, false); var sb = editor.searchBox; sb.wholeWordOption.checked = !sb.wholeWordOption.checked; sb.$syncOptions(); }); } }, { name: "removeSecondaryCursors", exec: function (editor) { var ranges = editor.selection.ranges; if (ranges && ranges.length > 1) editor.selection.toSingleRange(ranges[ranges.length - 1]); else editor.selection.clearSelection(); } }]); [{ bindKey: {mac: "Ctrl-G", win: "Ctrl-G"}, name: "gotoline" }, { bindKey: {mac: "Command-Shift-L|Command-F2", win: "Ctrl-Shift-L|Ctrl-F2"}, name: "findAll" }, { bindKey: {mac: "Shift-F8|Shift-Option-F8", win: "Shift-F8|Shift-Alt-F8"}, name: "goToPreviousError" }, { bindKey: {mac: "F8|Option-F8", win: "F8|Alt-F8"}, name: "goToNextError" }, { bindKey: {mac: "Command-Shift-P|F1", win: "Ctrl-Shift-P|F1"}, name: "openCommandPalette" }, { bindKey: {mac: "Shift-Option-Up", win: "Alt-Shift-Up"}, name: "copylinesup" }, { bindKey: {mac: "Shift-Option-Down", win: "Alt-Shift-Down"}, name: "copylinesdown" }, { bindKey: {mac: "Command-Shift-K", win: "Ctrl-Shift-K"}, name: "removeline" }, { bindKey: {mac: "Command-Enter", win: "Ctrl-Enter"}, name: "addLineAfter" }, { bindKey: {mac: "Command-Shift-Enter", win: "Ctrl-Shift-Enter"}, name: "addLineBefore" }, { bindKey: {mac: "Command-Shift-\\", win: "Ctrl-Shift-\\"}, name: "jumptomatching" }, { bindKey: {mac: "Command-]", win: "Ctrl-]"}, name: "blockindent" }, { bindKey: {mac: "Command-[", win: "Ctrl-["}, name: "blockoutdent" }, { bindKey: {mac: "Ctrl-PageDown", win: "Alt-PageDown"}, name: "pagedown" }, { bindKey: {mac: "Ctrl-PageUp", win: "Alt-PageUp"}, name: "pageup" }, { bindKey: {mac: "Shift-Option-A", win: "Shift-Alt-A"}, name: "toggleBlockComment" }, { bindKey: {mac: "Option-Z", win: "Alt-Z"}, name: "toggleWordWrap" }, { bindKey: {mac: "Command-G", win: "F3|Ctrl-K Ctrl-D"}, name: "findnext" }, { bindKey: {mac: "Command-Shift-G", win: "Shift-F3"}, name: "findprevious" }, { bindKey: {mac: "Option-Enter", win: "Alt-Enter"}, name: "selectAllMatches" }, { bindKey: {mac: "Command-D", win: "Ctrl-D"}, name: "selectMoreAfter" }, { bindKey: {mac: "Command-K Command-D", win: "Ctrl-K Ctrl-D"}, name: "selectOrFindNext" }, { bindKey: {mac: "Shift-Option-I", win: "Shift-Alt-I"}, name: "splitSelectionIntoLines" }, { bindKey: {mac: "Command-K M", win: "Ctrl-K M"}, name: "modeSelect" }, { // In VsCode this command is used only for folding instead of toggling fold bindKey: {mac: "Command-Option-[", win: "Ctrl-Shift-["}, name: "toggleFoldWidget" }, { bindKey: {mac: "Command-Option-]", win: "Ctrl-Shift-]"}, name: "toggleFoldWidget" }, { bindKey: {mac: "Command-K Command-0", win: "Ctrl-K Ctrl-0"}, name: "foldall" }, { bindKey: {mac: "Command-K Command-J", win: "Ctrl-K Ctrl-J"}, name: "unfoldall" }, { bindKey: { mac: "Command-K Command-1", win: "Ctrl-K Ctrl-1" }, name: "foldOther" }, { bindKey: { mac: "Command-K Command-Q", win: "Ctrl-K Ctrl-Q" }, name: "navigateToLastEditLocation" }, { bindKey: { mac: "Command-K Command-R|Command-K Command-S", win: "Ctrl-K Ctrl-R|Ctrl-K Ctrl-S" }, name: "showKeyboardShortcuts" }, { bindKey: { mac: "Command-K Command-X", win: "Ctrl-K Ctrl-X" }, name: "trimTrailingSpace" }, { bindKey: {mac: "Shift-Down|Command-Shift-Down", win: "Shift-Down|Ctrl-Shift-Down"}, name: "selectdown" }, { bindKey: {mac: "Shift-Up|Command-Shift-Up", win: "Shift-Up|Ctrl-Shift-Up"}, name: "selectup" }, { // TODO: add similar command to work inside SearchBox bindKey: {mac: "Command-Alt-Enter", win: "Ctrl-Alt-Enter"}, name: "replaceAll" }, { // TODO: add similar command to work inside SearchBox bindKey: {mac: "Command-Shift-1", win: "Ctrl-Shift-1"}, name: "replaceOne" }, { bindKey: {mac: "Option-C", win: "Alt-C"}, name: "toggleFindCaseSensitive" }, { bindKey: {mac: "Option-L", win: "Alt-L"}, name: "toggleFindInSelection" }, { bindKey: {mac: "Option-R", win: "Alt-R"}, name: "toggleFindRegex" }, { bindKey: {mac: "Option-W", win: "Alt-W"}, name: "toggleFindWholeWord" }, { bindKey: {mac: "Command-L", win: "Ctrl-L"}, name: "expandtoline" }, { bindKey: {mac: "Shift-Esc", win: "Shift-Esc"}, name: "removeSecondaryCursors" } // not implemented /*{ bindKey: {mac: "Option-Shift-Command-Right", win: "Shift-Alt-Right"}, name: "smartSelect.expand" }, { bindKey: {mac: "Ctrl-Shift-Command-Left", win: "Shift-Alt-Left"}, name: "smartSelect.shrink" }, { bindKey: {mac: "Shift-Option-F", win: "Shift-Alt-F"}, name: "beautify" }, { bindKey: {mac: "Command-K Command-F", win: "Ctrl-K Ctrl-F"}, name: "formatSelection" }, { bindKey: {mac: "Command-K Command-C", win: "Ctrl-K Ctrl-C"}, name: "addCommentLine" }, { bindKey: {mac: "Command-K Command-U", win: "Ctrl-K Ctrl-U"}, name: "removeCommentLine" }, { bindKey: {mac: "Command-K Command-/", win: "Ctrl-K Ctrl-/"}, name: "foldAllBlockComments" }, { bindKey: {mac: "Command-K Command-2", win: "Ctrl-K Ctrl-2"}, name: "foldLevel2" }, { bindKey: {mac: "Command-K Command-3", win: "Ctrl-K Ctrl-3"}, name: "foldLevel3" }, { bindKey: {mac: "Command-K Command-4", win: "Ctrl-K Ctrl-4"}, name: "foldLevel4" }, { bindKey: {mac: "Command-K Command-5", win: "Ctrl-K Ctrl-5"}, name: "foldLevel5" }, { bindKey: {mac: "Command-K Command-6", win: "Ctrl-K Ctrl-6"}, name: "foldLevel6" }, { bindKey: {mac: "Command-K Command-7", win: "Ctrl-K Ctrl-7"}, name: "foldLevel7" }, { bindKey: {mac: "Command-K Command-[", win: "Ctrl-K Ctrl-["}, name: "foldRecursively" }, { bindKey: {mac: "Command-K Command-8", win: "Ctrl-K Ctrl-8"}, name: "foldAllMarkerRegions" }, { bindKey: {mac: "Command-K Command-9", win: "Ctrl-K Ctrl-9"}, name: "unfoldAllMarkerRegions" }, { bindKey: {mac: "Command-K Command-]", win: "Ctrl-K Ctrl-]"}, name: "unfoldRecursively" }, { bindKey: {mac: "Command-K Command-T", win: "Ctrl-K Ctrl-T"}, name: "selectTheme" }, { bindKey: {mac: "Command-K Command-M", win: "Ctrl-K Ctrl-M"}, name: "selectKeymap" }, { bindKey: {mac: "Command-U", win: "Ctrl-U"}, name: "cursorUndo" }*/ ].forEach(function(binding) { var command = exports.handler.commands[binding.name]; if (command) command.bindKey = binding.bindKey; exports.handler.bindKey(binding.bindKey, command || binding.name); }); ================================================ FILE: src/layer/cursor.js ================================================ "use strict"; /** * @typedef {import("../edit_session").EditSession} EditSession */ var dom = require("../lib/dom"); class Cursor { /** * @param {HTMLElement} parentEl */ constructor(parentEl) { this.element = dom.createElement("div"); this.element.className = "ace_layer ace_cursor-layer"; parentEl.appendChild(this.element); 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 = this.$updateOpacity.bind(this); } /** * @param {boolean} [val] */ $updateOpacity(val) { var cursors = this.cursors; for (var i = cursors.length; i--; ) dom.setStyle(cursors[i].style, "opacity", val ? "" : "0"); } $startCssAnimation() { var cursors = this.cursors; for (var i = cursors.length; i--; ) cursors[i].style.animationDuration = this.blinkInterval + "ms"; this.$isAnimating = true; setTimeout(function() { if (this.$isAnimating) { dom.addCssClass(this.element, "ace_animate-blinking"); } }.bind(this)); } $stopCssAnimation() { this.$isAnimating = false; dom.removeCssClass(this.element, "ace_animate-blinking"); } /** * @param {number} padding */ setPadding(padding) { this.$padding = padding; } /** * @param {EditSession} session */ setSession(session) { this.session = session; } /** * @param {boolean} blinking */ setBlinking(blinking) { if (blinking != this.isBlinking) { this.isBlinking = blinking; this.restartTimer(); } } /** * @param {number} blinkInterval */ setBlinkInterval(blinkInterval) { if (blinkInterval != this.blinkInterval) { this.blinkInterval = blinkInterval; this.restartTimer(); } } /** * @param {boolean} smoothBlinking */ setSmoothBlinking(smoothBlinking) { if (smoothBlinking != this.smoothBlinking) { this.smoothBlinking = smoothBlinking; dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking); this.$updateCursors(true); this.restartTimer(); } } addCursor() { var el = dom.createElement("div"); el.className = "ace_cursor"; this.element.appendChild(el); this.cursors.push(el); return el; } removeCursor() { if (this.cursors.length > 1) { var el = this.cursors.pop(); el.parentNode.removeChild(el); return el; } } hideCursor() { this.isVisible = false; dom.addCssClass(this.element, "ace_hidden-cursors"); this.restartTimer(); } showCursor() { this.isVisible = true; dom.removeCssClass(this.element, "ace_hidden-cursors"); this.restartTimer(); } restartTimer() { var update = this.$updateCursors; clearInterval(this.intervalId); clearTimeout(this.timeoutId); this.$stopCssAnimation(); if (this.smoothBlinking) { this.$isSmoothBlinking = false; dom.removeCssClass(this.element, "ace_smooth-blinking"); } update(true); if (!this.isBlinking || !this.blinkInterval || !this.isVisible) { this.$stopCssAnimation(); return; } if (this.smoothBlinking) { this.$isSmoothBlinking = true; setTimeout(function() { if (this.$isSmoothBlinking) { dom.addCssClass(this.element, "ace_smooth-blinking"); } }.bind(this)); } if (dom.HAS_CSS_ANIMATION) { this.$startCssAnimation(); } else { var blink = /**@this{Cursor}*/function(){ /**@type{ReturnType}*/ this.timeoutId = setTimeout(function() { update(false); }, 0.6 * this.blinkInterval); }.bind(this); /**@type{ReturnType}*/ this.intervalId = setInterval(function() { update(true); blink(); }, this.blinkInterval); blink(); } } /** * @param {import("../../ace-internal").Ace.Point} [position] * @param {boolean} [onScreen] */ getPixelPosition(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}; } isCursorInView(pixelPos, config) { return pixelPos.top >= 0 && pixelPos.top < config.maxHeight; } update(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 element = this.cursors[cursorIndex++] || this.addCursor(); var style = element.style; if (!this.drawCursor) { if (!this.isCursorInView(pixelPos, config)) { dom.setStyle(style, "display", "none"); } else { dom.setStyle(style, "display", "block"); dom.translate(element, pixelPos.left, pixelPos.top); dom.setStyle(style, "width", Math.round(config.characterWidth) + "px"); dom.setStyle(style, "height", config.lineHeight + "px"); } } else { this.drawCursor(element, 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(); } /** * @param {boolean} overwrite */ $setOverwrite(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"); } } destroy() { clearInterval(this.intervalId); clearTimeout(this.timeoutId); } } Cursor.prototype.$padding = 0; Cursor.prototype.drawCursor = null; exports.Cursor = Cursor; ================================================ FILE: src/layer/decorators.js ================================================ "use strict"; var dom = require("../lib/dom"); var oop = require("../lib/oop"); var EventEmitter = require("../lib/event_emitter").EventEmitter; class Decorator { /** * @param {import("../../ace-internal").Ace.VScrollbar} scrollbarV * @param {import("../virtual_renderer").VirtualRenderer} renderer */ constructor(scrollbarV, renderer) { this.renderer = renderer; this.pixelRatio = 1; this.maxHeight = renderer.layerConfig.maxHeight; this.lineHeight = renderer.layerConfig.lineHeight; this.minDecorationHeight = (2 * this.pixelRatio) | 0; this.halfMinDecorationHeight = (this.minDecorationHeight / 2) | 0; this.colors = {}; this.colors.dark = { "error": "rgba(255, 18, 18, 1)", "warning": "rgba(18, 136, 18, 1)", "info": "rgba(18, 18, 136, 1)", }; this.colors.light = { "error": "rgb(255,51,51)", "warning": "rgb(32,133,72)", "info": "rgb(35,68,138)", }; this.setScrollBarV(scrollbarV); } $createCanvas() { this.canvas = dom.createElement("canvas"); this.canvas.style.top = 0 + "px"; this.canvas.style.right = 0 + "px"; this.canvas.style.zIndex = "7"; this.canvas.style.position = "absolute"; } setScrollBarV(scrollbarV) { this.$createCanvas(); this.scrollbarV = scrollbarV; scrollbarV.element.appendChild(this.canvas); this.setDimensions(); } $updateDecorators(config) { if (typeof this.canvas.getContext !== "function") { return; } var colors = (this.renderer.theme.isDark === true) ? this.colors.dark : this.colors.light; this.setDimensions(config); var ctx = this.canvas.getContext("2d"); function compare(a, b) { if (a.priority < b.priority) return -1; if (a.priority > b.priority) return 1; return 0; } var annotations = this.renderer.session.$annotations; ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); if (annotations) { var priorities = { "info": 1, "warning": 2, "error": 3 }; annotations.forEach(function (item) { item["priority"] = priorities[item.type] || null; }); annotations = annotations.sort(compare); for (let i = 0; i < annotations.length; i++) { let row = annotations[i].row; const offset1 = this.getVerticalOffsetForRow(row); const offset2 = offset1 + this.lineHeight; const y1 = Math.round(this.heightRatio * offset1); const y2 = Math.round(this.heightRatio * offset2); let ycenter = Math.round((y1 + y2) / 2); let halfHeight = (y2 - ycenter); if (halfHeight < this.halfMinDecorationHeight) { halfHeight = this.halfMinDecorationHeight; } if (ycenter - halfHeight < 0) { ycenter = halfHeight; } if (ycenter + halfHeight > this.canvasHeight) { ycenter = this.canvasHeight - halfHeight; } const from = ycenter - halfHeight; const to = ycenter + halfHeight; const zoneHeight = to - from; ctx.fillStyle = colors[annotations[i].type] || null; ctx.fillRect(0, from, Math.round(this.oneZoneWidth - 1), zoneHeight); } } var cursor = this.renderer.session.selection.getCursor(); if (cursor) { let currentY = Math.round(this.getVerticalOffsetForRow(cursor.row) * this.heightRatio); ctx.fillStyle = "rgba(0, 0, 0, 0.5)"; ctx.fillRect(0, currentY, this.canvasWidth, 2); } } getVerticalOffsetForRow(row) { row = row | 0; const offset = this.renderer.session.documentToScreenRow(row, 0) * this.lineHeight; return offset; } setDimensions(config) { config = config || this.renderer.layerConfig; this.maxHeight = config.maxHeight; this.lineHeight = config.lineHeight; this.canvasHeight = config.height; this.canvasWidth = this.scrollbarV.width || this.canvasWidth; this.setZoneWidth(); this.canvas.width = this.canvasWidth; this.canvas.height = this.canvasHeight; if (this.maxHeight < this.canvasHeight) { this.heightRatio = 1; } else { this.heightRatio = this.canvasHeight / this.maxHeight; } } setZoneWidth() { this.oneZoneWidth = this.canvasWidth; } destroy() { this.canvas.parentNode.removeChild(this.canvas); } } oop.implement(Decorator.prototype, EventEmitter); exports.Decorator = Decorator; ================================================ FILE: src/layer/font_metrics.js ================================================ var oop = require("../lib/oop"); var dom = require("../lib/dom"); var lang = require("../lib/lang"); var event = require("../lib/event"); var useragent = require("../lib/useragent"); var EventEmitter = require("../lib/event_emitter").EventEmitter; var CHAR_COUNT = 512; var USE_OBSERVER = typeof ResizeObserver == "function"; var L = 200; class FontMetrics { /** * @param {HTMLElement} parentEl */ constructor(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); this.$measureNode.textContent = lang.stringRepeat("X", CHAR_COUNT); this.$characterSize = {width: 0, height: 0}; if (USE_OBSERVER) this.$addObserver(); else this.checkForSizeChanges(); } $setMeasureNodeStyles(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"; } /** * @param {{height: number, width: number} | null} [size] */ checkForSizeChanges(size) { if (size === undefined) 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}); } } $addObserver() { var self = this; this.$observer = new window.ResizeObserver(function(e) { // e[0].contentRect is broken on safari when zoomed; self.checkForSizeChanges(); }); this.$observer.observe(this.$measureNode); } /** * @return {number} */ $pollSizeChanges() { if (this.$pollSizeChangesTimer || this.$observer) return this.$pollSizeChangesTimer; var self = this; return this.$pollSizeChangesTimer = event.onIdle(function cb() { self.checkForSizeChanges(); event.onIdle(cb, 500); }, 500); } /** * @param {boolean} val */ setPolling(val) { if (val) { this.$pollSizeChanges(); } else if (this.$pollSizeChangesTimer) { clearInterval(this.$pollSizeChangesTimer); this.$pollSizeChangesTimer = 0; } } $measureSizes(node) { var size = { height: (node || this.$measureNode).clientHeight, width: (node || 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; } $measureCharWidth(ch) { this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT); var rect = this.$main.getBoundingClientRect(); return rect.width / CHAR_COUNT; } getCharacterWidth(ch) { var w = this.charSizes[ch]; if (w === undefined) { w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width; } return w; } destroy() { clearInterval(this.$pollSizeChangesTimer); if (this.$observer) this.$observer.disconnect(); if (this.el && this.el.parentNode) this.el.parentNode.removeChild(this.el); } $getZoom(element) { if (!element || !element.parentElement) return 1; return (Number(window.getComputedStyle(element)["zoom"]) || 1) * this.$getZoom(element.parentElement); } $initTransformMeasureNodes() { var t = function(t, l) { return ["div", { style: "position: absolute;top:" + t + "px;left:" + l + "px;" }]; }; this.els = dom.buildDom([t(0, 0), t(L, 0), t(0, L), t(L, L)], this.el); } // general transforms from element coordinates x to screen coordinates u have the form // | m1[0] m2[0] t[0] | | x | | u | // | m1[1] m2[1] t[1] | . | y | == k | v | // | h[0] h[1] 1 | | 1 | | 1 | // this function finds the coeeficients of the matrix using positions of four points // transformCoordinates(clientPos, elPos) { if (clientPos) { var zoom = this.$getZoom(this.el); clientPos = mul(1 / zoom, clientPos); } function solve(l1, l2, r) { var det = l1[1] * l2[0] - l1[0] * l2[1]; return [ (-l2[1] * r[0] + l2[0] * r[1]) / det, (+l1[1] * r[0] - l1[0] * r[1]) / det ]; } function sub(a, b) { return [a[0] - b[0], a[1] - b[1]]; } function add(a, b) { return [a[0] + b[0], a[1] + b[1]]; } function mul(a, b) { return [a * b[0], a * b[1]]; } if (!this.els) this.$initTransformMeasureNodes(); function p(el) { var r = el.getBoundingClientRect(); return [r.left, r.top]; } var a = p(this.els[0]); var b = p(this.els[1]); var c = p(this.els[2]); var d = p(this.els[3]); var h = solve(sub(d, b), sub(d, c), sub(add(b, c), add(d, a))); var m1 = mul(1 + h[0], sub(b, a)); var m2 = mul(1 + h[1], sub(c, a)); if (elPos) { var x = elPos; var k = h[0] * x[0] / L + h[1] * x[1] / L + 1; var ut = add(mul(x[0], m1), mul(x[1], m2)); return add(mul(1 / k / L, ut), a); } var u = sub(clientPos, a); var f = solve(sub(m1, mul(h[0], u)), sub(m2, mul(h[1], u)), u); return mul(L, f); } } FontMetrics.prototype.$characterSize = {width: 0, height: 0}; oop.implement(FontMetrics.prototype, EventEmitter); exports.FontMetrics = FontMetrics; ================================================ FILE: src/layer/gutter.js ================================================ "use strict"; /** * @typedef {import("../edit_session").EditSession} EditSession * @typedef {import("../editor").Editor} Editor * @typedef {import("../../ace-internal").Ace.LayerConfig} LayerConfig */ /** * @typedef {Object} GutterRenderer * @property {(session: EditSession, row: number) => string} getText - Gets the text to display for a given row * @property {(session: EditSession, lastLineNumber: number, config: Object) => number} getWidth - Calculates the width needed for the gutter * @property {(e: undefined, editor: Editor) => void} [update] - Updates the gutter display * @property {(editor: Editor) => void} [attach] - Attaches the renderer to an editor * @property {(editor: Editor) => void} [detach] - Detaches the renderer from an editor */ var dom = require("../lib/dom"); var oop = require("../lib/oop"); var lang = require("../lib/lang"); var EventEmitter = require("../lib/event_emitter").EventEmitter; var Lines = require("./lines").Lines; var nls = require("../config").nls; class Gutter{ /** * @param {HTMLElement} parentEl */ constructor(parentEl) { this.$showCursorMarker = null; 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.$lines = new Lines(this.element); this.$lines.$offsetCoefficient = 1; } /** * @param {EditSession} session */ setSession(session) { if (this.session) this.session.off("change", this.$updateAnnotations); this.session = session; if (session) session.on("change", this.$updateAnnotations); } /** * @param {number} row * @param {string} className */ addGutterDecoration(row, className) { if (window.console) console.warn && console.warn("deprecated use session.addGutterDecoration"); this.session.addGutterDecoration(row, className); } /** * @param {number} row * @param {string} className */ removeGutterDecoration(row, className) { if (window.console) console.warn && console.warn("deprecated use session.removeGutterDecoration"); this.session.removeGutterDecoration(row, className); } /** * @param {any[]} annotations */ setAnnotations(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: [], type: [], displayText: []}; var annoText = annotation.text; var displayAnnoText = annotation.text; var annoType = annotation.type; annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || ""; displayAnnoText = displayAnnoText ? displayAnnoText : annotation.html || ""; if (rowInfo.text.indexOf(annoText) === -1){ rowInfo.text.push(annoText); rowInfo.type.push(annoType); rowInfo.displayText.push(displayAnnoText); } var className = annotation.className; if (className) { rowInfo.className = className; } else if (annoType === "error") { rowInfo.className = " ace_error"; } else if (annoType === "security" && !/\bace_error\b/.test(rowInfo.className)) { rowInfo.className = " ace_security"; } else if (annoType === "warning" && !/\bace_(error|security)\b/.test(rowInfo.className)) { rowInfo.className = " ace_warning"; } else if (annoType === "info" && !rowInfo.className) { rowInfo.className = " ace_info"; } else if (annoType === "hint" && !rowInfo.className) { rowInfo.className = " ace_hint"; } } } /** * @param {import("../../ace-internal").Ace.Delta} delta */ $updateAnnotations(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); } } /** * @param {LayerConfig} config */ update(config) { this.config = 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); this.oldLastRow = lastRow; this.config = config; this.$lines.moveContainer(config); this.$updateCursorRow(); var fold = session.getNextFoldLine(firstRow); var foldStart = fold ? fold.start.row : Infinity; 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.$lines.getLength() > index + 1) this.$lines.pop(); break; } cell = this.$lines.get(++index); if (cell) { cell.row = row; } else { cell = this.$lines.createCell(row, config, this.session, onCreateCell); this.$lines.push(cell); } this.$renderCell(cell, config, fold, row); row++; } this._signal("afterRender"); this.$updateGutterWidth(config); if (this.$showCursorMarker && this.$highlightGutterLine) this.$updateCursorMarker(); } /** * @param {LayerConfig} config */ $updateGutterWidth(config) { var session = this.session; var gutterRenderer = session.gutterRenderer || this.$renderer; var firstLineNumber = session.$firstLineNumber; var lastLineText = this.$lines.last() ? this.$lines.last().text : ""; if (this.$fixedWidth || session.$useWrapMode) lastLineText = session.getLength() + firstLineNumber - 1; var gutterWidth = gutterRenderer ? gutterRenderer.getWidth(session, lastLineText, config) : lastLineText.toString().length * config.characterWidth; var padding = this.$padding || this.$computePadding(); gutterWidth += padding.left + padding.right; if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) { this.gutterWidth = gutterWidth; /**@type{any}*/(this.element.parentNode).style.width = this.element.style.width = Math.ceil(this.gutterWidth) + "px"; this._signal("changeGutterWidth", gutterWidth); } } $updateCursorRow() { if (!this.$highlightGutterLine) return; var position = this.session.selection.getCursor(); if (this.$cursorRow === position.row) return; this.$cursorRow = position.row; } updateLineHighlight() { if (this.$showCursorMarker) this.$updateCursorMarker(); if (!this.$highlightGutterLine) return; var row = this.session.selection.cursor.row; this.$cursorRow = row; if (this.$cursorCell && this.$cursorCell.row == row) return; if (this.$cursorCell) this.$cursorCell.element.className = this.$cursorCell.element.className.replace("ace_gutter-active-line ", ""); var cells = this.$lines.cells; this.$cursorCell = null; for (var i = 0; i < cells.length; i++) { var cell = cells[i]; if (cell.row >= this.$cursorRow) { if (cell.row > this.$cursorRow) { var fold = this.session.getFoldLine(this.$cursorRow); if (i > 0 && fold && fold.start.row == cells[i - 1].row) cell = cells[i - 1]; else break; } cell.element.className = "ace_gutter-active-line " + cell.element.className; this.$cursorCell = cell; break; } } } $updateCursorMarker() { if (!this.session) return; var session = this.session; if (!this.$highlightElement) { this.$highlightElement = dom.createElement("div"); this.$highlightElement.className = "ace_gutter-cursor"; this.$highlightElement.style.pointerEvents = "none"; this.element.appendChild(this.$highlightElement); } var pos = session.selection.cursor; var config = this.config; var lines = this.$lines; var screenTop = config.firstRowScreen * config.lineHeight; var screenPage = Math.floor(screenTop / lines.canvasHeight); var lineTop = session.documentToScreenRow(pos) * config.lineHeight; var top = lineTop - (screenPage * lines.canvasHeight); dom.setStyle(this.$highlightElement.style, "height", config.lineHeight + "px"); dom.setStyle(this.$highlightElement.style, "top", top + "px"); } /** * @param {LayerConfig} config */ scrollLines(config) { var oldConfig = this.config; this.config = config; this.$updateCursorRow(); if (this.$lines.pageChanged(oldConfig, config)) return this.update(config); this.$lines.moveContainer(config); var lastRow = Math.min(config.lastRow + config.gutterOffset, // needed to compensate for hor scollbar this.session.getLength() - 1); var oldLastRow = this.oldLastRow; this.oldLastRow = lastRow; if (!oldConfig || oldLastRow < config.firstRow) return this.update(config); if (lastRow < oldConfig.firstRow) return this.update(config); if (oldConfig.firstRow < config.firstRow) for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--) this.$lines.shift(); if (oldLastRow > lastRow) for (var row=this.session.getFoldedRowCount(lastRow + 1, oldLastRow); row>0; row--) this.$lines.pop(); if (config.firstRow < oldConfig.firstRow) { this.$lines.unshift(this.$renderLines(config, config.firstRow, oldConfig.firstRow - 1)); } if (lastRow > oldLastRow) { this.$lines.push(this.$renderLines(config, oldLastRow + 1, lastRow)); } this.updateLineHighlight(); this._signal("afterRender"); this.$updateGutterWidth(config); } /** * @param {LayerConfig} config * @param {number} firstRow * @param {number} lastRow */ $renderLines(config, firstRow, lastRow) { var fragment = []; 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 cell = this.$lines.createCell(row, config, this.session, onCreateCell); this.$renderCell(cell, config, foldLine, row); fragment.push(cell); row++; } return fragment; } /** * @param {any} cell * @param {LayerConfig} config * @param {import("../../ace-internal").Ace.IRange | undefined} fold * @param {number} row */ $renderCell(cell, config, fold, row) { var element = cell.element; var session = this.session; var textNode = element.childNodes[0]; var foldWidget = element.childNodes[1]; var annotationNode = element.childNodes[2]; var customWidget = element.childNodes[3]; var annotationIconNode = annotationNode.firstChild; var firstLineNumber = session.$firstLineNumber; var breakpoints = session.$breakpoints; var decorations = session.$decorations; var gutterRenderer = session.gutterRenderer || this.$renderer; var foldWidgets = this.$showFoldWidgets && session.foldWidgets; var foldStart = fold ? fold.start.row : Number.MAX_VALUE; var lineHeight = config.lineHeight + "px"; var className = this.$useSvgGutterIcons ? "ace_gutter-cell_svg-icons " : "ace_gutter-cell "; var iconClassName = this.$useSvgGutterIcons ? "ace_icon_svg" : "ace_icon"; var rowText = (gutterRenderer ? gutterRenderer.getText(session, row) : row + firstLineNumber).toString(); if (this.$highlightGutterLine) { if (row == this.$cursorRow || (fold && row < this.$cursorRow && row >= foldStart && this.$cursorRow <= fold.end.row)) { className += "ace_gutter-active-line "; if (this.$cursorCell != cell) { if (this.$cursorCell) this.$cursorCell.element.className = this.$cursorCell.element.className.replace("ace_gutter-active-line ", ""); this.$cursorCell = cell; } } } if (breakpoints[row]) className += breakpoints[row]; if (decorations[row]) className += decorations[row]; if (this.$annotations[row] && row !== foldStart) className += this.$annotations[row].className; 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) { var foldClass = "ace_fold-widget ace_" + c; var isClosedFold = c == "start" && row == foldStart && row < fold.end.row; if (isClosedFold) { foldClass += " ace_closed"; var foldAnnotationClass = ""; var annotationInFold = false; for (var i = row + 1; i <= fold.end.row; i++) { if (!this.$annotations[i]) continue; if (this.$annotations[i].className === " ace_error") { annotationInFold = true; foldAnnotationClass = " ace_error_fold"; break; } if (this.$annotations[i].className === " ace_security") { annotationInFold = true; foldAnnotationClass = " ace_security_fold"; } else if ( this.$annotations[i].className === " ace_warning" && foldAnnotationClass !== " ace_security_fold" ) { annotationInFold = true; foldAnnotationClass = " ace_warning_fold"; } } className += foldAnnotationClass; } else foldClass += " ace_open"; if (foldWidget.className != foldClass) foldWidget.className = foldClass; dom.setStyle(foldWidget.style, "height", lineHeight); dom.setStyle(foldWidget.style, "display", "inline-block"); // Set a11y properties. foldWidget.setAttribute("role", "button"); foldWidget.setAttribute("tabindex", "-1"); var foldRange = session.getFoldWidgetRange(row); // getFoldWidgetRange is optional to be implemented by fold modes, if not available we fall-back. if (foldRange) foldWidget.setAttribute( "aria-label", nls("gutter.code-folding.range.aria-label", "Toggle code folding, rows $0 through $1", [ foldRange.start.row + 1, foldRange.end.row + 1 ]) ); else { if (fold) foldWidget.setAttribute( "aria-label", nls("gutter.code-folding.closed.aria-label", "Toggle code folding, rows $0 through $1", [ fold.start.row + 1, fold.end.row + 1 ]) ); else foldWidget.setAttribute( "aria-label", nls("gutter.code-folding.open.aria-label", "Toggle code folding, row $0", [row + 1]) ); } if (isClosedFold) { foldWidget.setAttribute("aria-expanded", "false"); foldWidget.setAttribute("title", nls("gutter.code-folding.closed.title", "Unfold code")); } else { foldWidget.setAttribute("aria-expanded", "true"); foldWidget.setAttribute("title", nls("gutter.code-folding.open.title", "Fold code")); } } else { if (foldWidget) { dom.setStyle(foldWidget.style, "display", "none"); foldWidget.setAttribute("tabindex", "0"); foldWidget.removeAttribute("role"); foldWidget.removeAttribute("aria-label"); } } // fold logic ends here const customWidgetAttributes = this.session.$gutterCustomWidgets[row]; if (customWidgetAttributes) { this.$addCustomWidget(row, customWidgetAttributes,cell); } else if (customWidget){ this.$removeCustomWidget(row,cell); } if (annotationInFold && this.$showFoldedAnnotations){ annotationNode.className = "ace_gutter_annotation"; annotationIconNode.className = iconClassName; annotationIconNode.className += foldAnnotationClass; dom.setStyle(annotationIconNode.style, "height", lineHeight); dom.setStyle(annotationNode.style, "display", "block"); dom.setStyle(annotationNode.style, "height", lineHeight); var ariaLabel; switch(foldAnnotationClass) { case " ace_error_fold": ariaLabel = nls("gutter.annotation.aria-label.error", "Error, read annotations row $0", [rowText]); break; case " ace_security_fold": ariaLabel = nls("gutter.annotation.aria-label.security", "Security finding, read annotations row $0", [rowText]); break; case " ace_warning_fold": ariaLabel = nls("gutter.annotation.aria-label.warning", "Warning, read annotations row $0", [rowText]); break; } annotationNode.setAttribute("aria-label", ariaLabel); annotationNode.setAttribute("tabindex", "-1"); annotationNode.setAttribute("role", "button"); } else if (this.$annotations[row]){ annotationNode.className = "ace_gutter_annotation"; annotationIconNode.className = iconClassName; if (this.$useSvgGutterIcons) annotationIconNode.className += this.$annotations[row].className; else element.classList.add(this.$annotations[row].className.replace(" ", "")); dom.setStyle(annotationIconNode.style, "height", lineHeight); dom.setStyle(annotationNode.style, "display", "block"); dom.setStyle(annotationNode.style, "height", lineHeight); var ariaLabel; switch(this.$annotations[row].className) { case " ace_error": ariaLabel = nls("gutter.annotation.aria-label.error", "Error, read annotations row $0", [rowText]); break; case " ace_security": ariaLabel = nls("gutter.annotation.aria-label.security", "Security finding, read annotations row $0", [rowText]); break; case " ace_warning": ariaLabel = nls("gutter.annotation.aria-label.warning", "Warning, read annotations row $0", [rowText]); break; case " ace_info": ariaLabel = nls("gutter.annotation.aria-label.info", "Info, read annotations row $0", [rowText]); break; case " ace_hint": ariaLabel = nls("gutter.annotation.aria-label.hint", "Suggestion, read annotations row $0", [rowText]); break; } annotationNode.setAttribute("aria-label", ariaLabel); annotationNode.setAttribute("tabindex", "-1"); annotationNode.setAttribute("role", "button"); } else { dom.setStyle(annotationNode.style, "display", "none"); annotationNode.removeAttribute("aria-label"); annotationNode.removeAttribute("role"); annotationNode.setAttribute("tabindex", "0"); } if (rowText !== textNode.data) { textNode.data = rowText; } if (element.className != className) element.className = className; dom.setStyle(cell.element.style, "height", this.$lines.computeLineHeight(row, config, session) + "px"); dom.setStyle(cell.element.style, "top", this.$lines.computeLineTop(row, config, session) + "px"); cell.text = rowText; // If there are no annotations or fold widgets in the gutter cell, hide it from assistive tech. if (annotationNode.style.display === "none" && foldWidget.style.display === "none" && !customWidgetAttributes) cell.element.setAttribute("aria-hidden", true); else cell.element.setAttribute("aria-hidden", false); return cell; } /** * @param {boolean} highlightGutterLine */ setHighlightGutterLine(highlightGutterLine) { this.$highlightGutterLine = highlightGutterLine; if (!highlightGutterLine && this.$highlightElement) { this.$highlightElement.remove(); this.$highlightElement = null; } } /** * @param {boolean} show */ setShowLineNumbers(show) { /**@type{GutterRenderer}*/ this.$renderer = !show && { getWidth: function() {return 0;}, getText: function() {return "";} }; } getShowLineNumbers() { return this.$showLineNumbers; } /** * @param {boolean} [show] */ setShowFoldWidgets(show) { if (show) dom.addCssClass(this.element, "ace_folding-enabled"); else dom.removeCssClass(this.element, "ace_folding-enabled"); this.$showFoldWidgets = show; this.$padding = null; } getShowFoldWidgets() { return this.$showFoldWidgets; } /** * Hides the fold widget/icon from a specific row in the gutter * @param {number} row The row number from which to hide the fold icon * @param {any} cell - Gutter cell * @experimental */ $hideFoldWidget(row, cell) { const rowCell = cell || this.$getGutterCell(row); if (rowCell && rowCell.element) { const foldWidget = rowCell.element.childNodes[1]; if (foldWidget) { dom.setStyle(foldWidget.style, "display", "none"); } } } /** * Shows the fold widget/icon from a specific row in the gutter * @param {number} row The row number from which to show the fold icon * @param {any} cell - Gutter cell * @experimental */ $showFoldWidget(row,cell) { const rowCell = cell || this.$getGutterCell(row); if (rowCell && rowCell.element) { const foldWidget = rowCell.element.childNodes[1]; if (foldWidget && this.session.foldWidgets && this.session.foldWidgets[rowCell.row]) { dom.setStyle(foldWidget.style, "display", "inline-block"); } } } /** * Retrieves the gutter cell element at the specified cursor row position. * @param {number} row - The row number in the editor where the gutter cell is located starts from 0 * @returns {HTMLElement|undefined} The gutter cell element at the specified row, or undefined if not found * @experimental */ $getGutterCell(row) { var cells = this.$lines.cells; var min = 0; var max = cells.length - 1; if (row < cells[0].row || row > cells[max].row) return; while (min <= max) { var mid = Math.floor((min + max) / 2); var cell = cells[mid]; if (cell.row > row) { max = mid - 1; } else if (cell.row < row) { min = mid + 1; } else { return cell; } } return cell; } /** * Displays a custom widget for a specific row * @param {number} row - The row number where the widget will be displayed * @param {Object} attributes - Configuration attributes for the widget * @param {string} attributes.className - CSS class name for styling the widget * @param {string} attributes.label - Text label to display in the widget * @param {string} attributes.title - Tooltip text for the widget * @param {Object} attributes.callbacks - Event callback functions for the widget e.g onClick; * @param {any} cell - Gutter cell * @returns {void} * @experimental */ $addCustomWidget(row, {className, label, title, callbacks}, cell) { this.session.$gutterCustomWidgets[row] = {className, label, title, callbacks}; this.$hideFoldWidget(row,cell); // cell is required because when cached cell is used to render, $lines won't have that cell const rowCell = cell || this.$getGutterCell(row); if (rowCell && rowCell.element) { let customWidget = rowCell.element.querySelector(".ace_custom-widget"); // deleting the old custom widget to remove the old click event listener if (customWidget) { customWidget.remove(); } customWidget = dom.createElement("span"); customWidget.className = `ace_custom-widget ${className}`; customWidget.setAttribute("tabindex", "-1"); customWidget.setAttribute("role", 'button'); customWidget.setAttribute("aria-label", label); customWidget.setAttribute("title", title); dom.setStyle(customWidget.style, "display", "inline-block"); dom.setStyle(customWidget.style, "height", "inherit"); if (callbacks&& callbacks.onClick) { customWidget.addEventListener("click", (e) => { callbacks.onClick(e, row); e.stopPropagation(); }); } rowCell.element.appendChild(customWidget); } } /** * Remove a custom widget for a specific row * @param {number} row - The row number where the widget will be removed * @param {any} cell - Gutter cell * @returns {void} * @experimental */ $removeCustomWidget(row, cell) { delete this.session.$gutterCustomWidgets[row]; this.$showFoldWidget(row,cell); // cell is required because when cached cell is used to render, $lines won't have that cell const rowCell = cell || this.$getGutterCell(row); if (rowCell && rowCell.element) { const customWidget = rowCell.element.querySelector(".ace_custom-widget"); if (customWidget) { rowCell.element.removeChild(customWidget); } } } $computePadding() { if (!this.element.firstChild) return {left: 0, right: 0}; var style = dom.computedStyle(/**@type{Element}*/(this.element.firstChild)); this.$padding = {}; this.$padding.left = (parseInt(style.borderLeftWidth) || 0) + (parseInt(style.paddingLeft) || 0) + 1; this.$padding.right = (parseInt(style.borderRightWidth) || 0) + (parseInt(style.paddingRight) || 0); return this.$padding; } /** * @param {{ x: number; }} point */ getRegion(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"; } } Gutter.prototype.$fixedWidth = false; Gutter.prototype.$highlightGutterLine = true; Gutter.prototype.$renderer = undefined; Gutter.prototype.$showLineNumbers = true; Gutter.prototype.$showFoldWidgets = true; oop.implement(Gutter.prototype, EventEmitter); function onCreateCell(element) { var textNode = document.createTextNode(''); element.appendChild(textNode); var foldWidget = dom.createElement("span"); element.appendChild(foldWidget); var annotationNode = dom.createElement("span"); element.appendChild(annotationNode); var annotationIconNode = dom.createElement("span"); annotationNode.appendChild(annotationIconNode); return element; } exports.Gutter = Gutter; ================================================ FILE: src/layer/gutter_test.js ================================================ "use strict"; if (typeof process !== "undefined") { require("../test/mockdom"); } var keys = require("../lib/keys"); require("../multi_select"); require("../theme/textmate"); var Editor = require("../editor").Editor; var Mode = require("../mode/java").Mode; var VirtualRenderer = require("../virtual_renderer").VirtualRenderer; var assert = require("../test/assertions"); var lang = require("../lib/lang"); function emit(keyCode) { var data = {bubbles: true, keyCode}; var event = new KeyboardEvent("keydown", data); var el = document.activeElement; el.dispatchEvent(event); } module.exports = { setUp: function() { this.editor = new Editor(new VirtualRenderer()); this.editor.container.style.position = "absolute"; this.editor.container.style.height = "500px"; this.editor.container.style.width = "500px"; this.editor.container.style.left = "50px"; this.editor.container.style.top = "10px"; document.body.appendChild(this.editor.container); }, "test: custom icon replaces the fold icon sucessfully": async function (done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.setOption("enableKeyboardAccessibility", true); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); // Focus on the fold widget. emit(keys["enter"]); editor.renderer.$gutterLayer.$addCustomWidget(13, { className: "ace_users_css", label: "Open_label", title: "Open_title" }); await lang.sleep(20); // Check that custom widget is shown editor.renderer.$loop._flush(); console.log(lines.cells[13].element.childNodes[2].className); assert.ok(/ace_users_css/.test(lines.cells[13].element.childNodes[3].className)); // fold widget is not shown assert.equal(lines.cells[13].element.childNodes[1].style.display, "none"); // After escape focus should be back to the gutter. emit(keys["escape"]); assert.equal(document.activeElement, editor.renderer.$gutter); done(); }, "test: after hiding custom icon fold icon is visible automatically": async function (done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.setOption("enableKeyboardAccessibility", true); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); // Focus on the custom widget. emit(keys["enter"]); editor.renderer.$gutterLayer.$addCustomWidget(0, { className: "ace_users_css", label: "Open_label", title: "Open_title" }); editor.renderer.$gutterLayer.$removeCustomWidget(0); await lang.sleep(20); assert.equal(document.activeElement, lines.cells[0].element.childNodes[1]); await lang.sleep(20); // Check that custom widget is hidden. editor.renderer.$loop._flush(); assert.equal(lines.cells[0].element.childNodes[3], undefined); assert.equal(lines.cells[0].element.childNodes[1].style.display, "inline-block"); assert.ok(/ace_open/.test(lines.cells[0].element.childNodes[1].className)); // After escape focus should be back to the gutter. emit(keys["escape"]); assert.equal(document.activeElement, editor.renderer.$gutter); done(); }, "test: folding is kept consistent when custom widget is shown first and then hidden": async function (done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.setOption("enableKeyboardAccessibility", true); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); // Focus on the fold widget. emit(keys["enter"]); await lang.sleep(20); assert.equal(document.activeElement, lines.cells[0].element.childNodes[1]); // Click the fold widget to fold the lines. emit(keys["enter"]); editor.renderer.$gutterLayer.$addCustomWidget(0, { className: "ace_users_css", label: "Open_label", title: "Open_title" }); editor.renderer.$gutterLayer.$removeCustomWidget(0); await lang.sleep(20); // Check that custom widget is hidden. editor.renderer.$loop._flush(); assert.equal(lines.cells[0].element.childNodes[3], undefined); assert.ok(/ace_closed/.test(lines.cells[0].element.childNodes[1].className)); // After escape focus should be back to the gutter. emit(keys["escape"]); assert.equal(document.activeElement, editor.renderer.$gutter); done(); }, "test: onClick callback is getting called and updated when updating the custom widget": async function (done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}\n"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.setOption("enableKeyboardAccessibility", true); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; // Set focus to the gutter div. editor.renderer.$gutter.focus(); assert.equal(document.activeElement, editor.renderer.$gutter); // Focus on the fold widget. emit(keys["enter"]); let firstCallbackCalledCount=0; const firstCallback = () =>{ firstCallbackCalledCount++; }; let secondCallbackCalledCount=0; const secondCallback = () =>{ secondCallbackCalledCount++; }; editor.renderer.$gutterLayer.$addCustomWidget(0, { className: "ace_users_css", label: "Open_label", title: "Open_title", callbacks: { onClick: firstCallback } }); editor.renderer.$gutterLayer.$addCustomWidget(0, { className: "ace_users_css", label: "Open_label", title: "Open_title", callbacks: { onClick: secondCallback } }); // clicking the custom widget lines.cells[0].element.childNodes[3].dispatchEvent(new CustomEvent("click")); await lang.sleep(20); // Check that custom widget is hidden. editor.renderer.$loop._flush(); assert.equal(firstCallbackCalledCount, 0); assert.equal(secondCallbackCalledCount, 1); // After escape focus should be back to the gutter. emit(keys["escape"]); assert.equal(document.activeElement, editor.renderer.$gutter); done(); }, tearDown: function () { this.editor.destroy(); document.body.removeChild(this.editor.container); } }; require("../test/run")(module); ================================================ FILE: src/layer/lines.js ================================================ "use strict"; /** * @typedef {import("../edit_session").EditSession} EditSession * @typedef {import("../../ace-internal").Ace.LayerConfig} LayerConfig */ var dom = require("../lib/dom"); class Lines { /** * @param {HTMLElement} element * @param {number} [canvasHeight] */ constructor(element, canvasHeight) { this.element = element; this.canvasHeight = canvasHeight || 500000; this.element.style.height = (this.canvasHeight * 2) + "px"; this.cells = []; this.cellCache = []; this.$offsetCoefficient = 0; } /** * @param {LayerConfig} config */ moveContainer(config) { dom.translate(this.element, 0, -((config.firstRowScreen * config.lineHeight) % this.canvasHeight) - config.offset * this.$offsetCoefficient); } /** * @param {LayerConfig} oldConfig * @param {LayerConfig} newConfig */ pageChanged(oldConfig, newConfig) { return ( Math.floor((oldConfig.firstRowScreen * oldConfig.lineHeight) / this.canvasHeight) !== Math.floor((newConfig.firstRowScreen * newConfig.lineHeight) / this.canvasHeight) ); } /** * @param {number} row * @param {Partial} config * @param {EditSession} session */ computeLineTop(row, config, session) { var screenTop = config.firstRowScreen * config.lineHeight; var screenPage = Math.floor(screenTop / this.canvasHeight); var lineTop = session.documentToScreenRow(row, 0) * config.lineHeight; return lineTop - (screenPage * this.canvasHeight); } /** * @param {number} row * @param {LayerConfig} config * @param {EditSession} session */ computeLineHeight(row, config, session) { return config.lineHeight * session.getRowLineCount(row); } getLength() { return this.cells.length; } /** * @param {number} index */ get(index) { return this.cells[index]; } shift() { this.$cacheCell(this.cells.shift()); } pop() { this.$cacheCell(this.cells.pop()); } push(cell) { if (Array.isArray(cell)) { this.cells.push.apply(this.cells, cell); var fragment = dom.createFragment(this.element); for (var i=0; i} layerConfig */ $getTop(row, layerConfig) { return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight; } // Draws a marker, which spans a range of text on multiple lines /** * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz * @param {Partial} layerConfig * @param {string} [extraStyle] */ drawTextMarker(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 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; this.drawSingleLineMarker(stringBuilder, lineRange, clazz + (row == start ? " ace_start" : "") + " ace_br" + getBorderClass(row == start || row == start + 1 && range.start.column, prev < curr, curr > next, row == end), layerConfig, row == end ? 0 : 1, extraStyle); } } // Draws a multi line marker, where lines span the full width /** * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz * @param {LayerConfig} config * @param {string} [extraStyle] */ drawMultiLineMarker(stringBuilder, range, clazz, config, extraStyle) { // from selection start to the end of the line var padding = this.$padding; var height = config.lineHeight; var top = this.$getTop(range.start.row, config); var left = padding + range.start.column * config.characterWidth; 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 { this.elt( clazz + " ace_br1 ace_start", "height:"+ height+ "px;"+ "right:" + padding + "px;"+ "top:"+top+ "px;left:"+ left+ "px;" + (extraStyle || "") ); } // 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 { top = this.$getTop(range.end.row, config); var width = range.end.column * config.characterWidth; this.elt( clazz + " ace_br12", "height:"+ height+ "px;"+ "width:"+ width+ "px;"+ "top:"+ top+ "px;"+ "left:"+ padding+ "px;"+ (extraStyle || "") ); } // 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); this.elt( clazz + (radiusClass ? " ace_br" + radiusClass : ""), "height:"+ height+ "px;"+ "right:" + padding + "px;"+ "top:"+ top+ "px;"+ "left:"+ padding+ "px;"+ (extraStyle || "") ); } // Draws a marker which covers part or whole width of a single screen line /** * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz * @param {Partial} config * @param {number} [extraLength] * @param {string} [extraStyle] */ drawSingleLineMarker(stringBuilder, range, clazz, config, extraLength, extraStyle) { if (this.session.$bidiHandler.isBidiRow(range.start.row)) return this.drawBidiSingleLineMarker(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; this.elt( clazz, "height:"+ height+ "px;"+ "width:"+ width+ "px;"+ "top:"+ top+ "px;"+ "left:"+ left+ "px;"+ (extraStyle || "") ); } // Draws Bidi marker which covers part or whole width of a single screen line /** * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz * @param {Partial} config * @param {number} extraLength * @param {string} extraStyle */ drawBidiSingleLineMarker(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) { this.elt( clazz, "height:" + height + "px;" + "width:" + (selection.width + (extraLength || 0)) + "px;" + "top:" + top + "px;" + "left:" + (padding + selection.left) + "px;" + (extraStyle || "") ); }, this); } /** * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz * @param {Partial} config * @param {undefined} [extraStyle] */ drawFullLineMarker(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; this.elt( clazz, "height:"+ height+ "px;"+ "top:"+ top+ "px;"+ "left:0;right:0;"+ (extraStyle || "") ); } /** * @param {undefined} stringBuilder * @param {Range} range * @param {string} clazz * @param {Partial} config * @param {undefined} [extraStyle] */ drawScreenLineMarker(stringBuilder, range, clazz, config, extraStyle) { var top = this.$getTop(range.start.row, config); var height = config.lineHeight; this.elt( clazz, "height:"+ height+ "px;"+ "top:"+ top+ "px;"+ "left:0;right:0;"+ (extraStyle || "") ); } } Marker.prototype.$padding = 0; function getBorderClass(tl, tr, br, bl) { return (tl ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl ? 8 : 0); } exports.Marker = Marker; ================================================ FILE: src/layer/text.js ================================================ "use strict"; /** * @typedef {import("../../ace-internal").Ace.LayerConfig} LayerConfig * @typedef {import("../edit_session").EditSession} EditSession */ var oop = require("../lib/oop"); var dom = require("../lib/dom"); var lang = require("../lib/lang"); var Lines = require("./lines").Lines; var EventEmitter = require("../lib/event_emitter").EventEmitter; var nls = require("../config").nls; var isTextToken = require("./text_util").isTextToken; class Text { /** * @param {HTMLElement} parentEl */ constructor(parentEl) { this.dom = dom; this.element = this.dom.createElement("div"); this.element.className = "ace_layer ace_text-layer"; parentEl.appendChild(this.element); this.$updateEolChar = this.$updateEolChar.bind(this); this.$lines = new Lines(this.element); } $updateEolChar() { var doc = this.session.doc; var unixMode = doc.getNewLineCharacter() == "\n" && doc.getNewLineMode() != "windows"; var EOL_CHAR = unixMode ? this.EOL_CHAR_LF : this.EOL_CHAR_CRLF; if (this.EOL_CHAR != EOL_CHAR) { this.EOL_CHAR = EOL_CHAR; return true; } } /** * @param {number} padding */ setPadding(padding) { this.$padding = padding; this.element.style.margin = "0 " + padding + "px"; } /** * @returns {number} */ getLineHeight() { return this.$fontMetrics.$characterSize.height || 0; } /** * @returns {number} */ getCharacterWidth() { return this.$fontMetrics.$characterSize.width || 0; } /** * @param {any} measure */ $setFontMetrics(measure) { this.$fontMetrics = measure; this.$fontMetrics.on("changeCharacterSize", /** * @this {Text} */ function (e) { this._signal("changeCharacterSize", e); }.bind(this)); this.$pollSizeChanges(); } checkForSizeChanges() { this.$fontMetrics.checkForSizeChanges(); } $pollSizeChanges() { return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges(); } /** * @param {EditSession} session */ setSession(session) { /**@type {EditSession}*/ this.session = session; if (session) this.$computeTabString(); } /** * @param {string} showInvisibles */ setShowInvisibles(showInvisibles) { if (this.showInvisibles == showInvisibles) return false; this.showInvisibles = showInvisibles; if (typeof showInvisibles == "string") { this.showSpaces = /tab/i.test(showInvisibles); this.showTabs = /space/i.test(showInvisibles); this.showEOL = /eol/i.test(showInvisibles); } else { this.showSpaces = this.showTabs = this.showEOL = showInvisibles; } this.$computeTabString(); return true; } /** * @param {boolean} display */ setDisplayIndentGuides(display) { if (this.displayIndentGuides == display) return false; this.displayIndentGuides = display; this.$computeTabString(); return true; } /** * @param {boolean} highlight */ setHighlightIndentGuides(highlight) { if (this.$highlightIndentGuides === highlight) return false; this.$highlightIndentGuides = highlight; return highlight; } $computeTabString() { var tabSize = this.session.getTabSize(); this.tabSize = tabSize; /**@type{any}*/var tabStr = this.$tabStrings = [0]; for (var i = 1; i < tabSize + 1; i++) { if (this.showTabs) { var span = this.dom.createElement("span"); span.className = "ace_invisible ace_invisible_tab"; span.textContent = lang.stringRepeat(this.TAB_CHAR, i); tabStr.push(span); } else { tabStr.push(this.dom.createTextNode(lang.stringRepeat(" ", i), this.element)); } } if (this.displayIndentGuides) { this.$indentGuideRe = /\s\S| \t|\t |\s$/; var className = "ace_indent-guide"; var spaceClass = this.showSpaces ? " ace_invisible ace_invisible_space" : ""; var spaceContent = this.showSpaces ? lang.stringRepeat(this.SPACE_CHAR, this.tabSize) : lang.stringRepeat(" ", this.tabSize); var tabClass = this.showTabs ? " ace_invisible ace_invisible_tab" : ""; var tabContent = this.showTabs ? lang.stringRepeat(this.TAB_CHAR, this.tabSize) : spaceContent; var span = this.dom.createElement("span"); span.className = className + spaceClass; span.textContent = spaceContent; this.$tabStrings[" "] = span; var span = this.dom.createElement("span"); span.className = className + tabClass; span.textContent = tabContent; this.$tabStrings["\t"] = span; } } /** * @param {LayerConfig} config * @param {number} firstRow * @param {number} lastRow */ updateLines(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) { return this.update(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 heightChanged = false; 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; /**@type{any}*/var lineElement = lineElements[lineElementsIdx++]; if (lineElement) { this.dom.removeChildren(lineElement); this.$renderLine( lineElement, row, row == foldStart ? foldLine : false ); if (heightChanged) lineElement.style.top = this.$lines.computeLineTop(row, config, this.session) + "px"; var height = (config.lineHeight * this.session.getRowLength(row)) + "px"; if (lineElement.style.height != height) { heightChanged = true; lineElement.style.height = height; } } row++; } if (heightChanged) { while (lineElementsIdx < this.$lines.cells.length) { var cell = this.$lines.cells[lineElementsIdx++]; cell.element.style.top = this.$lines.computeLineTop(cell.row, config, this.session) + "px"; } } } /** * @param {LayerConfig} config */ scrollLines(config) { var oldConfig = this.config; this.config = config; if (this.$lines.pageChanged(oldConfig, config)) return this.update(config); this.$lines.moveContainer(config); var lastRow = config.lastRow; var oldLastRow = oldConfig ? oldConfig.lastRow : -1; if (!oldConfig || oldLastRow < config.firstRow) return this.update(config); if (lastRow < oldConfig.firstRow) return this.update(config); if (!oldConfig || oldConfig.lastRow < config.firstRow) return this.update(config); if (config.lastRow < oldConfig.firstRow) return this.update(config); if (oldConfig.firstRow < config.firstRow) for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--) this.$lines.shift(); if (oldConfig.lastRow > config.lastRow) for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--) this.$lines.pop(); if (config.firstRow < oldConfig.firstRow) { this.$lines.unshift(this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1)); } if (config.lastRow > oldConfig.lastRow) { this.$lines.push(this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow)); } this.$highlightIndentGuide(); } /** * @param {LayerConfig} config * @param {number} firstRow * @param {number} lastRow */ $renderLinesFragment(config, firstRow, lastRow) { var fragment = []; 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 line = this.$lines.createCell(row, config, this.session); var lineEl = line.element; this.dom.removeChildren(lineEl); dom.setStyle(lineEl.style, "height", this.$lines.computeLineHeight(row, config, this.session) + "px"); dom.setStyle(lineEl.style, "top", this.$lines.computeLineTop(row, config, this.session) + "px"); // Get the tokens per line as there might be some lines in between // beeing folded. this.$renderLine(lineEl, row, row == foldStart ? foldLine : false); if (this.$useLineGroups()) { lineEl.className = "ace_line_group"; } else { lineEl.className = "ace_line"; } fragment.push(line); row++; } return fragment; } /** * @param {LayerConfig} config */ update(config) { this.$lines.moveContainer(config); this.config = config; var firstRow = config.firstRow; var lastRow = config.lastRow; var lines = this.$lines; while (lines.getLength()) lines.pop(); lines.push(this.$renderLinesFragment(config, firstRow, lastRow)); } $renderToken(parent, screenColumn, token, value) { var self = this; var re = /(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069\u2060\u2061\u2062\u2063\u2064\u206A\u206B\u206B\u206C\u206D\u206E\u206F]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\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 valueFragment = this.dom.createFragment(this.element); var m; var i = 0; while (m = re.exec(value)) { var tab = m[1]; var simpleSpace = m[2]; var controlCharacter = m[3]; var cjkSpace = m[4]; var cjk = m[5]; if (!self.showSpaces && simpleSpace) continue; var before = i != m.index ? value.slice(i, m.index) : ""; i = m.index + m[0].length; if (before) { valueFragment.appendChild(this.dom.createTextNode(before, this.element)); } if (tab) { var tabSize = self.session.getScreenTabSize(screenColumn + m.index); var text = self.$tabStrings[tabSize].cloneNode(true); text["charCount"] = 1; valueFragment.appendChild(text); screenColumn += tabSize - 1; } else if (simpleSpace) { if (self.showSpaces) { var span = this.dom.createElement("span"); span.className = "ace_invisible ace_invisible_space"; span.textContent = lang.stringRepeat(self.SPACE_CHAR, simpleSpace.length); valueFragment.appendChild(span); } else { valueFragment.appendChild(this.dom.createTextNode(simpleSpace, this.element)); } } else if (controlCharacter) { var span = this.dom.createElement("span"); span.className = "ace_invisible ace_invisible_space ace_invalid"; span.textContent = lang.stringRepeat(self.SPACE_CHAR, controlCharacter.length); valueFragment.appendChild(span); } else if (cjkSpace) { // U+3000 is both invisible AND full-width, so must be handled uniquely screenColumn += 1; var span = this.dom.createElement("span"); span.style.width = (self.config.characterWidth * 2) + "px"; span.className = self.showSpaces ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk"; span.textContent = self.showSpaces ? self.SPACE_CHAR : cjkSpace; valueFragment.appendChild(span); } else if (cjk) { screenColumn += 1; var span = this.dom.createElement("span"); span.style.width = (self.config.characterWidth * 2) + "px"; span.className = "ace_cjk"; span.textContent = cjk; valueFragment.appendChild(span); } } valueFragment.appendChild(this.dom.createTextNode(i ? value.slice(i) : value, this.element)); if (!isTextToken(token.type)) { var classes = "ace_" + token.type.replace(/\./g, " ace_"); var span = this.dom.createElement("span"); if (token.type == "fold"){ span.style.width = (token.value.length * this.config.characterWidth) + "px"; span.setAttribute("title", nls("inline-fold.closed.title", "Unfold code")); } span.className = classes; span.appendChild(valueFragment); parent.appendChild(span); } else { parent.appendChild(valueFragment); } return screenColumn + value.length; } renderIndentGuide(parent, value, max) { var cols = value.search(this.$indentGuideRe); if (cols <= 0 || cols >= max) return value; if (value[0] == " ") { cols -= cols % this.tabSize; var count = cols/this.tabSize; for (var i=0; i ranges[i].start.row) { this.$highlightIndentGuideMarker.dir = -1; } else { this.$highlightIndentGuideMarker.dir = 1; } break; } } } if (!this.$highlightIndentGuideMarker.end) { if (lines[cursor.row] !== '' && cursor.column === lines[cursor.row].length) { this.$highlightIndentGuideMarker.dir = 1; for (var i = cursor.row + 1; i < lines.length; i++) { var line = lines[i]; var currentIndent = /^\s*/.exec(line)[0].length; if (line !== '') { this.$highlightIndentGuideMarker.end = i; if (currentIndent <= initialIndent) break; } } } } this.$renderHighlightIndentGuide(); } $clearActiveIndentGuide() { var activeIndentGuides = this.element.querySelectorAll(".ace_indent-guide-active"); for (var i = 0; i < activeIndentGuides.length; i++) { activeIndentGuides[i].classList.remove("ace_indent-guide-active"); } } $setIndentGuideActive(cell, indentLevel) { var line = this.session.doc.getLine(cell.row); if (line !== "") { let element = cell.element; if (cell.element.classList && cell.element.classList.contains("ace_line_group")) { if (cell.element.childNodes.length > 0) { element = cell.element.childNodes[0]; } else { return; } } var childNodes = element.childNodes; if (childNodes) { let node = childNodes[indentLevel - 1]; if (node && node.classList && node.classList.contains("ace_indent-guide")) node.classList.add( "ace_indent-guide-active"); } } } $renderHighlightIndentGuide() { if (!this.$lines) return; var cells = this.$lines.cells; this.$clearActiveIndentGuide(); var indentLevel = this.$highlightIndentGuideMarker.indentLevel; if (indentLevel !== 0) { if (this.$highlightIndentGuideMarker.dir === 1) { for (var i = 0; i < cells.length; i++) { var cell = cells[i]; if (this.$highlightIndentGuideMarker.end && cell.row >= this.$highlightIndentGuideMarker.start + 1) { if (cell.row >= this.$highlightIndentGuideMarker.end) break; this.$setIndentGuideActive(cell, indentLevel); } } } else { for (var i = cells.length - 1; i >= 0; i--) { var cell = cells[i]; if (this.$highlightIndentGuideMarker.end && cell.row < this.$highlightIndentGuideMarker.start) { if (cell.row < this.$highlightIndentGuideMarker.end) break; this.$setIndentGuideActive(cell, indentLevel); } } } } } $createLineElement(parent) { var lineEl = this.dom.createElement("div"); lineEl.className = "ace_line"; lineEl.style.height = this.config.lineHeight + "px"; return lineEl; } $renderWrappedLine(parent, tokens, splits) { var chars = 0; var split = 0; var splitChars = splits[0]; var screenColumn = 0; var lineEl = this.$createLineElement(); parent.appendChild(lineEl); 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(lineEl, value, splitChars); if (!value) continue; chars -= value.length; } if (chars + value.length < splitChars) { screenColumn = this.$renderToken(lineEl, screenColumn, token, value); chars += value.length; } else { while (chars + value.length >= splitChars) { screenColumn = this.$renderToken( lineEl, screenColumn, token, value.substring(0, splitChars - chars) ); value = value.substring(splitChars - chars); chars = splitChars; lineEl = this.$createLineElement(); parent.appendChild(lineEl); var text = this.dom.createTextNode(lang.stringRepeat("\xa0", splits.indent), this.element); text["charCount"] = 0; // not to take into account when we are counting columns lineEl.appendChild(text); split ++; screenColumn = 0; splitChars = splits[split] || Number.MAX_VALUE; } if (value.length != 0) { chars += value.length; screenColumn = this.$renderToken( lineEl, screenColumn, token, value ); } } } if (splits[splits.length - 1] > this.MAX_LINE_LENGTH) this.$renderOverflowMessage(lineEl, screenColumn, null, "", true); } $renderSimpleLine(parent, tokens) { var screenColumn = 0; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; var value = token.value; if (i == 0 && this.displayIndentGuides) { value = this.renderIndentGuide(parent, value); if (!value) continue; } if (screenColumn + value.length > this.MAX_LINE_LENGTH) return this.$renderOverflowMessage(parent, screenColumn, token, value); screenColumn = this.$renderToken(parent, screenColumn, token, value); } } $renderOverflowMessage(parent, screenColumn, token, value, hide) { token && this.$renderToken(parent, screenColumn, token, value.slice(0, this.MAX_LINE_LENGTH - screenColumn)); var overflowEl = this.dom.createElement("span"); overflowEl.className = "ace_inline_button ace_keyword ace_toggle_wrap"; overflowEl.textContent = hide ? "" : ""; parent.appendChild(overflowEl); } // row is either first row of foldline or not in fold $renderLine(parent, row, 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); var lastLineEl = parent; if (tokens.length) { var splits = this.session.getRowSplitData(row); if (splits && splits.length) { this.$renderWrappedLine(parent, tokens, splits); var lastLineEl = parent.lastChild; } else { var lastLineEl = parent; if (this.$useLineGroups()) { lastLineEl = this.$createLineElement(); parent.appendChild(lastLineEl); } this.$renderSimpleLine(lastLineEl, tokens); } } else if (this.$useLineGroups()) { lastLineEl = this.$createLineElement(); parent.appendChild(lastLineEl); } if (this.showEOL && lastLineEl) { if (foldLine) row = foldLine.end.row; var invisibleEl = this.dom.createElement("span"); invisibleEl.className = "ace_invisible ace_invisible_eol"; invisibleEl.textContent = row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR; lastLineEl.appendChild(invisibleEl); } } /** * @param {number} row * @param {import("../../ace-internal").Ace.FoldLine} foldLine * @return {import("../../ace-internal").Ace.Token[]} */ $getFoldLineTokens(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; } $useLineGroups() { // 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(); } } Text.prototype.EOF_CHAR = "\xB6"; Text.prototype.EOL_CHAR_LF = "\xAC"; Text.prototype.EOL_CHAR_CRLF = "\xa4"; Text.prototype.EOL_CHAR = Text.prototype.EOL_CHAR_LF; Text.prototype.TAB_CHAR = "\u2014"; //"\u21E5"; Text.prototype.SPACE_CHAR = "\xB7"; Text.prototype.$padding = 0; Text.prototype.MAX_LINE_LENGTH = 10000; Text.prototype.showInvisibles = false; Text.prototype.showSpaces = false; Text.prototype.showTabs = false; Text.prototype.showEOL = false; Text.prototype.displayIndentGuides = true; Text.prototype.$highlightIndentGuides = true; Text.prototype.$tabStrings = []; Text.prototype.destroy = {}; Text.prototype.onChangeTabSize = Text.prototype.$computeTabString; oop.implement(Text.prototype, EventEmitter); exports.Text = Text; ================================================ FILE: src/layer/text_markers.js ================================================ var Text = require("./text").Text; var lang = require("../lib/lang"); /** * @typedef TextMarker * @property {import("../../ace-internal").Ace.IRange} range * @property {number} id * @property {string} className * @property {string} [type] */ /** * @typedef SelectionSegment * @property {number} beforeSelection - Characters before selection * @property {number} selectionLength - Length of selection * @property {number} afterSelection - Characters after selection */ var textMarkerMixin = { /** * @param {string} className * @this {Text} */ $removeClass(className) { if (!this.element || !className) return; var selectedElements = this.element.querySelectorAll('.' + className); for (let i = 0; i < selectedElements.length; i++) { var element = selectedElements[i]; element.classList.remove(className); if (element.hasAttribute('data-whitespace')) { var originalWhitespace = element.getAttribute('data-whitespace'); var textNode = this.dom.createTextNode(originalWhitespace, this.element); textNode["charCount"] = element["charCount"]; element.parentNode.replaceChild(textNode, element); } } }, /** * @this {Text} */ $applyTextMarkers() { if (this.session.$scheduleForRemove) { this.session.$scheduleForRemove.forEach(className => { this.$removeClass(className); }); this.session.$scheduleForRemove = new Set(); } var textMarkers = this.session.getTextMarkers(); if (textMarkers.length === 0) { return; } var classNameGroups = new Set(); textMarkers.forEach(marker => { classNameGroups.add(marker.className); }); classNameGroups.forEach(className => { this.$removeClass(className); }); textMarkers.forEach((marker) => { for (let row = marker.range.start.row; row <= marker.range.end.row; row++) { var cell = this.$lines.cells.find((el) => el.row === row); if (cell) { this.$modifyDomForMarkers(cell.element, row, marker); } } }); }, /** * Modifies the DOM for marker rendering. * @param {HTMLElement} lineElement - The line element to modify * @param {number} row - The row being processed * @param {TextMarker} marker - The marker to apply */ $modifyDomForMarkers(lineElement, row, marker) { var lineLength = this.session.getLine(row).length; let startCol = row > marker.range.start.row ? 0 : marker.range.start.column; let endCol = row < marker.range.end.row ? lineLength : marker.range.end.column; if (startCol === endCol) { return; } var lineElements = []; if (lineElement.classList.contains('ace_line_group')) { lineElements = Array.from(lineElement.childNodes); } else { lineElements = [lineElement]; } var currentColumn = 0; lineElements.forEach((lineElement) => { var childNodes = Array.from(lineElement.childNodes); for (let i = 0; i < childNodes.length; i++) { let subChildNodes = [childNodes[i]]; let parentNode = lineElement; if (childNodes[i].childNodes && childNodes[i].childNodes.length > 0) { subChildNodes = Array.from(childNodes[i].childNodes); parentNode = childNodes[i]; } for (let j = 0; j < subChildNodes.length; j++) { var node = subChildNodes[j]; var nodeText = node.textContent || ''; if (node.parentNode["charCount"]) { node["charCount"] = node.parentNode["charCount"]; } var contentLength = node["charCount"] || nodeText.length; var nodeStart = currentColumn; var nodeEnd = currentColumn + contentLength; if (node["charCount"] === 0 || contentLength === 0) { continue; } if (nodeStart < endCol && nodeEnd > startCol) { var beforeSelection = Math.max(0, startCol - nodeStart); var afterSelection = Math.max(0, nodeEnd - endCol); var selectionLength = contentLength - beforeSelection - afterSelection; if (marker.type === "invisible") { this.$processInvisibleMarker(node, parentNode, { beforeSelection, selectionLength, afterSelection }, marker); } else { this.$processRegularMarker(node, parentNode, { beforeSelection, selectionLength, afterSelection }, marker, nodeStart, startCol, endCol); } } currentColumn = nodeEnd; } } }); }, /** * Process text nodes for invisible markers (whitespace visualization) * @param {Node} node - The DOM node to process * @param {Node} parentNode - The parent node * @param {SelectionSegment} selectionSegment * @param {object} marker - The marker being applied */ $processInvisibleMarker(node, parentNode, selectionSegment, marker) { var nodeText = node.textContent || ''; if (node.nodeType === 3) { // Text node var fragment = this.dom.createFragment(this.element); if (selectionSegment.beforeSelection > 0) { fragment.appendChild( this.dom.createTextNode(nodeText.substring(0, selectionSegment.beforeSelection), this.element)); } if (selectionSegment.selectionLength > 0) { var selectedText = selectionSegment.beforeSelection === 0 && selectionSegment.afterSelection === 0 ? nodeText : nodeText.substring( selectionSegment.beforeSelection, selectionSegment.beforeSelection + selectionSegment.selectionLength ); var segments = selectedText.match(/\s+|[^\s]+/g) || []; for (let k = 0; k < segments.length; k++) { var segment = segments[k]; let span; if (/^\s+$/.test(segment)) { span = this.dom.createElement("span"); span.className = marker.className; var symbol = node["charCount"] ? this.TAB_CHAR : this.SPACE_CHAR; span.textContent = lang.stringRepeat(symbol, segment.length); span.setAttribute("data-whitespace", segment); fragment.appendChild(span); } else { span = this.dom.createElement("span"); span.textContent = segment; } if (node["charCount"] && segments.length === 1) { //this is for real tabs span["charCount"] = node["charCount"]; } fragment.appendChild(span); } } if (selectionSegment.afterSelection > 0) { fragment.appendChild(this.dom.createTextNode( nodeText.substring(selectionSegment.beforeSelection + selectionSegment.selectionLength), this.element )); } parentNode.replaceChild(fragment, node); } }, /** * Process nodes for regular markers (not invisible whitespace) * @param {Node} node - The DOM node to process * @param {Node} parentNode - The parent node * @param {SelectionSegment} selectionSegment * @param {TextMarker} marker - The marker being applied * @param {number} nodeStart - Starting column of the node * @param {number} startCol - Starting column of the selection * @param {number} endCol - Ending column of the selection */ $processRegularMarker(node, parentNode, selectionSegment, marker, nodeStart, startCol, endCol) { var nodeText = node.textContent || ''; if (node.nodeType === 3) { // Text node if (selectionSegment.beforeSelection > 0 || selectionSegment.afterSelection > 0) { var fragment = this.dom.createFragment(this.element); if (selectionSegment.beforeSelection > 0) { fragment.appendChild( this.dom.createTextNode(nodeText.substring(0, selectionSegment.beforeSelection), this.element)); } if (selectionSegment.selectionLength > 0) { var selectedSpan = this.dom.createElement('span'); selectedSpan.classList.add(marker.className); selectedSpan.textContent = nodeText.substring( selectionSegment.beforeSelection, selectionSegment.beforeSelection + selectionSegment.selectionLength ); fragment.appendChild(selectedSpan); } if (selectionSegment.afterSelection > 0) { fragment.appendChild(this.dom.createTextNode( nodeText.substring(selectionSegment.beforeSelection + selectionSegment.selectionLength), this.element )); } parentNode.replaceChild(fragment, node); } else { var selectedSpan = this.dom.createElement('span'); selectedSpan.classList.add(marker.className); selectedSpan.textContent = nodeText; selectedSpan["charCount"] = node["charCount"]; parentNode.replaceChild(selectedSpan, node); } } else if (node.nodeType === 1) { // Element node if (nodeStart >= startCol && nodeStart + (nodeText.length || 0) <= endCol) { // @ts-ignore node.classList.add(marker.className); } else { if (selectionSegment.beforeSelection > 0 || selectionSegment.afterSelection > 0) { // @ts-ignore var nodeClasses = node.className; var fragment = this.dom.createFragment(this.element); if (selectionSegment.beforeSelection > 0) { var beforeSpan = this.dom.createElement('span'); beforeSpan.className = nodeClasses; beforeSpan.textContent = nodeText.substring(0, selectionSegment.beforeSelection); fragment.appendChild(beforeSpan); } if (selectionSegment.selectionLength > 0) { var selectedSpan = this.dom.createElement('span'); selectedSpan.className = nodeClasses + ' ' + marker.className; selectedSpan.textContent = nodeText.substring( selectionSegment.beforeSelection, selectionSegment.beforeSelection + selectionSegment.selectionLength ); fragment.appendChild(selectedSpan); } if (selectionSegment.afterSelection > 0) { var afterSpan = this.dom.createElement('span'); afterSpan.className = nodeClasses; afterSpan.textContent = nodeText.substring(selectionSegment.beforeSelection + selectionSegment.selectionLength); fragment.appendChild(afterSpan); } parentNode.replaceChild(fragment, node); } } } } }; Object.assign(Text.prototype, textMarkerMixin); var EditSession = require("../edit_session").EditSession; var editSessionTextMarkerMixin = { /** * Adds a text marker to the current edit session. * * @param {import("../../ace-internal").Ace.IRange} range - The range to mark in the document * @param {string} className - The CSS class name to apply to the marked text * @param {string} [type] - The type of marker (e.g. "invisible" for whitespace rendering) * @returns {number} The unique identifier for the added text marker * * @this {EditSession} */ addTextMarker(range, className, type) { /**@type{number}*/ this.$textMarkerId = this.$textMarkerId || 0; this.$textMarkerId++; var marker = { range: range, id: this.$textMarkerId, className: className, type: type }; if (!this.$textMarkers) { this.$textMarkers = []; } this.$textMarkers[marker.id] = marker; return marker.id; }, /** * Removes a text marker from the current edit session. * * @param {number} markerId - The unique identifier of the text marker to remove * * @this {EditSession} */ removeTextMarker(markerId) { if (!this.$textMarkers) { return; } var marker = this.$textMarkers[markerId]; if (!marker) { return; } if (!this.$scheduleForRemove) { this.$scheduleForRemove = new Set(); } this.$scheduleForRemove.add(marker.className); delete this.$textMarkers[markerId]; }, /** * Retrieves the text markers associated with the current edit session. * * @returns {TextMarker[]} An array of text markers, or an empty array if no markers exist * * @this {EditSession} */ getTextMarkers() { return this.$textMarkers || []; } }; Object.assign(EditSession.prototype, editSessionTextMarkerMixin); var onAfterRender = (e, renderer) => { renderer.$textLayer.$applyTextMarkers(); }; var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { enableTextMarkers: { /** * @param {boolean} val * @this {Editor} */ set: function (val) { if (val) { this.renderer.on("afterRender", onAfterRender); } else { this.renderer.off("afterRender", onAfterRender); } }, value: true } }); exports.textMarkerMixin = textMarkerMixin; exports.editSessionTextMarkerMixin = editSessionTextMarkerMixin; ================================================ FILE: src/layer/text_markers_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; var assert = require("../test/assertions"); var EditSession = require("../edit_session").EditSession; var TextLayer = require("./text").Text; var JavaScriptMode = require("../mode/javascript").Mode; var dom = require("../lib/dom"); var Range = require("../range").Range; require("./text_markers"); function normalize(str) { return str.replace(/\s/gm, ""); } function getText(nodes) { var markedContent = ""; nodes.forEach(node => { markedContent += node.textContent; }); return markedContent; } module.exports = { setUp: function () { this.session = new EditSession(""); this.session.setMode(new JavaScriptMode()); this.container = document.createElement("div"); this.textLayer = new TextLayer(this.container); this.textLayer.setSession(this.session); this.textLayer.config = { characterWidth: 10, lineHeight: 20, firstRow: 0, lastRow: 10, firstRowScreen: 0, padding: 0, offset: 0 }; }, "test: marker splits single token into multiple DOM nodes": function () { this.session.setValue('var functionName = "test";'); this.textLayer.update(this.textLayer.config); this.session.addTextMarker(new Range(0, 6, 0, 10), "split-token-marker"); this.textLayer.$applyTextMarkers(); var markerSpans = this.textLayer.element.querySelectorAll('.split-token-marker'); assert.equal(markerSpans.length, 1); assert.equal(getText(markerSpans), "ncti"); var result = normalize(`var functionName = "test";`); var actual = normalize(this.textLayer.element.childNodes[0].innerHTML); assert.equal(actual, result); }, "test: marker partially overlaps multiple tokens": function () { this.session.setValue('var test = 123;'); this.textLayer.update(this.textLayer.config); this.session.addTextMarker(new Range(0, 6, 0, 12), "overlap-marker"); this.textLayer.$applyTextMarkers(); var markerSpans = this.textLayer.element.querySelectorAll('.overlap-marker'); assert.equal(getText(markerSpans), "st = 1"); var result = normalize(`var te st = 123;`); var actual = normalize(this.textLayer.element.childNodes[0].innerHTML); assert.equal(actual, result); }, "test: multiple overlapping markers split tokens differently": function () { this.session.setValue('var longVariableName = 42;'); this.textLayer.update(this.textLayer.config); this.session.addTextMarker(new Range(0, 4, 0, 12), "marker-1"); this.session.addTextMarker(new Range(0, 8, 0, 16), "marker-2"); this.session.addTextMarker(new Range(0, 6, 0, 14), "marker-3"); this.textLayer.$applyTextMarkers(); var line = this.textLayer.element.childNodes[0]; // Verify all markers are applied assert.ok(line.querySelectorAll('.marker-1').length > 0); assert.ok(line.querySelectorAll('.marker-2').length > 0); assert.ok(line.querySelectorAll('.marker-3').length > 0); assert.equal(line.textContent, 'var longVariableName = 42;'); var result = normalize(`var long Variab leName = 42;`); var actual = normalize(this.textLayer.element.childNodes[0].innerHTML); assert.equal(actual, result); }, "test: marker with tab characters and invisible rendering": function () { this.session.setValue("func\t\ttest"); this.textLayer.setShowInvisibles("tab"); this.textLayer.$computeTabString(); this.textLayer.update(this.textLayer.config); this.session.addTextMarker(new Range(0, 3, 0, 7), "tab-marker"); this.textLayer.$applyTextMarkers(); //preserve whitespaces var result = `func test`; var actual = this.textLayer.element.childNodes[0].innerHTML; assert.equal(actual, result); }, "test: marker with CJK characters and proper width calculation": function () { this.session.setValue("测试function测试"); this.textLayer.update(this.textLayer.config); this.session.addTextMarker(new Range(0, 1, 0, 11), "cjk-marker"); this.textLayer.$applyTextMarkers(); var line = this.textLayer.element.childNodes[0]; var cjkMarkers = line.querySelectorAll('.cjk-marker'); assert.ok(cjkMarkers.length > 0, "CJK marker should be present"); var markedText = ""; cjkMarkers.forEach(span => { markedText += span.textContent; }); assert.equal(markedText, "试function测"); var result = normalize(` function `); var actual = normalize(this.textLayer.element.childNodes[0].innerHTML); assert.equal(actual, result); }, "test: marker removal properly cleans up split tokens": function() { this.session.setValue('var functionName = "test";'); this.textLayer.update(this.textLayer.config); var markerId = this.session.addTextMarker(new Range(0, 6, 0, 10), "temp-marker"); this.textLayer.$applyTextMarkers(); var line = this.textLayer.element.childNodes[0]; var markerSpans = line.querySelectorAll('.temp-marker'); assert.ok(markerSpans.length > 0, "Marker should be present"); this.session.removeTextMarker(markerId); this.textLayer.update(this.textLayer.config); this.textLayer.$applyTextMarkers(); var newLine = this.textLayer.element.childNodes[0]; markerSpans = newLine.querySelectorAll('.temp-marker'); assert.equal(markerSpans.length, 0, "Marker should be removed"); }, "test: invisible marker with mixed whitespace and complete cleanup verification": function() { var value = "function\t test() { //test comment\n var x = 1;\n}"; this.session.setValue(value); this.textLayer.update(this.textLayer.config); var markerId = this.session.addTextMarker(new Range(0, 8, 0, 30), "invisible-marker", "invisible"); this.textLayer.$applyTextMarkers(); var markerElements = this.textLayer.element.querySelectorAll('.invisible-marker'); assert.ok(markerElements.length > 0, "Invisible marker should be applied"); var line = this.textLayer.element.childNodes[0]; var hasTabSymbol = line.innerHTML.includes(this.textLayer.TAB_CHAR); var hasSpaceSymbol = line.innerHTML.includes(this.textLayer.SPACE_CHAR); assert.ok(hasTabSymbol, "Should contain TAB_CHAR symbol"); assert.ok(hasSpaceSymbol, "Should contain SPACE_CHAR symbol"); var result = normalize(`function ———— ·· test ( ) · {· //test ···· comment`); var actual = normalize(this.textLayer.element.childNodes[0].innerHTML); assert.equal(actual, result); this.session.removeTextMarker(markerId); this.textLayer.$applyTextMarkers(); markerElements = this.textLayer.element.querySelectorAll('.invisible-marker'); assert.equal(markerElements.length, 0, "Marker class should be removed"); var finalLine = this.textLayer.element.childNodes[0]; assert.ok(!finalLine.innerHTML.includes(this.textLayer.TAB_CHAR), "TAB_CHAR should be removed from DOM"); assert.ok(!finalLine.innerHTML.includes(this.textLayer.SPACE_CHAR), "SPACE_CHAR should be removed from DOM"); var elementsWithWhitespace = this.textLayer.element.querySelectorAll('[data-whitespace]'); assert.equal(elementsWithWhitespace.length, 0, "No data-whitespace attributes should remain"); }, }; require("../test/run")(module); ================================================ FILE: src/layer/text_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; var assert = require("../test/assertions"); var EditSession = require("../edit_session").EditSession; var TextLayer = require("./text").Text; var JavaScriptMode = require("../mode/javascript").Mode; var dom = require("../lib/dom"); module.exports = { setUp: function() { 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 }; }, "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 parent1 = dom.createElement("div"); this.textLayer.$renderLine(parent1, 0); // row with soft tabs var parent2 = dom.createElement("div"); this.textLayer.$renderLine(parent2, 1); assert.equal(parent1.innerHTML, parent2.innerHTML); }, "test rendering width of ideographic space (U+3000)" : function() { this.session.setValue("\u3000"); var parent = dom.createElement("div"); this.textLayer.$renderLine(parent, 0); assert.domNode(parent, ["div", {}, ["span", {class: "ace_cjk", style: "width: 20px;"}, "\u3000"]]); this.textLayer.setShowInvisibles(true); var parent = dom.createElement("div"); this.textLayer.$renderLine(parent, 0); assert.domNode(parent, ["div", {}, ["span", {class: "ace_cjk ace_invisible ace_invisible_space", style: "width: 20px;"}, this.textLayer.SPACE_CHAR], ["span", {class: "ace_invisible ace_invisible_eol"}, "\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 parent = dom.createElement("div"); textLayer.$renderLine(parent, i); assert.equal(parent.innerHTML, 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 ]); } }; require("../test/run")(module); ================================================ FILE: src/layer/text_util.js ================================================ // Tokens for which Ace just uses a simple TextNode and does not add any special className. const textTokens = new Set(["text", "rparen", "lparen"]); exports.isTextToken = function(tokenType) { return textTokens.has(tokenType); }; ================================================ FILE: src/lib/app_config.js ================================================ "no use strict"; var oop = require("./oop"); var EventEmitter = require("./event_emitter").EventEmitter; const reportError = require("./report_error").reportError; const defaultEnglishMessages = require("./default_english_messages").defaultEnglishMessages; var optionsProvider = { setOptions: function(optList) { Object.keys(optList).forEach(function(key) { this.setOption(key, optList[key]); }, this); }, getOptions: function(optionNames) { var result = {}; if (!optionNames) { var options = this.$options; optionNames = Object.keys(options).filter(function(key) { return !options[key].hidden; }); } else if (!Array.isArray(optionNames)) { optionNames = Object.keys(optionNames); } optionNames.forEach(function(key) { result[key] = this.getOption(key); }, this); return result; }, setOption: function(name, value) { if (this["$" + name] === value) return; //@ts-ignore 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); } var messages; var nlsPlaceholders; class AppConfig { constructor() { this.$defaultOptions = {}; messages = defaultEnglishMessages; nlsPlaceholders = "dollarSigns"; } /** * @param {Object} obj * @param {string} path * @param {{ [key: string]: any }} options * @returns {import("../../ace-internal").Ace.AppConfig} */ defineOptions(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; } /** * @param {Object} obj */ resetOptions(obj) { Object.keys(obj.$options).forEach(function(key) { var opt = obj.$options[key]; if ("value" in opt) obj.setOption(key, opt.value); }); } /** * @param {string} path * @param {string} name * @param {any} value */ setDefaultValue(path, name, value) { if (!path) { for (path in this.$defaultOptions) if (this.$defaultOptions[path][name]) break; if (!this.$defaultOptions[path][name]) return false; } 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; } } /** * @param {string} path * @param {{ [key: string]: any; }} optionHash */ setDefaultValues(path, optionHash) { Object.keys(optionHash).forEach(function(key) { this.setDefaultValue(path, key, optionHash[key]); }, this); } /** * @param {any} value * @param {{placeholders?: "dollarSigns" | "curlyBrackets"}} [options] */ setMessages(value, options) { messages = value; if (options && options.placeholders) { nlsPlaceholders = options.placeholders; } } /** * @param {string} key * @param {string} defaultString * @param {{ [x: string]: any; }} [params] */ nls(key, defaultString, params) { if (!messages[key]) { warn("No message found for the key '" + key + "' in messages with id " + messages.$id + ", trying to find a translation for the default string '" + defaultString + "'."); if (!messages[defaultString]) { warn("No message found for the default string '" + defaultString + "' in the provided messages. Falling back to the default English message."); } } var translated = messages[key] || messages[defaultString] || defaultString; if (params) { // We support both $n or {n} as placeholder indicators in the provided translated strings if (nlsPlaceholders === "dollarSigns") { // Replace $n with the nth element in params translated = translated.replace(/\$(\$|[\d]+)/g, function(_, dollarMatch) { if (dollarMatch == "$") return "$"; return params[dollarMatch]; }); } if (nlsPlaceholders === "curlyBrackets") { // Replace {n} with the nth element in params translated = translated.replace(/\{([^\}]+)\}/g, function(_, curlyBracketMatch) { return params[curlyBracketMatch]; }); } } return translated; } } AppConfig.prototype.warn = warn; AppConfig.prototype.reportError = reportError; // module loading oop.implement(AppConfig.prototype, EventEmitter); exports.AppConfig = AppConfig; ================================================ FILE: src/lib/bidiutil.js ================================================ "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; /* invisible RLE (7 - odd), zero width */ exports.RLE = 7; 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} textCharTypes unicode character types produced by call to 'hasBidiCharacters' * @param {Boolean} isRtl '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; if (chars[0] === '\u202B') levels[0] = exports.RLE; 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} textCharTypes 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 || textCharTypes[i] == AN)) ret = true; } return ret; }; /** * Returns visual index corresponding to logical index basing on logicalFromvisual * map provided by Unicode Bidi algorithm. * @param {Number} logIdx logical index of character in text buffer * @param {Object} rowMap object containing logicalFromVisual map * * @return {Number} 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: src/lib/deep_copy.js ================================================ exports.deepCopy = function deepCopy(obj) { if (typeof obj !== "object" || !obj) return obj; var copy; if (Array.isArray(obj)) { copy = []; for (let key = 0; key < obj.length; key++) { copy[key] = deepCopy(obj[key]); } return copy; } if (Object.prototype.toString.call(obj) !== "[object Object]") return obj; copy = {}; for (let key in obj) copy[key] = deepCopy(obj[key]); return copy; }; ================================================ FILE: src/lib/default_english_messages.js ================================================ var defaultEnglishMessages = { "autocomplete.popup.aria-roledescription": "Autocomplete suggestions", "autocomplete.popup.aria-label": "Autocomplete suggestions", "autocomplete.popup.item.aria-roledescription": "item", "autocomplete.loading": "Loading...", "editor.scroller.aria-roledescription": "editor", "editor.scroller.aria-label": "Editor content, press Enter to start editing, press Escape to exit", "editor.gutter.aria-roledescription": "editor gutter", "editor.gutter.aria-label": "Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit", "error-marker.good-state": "Looks good!", "prompt.recently-used": "Recently used", "prompt.other-commands": "Other commands", "prompt.no-matching-commands": "No matching commands", "search-box.find.placeholder": "Search for", "search-box.find-all.text": "All", "search-box.replace.placeholder": "Replace with", "search-box.replace-next.text": "Replace", "search-box.replace-all.text": "All", "search-box.toggle-replace.title": "Toggle Replace mode", "search-box.toggle-regexp.title": "RegExp Search", "search-box.toggle-case.title": "CaseSensitive Search", "search-box.toggle-whole-word.title": "Whole Word Search", "search-box.toggle-in-selection.title": "Search In Selection", "search-box.search-counter": "$0 of $1", "text-input.aria-roledescription": "editor", "text-input.aria-label": "Cursor at row $0", "gutter.code-folding.range.aria-label": "Toggle code folding, rows $0 through $1", "gutter.code-folding.closed.aria-label": "Toggle code folding, rows $0 through $1", "gutter.code-folding.open.aria-label": "Toggle code folding, row $0", "gutter.code-folding.closed.title": "Unfold code", "gutter.code-folding.open.title": "Fold code", "gutter.annotation.aria-label.error": "Error, read annotations row $0", "gutter.annotation.aria-label.warning": "Warning, read annotations row $0", "gutter.annotation.aria-label.info": "Info, read annotations row $0", "inline-fold.closed.title": "Unfold code", "gutter-tooltip.aria-label.error.singular": "error", "gutter-tooltip.aria-label.error.plural": "errors", "gutter-tooltip.aria-label.warning.singular": "warning", "gutter-tooltip.aria-label.warning.plural": "warnings", "gutter-tooltip.aria-label.info.singular": "information message", "gutter-tooltip.aria-label.info.plural": "information messages", "gutter.annotation.aria-label.security": "Security finding, read annotations row $0", "gutter.annotation.aria-label.hint": "Suggestion, read annotations row $0", "gutter-tooltip.aria-label.security.singular": "security finding", "gutter-tooltip.aria-label.security.plural": "security findings", "gutter-tooltip.aria-label.hint.singular": "suggestion", "gutter-tooltip.aria-label.hint.plural": "suggestions", "editor.tooltip.disable-editing": "Editing is disabled" } exports.defaultEnglishMessages = defaultEnglishMessages; ================================================ FILE: src/lib/dom.js ================================================ "use strict"; var useragent = require("./useragent"); var XHTML_NS = "http://www.w3.org/1999/xhtml"; /** * @template {keyof HTMLElementTagNameMap} K * @overload * @param {[K, ...any[]]} arr * @param {HTMLElement} [parent] * @param {Record} [refs] * @returns {HTMLElementTagNameMap[K]} */ /** * @overload * @param {any} arr * @param {HTMLElement} [parent] * @param [refs] * @returns {HTMLElement | Text | any[]} */ exports.buildDom = function buildDom(arr, parent, refs) { if (typeof arr == "string" && arr) { var txt = document.createTextNode(arr); if (parent) parent.appendChild(txt); return txt; } if (!Array.isArray(arr)) { if (arr && arr.appendChild && parent) parent.appendChild(arr); return arr; } if (typeof arr[0] != "string" || !arr[0]) { var els = []; for (var i = 0; i < arr.length; i++) { var ch = buildDom(arr[i], parent, refs); ch && els.push(ch); } return els; } var el = document.createElement(arr[0]); var options = arr[1]; var childIndex = 1; if (options && typeof options == "object" && !Array.isArray(options)) childIndex = 2; for (var i = childIndex; i < arr.length; i++) buildDom(arr[i], el, refs); if (childIndex == 2) { Object.keys(options).forEach(function(n) { var val = options[n]; if (n === "class") { el.className = Array.isArray(val) ? val.join(" ") : val; } else if (typeof val == "function" || n == "value" || n[0] == "$") { el[n] = val; } else if (n === "ref") { if (refs) refs[val] = el; } else if (n === "style") { if (typeof val == "string") el.style.cssText = val; } else if (val != null) { el.setAttribute(n, val); } }); } if (parent) parent.appendChild(el); return el; }; /** * * @param {Document} [doc] * @returns {HTMLHeadElement|HTMLElement} */ exports.getDocumentHead = function(doc) { if (!doc) doc = document; return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement; }; /** * @template {keyof HTMLElementTagNameMap} T * @param {T | string} tag * @param {string} [ns] * @returns {HTMLElementTagNameMap[T]} */ exports.createElement = function(tag, ns) { // @ts-expect-error return document.createElementNS ? document.createElementNS(ns || XHTML_NS, tag) : document.createElement(tag); }; /** * @param {HTMLElement} element */ exports.removeChildren = function(element) { element.innerHTML = ""; }; /** * @param {string} textContent * @param {HTMLElement} [element] * @returns {Text} */ exports.createTextNode = function(textContent, element) { var doc = element ? element.ownerDocument : document; return doc.createTextNode(textContent); }; /** * @param {HTMLElement} [element] * @returns {DocumentFragment} */ exports.createFragment = function(element) { var doc = element ? element.ownerDocument : document; return doc.createDocumentFragment(); }; /** * @param {HTMLElement} el * @param {string} name * @returns {boolean} */ 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 * @param {HTMLElement} el * @param {string} name */ 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 * @param {HTMLElement} el * @param {string} name */ 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(" "); }; /** * @param {HTMLElement} el * @param {string} name * @returns {boolean} */ 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 * @param {HTMLElement} node * @param {string} className * @param {boolean} include */ exports.setCssClass = function(node, className, include) { if (include) { exports.addCssClass(node, className); } else { exports.removeCssClass(node, className); } }; /** * @param {string} id * @param {Document} [doc] * @returns {boolean} */ exports.hasCssString = function(id, doc) { var index = 0, sheets; doc = doc || document; if ((sheets = doc.querySelectorAll("style"))) { while (index < sheets.length) { if (sheets[index++].id === id) { return true; } } } }; /** * @param {string} id * @param {Document} [doc] */ exports.removeElementById = function(id, doc) { doc = doc || document; if(doc.getElementById(id)) { doc.getElementById(id).remove(); } }; var strictCSP; var cssCache = []; exports.useStrictCSP = function(value) { strictCSP = value; if (value == false) insertPendingStyles(); else if (!cssCache) cssCache = []; }; function insertPendingStyles() { var cache = cssCache; cssCache = null; cache && cache.forEach(function(item) { importCssString(item[0], item[1]); }); } /** * @param {string} cssText * @param {string} [id] * @param {any} [target] */ function importCssString(cssText, id, target) { if (typeof document == "undefined") return; if (cssCache) { if (target) { insertPendingStyles(); } else if (target === false) { return cssCache.push([cssText, id]); } } if (strictCSP) return; var container = target; if (!target || !target.getRootNode) { container = document; } else { container = target.getRootNode(); if (!container || container == target) container = document; } var doc = container.ownerDocument || container; // If style is already imported return immediately. if (id && exports.hasCssString(id, container)) return null; if (id) cssText += "\n/*# sourceURL=ace/css/" + id + " */"; var style = exports.createElement("style"); style.appendChild(doc.createTextNode(cssText)); if (id) style.id = id; if (container == doc) container = exports.getDocumentHead(doc); container.insertBefore(style, container.firstChild); } exports.importCssString = importCssString; /** * @param {string} uri * @param {Document} [doc] */ exports.importCssStylsheet = function(uri, doc) { exports.buildDom(["link", {rel: "stylesheet", href: uri}], exports.getDocumentHead(doc)); }; /** * Due to bug in html specification fixed position elements are placed relative to * ancestor with transform instead of screen, so we attempt to detect and compensate for that * @param {HTMLElement} el with position: fixed */ exports.$fixPositionBug = function(el) { var rect = el.getBoundingClientRect(); if (el.style.left) { var target = parseFloat(el.style.left); var result = +rect.left; if (Math.abs(target - result) > 1) { el.style.left = 2 * target - result + "px"; } } if (el.style.right) { var target = parseFloat(el.style.right); var result = window.innerWidth - rect.right; if (Math.abs(target - result) > 1) { el.style.right = 2 * target - result + "px"; } } if (el.style.top) { var target = parseFloat(el.style.top); var result = +rect.top; if (Math.abs(target - result) > 1) { el.style.top = 2 * target - result + "px"; } } if (el.style.bottom) { var target = parseFloat(el.style.bottom); var result = window.innerHeight - rect.bottom; if (Math.abs(target - result) > 1) { el.style.bottom = 2 * target - result + "px"; } } }; /** * @param {Document} [doc] * @returns {number} */ exports.scrollbarWidth = function(doc) { 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 = (doc && doc.documentElement) || (document && document.documentElement); if (!body) return 0; 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; }; /** * @param {Element} element * @param [style] * @returns {Partial} */ exports.computedStyle = function(element, style) { return window.getComputedStyle(element, "") || {}; }; /** * * @param {CSSStyleDeclaration} styles * @param {string} property * @param {string} value */ exports.setStyle = function(styles, property, value) { if (styles[property] !== value) { //console.log("set style", property, styles[property], value); styles[property] = value; } }; exports.HAS_CSS_ANIMATION = false; exports.HAS_CSS_TRANSFORMS = false; exports.HI_DPI = useragent.isWin ? typeof window !== "undefined" && window.devicePixelRatio >= 1.5 : true; if (useragent.isChromeOS) exports.HI_DPI = false; if (typeof document !== "undefined") { // detect CSS transformation support var div = document.createElement("div"); if (exports.HI_DPI && div.style.transform !== undefined) exports.HAS_CSS_TRANSFORMS = true; if (!useragent.isEdge && typeof div.style.animationName !== "undefined") exports.HAS_CSS_ANIMATION = true; div = null; } if (exports.HAS_CSS_TRANSFORMS) { exports.translate = function(element, tx, ty) { element.style.transform = "translate(" + Math.round(tx) + "px, " + Math.round(ty) +"px)"; }; } else { exports.translate = function(element, tx, ty) { element.style.top = Math.round(ty) + "px"; element.style.left = Math.round(tx) + "px"; }; } ================================================ FILE: src/lib/es6-shim.js ================================================ function defineProp(obj, name, val) { Object.defineProperty(obj, name, { value: val, enumerable: false, writable: true, configurable: true }); } if (!String.prototype.startsWith) { defineProp( String.prototype, "startsWith", function (searchString, position) { position = position || 0; return this.lastIndexOf(searchString, position) === position; } ); } if (!String.prototype.endsWith) { // Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith defineProp(String.prototype, "endsWith", function (searchString, position) { var subjectString = this; if (position === undefined || position > subjectString.length) { position = subjectString.length; } position -= searchString.length; var lastIndex = subjectString.indexOf(searchString, position); return lastIndex !== -1 && lastIndex === position; }); } if (!String.prototype.repeat) { defineProp(String.prototype, "repeat", function (count) { var result = ""; var string = this; while (count > 0) { if (count & 1) result += string; if ((count >>= 1)) string += string; } return result; }); } if (!String.prototype.includes) { defineProp(String.prototype, "includes", function (str, position) { return this.indexOf(str, position) != -1; }); } if (!Object.assign) { Object.assign = function (target) { if (target === undefined || target === null) { throw new TypeError("Cannot convert undefined or null to object"); } var output = Object(target); for (var index = 1; index < arguments.length; index++) { var source = arguments[index]; if (source !== undefined && source !== null) { Object.keys(source).forEach(function (key) { output[key] = source[key]; }); } } return output; }; } if (!Object.values) { Object.values = function (o) { return Object.keys(o).map(function (k) { return o[k]; }); }; } if (!Array.prototype.find) { defineProp(Array.prototype, "find", function (predicate) { var len = this.length; var thisArg = arguments[1]; for (var k = 0; k < len; k++) { var kValue = this[k]; if (predicate.call(thisArg, kValue, k, this)) { return kValue; } } }); } if (!Array.prototype.findIndex) { defineProp(Array.prototype, "findIndex", function (predicate) { var len = this.length; var thisArg = arguments[1]; for (var k = 0; k < len; k++) { var kValue = this[k]; if (predicate.call(thisArg, kValue, k, this)) { return k; } } }); } if (!Array.prototype.includes) { defineProp(Array.prototype, "includes", function (item, position) { return this.indexOf(item, position) != -1; }); } if (!Array.prototype.fill) { defineProp(Array.prototype, "fill", function (value) { var O = this; var len = O.length >>> 0; var start = arguments[1]; var relativeStart = start >> 0; var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len); var end = arguments[2]; var relativeEnd = end === undefined ? len : end >> 0; var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len); while (k < final) { O[k] = value; k++; } return O; }); } if (!Array.of) { defineProp(Array, "of", function () { return Array.prototype.slice.call(arguments); }); } ================================================ FILE: src/lib/event.js ================================================ "use strict"; /** @type {any} */var keys = require("./keys"); var useragent = require("./useragent"); var pressedKeys = null; var ts = 0; var activeListenerOptions; function detectListenerOptionsSupport() { activeListenerOptions = false; try { document.createComment("").addEventListener("test", function() {}, { get passive() { activeListenerOptions = {passive: false}; return true; } }); } catch(e) {} } function getListenerOptions() { if (activeListenerOptions == undefined) detectListenerOptionsSupport(); return activeListenerOptions; } function EventListener(elem, type, callback) { this.elem = elem; this.type = type; this.callback = callback; } EventListener.prototype.destroy = function() { removeListener(this.elem, this.type, this.callback); this.elem = this.type = this.callback = undefined; }; /** * Adds an event listener to the specified element. * * @param {any} elem - The element to add the event listener to. * @param {string} type - The type of event to listen for. * @param {any} callback - The callback function to be executed when the event is triggered. * @param {any} [destroyer] - An optional object that will have the created EventListener instance added to its $toDestroy array, allowing it to be easily destroyed later. */ var addListener = exports.addListener = function(elem, type, callback, destroyer) { elem.addEventListener(type, callback, getListenerOptions()); if (destroyer) destroyer.$toDestroy.push(new EventListener(elem, type, callback)); }; var removeListener = exports.removeListener = function(elem, type, callback) { elem.removeEventListener(type, callback, getListenerOptions()); }; /* * 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(); }; exports.preventDefault = function(e) { if (e.preventDefault) e.preventDefault(); }; /* * @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 return e.button; }; exports.capture = function(el, eventHandler, releaseCaptureHandler) { var ownerDocument = el && el.ownerDocument || document; function onMouseUp(e) { eventHandler && eventHandler(e); releaseCaptureHandler && releaseCaptureHandler(e); removeListener(ownerDocument, "mousemove", eventHandler); removeListener(ownerDocument, "mouseup", onMouseUp); removeListener(ownerDocument, "dragstart", onMouseUp); } addListener(ownerDocument, "mousemove", eventHandler); addListener(ownerDocument, "mouseup", onMouseUp); addListener(ownerDocument, "dragstart", onMouseUp); return onMouseUp; }; /** * @param el * @param callback * @param [destroyer] */ exports.addMouseWheelListener = function(el, callback, destroyer) { addListener(el, "wheel", function(e) { var factor = 0.15; // workaround for firefox changing deltaMode based on which property is accessed first var deltaX = e.deltaX || 0; var deltaY = e.deltaY || 0; switch (e.deltaMode) { case e.DOM_DELTA_PIXEL: e.wheelX = deltaX * factor; e.wheelY = deltaY * factor; break; case e.DOM_DELTA_LINE: var linePixels = 15; e.wheelX = deltaX * linePixels; e.wheelY = deltaY * linePixels; break; case e.DOM_DELTA_PAGE: var pagePixels = 150; e.wheelX = deltaX * pagePixels; e.wheelY = deltaY * pagePixels; break; } callback(e); }, destroyer); }; /** * @param elements * @param timeouts * @param eventHandler * @param callbackName * @param [destroyer] */ exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName, destroyer) { 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); } if (!Array.isArray(elements)) elements = [elements]; elements.forEach(function(el) { addListener(el, "mousedown", onMousedown, destroyer); }); }; /** @param {KeyboardEvent|MouseEvent} e */ function getModifierHash(e) { return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0); } /** * @param {KeyboardEvent|MouseEvent} e * @returns string */ exports.getModifierString = function(e) { return keys.KEY_MODS[getModifierHash(e)]; }; /** * @param {(e: KeyboardEvent, hashId: number, keyCode: number)=> void } callback * @param {KeyboardEvent} e * @param {number} keyCode */ function normalizeCommandKeys(callback, e, keyCode) { var hashId = getModifierHash(e); if (!keyCode && e.code) { keyCode = keys.$codeToKeyCode[e.code] || keyCode; } 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 = e.location; 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; } if (!hashId && keyCode === 13) { if (e.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); } /** * @param {EventTarget} el * @param {(e: KeyboardEvent, hashId: number, keyCode: number)=>void} callback * @param [destroyer] */ exports.addCommandKeyListener = function(el, callback, destroyer) { 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; }, destroyer); addListener(el, "keypress", function(e) { if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) { exports.stopEvent(e); lastDefaultPrevented = null; } }, destroyer); addListener(el, "keyup", function(e) { pressedKeys[e.keyCode] = null; }, destroyer); if (!pressedKeys) { resetPressedKeys(); addListener(window, "focus", resetPressedKeys); } }; function resetPressedKeys() { 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++); var listener = function(e) { if (e.data == messageName) { exports.stopPropagation(e); removeListener(win, "message", listener); callback(); } }; addListener(win, "message", listener); win.postMessage(messageName, "*"); }; } exports.$idleBlocked = false; /** * * @param {CallableFunction} cb * @param {number} timeout * @return {ReturnType} */ exports.onIdle = function(cb, timeout) { return setTimeout(function handler() { if (!exports.$idleBlocked) { cb(); } else { setTimeout(handler, 100); } }, timeout); }; /**@type {null | ReturnType}*/ exports.$idleBlockId = null; /** @arg [delay] {null | number} */ exports.blockIdle = function(delay) { if (exports.$idleBlockId) clearTimeout(exports.$idleBlockId); exports.$idleBlocked = true; exports.$idleBlockId = setTimeout(function() { exports.$idleBlocked = false; }, delay || 100); }; 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: src/lib/event_emitter.js ================================================ "use strict"; /**@type {any}*/ 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, ''); }; /** * @template T * @param {T} obj * @return {T} */ exports.copyObject = function(obj) { /** @type Object*/ 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} */ exports.sleep = function(ms) { return new Promise(function(resolve) { setTimeout(resolve, ms); }); }; exports.supportsLookbehind = function () { try { new RegExp('(?<=.)'); } catch (e) { return false; } return true; }; exports.skipEmptyMatch = function(line, last, supportsUnicodeFlag) { return supportsUnicodeFlag && line.codePointAt(last) > 0xffff ? 2 : 1; }; ================================================ FILE: src/lib/net.js ================================================ /* * based on code from: * * @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/requirejs for details */ "use strict"; var dom = require("./dom"); exports.get = function (url, callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.onreadystatechange = function () { //Do not explicitly handle errors, those should be //visible via console output in the browser. if (xhr.readyState === 4) { callback(xhr.responseText); } }; xhr.send(null); }; exports.loadScript = function(path, callback) { var head = dom.getDocumentHead(); /**@type {HTMLScriptElement & {onload?: Function, onreadystatechange?: Function, readyState?: string}}*/ var s = document.createElement('script'); s.src = path; head.appendChild(s); s.onload = s.onreadystatechange = function(_, isAbort) { if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") { s = s.onload = s.onreadystatechange = null; if (!isAbort) callback(); } }; }; /* * Convert a url into a fully qualified absolute URL * This function does not work in IE6 */ exports.qualifyURL = function(url) { var a = document.createElement('a'); a.href = url; return a.href; }; ================================================ FILE: src/lib/oop.js ================================================ "use strict"; exports.inherits = function(ctor, superCtor) { ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); }; /** * Implements mixin properties into the prototype of an object. * @template T * @param {T} obj - The prototype of the target object. * @param {Object} mixin - The source object. * @returns {T & Object} The merged prototype. */ exports.mixin = function(obj, mixin) { for (var key in mixin) { obj[key] = mixin[key]; } return obj; }; /** * Implements mixin properties into the prototype of an object. * @template T * @param {T} proto - The prototype of the target object. * @param {Object} mixin - The source object. * @returns {T & Object} The merged prototype. */ exports.implement = function(proto, mixin) { exports.mixin(proto, mixin); }; ================================================ FILE: src/lib/report_error.js ================================================ exports.reportError = 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; }); }; ================================================ FILE: src/lib/scroll.js ================================================ exports.preventParentScroll = function preventParentScroll(event) { event.stopPropagation(); var target = event.currentTarget; var contentOverflows = target.scrollHeight > target.clientHeight; if (!contentOverflows) { event.preventDefault(); } }; ================================================ FILE: src/lib/useragent.js ================================================ "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) var _navigator = typeof navigator == "object" ? navigator : {}; var os = (/mac|win|linux/i.exec(_navigator.platform) || ["other"])[0].toLowerCase(); var ua = _navigator.userAgent || ""; var appName = _navigator.appName || ""; // 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 = (appName == "Microsoft Internet Explorer" || 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 // @ts-expect-error exports.isOpera = typeof opera == "object" && 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.isSafari = parseFloat(ua.split(" Safari/")[1]) && !exports.isChrome || undefined; exports.isEdge = parseFloat(ua.split(" Edge/")[1]) || undefined; exports.isAIR = ua.indexOf("AdobeAIR") >= 0; exports.isAndroid = ua.indexOf("Android") >= 0; exports.isChromeOS = ua.indexOf(" CrOS ") >= 0; exports.isIOS = /iPad|iPhone|iPod/.test(ua) && !window["MSStream"]; if (exports.isIOS) exports.isMac = true; exports.isMobile = exports.isIOS || exports.isAndroid; ================================================ FILE: src/line_widgets.js ================================================ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession * @typedef {import("./editor").Editor} Editor * @typedef {import("./virtual_renderer").VirtualRenderer} VirtualRenderer * @typedef {import("../ace-internal").Ace.LineWidget} LineWidget */ var dom = require("./lib/dom"); class LineWidgets { /** * @param {EditSession} session */ constructor(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); } /** * @param {number} row * @return {number} */ getRowLength(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; } } /** * @return {number} */ $getWidgetScreenLength() { var screenRows = 0; this.lineWidgets.forEach(function(w){ if (w && w.rowCount && !w.hidden) screenRows += w.rowCount; }); return screenRows; } $onChangeEditor(e) { this.attach(e.editor); } /** * * @param {Editor} editor */ attach(editor) { if (editor && editor.widgetManager && editor.widgetManager != this) editor.widgetManager.detach(); if (this.editor == editor) return; this.detach(); /**@type {Editor} */ this.editor = editor; if (editor) { editor.widgetManager = this; editor.renderer.on("beforeRender", this.measureWidgets); editor.renderer.on("afterRender", this.renderWidgets); } } detach(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); } }); } /** * * @param e * @param {EditSession} session */ updateOnFold(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; } } } /** * * @param {import("../ace-internal").Ace.Delta} delta */ updateOnChange(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); if (!lineWidgets[startRow] && removed[removed.length - 1]) { lineWidgets[startRow] = removed.pop(); } removed.forEach(function(w) { w && this.removeLineWidget(w); }, this); this.$updateRows(); } else { var args = new Array(len); if (lineWidgets[startRow] && lineWidgets[startRow].column != null) { if (delta.start.column > lineWidgets[startRow].column) startRow++; } args.unshift(startRow, 0); lineWidgets.splice.apply(lineWidgets, args); this.$updateRows(); } } $updateRows() { 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; } /** * * @param {LineWidget} w * @return {LineWidget} */ $registerLineWidget(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; return w; } /** * * @param {LineWidget} w * @return {LineWidget} */ addLineWidget(w) { this.$registerLineWidget(w); w.session = this.session; if (!this.editor) return w; var renderer = this.editor.renderer; if (w.html && !w.el) { w.el = dom.createElement("div"); w.el.innerHTML = w.html; } if (w.text && !w.el) { w.el = dom.createElement("div"); w.el.textContent = w.text; } if (w.el) { dom.addCssClass(w.el, "ace_lineWidgetContainer"); if (w.className) { dom.addCssClass(w.el, w.className); } 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; } /** * @param {LineWidget} w */ removeLineWidget(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(); } /** * * @param {number} row * @return {LineWidget[]} */ getWidgetsAtRow(row) { var lineWidgets = this.session.lineWidgets; var w = lineWidgets && lineWidgets[row]; var list = []; while (w) { list.push(w); w = w.$oldWidget; } return list; } /** * @param {LineWidget} w * @internal */ onWidgetChanged(w) { this.session._changedWidgets.push(w); this.editor && this.editor.renderer.updateFull(); } /** * @param {any} e * @param {VirtualRenderer} renderer */ measureWidgets(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 = []; } /** * @param {any} e * @param {VirtualRenderer} renderer */ renderWidgets(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++) { /**@type{LineWidget}*/ 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 = ""; } } } } exports.LineWidgets = LineWidgets; ================================================ FILE: src/marker_group.js ================================================ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession * @typedef {{range: import("./range").Range, className: string}} MarkerGroupItem * @typedef {import("../ace-internal").Ace.LayerConfig} LayerConfig */ /** * @typedef {import("./layer/marker").Marker} Marker */ /* Potential improvements: - use binary search when looking for hover match */ class MarkerGroup { /** * @param {EditSession} session * @param {{markerType: "fullLine" | "line" | undefined}} [options] Options controlling the behvaiour of the marker. * User `markerType` to control how the markers which are part of this group will be rendered: * - `undefined`: uses `text` type markers where only text characters within the range will be highlighted. * - `fullLine`: will fully highlight all the rows within the range, including the characters before and after the range on the respective rows. * - `line`: will fully highlight the lines within the range but will only cover the characters between the start and end of the range. */ constructor(session, options) { if (options) this.markerType = options.markerType; /**@type {import("../ace-internal").Ace.MarkerGroupItem[]}*/ this.markers = []; /**@type {EditSession}*/ this.session = session; // @ts-expect-error TODO: could potential error here, or most likely missing checks in other places session.addDynamicMarker(this); } /** * Finds the first marker containing pos * @param {import("../ace-internal").Ace.Point} pos * @returns {import("../ace-internal").Ace.MarkerGroupItem | undefined} */ getMarkerAtPosition(pos) { return this.markers.find(function(marker) { return marker.range.contains(pos.row, pos.column); }); } /** * Comparator for Array.sort function, which sorts marker definitions by their positions * * @param {MarkerGroupItem} a first marker. * @param {MarkerGroupItem} b second marker. * @returns {number} negative number if a should be before b, positive number if b should be before a, 0 otherwise. */ markersComparator(a, b) { return a.range.start.row - b.range.start.row; } /** * Sets marker definitions to be rendered. Limits the number of markers at MAX_MARKERS. * @param {MarkerGroupItem[]} markers an array of marker definitions. */ setMarkers(markers) { this.markers = markers.sort(this.markersComparator).slice(0, this.MAX_MARKERS); this.session._signal("changeBackMarker"); } /** * @param {any} html * @param {Marker} markerLayer * @param {EditSession} session * @param {LayerConfig} config */ update(html, markerLayer, session, config) { if (!this.markers || !this.markers.length) return; var visibleRangeStartRow = config.firstRow, visibleRangeEndRow = config.lastRow; var foldLine; var markersOnOneLine = 0; var lastRow = 0; for (var i = 0; i < this.markers.length; i++) { var marker = this.markers[i]; if (marker.range.end.row < visibleRangeStartRow) continue; if (marker.range.start.row > visibleRangeEndRow) continue; if (marker.range.start.row === lastRow) { markersOnOneLine++; } else { lastRow = marker.range.start.row; markersOnOneLine = 0; } // do not render too many markers on one line // because we do not have virtual scroll for horizontal direction if (markersOnOneLine > 200) { continue; } var markerVisibleRange = marker.range.clipRows(visibleRangeStartRow, visibleRangeEndRow); if (markerVisibleRange.start.row === markerVisibleRange.end.row && markerVisibleRange.start.column === markerVisibleRange.end.column) { continue; // visible range is empty } var screenRange = markerVisibleRange.toScreenRange(session); if (screenRange.isEmpty()) { // we are inside a fold foldLine = session.getNextFoldLine(markerVisibleRange.end.row, foldLine); if (foldLine && foldLine.end.row > markerVisibleRange.end.row) { visibleRangeStartRow = foldLine.end.row; } continue; } if (this.markerType === "fullLine") { markerLayer.drawFullLineMarker(html, screenRange, marker.className, config); } else if (screenRange.isMultiLine()) { if (this.markerType === "line") markerLayer.drawMultiLineMarker(html, screenRange, marker.className, config); else markerLayer.drawTextMarker(html, screenRange, marker.className, config); } else { markerLayer.drawSingleLineMarker(html, screenRange, marker.className + " ace_br15", config); } } } } // this caps total amount of markers at 10K MarkerGroup.prototype.MAX_MARKERS = 10000; exports.MarkerGroup = MarkerGroup; ================================================ FILE: src/marker_group_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "use strict"; var ace = require("./ace"); var dom = require("./lib/dom"); var assert = require("./test/assertions"); var EditSession = require("./edit_session").EditSession; var Range = require("./range").Range; var MarkerGroup = require("./marker_group").MarkerGroup; var editor; var session1, session2; module.exports = { setUp: function() { var value = "Hello empty world\n" + "This is a second line" + "\n".repeat(100) + "line number 100"; session1 = new EditSession(value); session2 = new EditSession("2 " + value); editor = ace.edit(null, { session: session1 }); document.body.appendChild(editor.container); editor.container.style.height = "200px"; editor.container.style.width = "300px"; dom.importCssString('.ace_tooltip-marker_test { position: absolute; background: rgba(255, 0, 0, 0.3); }', 'marker_group_test'); }, "test: should show and update markers": function() { editor.resize(true); editor.renderer.$loop._flush(); var markerGroup = new MarkerGroup(session1); markerGroup.setMarkers([{ range: new Range(0, 0, 0, 5), className: "ace_tooltip-marker_test m2" }, { range: new Range(0, 12, 1, 4), className: "ace_tooltip-marker_test m1", isSecond: true }]); assert.ok(markerGroup.getMarkerAtPosition({row: 1, column: 1}).isSecond); assert.ok(!markerGroup.getMarkerAtPosition({row: 3, column: 1})); editor.renderer.$loop._flush(); assert.equal(editor.container.querySelectorAll(".m1").length, 2); assert.equal(editor.container.querySelectorAll(".m2").length, 1); editor.setSession(session2); editor.renderer.$loop._flush(); assert.equal(editor.container.querySelectorAll(".m1").length, 0); editor.setSession(session1); editor.renderer.$loop._flush(); assert.equal(editor.container.querySelectorAll(".m1").length, 2); editor.execCommand("gotoend"); editor.renderer.$loop._flush(); assert.equal(editor.container.querySelectorAll(".m1").length, 0); editor.execCommand("gotostart"); editor.renderer.$loop._flush(); assert.equal(editor.container.querySelectorAll(".m1").length, 2); markerGroup.setMarkers([]); editor.renderer.$loop._flush(); assert.equal(editor.container.querySelectorAll(".m1").length, 0); }, "test: should show markers of fullLine type": function() { editor.resize(true); editor.renderer.$loop._flush(); var markerGroup = new MarkerGroup(session1, {markerType: "fullLine"}); // this marker should be rendered as a full block across lines 1 and 2 markerGroup.setMarkers([{ range: new Range(0, 12, 1, 4), className: "ace_tooltip-marker_test m" }]); assert.ok(markerGroup.getMarkerAtPosition({row: 1, column: 1})); editor.renderer.$loop._flush(); assert.equal(editor.container.querySelectorAll(".m").length, 1); // Get dimensions of the full line marker var markerSize = editor.container.querySelector(".m").getBoundingClientRect(); var lineHeight = editor.renderer.lineHeight; // Height should be two lines assert.equal(markerSize.height, 2 * lineHeight); // Should start at the beginning of the line assert.equal(markerSize.left, editor.renderer.scroller.getBoundingClientRect().left); // Shoud be as wide as the marker layer itself. assert.equal(markerSize.width, editor.renderer.$markerBack.element.getBoundingClientRect().width); }, "test: should show markers of line type": function() { editor.resize(true); editor.renderer.$loop._flush(); var markerGroup = new MarkerGroup(session1, {markerType: "line"}); // this marker should be rendered just covering the range, but extending to the edge of the editor on newlines markerGroup.setMarkers([{ range: new Range(0, 12, 1, 4), className: "ace_tooltip-marker_test m" }]); assert.ok(markerGroup.getMarkerAtPosition({row: 1, column: 1})); editor.renderer.$loop._flush(); // Should render two separate markers for each row assert.equal(editor.container.querySelectorAll(".m").length, 2); // Get dimensions of the first line marker var markerSize = editor.container.querySelectorAll(".m")[0].getBoundingClientRect(); var lineHeight = editor.renderer.lineHeight; var characterWidth = editor.renderer.characterWidth; var baseRect = editor.renderer.$markerBack.element.getBoundingClientRect(); // Height should be one lines assert.equal(markerSize.height, lineHeight); // Should start at the 13th character (including 4px offset) assert.equal(markerSize.left, 12 * characterWidth + 4 + baseRect.left); // Shoud be as wide as the marker layer - 12 characters and the offset on both sides. assert.equal(markerSize.width, baseRect.width - 12 * characterWidth - 4 - 4); }, "test: should default to markers of text type": function() { editor.resize(true); editor.renderer.$loop._flush(); // We don't set options.markerType, should default to text markers var markerGroup = new MarkerGroup(session1); // this marker should be rendered just covering the range markerGroup.setMarkers([{ range: new Range(0, 12, 1, 4), className: "ace_tooltip-marker_test m" }]); assert.ok(markerGroup.getMarkerAtPosition({row: 1, column: 1})); editor.renderer.$loop._flush(); // Should render two separate markers for each row assert.equal(editor.container.querySelectorAll(".m").length, 2); // Get dimensions of the first line marker var markerSize = editor.container.querySelectorAll(".m")[0].getBoundingClientRect(); var lineHeight = editor.renderer.lineHeight; var characterWidth = editor.renderer.characterWidth; var baseRect = editor.renderer.$markerBack.element.getBoundingClientRect(); // Height should be one lines assert.equal(markerSize.height, lineHeight); // Should start at the 13th character (including 4px offset) assert.equal(markerSize.left, 12 * characterWidth + 4 + baseRect.left); // Shoud be as wide as the remaining characters in the range on the first line. assert.equal(Math.round(markerSize.width), Math.round(6 * characterWidth)); }, tearDown: function() { editor.destroy(); } }; require("./test/run")(module); ================================================ FILE: src/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/docs/*` with ```sh node highlight_rules_test.js -gen ``` command. ================================================ FILE: src/mode/_test/highlight_rules_test.js ================================================ var fs = require("fs"); var path = require("path"); var regexpTokenizer = require("../../../tool/regexp_tokenizer"); var EditSession = require("../../edit_session").EditSession; var Editor = require("../../editor").Editor; var MockRenderer = require("../../test/mockrenderer").MockRenderer; require("../../multi_select").MultiSelect; var editor = new Editor(new MockRenderer()); if (!fs.existsSync) fs.existsSync = path.existsSync; var cwd = __dirname + "/"; var root = path.normalize(cwd + Array(4).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() { var snippets = {}; modeList().forEach(function(modeName, i) { silent || 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 (!m.lineCommentStart && !m.blockComment) console.error("missing comment in " + modeName); if (!m.$id) console.warn("missing id in " + modeName); if (!m.$behaviour) console.warn("missing behavior in " + modeName); var tokenizer = m.getTokenizer(); testNextState(tokenizer, modeName); testComments(m.lineCommentStart, testLineComment, tokenizer, modeName); testComments(m.blockComment, testBlockComment, tokenizer, modeName); testBrackets(m, modeName); if (m.snippetFileId) snippets[m.snippetFileId] = modeName; }); jsFileList(cwd + "../../snippets").forEach(function(snippetFileName) { if (/\.snippets$/.test(snippetFileName)) return; if (!snippets["ace/snippets/" + snippetFileName]) throw new Error("Snippet file " + snippetFileName + " is not used"); delete snippets["ace/snippets/" + snippetFileName]; }) ; if (Object.keys(snippets).length) { console.error("Snippet files missing", snippets); throw new Error("Snippet files missing"); } function testNextState(tokenizer, modeName) { let keys = Object.keys(tokenizer.states); for (let i = 0; i < keys.length; i++) { let key = keys[i]; let tokens = tokenizer.states[key]; for (let j = 0; j < tokens.length; j++) { let token = tokens[j]; checkState(keys, token, "nextState", modeName); checkState(keys, token, "next", modeName); } } } function checkState(stateNames, token, property, modeName) { if (token.hasOwnProperty(property) && typeof token[property] === "string" && !stateNames.includes( token[property])) { console.warn("non-existent next state '" + token[property] + "' in " + 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) { die("broken blockComment in " + modeName, data); } if (!/start/.test(data.state)) { die("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)) { die("broken lineCommentStart in " + modeName, tokens); } } function testBrackets(mode, modeName) { if (/^(forth|mask)$/.test(modeName)) return; var session = new EditSession("{ foo[ bar(baz) ] }", mode); var isInvalid = session.getTokens(0).some(function(t) { return /invalid|illegal|string/.test(t.type); }); if (isInvalid) return; var position = session.findMatchingBracket({row:0, column:1}); if (!position || position.column != 18) die("Matching bracket not found in " + modeName); position = session.findMatchingBracket({row:0, column:6}); if (!position || position.column != 16) die("Matching bracket not found in " + modeName); position = session.findMatchingBracket({row:0, column:11}); if (!position || position.column != 14) die("Matching bracket not found in " + modeName); if (mode.$behaviour) { session.setValue(""); editor.setSession(session); editor.execCommand("insertstring", "("); if (editor.getValue() != "()") return silent || console.log("() not paired in " + modeName); editor.execCommand("insertstring", "("); if (editor.getValue() != "(())") die("(()) not paired in " + modeName); } } function die() { console.warn.apply(console, arguments); process.exit(1); } } 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; } silent || 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); silent || console.log("\u001b[32m" + "all ok" + "\u001b[0m"); } function testMode(modeName, i) { silent || 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(); // TODO this is too slow to run in regular tests if (RECHECK) checkBacktracking(tokenizer); 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); } function checkBacktracking(tokenizer) { var states = tokenizer.states; Object.keys(states || {}).forEach(function(state) { states[state].forEach(function(rule) { var regex = rule.regex; if (regex && typeof regex != "string") regex = regex.source; if (!regex) return; regex = "(" + regex + ")|"; var result = require("recheck").checkSync(regex, "gmi", { checker: "automaton", timeout: 100000 }); if (result.status != "safe") { if (result.attack && result.attack.string) delete result.attack.string; console.log("\tPossible error in", state, rule, result); } }); }); } // cli var silent = false; var arg = process.argv[2]; var RECHECK = process.argv.indexOf("--recheck") !== -1; if (global.describe && global.it) { silent = true; global.describe("check modes", function() { if (this.timeout) this.timeout(20000); global.it("should check modes", function() { checkModes(); }); global.it("should test modes", function() { test(); }); }); } else 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: src/mode/_test/text_alda.txt ================================================ vibraphone: (quant 200) (key-signature "f+ c+ g+") a8 b > c d e f g a < a b > c_ d e f_ g_ a < (key-signature [:g :minor]) g a b > c+ d e f+ g < (key-signature {:e [:flat] :b [:flat]}) g1~1/b/d ================================================ FILE: src/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: src/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: src/mode/_test/text_coldfusion.txt ================================================ z ---> welcome="Hello World!"> z --> #welcome# Dateformat(now()) ================================================ FILE: src/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: src/mode/_test/text_ejs.txt ================================================ Cloud9 Rocks! <% if (!isRoot) { %> <% } %> <% entries.forEach(function(entry) { %> <% }) %>
    Name Size
    ..
    <%= entry.name %> <%= entry.size %>
    value="<%=window%>" <% } %> /> ================================================ FILE: src/mode/_test/text_gobstones.txt ================================================ /* * A Gobstones implementation of Conwey's Game of Life * that tries to use most of Gobstones syntax. * * Check out more about Gobstones at http://gobstones.org */ ----------------------------------------------------------- -- HELPERS TO MOVE AROUND ALL THE BOARD -- ----------------------------------------------------------- // This helpers allow the user to move around the board // one cell at a time procedure GoToStartOfBoard(firstDir, secondDir) { IrAlBorde(opuesto(firstDir)) IrAlBorde(opuesto(secondDir)) } function isEndOfBoard(firstDir, secondDir) { return (not puedeMover(firstDir) && not puedeMover(secondDir)) } procedure NextCellOfTheBoard(firstDir, secondDir) { if (puedeMover(firstDir)) { Mover(firstDir) } else { IrAlBorde(opuesto(firstDir)) Mover(secondDir) } } ----------------------------------------------------------- -- TYPE DECLARATIONS -- ----------------------------------------------------------- // The cell type declarations type CellStatus is variant { case Alive {} case Dead {} } type Cell is record { field status # CellStatus field color # Color } ----------------------------------------------------------- -- PROGRAM DEFINITION -- ----------------------------------------------------------- interactive program { # Map key press to actions K_UP -> { PrepareNextTick() } K_RIGHT -> { CompleteNextTick() } K_RETURN -> { SimulateNextTick() } } /* program { return ( numberOfNeighbors()) } */ ----------------------------------------------------------- -- FUNCTIONS -- ----------------------------------------------------------- function isCellAlive() { return (hayBolitas(Verde)) } function cellStatus() { return ( choose Alive when (isCellAlive()) Dead otherwise ) } function readCell() { return ( Cell(color <- Verde, status <- cellStatus()) ) } function numberOfNeighbors() { amountOfNeighbors := 0 foreach dir in [minDir() .. maxDir()] { amountOfNeighbors := amountOfNeighbors + aliveCellsAt(dir) } return (amountOfNeighbors) } function aliveCellsAt(dir) { firstCompare := puedeMover(dir) && hasAliveCellAt(dir) secondCompare := puedeMover(dir) && puedeMover(siguiente(dir)) && hasAliveCellAtD(dir) value := matching (firstCompare) select 1 on True 0 otherwise + matching (secondCompare) select 1 on True 0 otherwise return (value) } function hasAliveCellAt(dir) { Mover(dir) return (isCellAlive()) } function hasAliveCellAtD(dir) { Mover(dir) Mover(siguiente(dir)) return (isCellAlive()) } ----------------------------------------------------------- -- ROCEDURES DECLARATIONS -- ----------------------------------------------------------- procedure TagAsReanimated() { Poner(Azul) } procedure TagAsDead() { Poner(Rojo) } procedure ProcessAction() { switch (hayBolitas(Rojo)) { True -> { Sacar(Verde); Sacar(Rojo) } _ -> {} } switch (hayBolitas(Azul)) { True -> { Poner(Verde); Sacar(Azul) } _ -> {} } } procedure TagCell(numNeighbors) { if ( isCellAlive() && numNeighbors < 2) { TagAsDead() } elseif ( isCellAlive() && numNeighbors > 3) { TagAsDead() } elseif ((not isCellAlive()) && numNeighbors == 3) { TagAsReanimated() } } procedure SimulateTicks(amount) { repeat(amount) { SimulateNextTick() } } procedure SimulateNextTick() { PrepareNextTick() CompleteNextTick() } procedure PrepareNextTick() { GoToStartOfBoard(Norte, Este) while (not isEndOfBoard(Norte, Este)) { TagCell(numberOfNeighbors()) NextCellOfTheBoard(Norte, Este) } TagCell(numberOfNeighbors()) } procedure CompleteNextTick() { GoToStartOfBoard(Norte, Este) while (not isEndOfBoard(Norte, Este)) { ProcessAction() NextCellOfTheBoard(Norte, Este) } ProcessAction() } ================================================ FILE: src/mode/_test/text_html.txt ================================================ '123'
    ================================================ FILE: src/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.prototype.d = function(a, b, c, d) foo.d =function(a, b) foo.d =function(a, /*****/ d"string" var o = { t:`${[].map(x => { return x })}` }; //test generator function function* range (start, end, step) { while (start < end) { yield start start += step } } //test ES6 new built-in methods "hello".startsWith("ello", 1) // true "hello".endsWith("hell", 4) // true "hello".includes("ell") // true [ 1, 3, 4, 2 ].find(x => x > 3) // 4 [ 1, 3, 4, 2 ].findIndex(x => x > 3) // 2 "foo".repeat(3) Number.isSafeInteger(42) === true let x = Number.MAX_SAFE_INTEGER; let x = Number.MIN_SAFE_INTEGER; let x = Number.EPSILON; //test Promises new Promise(tetheredGetNumber) .then(determineParity, troubleWithGetNumber) .then(promiseGetWord) .then((info) => { console.log(`Got: ${info.value}, ${info.wordEvenOdd}`); return info; }) .catch((reason) => { if (reason.cause) { console.error("Had previously handled error"); } else { console.error(`Trouble with promiseGetWord(): ${reason}`); } }) .finally((info) => console.log("All done")); //test ES6 arrow functions param => expression; (param) => expression; (param1 = 123, paramN = "test") => expression; param => { statements; }; (param1, paramN) => { statements } (a, b, ...r) => expression; (a = 400, b = 20, c) => expression; async param => expression; //test JSX functions arguments in arrow functions { console.log("Test") }}/> { console.log("Test") }}/> //test different generator functions use cases function* generator() {} function*generator() {} Sound.play = function* play() { } foobar: function * () { } //func's args shouldn't be determined as arrow function func (a,b,1,2,3, async () => {}) func(a,b,innerCall(c,d), () => {}) //async arrow function with default params async (param1, param2, ...paramN) => { statements } //all should be constant.numeric 1_000_000_000_000 1_050.95 0b1010_0001_1000_0101 0o2_2_5_6 0xA0_B0_C0 1_000_000_000_000_000_000_000n 1.0_1322323_33 1. 0.4_3223_32 ================================================ FILE: src/mode/_test/text_livescript.txt ================================================ # comment ================================================ FILE: src/mode/_test/text_lucene.txt ================================================ foo foo: foo AND bar foo AND bar foo OR bar foo NOT bar "foo bar" bar "foo bar" bar -foo bar -"foo bar" -foo -"foo bar" bar foo~100 foo~100 foo~100 bar "foo bar"~10 foo~ bar foo~ foo~ bar foo~0.8 field:foo field:foo bar field:"foo bar" (foo AND bar) (field:foo AND field:"bar baz") foo* f?o f*o +foo +"foo bar" foo? ?oo foo field:(-foo +bar +"foo bar") field:{foo TO bar} field:[foo TO bar] field:["a b c" TO def] field:{"a b c" TO def} field:{foo TO "bar"} field:{20180101 TO 20190202} field:{"2018-01-01" TO "2019-02-02"} \+escaped \-escaped esc\&aped esc\|aped \!escaped \(escaped\) \{escaped\} \[escaped\] escaped\^4 \"escaped\" escaped\~0.4 escaped\* escaped\? esc\:aped esc\\aped esc\ aped:foo "foo\"bar" foo:/bar/ ================================================ FILE: src/mode/_test/text_markdown.txt ================================================ test: header 1 #f # 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 a valid header # test: only space between #s is 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: src/mode/_test/text_php.txt ================================================ not &js; ================================================ FILE: src/mode/_test/text_prisma.txt ================================================ generator photon { provider = "photonjs" } model User { id String @default(cuid()) @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt firstName String lastName String email String @unique password String phone String responseRate Float? responseTime Int? ReportsTo User? @relation("EmployeeToEmployee_ReportsTo") employees User[] @relation("EmployeeToEmployee_ReportsTo") isSuperHost Boolean ownedPlaces Place[] location Location? bookings Booking[] paymentAccount PaymentAccount[] sentMessages Message[] @relation("SentMessages") receivedMessages Message[] @relation("ReceivedMessages") notifications Notification[] profilePicture Picture? hostingExperiences Experience[] } model Place { id String @default(cuid()) @id name String size PLACE_SIZES? shortDescription String description String slug String maxGuests Int numBedrooms Int numBeds Int numBaths Int reviews Review[] amenities Amenities host User pricing Pricing location Location views Views guestRequirements GuestRequirements? policies Policies? houseRules HouseRules? bookings Booking[] pictures Picture[] popularity Int } model Pricing { id String @default(cuid()) @id place Place monthlyDiscount Int? weeklyDiscount Int? perNight Int smartPricing Boolean basePrice Int averageWeekly Int averageMonthly Int cleaningFee Int? securityDeposit Int? extraGuests Int? weekendPricing Int? currency CURRENCY? } model GuestRequirements { id String @default(cuid()) @id govIssuedId Boolean recommendationsFromOtherHosts Boolean guestTripInformation Boolean place Place } model Policies { id String @default(cuid()) @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt checkInStartTime Float checkInEndTime Float checkoutTime Float place Place } model HouseRules { id String @default(cuid()) @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt suitableForChildren Boolean? suitableForInfants Boolean? petsAllowed Boolean? smokingAllowed Boolean? partiesAndEventsAllowed Boolean? additionalRules String? } model Views { id String @default(cuid()) @id lastWeek Int place Place } model Location { id String @default(cuid()) @id lat Float lng Float neighbourHood Neighbourhood? user User? place Place? address String directions String experience Experience? restaurant Restaurant? } model Neighbourhood { id String @default(cuid()) @id locations Location[] name String slug String homePreview Picture? city City featured Boolean popularity Int } model City { id String @default(cuid()) @id name String neighbourhoods Neighbourhood[] } model Picture { id String @default(cuid()) @id url String } model Experience { id String @default(cuid()) @id category ExperienceCategory? title String host User location Location pricePerPerson Int reviews Review[] preview Picture popularity Int } model ExperienceCategory { id String @default(cuid()) @id mainColor String name String experience Experience? } model Amenities { id String @default(cuid()) @id place Place elevator Boolean petsAllowed Boolean internet Boolean kitchen Boolean wirelessInternet Boolean familyKidFriendly Boolean freeParkingOnPremises Boolean hotTub Boolean pool Boolean smokingAllowed Boolean wheelchairAccessible Boolean breakfast Boolean cableTv Boolean suitableForEvents Boolean dryer Boolean washer Boolean indoorFireplace Boolean tv Boolean heating Boolean hangers Boolean iron Boolean hairDryer Boolean doorman Boolean paidParkingOffPremises Boolean freeParkingOnStreet Boolean gym Boolean airConditioning Boolean shampoo Boolean essentials Boolean laptopFriendlyWorkspace Boolean privateEntrance Boolean buzzerWirelessIntercom Boolean babyBath Boolean babyMonitor Boolean babysitterRecommendations Boolean bathtub Boolean changingTable Boolean childrensBooksAndToys Boolean childrensDinnerware Boolean crib Boolean } model Review { id String @default(cuid()) @id createdAt DateTime @default(now()) text String stars Int accuracy Int location Int checkIn Int value Int cleanliness Int communication Int place Place experience Experience? } model Booking { id String @default(cuid()) @id createdAt DateTime @default(now()) bookee User place Place startDate DateTime endDate DateTime payment Payment? } model Payment { id String @default(cuid()) @id createdAt DateTime @default(now()) serviceFee Float placePrice Float totalPrice Float booking Booking paymentMethod PaymentAccount } model PaymentAccount { id String @default(cuid()) @id createdAt DateTime @default(now()) type PAYMENT_PROVIDER? user User payments Payment[] paypal PaypalInformation? creditcard CreditCardInformation? } model PaypalInformation { id String @default(cuid()) @id createdAt DateTime @default(now()) email String paymentAccount PaymentAccount } model CreditCardInformation { id String @default(cuid()) @id createdAt DateTime @default(now()) cardNumber String expiresOnMonth Int expiresOnYear Int securityCode String firstName String lastName String postalCode String country String paymentAccount PaymentAccount? } model Message { id String @default(cuid()) @id createdAt DateTime @default(now()) from User @relation("SentMessages") to User @relation("ReceivedMessages") deliveredAt DateTime readAt DateTime } model Notification { id String @default(cuid()) @id createdAt DateTime @default(now()) type NOTIFICATION_TYPE? user User link String readDate DateTime } model Restaurant { id String @default(cuid()) @id createdAt DateTime @default(now()) title String avgPricePerPerson Int pictures Picture[] location Location isCurated Boolean slug String popularity Int } enum CURRENCY { CAD CHF EUR JPY USD ZAR } enum PLACE_SIZES { ENTIRE_HOUSE ENTIRE_APARTMENT ENTIRE_EARTH_HOUSE ENTIRE_CABIN ENTIRE_VILLA ENTIRE_PLACE ENTIRE_BOAT PRIVATE_ROOM } enum PAYMENT_PROVIDER { PAYPAL CREDIT_CARD } enum NOTIFICATION_TYPE { OFFER INSTANT_BOOK RESPONSIVENESS NEW_AMENITIES HOUSE_RULES } ================================================ FILE: src/mode/_test/text_razor.txt ================================================ @{ Layout = "~/layout" } @code{ private int count = 0; } @code { private string name = "Test"; } @functions{ public void DoSomething() { } } @model MyApp.Models.User @inject IUserService UserService @inherits CustomBasePage @implements IDisposable @attribute [Authorize] @layout MainLayout @namespace MyApp.Pages @rendermode InteractiveServer @using System.Collections.Generic @page "/counter" ================================================ FILE: src/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 pub fn g() -> std::mem::MaybeUninit<[T; 1 << 2]> { std::mem::MaybeUninit::uninit() } let multiline = r##" This is a raw string. r#"nested string"# "##; let empty = br##""##; let _strings = [r"hello\", br"hello\", cr"hello\" ]; ================================================ FILE: src/mode/_test/text_verilog.txt ================================================ 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]; module test; assign a = "1"; initial begin $display("Hello \778\xaa\ \n world") $finish; end endmodule ================================================ FILE: src/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: src/mode/_test/text_xml.txt ================================================ //Juhu Kinners test: two tags in the same lines should be in separate tokens" test: multiline attributes" ================================================ FILE: src/mode/_test/text_yaml.txt ================================================ # 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 version: 1.2.3.4 bill-to: &id001 street: | 123 Tornado Alley Suite 16 ref-id: id123 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. ? | block key #1 kkk : - | one - | tw #o - ? |- as #d q b - x: xx r: xx z: sss zdd: dddd "block key 2" : - two # block value - ? | as #d : | asdadas #d asd a: 2 - ? | asdas #d : | xx s: |4+ #comment 7 a a ================================================ FILE: src/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: src/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: src/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: src/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: src/mode/_test/tokens_alda.json ================================================ [[ "start", ["constant.language.instrument.alda","vibraphone"], ["meta.part.call.alda",":"] ],[ "start", ["text"," "], ["meta.inline.clojure.alda","(quant 200)"] ],[ "start", ["text"," "], ["meta.inline.clojure.alda","(key-signature \"f+ c+ g+\")"] ],[ "start", ["text"," a"], ["string.quoted.operator.timing.alda","8"], ["text"," b "], ["keyword.operator.octave-shift.alda",">"], ["text"," c d e f g a "], ["keyword.operator.octave-shift.alda","<"] ],[ "start", ["text"," a b "], ["keyword.operator.octave-shift.alda",">"], ["text"," c_ d e f_ g_ a "], ["keyword.operator.octave-shift.alda","<"] ],[ "start" ],[ "start", ["text"," "], ["meta.inline.clojure.alda","(key-signature [:g :minor])"] ],[ "start", ["text"," g a b "], ["keyword.operator.octave-shift.alda",">"], ["text"," c"], ["variable.parameter.operator.pitch.alda","+"], ["text"," d e f"], ["variable.parameter.operator.pitch.alda","+"], ["text"," g "], ["keyword.operator.octave-shift.alda","<"] ],[ "start" ],[ "start", ["text"," "], ["meta.inline.clojure.alda","(key-signature {:e [:flat] :b [:flat]})"] ],[ "pitch", ["text"," g"], ["string.quoted.operator.timing.alda","1~1"], ["constant.numeric.subchord.alda","/"], ["text","b"], ["constant.numeric.subchord.alda","/"], ["text","d"] ]] ================================================ FILE: src/mode/_test/tokens_apex.json ================================================ [[ "start", ["keyword","public"], ["text"," "], ["keyword","class"], ["text"," "], ["identifier","testBlockDuplicatesLeadTrigger"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"] ],[ "start", ["text","\t"], ["keyword","static"], ["text"," "], ["keyword","testMethod"], ["text"," "], ["storage.type","void"], ["text"," "], ["identifier","testDuplicateTrigger"], ["paren.lparen","("], ["paren.rparen",")"], ["paren.lparen","{"], ["text"," "] ],[ "start", ["text","\t"] ],[ "start", ["text","\t\t"], ["identifier","Lead"], ["paren.lparen","["], ["paren.rparen","]"], ["text"," "], ["identifier","l1"], ["text"," "], ["keyword.operator","="], ["keyword","new"], ["text"," "], ["identifier","Lead"], ["paren.lparen","["], ["paren.rparen","]"], ["paren.lparen","{"] ],[ "start", ["text","\t\t\t"], ["keyword","new"], ["text"," "], ["identifier","Lead"], ["paren.lparen","("], ["text"," "], ["identifier","Email"], ["keyword.operator","="], ["string.start","'"], ["string","homer@fox.tv"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","LastName"], ["keyword.operator","="], ["string.start","'"], ["string","Simpson"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","Company"], ["keyword.operator","="], ["string.start","'"], ["string","fox"], ["string.end","'"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text","\t\t"], ["paren.rparen","}"], ["punctuation.operator",";"] ],[ "start", ["text","\t\t"], ["keyword","insert"], ["text"," "], ["identifier","l1"], ["punctuation.operator",";"], ["text","\t\t"], ["comment","// add a known lead"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\t"], ["identifier","Lead"], ["paren.lparen","["], ["paren.rparen","]"], ["text"," "], ["identifier","l2"], ["text"," "], ["keyword.operator","="], ["keyword","new"], ["text"," "], ["identifier","Lead"], ["paren.lparen","["], ["paren.rparen","]"], ["paren.lparen","{"] ],[ "start", ["text","\t\t\t"], ["keyword","new"], ["text"," "], ["identifier","Lead"], ["paren.lparen","("], ["text"," "], ["identifier","Email"], ["keyword.operator","="], ["string.start","'"], ["string","homer@fox.tv"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","LastName"], ["keyword.operator","="], ["string.start","'"], ["string","Simpson"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","Company"], ["keyword.operator","="], ["string.start","'"], ["string","fox"], ["string.end","'"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text","\t\t"], ["paren.rparen","}"], ["punctuation.operator",";"] ],[ "start", ["text","\t\t"], ["comment","// try to add a matching lead"] ],[ "start", ["text","\t\t"], ["keyword","try"], ["text"," "], ["paren.lparen","{"], ["text","\t"], ["keyword","insert"], ["text"," "], ["identifier","l2"], ["punctuation.operator",";"], ["text","\t"], ["paren.rparen","}"], ["text"," "], ["keyword","catch"], ["text"," "], ["paren.lparen","("], ["text"," "], ["support.function","System"], ["punctuation.operator","."], ["identifier","DmlException"], ["text"," "], ["identifier","e"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "] ],[ "start", ["text","\t\t\t"], ["support.function","system"], ["punctuation.operator","."], ["identifier","assert"], ["paren.lparen","("], ["identifier","e"], ["punctuation.operator","."], ["identifier","getMessage"], ["paren.lparen","("], ["paren.rparen",")"], ["punctuation.operator","."], ["identifier","contains"], ["paren.lparen","("], ["string.start","'"], ["string","first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, A lead with this email address already exists"], ["string.end","'"], ["paren.rparen",")"], ["punctuation.operator",","] ],[ "start", ["text","\t\t\t "], ["identifier","e"], ["punctuation.operator","."], ["identifier","getMessage"], ["paren.lparen","("], ["paren.rparen",")"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text","\t\t"], ["paren.rparen","}"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\t"], ["comment","// test duplicates in the same batch"] ],[ "start", ["text","\t\t"], ["identifier","Lead"], ["paren.lparen","["], ["paren.rparen","]"], ["text"," "], ["identifier","l3"], ["text"," "], ["keyword.operator","="], ["keyword","new"], ["text"," "], ["identifier","Lead"], ["paren.lparen","["], ["paren.rparen","]"], ["paren.lparen","{"] ],[ "start", ["text","\t\t\t"], ["keyword","new"], ["text"," "], ["identifier","Lead"], ["paren.lparen","("], ["text"," "], ["identifier","Email"], ["keyword.operator","="], ["string.start","'"], ["string","marge@fox.tv"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","LastName"], ["keyword.operator","="], ["string.start","'"], ["string","Simpson"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","Company"], ["keyword.operator","="], ["string.start","'"], ["string","fox"], ["string.end","'"], ["text"," "], ["paren.rparen",")"], ["punctuation.operator",","] ],[ "start", ["text","\t\t\t"], ["keyword","new"], ["text"," "], ["identifier","Lead"], ["paren.lparen","("], ["text"," "], ["identifier","Email"], ["keyword.operator","="], ["string.start","'"], ["string","marge@fox.tv"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","LastName"], ["keyword.operator","="], ["string.start","'"], ["string","Simpson"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","Company"], ["keyword.operator","="], ["string.start","'"], ["string","fox"], ["string.end","'"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text","\t\t"], ["paren.rparen","}"], ["punctuation.operator",";"], ["text","\t\t"] ],[ "start", ["text","\t\t"], ["keyword","try"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["keyword","insert"], ["text"," "], ["identifier","l3"], ["punctuation.operator",";"], ["text","\t"], ["paren.rparen","}"], ["text"," "], ["keyword","catch"], ["text"," "], ["paren.lparen","("], ["text"," "], ["support.function","System"], ["punctuation.operator","."], ["identifier","DmlException"], ["text"," "], ["identifier","e"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "] ],[ "start", ["text","\t\t\t"], ["support.function","system"], ["punctuation.operator","."], ["identifier","assert"], ["paren.lparen","("], ["identifier","e"], ["punctuation.operator","."], ["identifier","getMessage"], ["paren.lparen","("], ["paren.rparen",")"], ["punctuation.operator","."], ["identifier","contains"], ["paren.lparen","("], ["string.start","'"], ["string","first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Another new lead has the same email"], ["string.end","'"], ["paren.rparen",")"], ["punctuation.operator",","] ],[ "start", ["text","\t\t\t\t"], ["identifier","e"], ["punctuation.operator","."], ["identifier","getMessage"], ["paren.lparen","("], ["paren.rparen",")"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text","\t\t\t"] ],[ "start", ["text","\t\t"], ["paren.rparen","}"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\t"], ["comment","// test update also"] ],[ "start", ["text","\t\t"], ["identifier","Lead"], ["paren.lparen","["], ["paren.rparen","]"], ["text"," "], ["identifier","lup"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword","new"], ["text"," "], ["identifier","Lead"], ["paren.lparen","["], ["paren.rparen","]"], ["paren.lparen","{"] ],[ "start", ["text","\t\t\t"], ["keyword","new"], ["text"," "], ["identifier","Lead"], ["paren.lparen","("], ["text"," "], ["identifier","Email"], ["keyword.operator","="], ["string.start","'"], ["string","marge@fox.tv"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","LastName"], ["keyword.operator","="], ["string.start","'"], ["string","Simpson"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["identifier","Company"], ["keyword.operator","="], ["string.start","'"], ["string","fox"], ["string.end","'"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text","\t\t"], ["paren.rparen","}"], ["punctuation.operator",";"] ],[ "start", ["text","\t\t"], ["keyword","insert"], ["text"," "], ["identifier","lup"], ["punctuation.operator",";"] ],[ "start", ["text","\t\t"], ["identifier","Lead"], ["text"," "], ["identifier","marge"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","["], ["text"," "], ["keyword","select"], ["text"," id"], ["keyword.operator",","], ["text","Email "], ["keyword","from"], ["text"," lead "], ["keyword","where"], ["text"," Email "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","marge@fox.tv"], ["string.end","'"], ["text"," "], ["keyword","limit"], ["text"," 1"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["text","\t\t"], ["support.function","system"], ["punctuation.operator","."], ["identifier","assert"], ["paren.lparen","("], ["identifier","marge"], ["keyword.operator","!="], ["constant.language","null"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text","\t\t"], ["identifier","marge"], ["punctuation.operator","."], ["identifier","Email"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","homer@fox.tv"], ["string.end","'"], ["punctuation.operator",";"], ["text"," "] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\t"], ["keyword","try"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["keyword","update"], ["text"," "], ["identifier","marge"], ["punctuation.operator",";"], ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword","catch"], ["text"," "], ["paren.lparen","("], ["text"," "], ["support.function","System"], ["punctuation.operator","."], ["identifier","DmlException"], ["text"," "], ["identifier","e"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "] ],[ "start", ["text","\t\t\t"], ["support.function","system"], ["punctuation.operator","."], ["identifier","assert"], ["paren.lparen","("], ["identifier","e"], ["punctuation.operator","."], ["identifier","getMessage"], ["paren.lparen","("], ["paren.rparen",")"], ["punctuation.operator","."], ["identifier","contains"], ["paren.lparen","("], ["string.start","'"], ["string","irst error: FIELD_CUSTOM_VALIDATION_EXCEPTION, A lead with this email address already exists"], ["string.end","'"], ["paren.rparen",")"], ["punctuation.operator",","] ],[ "start", ["text","\t\t\t\t"], ["identifier","e"], ["punctuation.operator","."], ["identifier","getMessage"], ["paren.lparen","("], ["paren.rparen",")"], ["paren.rparen",")"], ["punctuation.operator",";"], ["text","\t"] ],[ "start", ["text","\t\t"], ["paren.rparen","}"] ],[ "start", ["text","\t"], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: src/mode/_test/tokens_aql.json ================================================ [[ "start", ["keyword","FOR"], ["text"," "], ["identifier","user"], ["text"," "], ["keyword","IN"], ["text"," "], ["identifier","users"] ],[ "start", ["text"," "], ["keyword","FILTER"], ["text"," "], ["identifier","user"], ["text","."], ["identifier","username"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","\"olivier\""] ],[ "start", ["text"," "], ["keyword","RETURN"], ["text"," "], ["identifier","user"] ]] ================================================ FILE: src/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: src/mode/_test/tokens_asl.json ================================================ [[ "comment", ["comment","/*"] ],[ "comment", ["comment"," * Intel ACPI Component Architecture"] ],[ "comment", ["comment"," * AML/ASL+ Disassembler version 20180105"] ],[ "comment", ["comment"," *"] ],[ "comment", ["comment"," * ASL example"] ],[ "start", ["comment"," */"] ],[ "start", ["keyword","DefinitionBlock"], ["text"," "], ["lparen","("], ["string","\"\""], ["keyword.operator",","], ["text"," "], ["string","\"SSDT\""], ["keyword.operator",","], ["text"," "], ["constant.numeric","1"], ["keyword.operator",","], ["text"," "], ["string","\"PmRef\""], ["keyword.operator",","], ["text"," "], ["string","\"Cpu0Ist\""], ["keyword.operator",","], ["text"," "], ["constant.numeric","0x00003000"], ["rparen",")"] ],[ "start", ["lparen","{"] ],[ "start", ["text"," "], ["keyword","External"], ["text"," "], ["lparen","("], ["identifier","_PR_"], ["keyword.operator","."], ["identifier","CPU0"], ["keyword.operator",","], ["text"," "], ["storage.type","DeviceObj"], ["rparen",")"] ],[ "start", ["text"," "], ["keyword","External"], ["text"," "], ["lparen","("], ["identifier","_SB_"], ["keyword.operator","."], ["identifier","CPUP"], ["keyword.operator",","], ["text"," "], ["storage.type","UnknownObj"], ["rparen",")"] ],[ "start" ],[ "start", ["text"," "], ["keyword","Scope"], ["text"," "], ["lparen","("], ["text","\\"], ["identifier","_PR"], ["keyword.operator","."], ["identifier","CPU0"], ["rparen",")"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","Method"], ["text"," "], ["lparen","("], ["identifier","_PCT"], ["keyword.operator",","], ["text"," "], ["constant.numeric","0"], ["keyword.operator",","], ["text"," "], ["constant.library","NotSerialized"], ["rparen",")"], ["text"," "], ["comment","// _PCT: Performance Control"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","If"], ["text"," "], ["lparen","((("], ["identifier","CFGD"], ["text"," "], ["keyword.operator","&"], ["text"," "], ["constant.numeric","One"], ["rparen",")"], ["text"," "], ["keyword.operator","&&"], ["text"," "], ["lparen","("], ["identifier","PDC0"], ["text"," "], ["keyword.operator","&"], ["text"," "], ["constant.numeric","One"], ["rparen",")))"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","Return"], ["text"," "], ["lparen","("], ["keyword","Package"], ["text"," "], ["lparen","("], ["constant.numeric","0x02"], ["rparen",")"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","ResourceTemplate"], ["text"," "], ["lparen","("], ["rparen",")"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","Register"], ["text"," "], ["lparen","("], ["constant.library","FFixedHW"], ["keyword.operator",","], ["text"," "] ],[ "start", ["text"," "], ["constant.numeric","0x00"], ["keyword.operator",","], ["text"," "], ["comment","// Bit Width"] ],[ "start", ["text"," "], ["constant.numeric","0x00"], ["keyword.operator",","], ["text"," "], ["comment","// Bit Offset"] ],[ "start", ["text"," "], ["constant.numeric","0x0000000000000000"], ["keyword.operator",","], ["text"," "], ["comment","// Address"] ],[ "start", ["text"," "], ["keyword.operator",","], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"], ["keyword.operator",","], ["text"," "] ],[ "start" ],[ "start", ["text"," "], ["keyword","ResourceTemplate"], ["text"," "], ["lparen","("], ["rparen",")"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","Register"], ["text"," "], ["lparen","("], ["constant.library","FFixedHW"], ["keyword.operator",","], ["text"," "] ],[ "start", ["text"," "], ["constant.numeric","0x00"], ["keyword.operator",","], ["text"," "], ["comment","// Bit Width"] ],[ "start", ["text"," "], ["constant.numeric","0x00"], ["keyword.operator",","], ["text"," "], ["comment","// Bit Offset"] ],[ "start", ["text"," "], ["constant.numeric","0x0000000000000000"], ["keyword.operator",","], ["text"," "], ["comment","// Address"] ],[ "start", ["text"," "], ["keyword.operator",","], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["rparen","})"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword","Return"], ["text"," "], ["lparen","("], ["keyword","Package"], ["text"," "], ["lparen","("], ["constant.numeric","0x02"], ["rparen",")"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","ResourceTemplate"], ["text"," "], ["lparen","("], ["rparen",")"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","Register"], ["text"," "], ["lparen","("], ["constant.library","SystemIO"], ["keyword.operator",","], ["text"," "] ],[ "start", ["text"," "], ["constant.numeric","0x10"], ["keyword.operator",","], ["text"," "], ["comment","// Bit Width"] ],[ "start", ["text"," "], ["constant.numeric","0x00"], ["keyword.operator",","], ["text"," "], ["comment","// Bit Offset"] ],[ "start", ["text"," "], ["constant.numeric","0x0000000000001000"], ["keyword.operator",","], ["text"," "], ["comment","// Address"] ],[ "start", ["text"," "], ["keyword.operator",","], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"], ["keyword.operator",","], ["text"," "] ],[ "start" ],[ "start", ["text"," "], ["keyword","ResourceTemplate"], ["text"," "], ["lparen","("], ["rparen",")"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","Register"], ["text"," "], ["lparen","("], ["constant.library","SystemIO"], ["keyword.operator",","], ["text"," "] ],[ "start", ["text"," "], ["constant.numeric","0x08"], ["keyword.operator",","], ["text"," "], ["comment","// Bit Width"] ],[ "start", ["text"," "], ["constant.numeric","0x00"], ["keyword.operator",","], ["text"," "], ["comment","// Bit Offset"] ],[ "start", ["text"," "], ["constant.numeric","0x00000000000000B3"], ["keyword.operator",","], ["text"," "], ["comment","// Address"] ],[ "start", ["text"," "], ["keyword.operator",","], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["rparen","})"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword","Name"], ["text"," "], ["lparen","("], ["identifier","PSDF"], ["keyword.operator",","], ["text"," "], ["constant.numeric","Zero"], ["rparen",")"] ],[ "start", ["text"," "], ["keyword","Method"], ["text"," "], ["lparen","("], ["identifier","_PSD"], ["keyword.operator",","], ["text"," "], ["constant.numeric","0"], ["keyword.operator",","], ["text"," "], ["constant.library","NotSerialized"], ["rparen",")"], ["text"," "], ["comment","// _PSD: Power State Dependencies"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","If"], ["text"," "], ["lparen","("], ["keyword.operator","!"], ["identifier","PSDF"], ["rparen",")"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword.operator","DerefOf"], ["text"," "], ["lparen","("], ["identifier","HPSD"], ["text"," "], ["comment","[Zero]"], ["rparen",")"], ["text"," "], ["comment","[0x04]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","TCNT"], ["text"," "], ["comment","/* External reference */"] ],[ "start", ["text"," "], ["keyword.operator","DerefOf"], ["text"," "], ["lparen","("], ["identifier","SPSD"], ["text"," "], ["comment","[Zero]"], ["rparen",")"], ["text"," "], ["comment","[0x04]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","TCNT"], ["text"," "], ["comment","/* External reference */"] ],[ "start", ["text"," "], ["identifier","PSDF"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","Ones"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword","If"], ["text"," "], ["lparen","(("], ["identifier","PDC0"], ["text"," "], ["keyword.operator","&"], ["text"," "], ["constant.numeric","0x0800"], ["rparen","))"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","Return"], ["text"," "], ["lparen","("], ["identifier","HPSD"], ["rparen",")"], ["text"," "], ["comment","/* \\_PR_.CPU0.HPSD */"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword","Return"], ["text"," "], ["lparen","("], ["identifier","SPSD"], ["rparen",")"], ["text"," "], ["comment","/* \\_PR_.CPU0.SPSD */"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start" ]] ================================================ FILE: src/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: src/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"], ["paren","(){"] ],[ "start", ["text","\t"], ["keyword.control.ahk","global"], ["text"," as_x"] ],[ "start", ["text","\tas_x "], ["keyword.operator.ahk",":="], ["text"," "], ["support.function.ahk","Round"], ["paren","("], ["text","ws_x"], ["keyword.operator.ahk","/"], ["text","zoom"], ["keyword.operator.ahk","/"], ["text","2 "], ["keyword.operator.ahk","-"], ["text"," 0.5"], ["paren",")"] ],[ "start", ["text","\t"], ["keyword.control.ahk","if"], ["text"," "], ["paren","("], ["text","zoom"], ["keyword.operator.ahk",">"], ["text","1"], ["paren",")"], ["text"," "], ["paren","{"] ],[ "start", ["text","\t\tpix "], ["keyword.operator.ahk",":="], ["text"," "], ["support.function.ahk","Round"], ["paren","("], ["text","zoom"], ["paren",")"] ],[ "start", ["text","\t"], ["paren","}"], ["text"," ele "], ["paren","{"] ],[ "start", ["text","\t\tpix "], ["keyword.operator.ahk",":="], ["text"," 1"] ],[ "start", ["text","\t"], ["paren","}"] ],[ "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", ["paren","}"] ],[ "start" ],[ "start", ["text","hdc_frame "], ["keyword.operator.ahk",":="], ["text"," "], ["support.function.ahk","DllCall"], ["paren","("], ["punctuation.quote.double","\""], ["string.quoted.ahk","GetDC"], ["punctuation.quote.double","\""], ["punctuation.ahk",","], ["text"," UInt"], ["punctuation.ahk",","], ["text"," MagnifierID"], ["paren",")"] ],[ "start" ],[ "start", ["comment.line.ahk","; comment"] ],[ "start", ["text","DrawCross"], ["paren","("], ["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"], ["paren","){"] ],[ "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"], ["paren","("], ["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"], ["paren",")"] ],[ "start", ["paren","}"] ],[ "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"], ["paren","("], ["text","zoom "], ["keyword.operator.ahk","<"], ["text"," ws_x "], ["variable.parameter","and"], ["text"," "], ["paren","("], ["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","\""], ["paren",")"], ["text"," "], ["paren",")"] ],[ "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: src/mode/_test/tokens_basic.json ================================================ [[ "start", ["constant.numeric","120"], ["text"," "], ["entity.name","OPEN"], ["string","\"R\""], ["text"," #"], ["constant.numeric","1"], ["text"," "], ["string","\"INVEN.DAT\""], ["punctiation",","], ["constant.numeric","39"] ],[ "start", ["constant.numeric","125"], ["text"," "], ["entity.name","FIELD"], ["text","#"], ["constant.numeric","1"], ["punctiation",","], ["constant.numeric","1"], ["text"," "], ["identifier","AS"], ["text"," "], ["identifier","F"], ["text","$"], ["punctiation",","], ["constant.numeric","30"], ["text"," "], ["identifier","AS"], ["text"," "], ["identifier","D"], ["text","$"], ["punctiation",","], ["text"," "], ["constant.numeric","2"], ["text"," "], ["identifier","AS"], ["text"," "], ["identifier","Q"], ["text","$"], ["punctiation",","], ["constant.numeric","2"], ["text"," "], ["identifier","AS"], ["text"," "], ["identifier","R"], ["text","$"], ["punctiation",","], ["constant.numeric","4"], ["text"," "], ["identifier","AS"], ["text"," "], ["identifier","PH"] ],[ "start", ["constant.numeric","130"], ["text"," "], ["entity.name","PRINT"], ["text",":"], ["entity.name","PRINT"], ["text"," "], ["string","\"FUNCTIONS:\""], ["text",":"], ["entity.name","PRINT"] ],[ "start", ["constant.numeric","135"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["constant.numeric","1"], ["punctiation",","], ["string","\"INITIALIZE FILE\""] ],[ "start", ["constant.numeric","140"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["constant.numeric","2"], ["text"," "], ["string","\"CREATE A NEW ENTRY\""] ],[ "start", ["constant.numeric","150"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["constant.numeric","3"], ["punctiation",","], ["string","\"DISPLAY INVENTORY FOR ONE PART\""] ],[ "start", ["constant.numeric","160"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["constant.numeric","4"], ["text"," "], ["string","\"ADD TO STOCK\""] ],[ "start", ["constant.numeric","170"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["constant.numeric","5"], ["punctiation",","], ["string","\"SUBTRACT FROM STOCK\""] ],[ "start", ["constant.numeric","180"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["constant.numeric","6"], ["punctiation",","], ["string","\"DISPLAY ALL ITEMS BELOW REORDER LEVEL\""] ],[ "start", ["constant.numeric","220"], ["text"," "], ["entity.name","PRINT"], ["text",":"], ["entity.name","PRINT"], ["text",":"], ["entity.name","INPUT"], ["string","\"FUNCTION\""], ["punctiation",";"], ["identifier","FUNCTION"] ],[ "start", ["constant.numeric","225"], ["text"," "], ["keyword.control","IF"], ["text"," "], ["paren.lparen","("], ["identifier","FUNCTION"], ["keyword.operator","<"], ["constant.numeric","1"], ["paren.rparen",")"], ["keyword.operator","OR"], ["paren.lparen","("], ["identifier","FUNCTION"], ["keyword.operator",">"], ["constant.numeric","6"], ["paren.rparen",")"], ["text"," "], ["keyword.control","THEN"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["string","\"BAD FUNCTION NUMBER\""], ["text",":"], ["keyword.control","GOTO"], ["text"," "], ["constant.numeric","130"] ],[ "start", ["constant.numeric","230"], ["text"," "], ["keyword.control","ON"], ["text"," "], ["identifier","FUNCTION"], ["text"," "], ["keyword.control","GOSUB"], ["text"," "], ["constant.numeric","900"], ["punctiation",","], ["constant.numeric","250"], ["punctiation",","], ["constant.numeric","390"], ["punctiation",","], ["constant.numeric","480"], ["punctiation",","], ["constant.numeric","560"], ["punctiation",","], ["constant.numeric","680"] ],[ "start", ["constant.numeric","240"], ["text"," "], ["keyword.control","GOTO"], ["text"," "], ["constant.numeric","220"] ],[ "start", ["constant.numeric","560"], ["text"," "], ["comment","REM REMOVE FROM STOCK"] ],[ "start", ["constant.numeric","570"], ["text"," "], ["keyword.control","GOSUB"], ["text"," "], ["constant.numeric","840"] ],[ "start", ["constant.numeric","580"], ["text"," "], ["keyword.control","IF"], ["text"," "], ["support.function","ASC"], ["paren.lparen","("], ["identifier","F"], ["text","$"], ["paren.rparen",")"], ["keyword.operator","="], ["constant.numeric","255"], ["text"," "], ["keyword.control","THEN"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["string","\"NULL ENTRY\""], ["text",":"], ["keyword.control","RETURN"] ],[ "start", ["constant.numeric","590"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["identifier","DH"] ],[ "start", ["constant.numeric","600"], ["text"," "], ["entity.name","INPUT"], ["text"," "], ["string","\"QUANTITY TO SUBTRACT\""], ["punctiation",";"], ["identifier","S"], ["text","%"] ],[ "start", ["constant.numeric","610"], ["text"," "], ["variable","Q%"], ["keyword.operator","="], ["support.function","CVI"], ["paren.lparen","("], ["identifier","Q"], ["text","$"], ["paren.rparen",")"] ],[ "start", ["constant.numeric","620"], ["text"," "], ["keyword.control","IF"], ["text"," "], ["paren.lparen","("], ["identifier","Q"], ["text","%"], ["keyword.operator","-"], ["identifier","S"], ["text","%"], ["paren.rparen",")"], ["keyword.operator","<"], ["constant.numeric","0"], ["text"," "], ["keyword.control","THEN"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["string","\"ONIY\""], ["punctiation",";"], ["identifier","Q"], ["text","%"], ["punctiation",";"], ["text"," "], ["string","\"IN STOCK\""], ["text",":"], ["keyword.control","GOTO"], ["text"," "], ["constant.numeric","600"] ],[ "start", ["constant.numeric","630"], ["text"," "], ["variable","Q%"], ["keyword.operator","="], ["identifier","Q"], ["text","%"], ["keyword.operator","-"], ["identifier","S"], ["text","%"] ],[ "start", ["constant.numeric","640"], ["text"," "], ["keyword.control","IF"], ["text"," "], ["variable","Q%"], ["keyword.operator","=<"], ["identifier","CVT"], ["paren.lparen","("], ["identifier","R"], ["text","$"], ["paren.rparen",")"], ["text"," "], ["keyword.control","THEN"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["string","\"QUANTITY NOW\""], ["punctiation",";"], ["identifier","Q"], ["text","%"], ["punctiation",";"] ],[ "start", ["constant.numeric","44"], ["text"," "], ["identifier","REORDER"], ["text"," "], ["identifier","LEVEL"], ["text","\""], ["punctiation",";"], ["support.function","CVI"], ["paren.lparen","("], ["identifier","RH"], ["paren.rparen",")"] ],[ "start", ["entity.name","LSET"], ["text"," "], ["variable","Q$"], ["keyword.operator","="], ["identifier","MKU"], ["paren.lparen","("], ["identifier","Q"], ["text","%"], ["paren.rparen",")"] ],[ "start", ["entity.name","PUT"], ["text","#"], ["constant.numeric","1"], ["punctiation",","], ["identifier","PART"], ["text","%"] ],[ "start", ["keyword.control","RETURN"] ],[ "start", ["identifier","DISPLAY"], ["text"," "], ["identifier","ITEMS"], ["text"," "], ["identifier","BELOW"], ["text"," "], ["identifier","REORDER"], ["text"," "], ["identifier","LEVEL"] ],[ "start", ["keyword.control","FOR"], ["text"," "], ["constant.numeric","1"], ["keyword.operator","="], ["constant.numeric","1"], ["text"," "], ["keyword.control","TO"], ["text"," "], ["constant.numeric","100"] ],[ "start", ["entity.name","GET"], ["text","#"], ["constant.numeric","1"], ["identifier","J"] ],[ "start", ["keyword.control","IF"], ["text"," "], ["identifier","OVI"], ["paren.lparen","("], ["identifier","tzH"], ["paren.rparen",")"], ["identifier","OVI"], ["paren.lparen","("], ["identifier","RH"], ["paren.rparen",")"], ["text"," "], ["keyword.control","THEN"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["identifier","Dtz"], ["punctiation",";"], ["string","\" QUANTITY\""], ["punctiation",";"] ],[ "start", ["identifier","OVI"], ["paren.lparen","("], ["identifier","Qtz"], ["paren.rparen",")"], ["text"," "], ["support.function","TAB"], ["paren.lparen","("], ["constant.numeric","50"], ["paren.rparen",")"], ["text"," "], ["string","\"REORDER LEVEL\""], ["punctiation",";"], ["support.function","CVI"], ["paren.lparen","("], ["identifier","R"], ["text","$"], ["paren.rparen",")"] ],[ "start", ["keyword.control","NEXT"], ["text"," "], ["identifier","I"] ],[ "start", ["keyword.control","RETURN"] ],[ "start", ["entity.name","INPUT"], ["text"," "], ["string","\"PART NUMBER\""], ["punctiation",";"], ["identifier","PART"], ["text","%"] ],[ "start", ["keyword.control","IF"], ["paren.lparen","("], ["identifier","PART"], ["text","%"], ["keyword.operator","<"], ["constant.numeric","1"], ["paren.rparen",")"], ["keyword.operator","OR"], ["paren.lparen","("], ["identifier","PART"], ["text","%"], ["keyword.operator",">"], ["constant.numeric","100"], ["paren.rparen",")"], ["text"," "], ["keyword.control","THEN"], ["text"," "], ["entity.name","PRINT"], ["text"," "], ["string","\"BAD PART NUMBER\""], ["text",": "], ["keyword.control","GOTO"], ["text"," "], ["constant.numeric","840"], ["text"," "], ["keyword.control","ELSE"], ["text"," "], ["entity.name","GET"], ["text","#"], ["constant.numeric","1"], ["text"," "], ["identifier","J"], ["keyword.operator",">"], ["identifier","ART"], ["text","%:"], ["keyword.control","RETURN"] ],[ "start", ["entity.name","END"] ],[ "start", ["comment","REM INITIALIZE FILE"] ],[ "start", ["entity.name","INPUT"], ["text"," "], ["string","\"ARE YOU SURE\""], ["punctiation",";"], ["identifier","B"], ["text","$:"], ["keyword.control","IF"], ["text"," "], ["identifier","B"], ["text","$"], ["keyword.operator","<="], ["string","\"Y\""], ["text"," "], ["keyword.control","THEN"], ["text"," "], ["keyword.control","RETURN"] ],[ "start", ["entity.name","LSET"], ["text"," "], ["variable","F$"], ["keyword.operator","="], ["support.function","CHR$"], ["paren.lparen","("], ["constant.numeric","255"], ["paren.rparen",")"] ],[ "start", ["keyword.control","FOR"], ["text"," "], ["variable","O"], ["keyword.operator","="], ["constant.numeric","1"], ["text"," "], ["keyword.control","TO"], ["text"," "], ["constant.numeric","100"] ],[ "start", ["entity.name","PUT"], ["text","#"], ["constant.numeric","1"], ["identifier","J"] ],[ "start", ["keyword.control","NEXT"], ["text"," "], ["identifier","I"] ],[ "start", ["keyword.control","RETURN"] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_bibtex.json ================================================ [[ "bibtexComment", ["comment","@Comment{"] ],[ ["bibtexComment","bibtexComment"], ["comment"," @Book{tes03,"] ],[ ["bibtexComment","bibtexComment"], ["comment"," author =\t {John Smith},"] ],[ ["bibtexComment","bibtexComment"], ["comment"," title =\t {Cooking},"] ],[ ["bibtexComment","bibtexComment"], ["comment"," publisher =\t {Culinary Expert},"] ],[ ["bibtexComment","bibtexComment"], ["comment"," year =\t 1890"] ],[ "bibtexComment", ["comment"," }"] ],[ "start", ["comment","}"] ],[ "start" ],[ "start", ["keyword","@String"], ["paren.lparen","("], ["variable","mar"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"march\""], ["paren.rparen",")"] ],[ "start" ],[ "keyword3", ["keyword","@Book"], ["paren.lparen","{"], ["support.class","sweig-42"], ["punctuation",","] ],[ "keyword3", ["text"," "], ["variable","Author"], ["text"," "], ["keyword.operator","="], ["text","\t "], ["paren.lparen","{"], ["string"," Stefan Sweig "], ["paren.rparen","}"], ["punctuation",","] ],[ "keyword3", ["text"," "], ["variable","title"], ["text"," "], ["keyword.operator","="], ["text","\t "], ["paren.lparen","{"], ["string"," The impossible book "], ["paren.rparen","}"], ["punctuation",","] ],[ "keyword3", ["text"," "], ["variable","publisher"], ["text"," "], ["keyword.operator","="], ["text","\t "], ["paren.lparen","{"], ["string"," Dead Poet Society"], ["paren.rparen","}"], ["punctuation",","] ],[ "keyword3", ["text"," "], ["variable","year"], ["text"," "], ["keyword.operator","="], ["text","\t "], ["constant.numeric.bibtex","1942"], ["punctuation",","] ],[ ["variable","keyword3"], ["text"," "], ["variable","month"], ["text"," "], ["keyword.operator","="], ["text"," mar"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","@String"], ["text"," "], ["paren.lparen","{"], ["variable","firstname"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"John\""], ["paren.rparen","}"] ],[ "start", ["keyword","@String"], ["text"," "], ["paren.lparen","{"], ["variable","lastname"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Smith\""], ["paren.rparen","}"] ],[ "start", ["keyword","@String"], ["text"," "], ["paren.lparen","{"], ["variable","email"], ["text"," "], ["keyword.operator","="], ["text"," firstname "], ["keyword.operator","#"], ["text"," "], ["string","\".\""], ["text"," "], ["keyword.operator","#"], ["text"," lastname "], ["keyword.operator","#"], ["text"," "], ["string","\"@imag.en\""], ["paren.rparen","}"] ],[ "start" ],[ "keyword3", ["keyword","@Article"], ["paren.lparen","{"], ["support.class","key01"], ["punctuation",","] ],[ ["variable","keyword3"], ["text"," "], ["variable","title"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"], ["string"," The history of "], ["invalid.illegal","@"], ["string"," sign "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","Everything \" \" outside {entries} is treated as comment in BibTeX."] ],[ "start" ],[ "keyword3", ["keyword","@Article"], ["paren.lparen","{"], ["support.class","key03"], ["punctuation",","] ],[ ["variable","keyword3"], ["text"," "], ["variable","title"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"A "], ["paren.lparen","{"], ["string","bunch "], ["paren.lparen","{"], ["string","of"], ["paren.rparen","}"], ["string"," braces "], ["paren.lparen","{"], ["string","in"], ["paren.rparen","}}"], ["string"," title\""] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","@preamble"], ["text"," "], ["paren.lparen","{"], ["string","\"This bibliography was generated on \\today\""], ["paren.rparen","}"] ]] ================================================ FILE: src/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: src/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: src/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: src/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"] ],[ "start" ],[ "regex", ["keyword","("], ["support.function","print"], ["text"," "], ["keyword","("], ["support.function","re-matches"], ["text"," "], ["string.regexp","#\"abc"], ["constant.language.escape","(.*)"] ],[ "string", ["string.regexp"," "], ["constant.language.escape","("], ["string.regexp","r"], ["constant.language.escape",")"], ["string.regexp","\""], ["text"," "], ["string","\"abcxyz"] ],[ "start", ["string"," r\""], ["keyword",")"], ["text"," "], ["keyword",")"] ]] ================================================ FILE: src/mode/_test/tokens_cobol.json ================================================ [[ "start", ["identifier","TODO"] ]] ================================================ FILE: src/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: src/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: src/mode/_test/tokens_crystal.json ================================================ [[ "start", ["comment","# crystal comment"] ],[ "start" ],[ "start", ["keyword","require"], ["text"," "], ["string.start","\""], ["string","llvm"], ["string.end","\""] ],[ "start" ],[ "start", ["support.class","NUM_CELLS"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","30000"] ],[ "start", ["support.class","CELL_SIZE_IN_BYTES"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"] ],[ "start" ],[ "start", ["keyword","abstract"], ["text"," "], ["keyword","class"], ["text"," "], ["support.class","Instruction"] ],[ "start", ["text"," "], ["keyword","abstract"], ["text"," "], ["keyword","def"], ["text"," "], ["identifier","compile"], ["paren.lparen","("], ["identifier","program"], ["punctuation.operator",","], ["text"," "], ["identifier","bb"], ["paren.rparen",")"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","class"], ["text"," "], ["support.class","Increment"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["support.class","Instruction"] ],[ "start", ["text"," "], ["keyword","def"], ["text"," "], ["support.function","initialize"], ["paren.lparen","("], ["variable.instance","@amount"], ["text"," "], ["keyword.operator",":"], ["text"," "], ["support.class","Int32"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","end"] ],[ "start" ],[ "start", ["text"," "], ["keyword","def"], ["text"," "], ["identifier","compile"], ["paren.lparen","("], ["identifier","program"], ["punctuation.operator",","], ["text"," "], ["identifier","bb"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","cell_val_is_zero"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","builder"], ["punctuation.operator","."], ["support.function","icmp"], ["text"," "], ["support.class","LLVM"], ["text","::"], ["support.class","IntPredicate"], ["text","::"], ["support.class","EQ"], ["punctuation.operator",","], ["text"," "], ["identifier","cell_val"], ["punctuation.operator",","], ["text"," "], ["identifier","zero"] ],[ "start", ["text"," "], ["identifier","call_args"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","["], ["variable.instance","@ctx"], ["punctuation.operator","."], ["support.function","int32"], ["punctuation.operator","."], ["support.function","const_int"], ["paren.lparen","("], ["support.class","NUM_CELLS"], ["paren.rparen",")"], ["punctuation.operator",","], ["text"," "], ["variable.instance","@ctx"], ["punctuation.operator","."], ["support.function","int32"], ["punctuation.operator","."], ["support.function","const_int"], ["paren.lparen","("], ["support.class","CELL_SIZE_IN_BYTES"], ["paren.rparen",")]"] ],[ "start", ["text"," "], ["identifier","builder"], ["punctuation.operator","."], ["support.function","cond"], ["text"," "], ["identifier","cell_val_is_zero"], ["punctuation.operator",","], ["text"," "], ["identifier","loop_after"], ["punctuation.operator",","], ["text"," "], ["identifier","loop_body_block"] ],[ "start" ],[ "start", ["text"," "], ["variable.instance","@body"], ["punctuation.operator","."], ["support.function","each"], ["text"," "], ["keyword","do"], ["text"," "], ["keyword.operator","|"], ["identifier","instruction"], ["keyword.operator","|"] ],[ "start", ["text"," "], ["identifier","loop_body_block"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","instruction"], ["punctuation.operator","."], ["support.function","compile"], ["paren.lparen","("], ["identifier","program"], ["punctuation.operator",","], ["text"," "], ["identifier","loop_body_block"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","end"] ],[ "start" ],[ "start", ["text"," "], ["identifier","builder"], ["punctuation.operator","."], ["support.function","position_at_end"], ["text"," "], ["identifier","loop_body_block"] ],[ "start" ],[ "start", ["text"," "], ["keyword","unless"], ["text"," "], ["identifier","matching_close_index"] ],[ "start", ["text"," "], ["identifier","error"], ["text"," "], ["string.start","\""], ["string","Unmatched '[' at position "], ["paren.start","#{"], ["identifier","i"], ["paren.end","}"], ["string.end","\""] ],[ "start", ["text"," "], ["keyword","end"] ],[ "start" ],[ "start", ["text"," "], ["identifier","bb"] ],[ "start", ["text"," "], ["keyword","end"] ],[ "start", ["keyword","end"] ],[ "start" ]] ================================================ FILE: src/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: src/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: src/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: src/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","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: src/mode/_test/tokens_csp.json ================================================ [[ "start", ["constant.language","child-src"] ],[ "start", ["constant.language","connect-src"] ],[ "start", ["constant.language","default-src"] ],[ "start", ["constant.language","font-src"] ],[ "start", ["constant.language","frame-src"] ],[ "start", ["constant.language","img-src"] ],[ "start", ["constant.language","manifest-src"] ],[ "start", ["constant.language","media-src"] ],[ "start", ["constant.language","object-src"] ],[ "start", ["constant.language","script-src"] ],[ "start", ["constant.language","style-src"] ],[ "start", ["constant.language","worker-src"] ],[ "start", ["constant.language","base-uri"] ],[ "start", ["constant.language","plugin-types"] ],[ "start", ["constant.language","sandbox"] ],[ "start", ["constant.language","disown-opener"] ],[ "start", ["constant.language","form-action"] ],[ "start", ["constant.language","frame-ancestors"] ],[ "start", ["constant.language","report-uri"] ],[ "start", ["constant.language","report-to"] ],[ "start", ["constant.language","upgrade-insecure-requests"] ],[ "start", ["constant.language","block-all-mixed-content"] ],[ "start", ["constant.language","require-sri-for"] ],[ "start", ["constant.language","reflected-xss"] ],[ "start", ["constant.language","referrer"] ],[ "start", ["constant.language","policy-uri"] ],[ "start", ["variable","'self'"] ],[ "start", ["variable","'unsafe-inline'"] ],[ "start", ["variable","'unsafe-eval'"] ],[ "start", ["variable","'strict-dynamic'"] ],[ "start", ["variable","'unsafe-hashed-attributes'"] ]] ================================================ FILE: src/mode/_test/tokens_css.json ================================================ [[ "ruleset", ["variable",".text-layer"], ["text"," "], ["paren.lparen","{"] ],[ "ruleset", ["text"," "], ["support.type","font"], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","12"], ["keyword","px"], ["text"," Monaco, "], ["string.start","\""], ["string","Courier New"], ["string.end","\""], ["text",", "], ["support.constant.fonts","monospace"], ["punctuation.operator",";"] ],[ "ruleset", ["text"," "], ["support.type","cursor"], ["punctuation.operator",":"], ["text"," "], ["support.constant","text"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "ruleset", ["variable",".blinker"], ["text"," "], ["paren.lparen","{"] ],[ "ruleset", ["text"," "], ["support.type","animation"], ["punctuation.operator",":"], ["text"," blink "], ["constant.numeric","1"], ["keyword","s"], ["text"," "], ["support.constant","linear"], ["text"," infinite alternate"], ["punctuation.operator",";"] ],[ "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"], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"], ["text"," "], ["comment","/*"] ],[ "ruleset", ["comment"," */"] ],[ "ruleset", ["text"," "], ["support.type","opacity"], ["punctuation.operator",":"], ["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"], ["punctuation.operator",":"], ["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"], ["punctuation.operator",":"], ["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)"], ["punctuation.operator",";"], ["text"," "], ["comment","/*"] ],[ "ruleset", ["comment"," */"] ],[ "ruleset", ["text"," "], ["support.type","white-space"], ["punctuation.operator",":"], ["text"," "], ["support.constant","pre"], ["punctuation.operator",";"] ],[ "ruleset", ["text"," "], ["support.type","display"], ["punctuation.operator",":"], ["text"," "], ["support.constant","block"], ["punctuation.operator",";"] ],[ "ruleset", ["text"," "], ["support.type","background"], ["punctuation.operator",":"], ["text"," "], ["support.function","url("], ["string","asdasd"], ["support.function",")"], ["punctuation.operator",";"], ["text"," "], ["string.start","\""], ["string","err"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_csv.json ================================================ [[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator",","], ["text.csv_1","col2 long"], ["string.csv_2.csv_separator",","], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator",","], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator",","] ],[ "start", ["keyword.csv_0","\""], ["keyword.csv_0","col1"], ["keyword.csv_0",","], ["keyword.csv_0","with quotes"], ["keyword.csv_0","\""], ["text.csv_1.csv_separator",","], ["text.csv_1","col2"], ["string.csv_2.csv_separator",","], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator",","], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator",","] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator",","], ["text.csv_1","col2"], ["string.csv_2.csv_separator",","], ["string.csv_2","col"], ["string.csv_2","\""], ["string.csv_2","\""], ["string.csv_2","\""], ["string.csv_2","3"], ["string.regex.csv_3.csv_separator",","], ["string.regex.csv_3","co"], ["string.regex.csv_3","\""], ["string.regex.csv_3","\""], ["string.regex.csv_3","l4"], ["variable.csv_4.csv_separator",","] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator",","], ["text.csv_1","col2"], ["string.csv_2.csv_separator",","], ["string.csv_2","col3"], ["string.csv_2","\""], ["string.csv_2","broken"], ["string.csv_2","\""], ["string.regex.csv_3.csv_separator",","], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator",","] ],[ "start", ["keyword.csv_0","col1"], ["keyword.csv_0","\""], ["text.csv_1.csv_separator",","], ["text.csv_1","-"], ["text.csv_1","\""], ["text.csv_1","col2"], ["string.csv_2.csv_separator",","], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator",","], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator",","], ["variable.csv_4","col5"] ],[ "string-1", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator",","], ["text.csv_1","\""], ["text.csv_1","col2"] ],[ "string-2", ["text.csv_1","multiline"], ["text.csv_1","\""], ["string.csv_2.csv_separator",","], ["string.csv_2","\""], ["string.csv_2","col3"] ],[ "string-2", ["string.csv_2","multiline"], ["string.csv_2","\"\""], ["string.csv_2","string"] ],[ "string-3", ["string.csv_2","3"], ["string.csv_2","\""], ["string.regex.csv_3.csv_separator",","], ["string.regex.csv_3","\""], ["string.regex.csv_3","col4"] ],[ "string-3", ["string.regex.csv_3","multiline string"] ],[ "string-3" ],[ "start", ["string.regex.csv_3","4"], ["string.regex.csv_3","\""] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator",","], ["text.csv_1","col2"], ["string.csv_2.csv_separator",","], ["string.csv_2","\""], ["string.csv_2","c"], ["string.csv_2",","], ["string.csv_2","o"], ["string.csv_2",","], ["string.csv_2","l"], ["string.csv_2","\"\""], ["string.csv_2","3"], ["string.csv_2","\""], ["string.regex.csv_3.csv_separator",","], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator",","], ["variable.csv_4","col5"], ["constant.numeric.csv_5.csv_separator",","], ["constant.numeric.csv_5","col6"], ["keyword.csv_6.csv_separator",","], ["keyword.csv_6","col7"], ["text.csv_7.csv_separator",","], ["text.csv_7","col8"], ["string.csv_8.csv_separator",","], ["string.csv_8","col9"], ["string.regex.csv_9.csv_separator",","], ["string.regex.csv_9","col10"], ["variable.csv_10.csv_separator",","], ["variable.csv_10","col11"], ["constant.numeric.csv_11.csv_separator",","], ["constant.numeric.csv_11","col12"], ["keyword.csv_12.csv_separator",","], ["keyword.csv_12","col13"] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator",","], ["text.csv_1","col2"], ["string.csv_2.csv_separator",","], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator",","], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator",","], ["variable.csv_4","col5"], ["constant.numeric.csv_5.csv_separator",","], ["constant.numeric.csv_5","col6"], ["keyword.csv_6.csv_separator",","], ["keyword.csv_6","col7"], ["text.csv_7.csv_separator",","], ["text.csv_7","col8"], ["string.csv_8.csv_separator",","], ["string.csv_8","col9"], ["string.regex.csv_9.csv_separator",","], ["string.regex.csv_9","col10"], ["variable.csv_10.csv_separator",","], ["variable.csv_10","col11"], ["constant.numeric.csv_11.csv_separator",","], ["constant.numeric.csv_11","col12"], ["keyword.csv_12.csv_separator",","], ["keyword.csv_12","col13"] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator",","], ["text.csv_1","col2"], ["string.csv_2.csv_separator",","], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator",","], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator",","], ["variable.csv_4","col5"], ["constant.numeric.csv_5.csv_separator",","], ["constant.numeric.csv_5","col6"], ["keyword.csv_6.csv_separator",","], ["keyword.csv_6","co"], ["keyword.csv_6","\""], ["keyword.csv_6","l7"], ["text.csv_7.csv_separator",","], ["text.csv_7","col8"], ["string.csv_8.csv_separator",","], ["string.csv_8","col9"], ["string.regex.csv_9.csv_separator",","], ["string.regex.csv_9","col10"], ["variable.csv_10.csv_separator",","], ["variable.csv_10","11"], ["constant.numeric.csv_11.csv_separator",","], ["constant.numeric.csv_11","col12"], ["keyword.csv_12.csv_separator",","], ["keyword.csv_12","col13"] ],[ "start" ]] ================================================ FILE: src/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: src/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: src/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) = "], ["text","${fib(20)}"], ["string","'"], ["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: src/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: src/mode/_test/tokens_django.json ================================================ [[ "start", ["constant.language","{%"], ["text"," "], ["entity.name.function","extends"], ["text"," "], ["string","\"base.html\""], ["text"," "], ["constant.language","%}"] ],[ "start" ],[ "start", ["constant.language","{%"], ["text"," "], ["entity.name.function","block"], ["text"," "], ["variable","title"], ["text"," "], ["constant.language","%}"], ["text.xml","Ace Django Template"], ["constant.language","{%"], ["text"," "], ["entity.name.function","endblock"], ["text"," "], ["constant.language","%}"] ],[ "start" ],[ "start", ["constant.language","{%"], ["text"," "], ["entity.name.function","block"], ["text"," "], ["variable","content"], ["text"," "], ["constant.language","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h1"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Hello, "], ["constant.language","{{"], ["text"," "], ["variable","name"], ["text","|"], ["variable","default:"], ["string","\"World\""], ["text"," "], ["constant.language","}}"], ["text.xml","!"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["constant.language","{%"], ["text"," "], ["entity.name.function","endblock"], ["text"," "], ["constant.language","%}"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"formatted\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"test-class-1 "], ["constant.language","{{"], ["text"," "], ["variable","variable_class"], ["text"," "], ["constant.language","}}"], ["string.attribute-value.xml"," test-class-2\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","data-attribute"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"unformatted\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "comment.block", ["comment.block","{% comment %}"] ],[ "comment.block", ["comment.block"," This content should be green."] ],[ "start", ["comment.block","{% endcomment %}"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["comment.line","{#line comment#}"], ["meta.tag.punctuation.end-tag-open.xml",""] ]] ================================================ FILE: src/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: src/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.body"," * "], ["comment.doc.tag","@param"], ["comment.doc.body"," name who we'll salute?"] ],[ "start", ["comment.doc.body"," "], ["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","java-start"], ["text"," "], ["comment.doc","/**"] ],[ ["java-doc-start","java-start"], ["comment.doc.body"," * "], ["comment.doc.tag.storage.type","TODO"], ["comment.doc.body"," There mus be better way"] ],[ "java-start", ["comment.doc.body"," "], ["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","."], ["entity.name.function","toString"], ["lparen","("], ["rparen",")"], ["text",";"] ],[ "java-start" ],[ "java-start", ["text"," "], ["support.function","insert"], ["lparen","("], ["identifier","$s"], ["text","."], ["entity.name.function","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","."], ["entity.name.function","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","."], ["entity.name.function","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","."], ["entity.name.function","println"], ["lparen","("], ["text"," "], ["string","\"Draw in the House\""], ["text"," "], ["rparen",")"], ["text",";"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "doc-start", ["comment.doc","/**"] ],[ "doc-start", ["comment.doc.body"," * Go Right"] ],[ "start", ["comment.doc.body"," "], ["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","."], ["entity.name.function","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"," "], ["entity.name.function","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: src/mode/_test/tokens_edifact.json ================================================ [[ "start", ["entity.name.segment","UNB"], ["keyword.operator","+"], ["keyword","UNOA"], ["punctuation.operator",":"], ["text","1"], ["keyword.operator","+"], ["text","005435656"], ["punctuation.operator",":"], ["text","1"], ["keyword.operator","+"], ["text","006415160"], ["punctuation.operator",":"], ["text","1"], ["keyword.operator","+"], ["text","060515"], ["punctuation.operator",":"], ["text","1434"], ["keyword.operator","+"], ["text","00000000000778"], ["punctuation.operator","'"] ],[ "start", ["entity.name.header","UNH"], ["keyword.operator","+"], ["text","00000000000117"], ["keyword.operator","+"], ["identifier","INVnrOIC"], ["punctuation.operator",":"], ["identifier","D"], ["punctuation.operator",":"], ["text","97"], ["identifier","B"], ["punctuation.operator",":"], ["identifier","UN"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","BGM"], ["keyword.operator","+"], ["text","380"], ["keyword.operator","+"], ["text","342459"], ["keyword.operator","+"], ["text","9"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","DTM"], ["keyword.operator","+"], ["text","3"], ["punctuation.operator",":"], ["text","20060515"], ["punctuation.operator",":"], ["text","102"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","RFF"], ["keyword.operator","+"], ["keyword","ON"], ["punctuation.operator",":"], ["text","521052"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","NAD"], ["keyword.operator","+"], ["keyword","BY"], ["keyword.operator","+"], ["text","792820524"], ["punctuation.operator","::"], ["text","16"], ["keyword.operator","++"], ["identifier","CUMMINS"], ["text"," "], ["identifier","MID"], ["text","-"], ["identifier","RANGE"], ["text"," "], ["identifier","ENGINE"], ["text"," "], ["identifier","PLANT"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","NAD"], ["keyword.operator","+"], ["keyword","SE"], ["keyword.operator","+"], ["text","005435656"], ["punctuation.operator","::"], ["text","16"], ["keyword.operator","++"], ["identifier","GENERAL"], ["text"," "], ["identifier","WIDGET"], ["text"," "], ["identifier","COMPANY"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","CUX"], ["keyword.operator","+"], ["text","1"], ["punctuation.operator",":"], ["identifier","USD"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","LIN"], ["punctuation.operator","+1+"], ["keyword.operator","+"], ["text","157870"], ["punctuation.operator",":"], ["identifier","IN"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","IMD"], ["punctuation.operator","+F+"], ["keyword.operator","+"], ["punctuation.operator",":::"], ["identifier","WIDGET"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","QTY"], ["keyword.operator","+"], ["text","47"], ["punctuation.operator",":"], ["text","1020"], ["punctuation.operator",":"], ["identifier","EA"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","ALI"], ["keyword.operator","+"], ["identifier","US"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","MOA"], ["keyword.operator","+"], ["text","203"], ["punctuation.operator",":"], ["text","1202.58"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","PRI"], ["keyword.operator","+"], ["entity.name.segment","INV"], ["punctuation.operator",":"], ["text","1.179"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","LIN"], ["punctuation.operator","+2+"], ["keyword.operator","+"], ["text","157871"], ["punctuation.operator",":"], ["identifier","IN"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","IMD"], ["punctuation.operator","+F+"], ["keyword.operator","+"], ["punctuation.operator",":::"], ["identifier","DIFFERENT"], ["text"," "], ["identifier","WIDGET"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","QTY"], ["keyword.operator","+"], ["text","47"], ["punctuation.operator",":"], ["text","20"], ["punctuation.operator",":"], ["identifier","EA"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","ALI"], ["keyword.operator","+"], ["keyword","JP"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","MOA"], ["keyword.operator","+"], ["text","203"], ["punctuation.operator",":"], ["text","410"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","PRI"], ["keyword.operator","+"], ["entity.name.segment","INV"], ["punctuation.operator",":"], ["text","20.5"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","UNS"], ["keyword.operator","+"], ["identifier","S"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","MOA"], ["keyword.operator","+"], ["text","39"], ["punctuation.operator",":"], ["text","2137.58"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","ALC"], ["punctuation.operator","+C+"], ["identifier","ABG"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","MOA"], ["keyword.operator","+"], ["text","8"], ["punctuation.operator",":"], ["text","525"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","UNT"], ["keyword.operator","+"], ["text","23"], ["keyword.operator","+"], ["text","00000000000117"], ["punctuation.operator","'"] ],[ "start", ["entity.name.segment","UNZ"], ["punctuation.operator","+1+"], ["text","00000000000778"], ["punctuation.operator","'"] ]] ================================================ FILE: src/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: src/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","."], ["support.function","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: src/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: src/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: src/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","."] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["punctuation.definition.comment.erlang","% Print the data using the pretty print specifier"] ],[ "start", ["text"," "], ["entity.name.type.class.module.erlang","io"], ["punctuation.separator.module-function.erlang",":"], ["entity.name.function.erlang","format"], ["punctuation.definition.parameters.begin.erlang","("], ["punctuation.definition.string.begin.erlang","\""], ["string.quoted.double.erlang","Here is the data: "], ["punctuation.definition.erlang","~"], ["constant.other.erlang","p"], ["punctuation.definition.erlang","~"], ["constant.other.erlang","n"], ["punctuation.definition.string.end.erlang","\""], ["punctuation.separator.parameters.erlang",","], ["text"," "], ["punctuation.definition.list.begin.erlang","["], ["variable.other.erlang","Data"], ["punctuation.definition.list.end.erlang","]"], ["punctuation.definition.parameters.end.erlang",")"], ["text","."] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_flix.json ================================================ [[ "start", ["comment.line","/// Mooo's `n` times on channel `c`."] ],[ "start", ["storage.type","def"], ["text"," "], ["identifier","mooo"], ["paren.lparen","("], ["identifier","tx"], ["text",": "], ["identifier","Sender"], ["paren.lparen","["], ["support.type","String"], ["text",", "], ["identifier","r"], ["paren.rparen","]"], ["text",", "], ["identifier","n"], ["text",": "], ["support.type","Int32"], ["paren.rparen",")"], ["text",": "], ["support.type","Unit"], ["text"," \\ "], ["identifier","IO"], ["text"," ="] ],[ "start", ["text"," "], ["keyword.control","match"], ["text"," "], ["identifier","n"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","case"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["text"," "], ["storage.type","case"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["identifier","Channel"], ["text","."], ["identifier","send"], ["paren.lparen","("], ["string","\"Mooo!\""], ["text",", "], ["identifier","tx"], ["paren.rparen",")"], ["text","; "], ["identifier","mooo"], ["paren.lparen","("], ["identifier","tx"], ["text",", "], ["identifier","x"], ["text"," - "], ["constant.numeric","1"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment.line","/// Meow's `n` times on channel `c`."] ],[ "start", ["storage.type","def"], ["text"," "], ["identifier","meow"], ["paren.lparen","("], ["identifier","tx"], ["text",": "], ["identifier","Sender"], ["paren.lparen","["], ["support.type","String"], ["text",", "], ["identifier","r"], ["paren.rparen","]"], ["text",", "], ["identifier","n"], ["text",": "], ["support.type","Int32"], ["paren.rparen",")"], ["text",": "], ["support.type","Unit"], ["text"," \\ "], ["identifier","IO"], ["text"," ="] ],[ "start", ["text"," "], ["keyword.control","match"], ["text"," "], ["identifier","n"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","case"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["text"," "], ["storage.type","case"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["identifier","Channel"], ["text","."], ["identifier","send"], ["paren.lparen","("], ["string","\"Meow!\""], ["text",", "], ["identifier","tx"], ["paren.rparen",")"], ["text","; "], ["identifier","meow"], ["paren.lparen","("], ["identifier","tx"], ["text",", "], ["identifier","x"], ["text"," - "], ["constant.numeric","1"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment.line","/// Hiss'es `n` times on channel `c`."] ],[ "start", ["storage.type","def"], ["text"," "], ["identifier","hiss"], ["paren.lparen","("], ["identifier","tx"], ["text",": "], ["identifier","Sender"], ["paren.lparen","["], ["support.type","String"], ["text",", "], ["identifier","r"], ["paren.rparen","]"], ["text",", "], ["identifier","n"], ["text",": "], ["support.type","Int32"], ["paren.rparen",")"], ["text",": "], ["support.type","Unit"], ["text"," \\ "], ["identifier","IO"], ["text"," ="] ],[ "start", ["text"," "], ["keyword.control","match"], ["text"," "], ["identifier","n"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","case"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["text"," "], ["storage.type","case"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["identifier","Channel"], ["text","."], ["identifier","send"], ["paren.lparen","("], ["string","\"Hiss!\""], ["text",", "], ["identifier","tx"], ["paren.rparen",")"], ["text","; "], ["identifier","hiss"], ["paren.lparen","("], ["identifier","tx"], ["text",", "], ["identifier","x"], ["text"," - "], ["constant.numeric","1"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment.line","/// Start the animal farm..."] ],[ "start", ["storage.type","def"], ["text"," "], ["identifier","main"], ["paren.lparen","("], ["paren.rparen",")"], ["text",": "], ["support.type","Unit"], ["text"," \\ "], ["identifier","IO"], ["text"," = "], ["keyword","region"], ["text"," "], ["identifier","rc"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","let"], ["text"," "], ["paren.lparen","("], ["identifier","tx1"], ["text",", "], ["identifier","rx1"], ["paren.rparen",")"], ["text"," = "], ["identifier","Channel"], ["text","."], ["identifier","buffered"], ["paren.lparen","("], ["identifier","rc"], ["text",", "], ["constant.numeric","10"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text"," "], ["storage.type","let"], ["text"," "], ["paren.lparen","("], ["identifier","tx2"], ["text",", "], ["identifier","rx2"], ["paren.rparen",")"], ["text"," = "], ["identifier","Channel"], ["text","."], ["identifier","buffered"], ["paren.lparen","("], ["identifier","rc"], ["text",", "], ["constant.numeric","10"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text"," "], ["storage.type","let"], ["text"," "], ["paren.lparen","("], ["identifier","tx3"], ["text",", "], ["identifier","rx3"], ["paren.rparen",")"], ["text"," = "], ["identifier","Channel"], ["text","."], ["identifier","buffered"], ["paren.lparen","("], ["identifier","rc"], ["text",", "], ["constant.numeric","10"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text"," "], ["keyword.control","spawn"], ["text"," "], ["identifier","mooo"], ["paren.lparen","("], ["identifier","tx1"], ["text",", "], ["constant.numeric","0"], ["paren.rparen",")"], ["text"," @ "], ["identifier","rc"], ["text",";"] ],[ "start", ["text"," "], ["keyword.control","spawn"], ["text"," "], ["identifier","meow"], ["paren.lparen","("], ["identifier","tx2"], ["text",", "], ["constant.numeric","3"], ["paren.rparen",")"], ["text"," @ "], ["identifier","rc"], ["text",";"] ],[ "start", ["text"," "], ["keyword.control","spawn"], ["text"," "], ["identifier","hiss"], ["paren.lparen","("], ["identifier","tx3"], ["text",", "], ["constant.numeric","7"], ["paren.rparen",")"], ["text"," @ "], ["identifier","rc"], ["text",";"] ],[ "start", ["text"," "], ["keyword","select"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","case"], ["text"," "], ["identifier","m"], ["text"," "], ["keyword.operator","<-"], ["text"," "], ["identifier","recv"], ["paren.lparen","("], ["identifier","rx1"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["identifier","m"], ["text"," |> "], ["identifier","println"] ],[ "start", ["text"," "], ["storage.type","case"], ["text"," "], ["identifier","m"], ["text"," "], ["keyword.operator","<-"], ["text"," "], ["identifier","recv"], ["paren.lparen","("], ["identifier","rx2"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["identifier","m"], ["text"," |> "], ["identifier","println"] ],[ "start", ["text"," "], ["storage.type","case"], ["text"," "], ["identifier","m"], ["text"," "], ["keyword.operator","<-"], ["text"," "], ["identifier","recv"], ["paren.lparen","("], ["identifier","rx3"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["identifier","m"], ["text"," |> "], ["identifier","println"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: src/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: src/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: src/mode/_test/tokens_fsharp.json ================================================ [[ "start", ["comment.start","(*"], ["comment"," fsharp "], ["comment.start","(*"], ["comment"," example "], ["comment.end","*)"], ["comment"," "], ["comment.end","*)"] ],[ "start", ["keyword","module"], ["text"," "], ["identifier","Test"], ["text"," "], ["keyword.operator","="] ],[ "start", ["text"," "], ["keyword","let"], ["text"," "], ["identifier","func1"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","="], ["text"," "] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["constant.integer","100"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["identifier","x"], ["keyword.operator","*"], ["identifier","x"] ],[ "start", ["text"," "], ["keyword","else"] ],[ "start", ["text"," "], ["identifier","x"], ["keyword.operator","*"], ["identifier","x"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.integer","1"] ],[ "start", ["text"," "], ["keyword","let"], ["text"," "], ["identifier","list"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["keyword.operator","-"], ["constant.integer","1"], ["text",", "], ["constant.integer","42"], ["paren.rparen",")"], ["text"," :: "], ["paren.lparen","["], ["text"," "], ["keyword","for"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword","in"], ["text"," "], ["constant.integer","0"], ["text"," .. "], ["constant.integer","99"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["paren.lparen","("], ["identifier","i"], ["text",", "], ["identifier","func1"], ["paren.lparen","("], ["identifier","i"], ["paren.rparen","))"], ["text"," "], ["paren.rparen","]"] ],[ "start", ["text"," "], ["keyword","let"], ["text"," "], ["identifier","verbatim"], ["text"," "], ["keyword.operator","="], ["text"," "], ["verbatim.string","@"], ["string","\""], ["string","c:\\Program "], ["constant.language.escape","\"\""], ["string"," Files\\\""] ],[ "start", ["text"," "], ["keyword","let"], ["text"," "], ["identifier","trippleQuote"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"\"\" \"hello world\" \"\"\""] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["comment","// print"] ],[ "start", ["text"," "], ["identifier","printfn"], ["text"," "], ["string","\"The table of squares from 0 to 99 is:"], ["constant.language.escape","\\n"], ["string","%A\""], ["text"," "], ["identifier","list"] ]] ================================================ FILE: src/mode/_test/tokens_fsl.json ================================================ [[ "start", ["constant.language.fslLanguage","machine_name :"], ["text"," "], ["string.quoted.double.fslLabel.doublequoted","\"BGP\""], ["text",";"] ],[ "start", ["constant.language.fslLanguage","machine_version :"], ["text"," "], ["constant.numeric","1.0.0"], ["text",";"] ],[ "start" ],[ "start", ["constant.language.fslLanguage","machine_author :"], ["text"," "], ["string.quoted.double.fslLabel.doublequoted","\"John Haugeland \""], ["text",";"] ],[ "start", ["constant.language.fslLanguage","machine_license :"], ["text"," "], ["entity.name.tag.fslLabel.atom","MIT"], ["text",";"] ],[ "start" ],[ "start", ["constant.language.fslLanguage","graph_layout :"], ["text"," "], ["entity.name.tag.fslLabel.atom","dot"], ["text",";"] ],[ "start" ],[ "start" ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Idle"], ["text"," "], ["constant.character.fslAction","'Invite'"], ["text"," "], ["keyword.control.transition.fslArrow","=>"], ["text"," "], ["entity.name.tag.fslLabel.atom","Invited"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Invited"], ["text"," "], ["constant.character.fslAction","'Invite, 1xx'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Invited"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Invited"], ["text"," "], ["constant.character.fslAction","'3xx'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Redirecting"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Invited"], ["text"," "], ["constant.character.fslAction","'Cancel'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Cancelling"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Invited"], ["text"," "], ["constant.character.fslAction","'200'"], ["text"," "], ["keyword.control.transition.fslArrow","=>"], ["text"," "], ["entity.name.tag.fslLabel.atom","Accepted"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Invited"], ["text"," "], ["constant.character.fslAction","'407'"], ["text"," "], ["keyword.control.transition.fslArrow","=>"], ["text"," "], ["entity.name.tag.fslLabel.atom","AuthRequested"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Invited"], ["text"," "], ["constant.character.fslAction","'4xx-6xx'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Failed"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","AuthRequested"], ["text"," "], ["constant.character.fslAction","'Ack'"], ["text"," "], ["keyword.control.transition.fslArrow","=>"], ["text"," "], ["entity.name.tag.fslLabel.atom","Invited"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Redirecting"], ["text"," "], ["constant.character.fslAction","'Act'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Redirected"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Cancelling"], ["text"," "], ["constant.character.fslAction","'200 (Invite)'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","LateCancel"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Cancelling"], ["text"," "], ["constant.character.fslAction","'200 (Cancel)'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Cancelled"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Accepted"], ["text"," "], ["constant.character.fslAction","'Cancel'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","LateCancel"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Accepted"], ["text"," "], ["constant.character.fslAction","'Ack'"], ["text"," "], ["keyword.control.transition.fslArrow","=>"], ["text"," "], ["entity.name.tag.fslLabel.atom","Established"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Failed"], ["text"," "], ["constant.character.fslAction","'Ack'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Terminated"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Redirected"], ["text"," "], ["constant.character.fslAction","'Invite'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Invited"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Redirected"], ["text"," "], ["constant.character.fslAction","'Timeout'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Terminated"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","LateCancel"], ["text"," "], ["constant.character.fslAction","'Ack'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Established"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Cancelled"], ["text"," "], ["constant.character.fslAction","'487'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Failed"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Established"], ["text"," "], ["constant.character.fslAction","'Invite'"], ["text"," "], ["keyword.control.transition.fslArrow","=>"], ["text"," "], ["entity.name.tag.fslLabel.atom","SessionModifying"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Established"], ["text"," "], ["constant.character.fslAction","'Bye'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Closing"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","SessionModifying"], ["text"," "], ["constant.character.fslAction","'488'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","SessionModificationRefused"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","SessionModifying"], ["text"," "], ["constant.character.fslAction","'200'"], ["text"," "], ["keyword.control.transition.fslArrow","=>"], ["text"," "], ["entity.name.tag.fslLabel.atom","SessionModified"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","Closing"], ["text"," "], ["constant.character.fslAction","'Bye,Ack,200 (Invite)'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Closing"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","Closing"], ["text"," "], ["constant.character.fslAction","'200 (Bye)'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Terminated"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","SessionModificationRefused"], ["text"," "], ["constant.character.fslAction","'Ack'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Established"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.fslLabel.atom","SessionModified"], ["text"," "], ["constant.character.fslAction","'Ack'"], ["text"," "], ["keyword.control.transition.fslArrow","=>"], ["text"," "], ["entity.name.tag.fslLabel.atom","Established"], ["text",";"] ],[ "start", ["entity.name.tag.fslLabel.atom","SessionModified"], ["text"," "], ["constant.character.fslAction","'Bye'"], ["text"," "], ["keyword.control.transition.fslArrow","->"], ["text"," "], ["entity.name.tag.fslLabel.atom","Closing"], ["text",";"] ],[ "start" ]] ================================================ FILE: src/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: src/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: src/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: src/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: src/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: src/mode/_test/tokens_gobstones.json ================================================ [[ "block_comment_end", ["comment.block.dash-asterisc.gobstones","/*"] ],[ "block_comment_end", ["comment.block.dash-asterisc.gobstones"," * A Gobstones implementation of Conwey's Game of Life"] ],[ "block_comment_end", ["comment.block.dash-asterisc.gobstones"," * that tries to use most of Gobstones syntax."] ],[ "block_comment_end", ["comment.block.dash-asterisc.gobstones"," *"] ],[ "block_comment_end", ["comment.block.dash-asterisc.gobstones"," * Check out more about Gobstones at http://gobstones.org"] ],[ "start", ["comment.block.dash-asterisc.gobstones"," */"] ],[ "start" ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start", ["comment.line.double-dash.gobstones","-- HELPERS TO MOVE AROUND ALL THE BOARD --"] ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start" ],[ "start", ["comment.line.double-slash.gobstones","// This helpers allow the user to move around the board"] ],[ "start", ["comment.line.double-slash.gobstones","// one cell at a time"] ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","GoToStartOfBoard"], ["lparen","("], ["identifier.gobstones","firstDir"], ["comma.gobstones",","], ["text"," "], ["identifier.gobstones","secondDir"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function.gobstones","IrAlBorde"], ["lparen","("], ["support.variable.gobstones","opuesto"], ["lparen","("], ["identifier.gobstones","firstDir"], ["rparen","))"] ],[ "start", ["text"," "], ["support.function.gobstones","IrAlBorde"], ["lparen","("], ["support.variable.gobstones","opuesto"], ["lparen","("], ["identifier.gobstones","secondDir"], ["rparen","))"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","function"], ["text"," "], ["identifier.gobstones","isEndOfBoard"], ["lparen","("], ["identifier.gobstones","firstDir"], ["comma.gobstones",","], ["text"," "], ["identifier.gobstones","secondDir"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["storage.type.definitions.gobstones","return"], ["text"," "], ["lparen","("], ["keyword.operator.boolean.gobstones","not"], ["text"," "], ["support.variable.gobstones","puedeMover"], ["lparen","("], ["identifier.gobstones","firstDir"], ["rparen",")"], ["text"," "], ["keyword.operator.boolean.gobstones","&&"], ["text"," "], ["keyword.operator.boolean.gobstones","not"], ["text"," "], ["support.variable.gobstones","puedeMover"], ["lparen","("], ["identifier.gobstones","secondDir"], ["rparen","))"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","NextCellOfTheBoard"], ["lparen","("], ["identifier.gobstones","firstDir"], ["comma.gobstones",","], ["text"," "], ["identifier.gobstones","secondDir"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword.control.commands.alternatives.gobstones","if"], ["text"," "], ["lparen","("], ["support.variable.gobstones","puedeMover"], ["lparen","("], ["identifier.gobstones","firstDir"], ["rparen","))"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function.gobstones","Mover"], ["lparen","("], ["identifier.gobstones","firstDir"], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"], ["text"," "], ["keyword.control.commands.alternatives.gobstones","else"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function.gobstones","IrAlBorde"], ["lparen","("], ["support.variable.gobstones","opuesto"], ["lparen","("], ["identifier.gobstones","firstDir"], ["rparen","))"] ],[ "start", ["text"," "], ["support.function.gobstones","Mover"], ["lparen","("], ["identifier.gobstones","secondDir"], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start", ["comment.line.double-dash.gobstones","-- TYPE DECLARATIONS --"] ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start", ["comment.line.double-slash.gobstones","// The cell type declarations"] ],[ "start", ["storage.type.types.gobstones","type"], ["text"," "], ["identifier.gobstones","CellStatus"], ["text"," "], ["storage.type.types.gobstones","is"], ["text"," "], ["storage.type.types.gobstones","variant"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["storage.type.types.gobstones","case"], ["text"," "], ["identifier.gobstones","Alive"], ["text"," "], ["lparen","{"], ["rparen","}"] ],[ "start", ["text"," "], ["storage.type.types.gobstones","case"], ["text"," "], ["identifier.gobstones","Dead"], ["text"," "], ["lparen","{"], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.types.gobstones","type"], ["text"," "], ["identifier.gobstones","Cell"], ["text"," "], ["storage.type.types.gobstones","is"], ["text"," "], ["storage.type.types.gobstones","record"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["storage.type.types.gobstones","field"], ["text"," "], ["identifier.gobstones","status"], ["text"," "], ["comment.line.number-sign.gobstones","# CellStatus"] ],[ "start", ["text"," "], ["storage.type.types.gobstones","field"], ["text"," "], ["identifier.gobstones","color"], ["text"," "], ["comment.line.number-sign.gobstones","# Color"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start" ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start", ["comment.line.double-dash.gobstones","-- PROGRAM DEFINITION --"] ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start", ["storage.type.definitions.gobstones","interactive"], ["text"," "], ["storage.type.definitions.gobstones","program"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["comment.line.number-sign.gobstones","# Map key press to actions"] ],[ "start", ["text"," "], ["variable.language.gobstones","K_UP"], ["text"," "], ["keyword.operator.other.gobstones","->"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier.gobstones","PrepareNextTick"], ["lparen","("], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["variable.language.gobstones","K_RIGHT"], ["text"," "], ["keyword.operator.other.gobstones","->"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier.gobstones","CompleteNextTick"], ["lparen","("], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["variable.language.gobstones","K_RETURN"], ["text"," "], ["keyword.operator.other.gobstones","->"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier.gobstones","SimulateNextTick"], ["lparen","("], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "block_comment_end", ["comment.block.dash-asterisc.gobstones","/*"] ],[ "block_comment_end", ["comment.block.dash-asterisc.gobstones","program {"] ],[ "block_comment_end", ["comment.block.dash-asterisc.gobstones"," return ( numberOfNeighbors())"] ],[ "block_comment_end", ["comment.block.dash-asterisc.gobstones","}"] ],[ "start", ["comment.block.dash-asterisc.gobstones","*/"] ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start", ["comment.line.double-dash.gobstones","-- FUNCTIONS --"] ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start", ["storage.type.definitions.gobstones","function"], ["text"," "], ["identifier.gobstones","isCellAlive"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["storage.type.definitions.gobstones","return"], ["text"," "], ["lparen","("], ["support.variable.gobstones","hayBolitas"], ["lparen","("], ["constant.language.colors.gobstones","Verde"], ["rparen","))"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","function"], ["text"," "], ["identifier.gobstones","cellStatus"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["storage.type.definitions.gobstones","return"], ["text"," "], ["lparen","("] ],[ "start", ["text"," "], ["keyword.control.expressions.alternatives.gobstones","choose"] ],[ "start", ["text"," "], ["identifier.gobstones","Alive"], ["text"," "], ["keyword.control.expressions.alternatives.gobstones","when"], ["text"," "], ["lparen","("], ["identifier.gobstones","isCellAlive"], ["lparen","("], ["rparen","))"] ],[ "start", ["text"," "], ["identifier.gobstones","Dead"], ["text"," "], ["keyword.control.expressions.alternatives.gobstones","otherwise"] ],[ "start", ["text"," "], ["rparen",")"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","function"], ["text"," "], ["identifier.gobstones","readCell"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["storage.type.definitions.gobstones","return"], ["text"," "], ["lparen","("] ],[ "start", ["text"," "], ["identifier.gobstones","Cell"], ["lparen","("], ["identifier.gobstones","color"], ["text"," "], ["keyword.operator.other.gobstones","<-"], ["text"," "], ["constant.language.colors.gobstones","Verde"], ["comma.gobstones",","], ["text"," "], ["identifier.gobstones","status"], ["text"," "], ["keyword.operator.other.gobstones","<-"], ["text"," "], ["identifier.gobstones","cellStatus"], ["lparen","("], ["rparen","))"] ],[ "start", ["text"," "], ["rparen",")"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","function"], ["text"," "], ["identifier.gobstones","numberOfNeighbors"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier.gobstones","amountOfNeighbors"], ["text"," := "], ["constant.numeric.gobstones","0"] ],[ "start", ["text"," "], ["keyword.control.commands.repetitions.gobstones","foreach"], ["text"," "], ["identifier.gobstones","dir"], ["text"," "], ["keyword.control.commands.repetitions.gobstones","in"], ["text"," "], ["keyword.operator.other.gobstones","["], ["support.variable.gobstones","minDir"], ["lparen","("], ["rparen",")"], ["text"," .. "], ["support.variable.gobstones","maxDir"], ["lparen","("], ["rparen",")"], ["keyword.operator.other.gobstones","]"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier.gobstones","amountOfNeighbors"], ["text"," := "], ["identifier.gobstones","amountOfNeighbors"], ["text"," "], ["keyword.operator.numeric.gobstones","+"], ["text"," "], ["identifier.gobstones","aliveCellsAt"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["storage.type.definitions.gobstones","return"], ["text"," "], ["lparen","("], ["identifier.gobstones","amountOfNeighbors"], ["rparen",")"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","function"], ["text"," "], ["identifier.gobstones","aliveCellsAt"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier.gobstones","firstCompare"], ["text"," := "], ["support.variable.gobstones","puedeMover"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"], ["text"," "], ["keyword.operator.boolean.gobstones","&&"], ["text"," "], ["identifier.gobstones","hasAliveCellAt"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"] ],[ "start", ["text"," "], ["identifier.gobstones","secondCompare"], ["text"," := "], ["support.variable.gobstones","puedeMover"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"], ["text"," "], ["keyword.operator.boolean.gobstones","&&"], ["text"," "], ["support.variable.gobstones","puedeMover"], ["lparen","("], ["support.variable.gobstones","siguiente"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen","))"], ["text"," "], ["keyword.operator.boolean.gobstones","&&"], ["text"," "], ["identifier.gobstones","hasAliveCellAtD"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"] ],[ "start", ["text"," "], ["identifier.gobstones","value"], ["text"," :="] ],[ "start", ["text"," "], ["keyword.control.expressions.alternatives.gobstones","matching"], ["text"," "], ["lparen","("], ["identifier.gobstones","firstCompare"], ["rparen",")"], ["text"," "], ["keyword.control.expressions.alternatives.gobstones","select"] ],[ "start", ["text"," "], ["constant.numeric.gobstones","1"], ["text"," "], ["keyword.control.expressions.alternatives.gobstones","on"], ["text"," "], ["constant.language.boolean.gobstones","True"] ],[ "start", ["text"," "], ["constant.numeric.gobstones","0"], ["text"," "], ["keyword.control.expressions.alternatives.gobstones","otherwise"] ],[ "start", ["text"," "], ["keyword.operator.numeric.gobstones","+"] ],[ "start", ["text"," "], ["keyword.control.expressions.alternatives.gobstones","matching"], ["text"," "], ["lparen","("], ["identifier.gobstones","secondCompare"], ["rparen",")"], ["text"," "], ["keyword.control.expressions.alternatives.gobstones","select"] ],[ "start", ["text"," "], ["constant.numeric.gobstones","1"], ["text"," "], ["keyword.control.expressions.alternatives.gobstones","on"], ["text"," "], ["constant.language.boolean.gobstones","True"] ],[ "start", ["text"," "], ["constant.numeric.gobstones","0"], ["text"," "], ["keyword.control.expressions.alternatives.gobstones","otherwise"] ],[ "start", ["text"," "], ["storage.type.definitions.gobstones","return"], ["text"," "], ["lparen","("], ["identifier.gobstones","value"], ["rparen",")"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","function"], ["text"," "], ["identifier.gobstones","hasAliveCellAt"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function.gobstones","Mover"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"] ],[ "start", ["text"," "], ["storage.type.definitions.gobstones","return"], ["text"," "], ["lparen","("], ["identifier.gobstones","isCellAlive"], ["lparen","("], ["rparen","))"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","function"], ["text"," "], ["identifier.gobstones","hasAliveCellAtD"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function.gobstones","Mover"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen",")"] ],[ "start", ["text"," "], ["support.function.gobstones","Mover"], ["lparen","("], ["support.variable.gobstones","siguiente"], ["lparen","("], ["identifier.gobstones","dir"], ["rparen","))"] ],[ "start", ["text"," "], ["storage.type.definitions.gobstones","return"], ["text"," "], ["lparen","("], ["identifier.gobstones","isCellAlive"], ["lparen","("], ["rparen","))"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start", ["comment.line.double-dash.gobstones","-- ROCEDURES DECLARATIONS --"] ],[ "start", ["comment.line.double-dash.gobstones","-----------------------------------------------------------"] ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","TagAsReanimated"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function.gobstones","Poner"], ["lparen","("], ["constant.language.colors.gobstones","Azul"], ["rparen",")"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","TagAsDead"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function.gobstones","Poner"], ["lparen","("], ["constant.language.colors.gobstones","Rojo"], ["rparen",")"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","ProcessAction"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword.control.commands.alternatives.gobstones","switch"], ["text"," "], ["lparen","("], ["support.variable.gobstones","hayBolitas"], ["lparen","("], ["constant.language.colors.gobstones","Rojo"], ["rparen","))"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["constant.language.boolean.gobstones","True"], ["text"," "], ["keyword.operator.other.gobstones","->"], ["text"," "], ["lparen","{"], ["text"," "], ["support.function.gobstones","Sacar"], ["lparen","("], ["constant.language.colors.gobstones","Verde"], ["rparen",")"], ["semicolon.gobstones",";"], ["text"," "], ["support.function.gobstones","Sacar"], ["lparen","("], ["constant.language.colors.gobstones","Rojo"], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["keyword.operator.other.gobstones","_"], ["text"," "], ["keyword.operator.other.gobstones","->"], ["text"," "], ["lparen","{"], ["rparen","}"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["keyword.control.commands.alternatives.gobstones","switch"], ["text"," "], ["lparen","("], ["support.variable.gobstones","hayBolitas"], ["lparen","("], ["constant.language.colors.gobstones","Azul"], ["rparen","))"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["constant.language.boolean.gobstones","True"], ["text"," "], ["keyword.operator.other.gobstones","->"], ["text"," "], ["lparen","{"], ["text"," "], ["support.function.gobstones","Poner"], ["lparen","("], ["constant.language.colors.gobstones","Verde"], ["rparen",")"], ["semicolon.gobstones",";"], ["text"," "], ["support.function.gobstones","Sacar"], ["lparen","("], ["constant.language.colors.gobstones","Azul"], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["keyword.operator.other.gobstones","_"], ["text"," "], ["keyword.operator.other.gobstones","->"], ["text"," "], ["lparen","{"], ["rparen","}"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","TagCell"], ["lparen","("], ["identifier.gobstones","numNeighbors"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword.control.commands.alternatives.gobstones","if"], ["text"," "], ["lparen","("], ["text"," "], ["identifier.gobstones","isCellAlive"], ["lparen","("], ["rparen",")"], ["text"," "], ["keyword.operator.boolean.gobstones","&&"], ["text"," "], ["identifier.gobstones","numNeighbors"], ["text"," "], ["keyword.operator.compare.gobstones","<"], ["text"," "], ["constant.numeric.gobstones","2"], ["rparen",")"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier.gobstones","TagAsDead"], ["lparen","("], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["keyword.control.commands.alternatives.gobstones","elseif"], ["text"," "], ["lparen","("], ["text"," "], ["identifier.gobstones","isCellAlive"], ["lparen","("], ["rparen",")"], ["text"," "], ["keyword.operator.boolean.gobstones","&&"], ["text"," "], ["identifier.gobstones","numNeighbors"], ["text"," "], ["keyword.operator.compare.gobstones",">"], ["text"," "], ["constant.numeric.gobstones","3"], ["rparen",")"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier.gobstones","TagAsDead"], ["lparen","("], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["keyword.control.commands.alternatives.gobstones","elseif"], ["text"," "], ["lparen","(("], ["keyword.operator.boolean.gobstones","not"], ["text"," "], ["identifier.gobstones","isCellAlive"], ["lparen","("], ["rparen","))"], ["text"," "], ["keyword.operator.boolean.gobstones","&&"], ["text"," "], ["identifier.gobstones","numNeighbors"], ["text"," "], ["keyword.operator.compare.gobstones","=="], ["text"," "], ["constant.numeric.gobstones","3"], ["rparen",")"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier.gobstones","TagAsReanimated"], ["lparen","("], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","SimulateTicks"], ["lparen","("], ["identifier.gobstones","amount"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword.control.commands.repetitions.gobstones","repeat"], ["lparen","("], ["identifier.gobstones","amount"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier.gobstones","SimulateNextTick"], ["lparen","("], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","SimulateNextTick"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier.gobstones","PrepareNextTick"], ["lparen","("], ["rparen",")"] ],[ "start", ["text"," "], ["identifier.gobstones","CompleteNextTick"], ["lparen","("], ["rparen",")"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","PrepareNextTick"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier.gobstones","GoToStartOfBoard"], ["lparen","("], ["constant.language.cardinals.gobstones","Norte"], ["comma.gobstones",","], ["text"," "], ["constant.language.cardinals.gobstones","Este"], ["rparen",")"] ],[ "start", ["text"," "], ["keyword.control.commands.repetitions.gobstones","while"], ["text"," "], ["lparen","("], ["keyword.operator.boolean.gobstones","not"], ["text"," "], ["identifier.gobstones","isEndOfBoard"], ["lparen","("], ["constant.language.cardinals.gobstones","Norte"], ["comma.gobstones",","], ["text"," "], ["constant.language.cardinals.gobstones","Este"], ["rparen","))"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier.gobstones","TagCell"], ["lparen","("], ["identifier.gobstones","numberOfNeighbors"], ["lparen","("], ["rparen","))"] ],[ "start", ["text"," "], ["identifier.gobstones","NextCellOfTheBoard"], ["lparen","("], ["constant.language.cardinals.gobstones","Norte"], ["comma.gobstones",","], ["text"," "], ["constant.language.cardinals.gobstones","Este"], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["identifier.gobstones","TagCell"], ["lparen","("], ["identifier.gobstones","numberOfNeighbors"], ["lparen","("], ["rparen","))"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["storage.type.definitions.gobstones","procedure"], ["text"," "], ["identifier.gobstones","CompleteNextTick"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier.gobstones","GoToStartOfBoard"], ["lparen","("], ["constant.language.cardinals.gobstones","Norte"], ["comma.gobstones",","], ["text"," "], ["constant.language.cardinals.gobstones","Este"], ["rparen",")"] ],[ "start", ["text"," "], ["keyword.control.commands.repetitions.gobstones","while"], ["text"," "], ["lparen","("], ["keyword.operator.boolean.gobstones","not"], ["text"," "], ["identifier.gobstones","isEndOfBoard"], ["lparen","("], ["constant.language.cardinals.gobstones","Norte"], ["comma.gobstones",","], ["text"," "], ["constant.language.cardinals.gobstones","Este"], ["rparen","))"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier.gobstones","ProcessAction"], ["lparen","("], ["rparen",")"] ],[ "start", ["text"," "], ["identifier.gobstones","NextCellOfTheBoard"], ["lparen","("], ["constant.language.cardinals.gobstones","Norte"], ["comma.gobstones",","], ["text"," "], ["constant.language.cardinals.gobstones","Este"], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["identifier.gobstones","ProcessAction"], ["lparen","("], ["rparen",")"] ],[ "start", ["rparen","}"] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_graphqlschema.json ================================================ [[ "start", ["comment","# Main Schema"] ],[ "start", ["keyword","schema"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["identifier","query"], ["text",": "], ["identifier","Query"], ["text",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","scalar"], ["text"," "], ["identifier","Date"], ["text",";"] ],[ "start" ],[ "start", ["comment","# Simple type to contain all scalar types"] ],[ "start", ["keyword","type"], ["text"," "], ["identifier","AllTypes"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["comment","# Field Description for String"] ],[ "start", ["text","\t"], ["identifier","testString"], ["text",": "], ["storage.type","String"], ["text",";"] ],[ "start", ["text","\t"], ["comment","# Field Description for Int"] ],[ "start", ["text","\t"], ["identifier","testInt"], ["text",": "], ["storage.type","Int"], ["text",";"] ],[ "start", ["text","\t"], ["comment","# Field Description for ID"] ],[ "start", ["text","\t"], ["identifier","testID"], ["text",": "], ["storage.type","ID"], ["text",";"] ],[ "start", ["text","\t"], ["comment","# Field Description for Boolean"] ],[ "start", ["text","\t"], ["identifier","testBoolean"], ["text",": "], ["storage.type","Boolean"], ["text",";"] ],[ "start", ["text","\t"], ["comment","# Field Description for Float"] ],[ "start", ["text","\t"], ["identifier","testFloat"], ["text",": "], ["storage.type","Float"], ["text",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","interface"], ["text"," "], ["identifier","ISearchable"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","searchPreview"], ["text",": "], ["storage.type","String"], ["text","!;"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","union"], ["text"," "], ["identifier","ProductTypes"], ["text"," = "], ["identifier","Movie"], ["text"," | "], ["identifier","Book"], ["text",";"] ],[ "start" ],[ "start", ["comment","# Testing enum"] ],[ "start", ["keyword","enum"], ["text"," "], ["identifier","MovieGenere"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","ACTION"] ],[ "start", ["text"," "], ["identifier","COMEDY"] ],[ "start", ["text"," "], ["identifier","THRILLER"] ],[ "start", ["text"," "], ["identifier","DRAMA"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","# Testing Input"] ],[ "start", ["keyword","input"], ["text"," "], ["identifier","SearchByGenere"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["identifier","before"], ["text",": "], ["identifier","Date"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","after"], ["text",": "], ["identifier","Date"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","genere"], ["text",": "], ["identifier","MovieGenere"], ["text","!;"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","# Testing Interface"] ],[ "start", ["keyword","type"], ["text"," "], ["identifier","Movie"], ["text"," "], ["keyword","implements"], ["text"," "], ["identifier","ISearchable"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["identifier","id"], ["text",": "], ["storage.type","ID"], ["text","!;"] ],[ "start", ["text","\t"], ["identifier","searchPreview"], ["text",": "], ["storage.type","String"], ["text","!;"] ],[ "start", ["text","\t"], ["identifier","rentPrice"], ["text",": "], ["storage.type","Float"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","publishDate"], ["text",": "], ["identifier","Date"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","genere"], ["text",": "], ["identifier","MovieGenere"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","cast"], ["text",": "], ["paren.lparen","["], ["storage.type","String"], ["paren.rparen","]"], ["text",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","# Testing Interface"] ],[ "start", ["keyword","type"], ["text"," "], ["identifier","Book"], ["text"," "], ["keyword","implements"], ["text"," "], ["identifier","ISearchable"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","id"], ["text",": "], ["storage.type","ID"], ["text","!;"] ],[ "start", ["text","\t"], ["identifier","searchPreview"], ["text",": "], ["storage.type","String"], ["text","!;"] ],[ "start", ["text","\t"], ["identifier","price"], ["text",": "], ["storage.type","Float"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","publishDate"], ["text",": "], ["identifier","Date"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","authors"], ["text",": "], ["paren.lparen","["], ["storage.type","String"], ["paren.rparen","]"], ["text",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","type"], ["text"," "], ["identifier","Query"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["identifier","testString"], ["text",": "], ["storage.type","String"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","testDate"], ["text","; "], ["identifier","Date"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","allTypes"], ["text",": "], ["identifier","AllTypes"], ["text",";"] ],[ "start", ["text","\t"], ["identifier","allProducts"], ["text",": "], ["paren.lparen","["], ["identifier","ProductTypes"], ["paren.rparen","]"], ["text",";"] ],[ "start" ],[ "start", ["text","\t"], ["comment","# searches only movies by genere with sophisticated argument"] ],[ "start", ["text","\t"], ["identifier","searchMovieByGenere"], ["paren.lparen","("], ["identifier","searchObject"], ["text",": "], ["identifier","SearchByGenere"], ["text","!"], ["paren.rparen",")"], ["text",": "], ["paren.lparen","["], ["identifier","Movie"], ["paren.rparen","]"], ["text",";"] ],[ "start" ],[ "start", ["text","\t"], ["comment","# Searchs all products by text string"] ],[ "start", ["text","\t"], ["identifier","searchProduct"], ["paren.lparen","("], ["identifier","text"], ["text",": "], ["storage.type","String"], ["text","!"], ["paren.rparen",")"], ["text",": "], ["paren.lparen","["], ["identifier","ISearchable"], ["paren.rparen","]"], ["text",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: src/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: src/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: src/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: src/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: src/mode/_test/tokens_haskell_cabal.json ================================================ [[ "start", ["keyword","name: "], ["text","reload"] ],[ "start", ["keyword","version: "], ["constant.numeric","0.1.0.0"] ],[ "start", ["keyword","synopsis: "], ["text","Initial project template from stack"] ],[ "start", ["keyword","Description:"] ],[ "start", ["text"," The \\'cabal\\' command-line program simplifies the process of managing"] ],[ "start", ["text"," Haskell software by automating the fetching, configuration, compilation"] ],[ "start", ["text"," and installation of Haskell libraries and programs."] ],[ "start", ["keyword","homepage: "], ["text","https://github.com/jpmoresmau/dbIDE/reload#readme"] ],[ "start", ["keyword","license: "], ["text","BSD"], ["constant.numeric","3"] ],[ "start", ["keyword","license-file: "], ["text","LICENSE"] ],[ "start", ["keyword","author: "], ["text","JP Moresmau"] ],[ "start", ["keyword","maintainer: "], ["text","jpmoresmau@gmail.com"] ],[ "start", ["keyword","copyright: "], ["constant.numeric","2016"], ["text"," JP Moresmau"] ],[ "start", ["keyword","category: "], ["text","Web"] ],[ "start", ["keyword","build-type: "], ["text","Simple"] ],[ "start", ["comment","-- extra-source-files:"] ],[ "start", ["keyword","cabal-version: "], ["text",">="], ["constant.numeric","1.10"] ],[ "start" ],[ "start", ["markup.heading","Flag network-uri"] ],[ "start", ["keyword"," description: "], ["text","Get Network.URI from the network-uri package"] ],[ "start", ["keyword"," default: "], ["constant.language.boolean","True"] ],[ "start" ],[ "start", ["markup.heading","library"] ],[ "start", ["keyword"," hs-source-dirs: "], ["text","src"] ],[ "start", ["keyword"," exposed-modules: "], ["text","Language.Haskell.Reload"] ],[ "start", ["keyword"," build-depends: "], ["text","base >= "], ["constant.numeric","4.7"], ["text"," && < "], ["constant.numeric","5"] ],[ "start", ["text"," , aeson"] ],[ "start", ["text"," , scotty"] ],[ "start", ["text"," , wai"] ],[ "start", ["text"," , text"] ],[ "start", ["text"," , directory"] ],[ "start", ["text"," , filepath"] ],[ "start", ["text"," , bytestring"] ],[ "start", ["text"," , containers"] ],[ "start", ["text"," , mime-types"] ],[ "start", ["text"," , transformers"] ],[ "start", ["text"," , wai-handler-launch"] ],[ "start", ["text"," , wai-middleware-static"] ],[ "start", ["text"," , wai-extra"] ],[ "start", ["text"," , http-types"] ],[ "start", ["keyword"," default-language: "], ["text","Haskell"], ["constant.numeric","2010"] ],[ "start", ["keyword"," other-modules: "], ["text","Language.Haskell.Reload.FileBrowser"] ],[ "start", ["keyword"," ghc-options: "], ["text","-Wall -O"], ["constant.numeric","2"] ],[ "start" ],[ "start", ["markup.heading","executable reload-exe"] ],[ "start", ["keyword"," hs-source-dirs: "], ["text","app"] ],[ "start", ["keyword"," main-is: "], ["text","Main.hs"] ],[ "start", ["keyword"," ghc-options: "], ["text","-threaded -O"], ["constant.numeric","2"], ["text"," -rtsopts -with-rtsopts=-N"] ],[ "start", ["keyword"," build-depends: "], ["text","base"] ],[ "start", ["text"," , reload"] ],[ "start", ["keyword"," default-language: "], ["text","Haskell"], ["constant.numeric","2010"] ],[ "start" ],[ "start", ["markup.heading","test-suite reload-test"] ],[ "start", ["keyword"," type: "], ["text","exitcode-stdio-"], ["constant.numeric","1.0"] ],[ "start", ["keyword"," hs-source-dirs: "], ["text","test"] ],[ "start", ["keyword"," main-is: "], ["text","Spec.hs"] ],[ "start", ["keyword"," build-depends: "], ["text","base"] ],[ "start", ["text"," , reload"] ],[ "start", ["text"," , hspec"] ],[ "start", ["text"," , hspec-wai"] ],[ "start", ["text"," , hspec-wai-json"] ],[ "start", ["text"," , aeson"] ],[ "start", ["text"," , directory"] ],[ "start", ["text"," , filepath"] ],[ "start", ["text"," , text"] ],[ "start", ["text"," , containers"] ],[ "start", ["text"," , unordered-containers"] ],[ "start", ["text"," , bytestring"] ],[ "start", ["text"," , wai-extra"] ],[ "start", ["keyword"," ghc-options: "], ["text","-threaded -O"], ["constant.numeric","2"], ["text"," -rtsopts -with-rtsopts=-N"] ],[ "start", ["keyword"," default-language: "], ["text","Haskell"], ["constant.numeric","2010"] ],[ "start", ["keyword"," other-modules: "], ["text","Language.Haskell.Reload.FileBrowserSpec"] ],[ "start", ["text"," Language.Haskell.ReloadSpec"] ],[ "start" ],[ "start", ["markup.heading","source-repository head"] ],[ "start", ["keyword"," type: "], ["text","git"] ],[ "start", ["keyword"," location: "], ["text","https://github.com/jpmoresmau/dbIDE/reload"] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_hjson.json ================================================ [[ "paren.lparen0", ["paren.lparen","{"] ],[ "paren.lparen0", ["paren"," "], ["comment.punctuation","#"], ["comment.line"," specify rate in requests/second (because comments are helpful!)"] ],[ "paren.lparen0", ["paren"," "], ["keyword","rate"], ["text",":"], ["paren"," "], ["constant.numeric","1000"] ],[ "paren.lparen0" ],[ "paren.lparen0", ["paren"," "], ["comment.punctuation","//"], ["comment.line"," prefer c-style comments?"] ],[ "paren.lparen0", ["paren"," "], ["comment.punctuation","/*"], ["comment.block"," feeling old fashioned? "], ["comment.punctuation","*/"] ],[ "paren.lparen0" ],[ "paren.lparen0", ["paren"," "], ["comment.punctuation","#"], ["comment.line"," did you notice that rate doesn't need quotes?"] ],[ "paren.lparen0", ["paren"," "], ["keyword","hey"], ["text",":"], ["paren"," "], ["string","look ma, no quotes for strings either!"] ],[ "paren.lparen0" ],[ "paren.lparen0", ["paren"," "], ["comment.punctuation","#"], ["comment.line"," best of all"] ],[ "paren.lparen0", ["paren"," "], ["keyword","notice"], ["text",":"], ["paren"," "], ["paren.lparen","["], ["paren.rparen","]"] ],[ "paren.lparen0", ["paren"," "], ["keyword","anything"], ["text",":"], ["paren"," ?"] ],[ "paren.lparen0" ],[ "paren.lparen0", ["paren"," "], ["comment.punctuation","#"], ["comment.line"," yes, commas are optional!"] ],[ "start", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: src/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: src/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: src/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"], ["punctuation.operator","."], ["identifier","each"], ["text"," "], ["keyword","do"], ["text"," "], ["keyword.operator","|"], ["identifier","book"], ["keyword.operator","|"], ["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"], ["punctuation.operator","."], ["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"], ["punctuation.operator","."], ["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","'"], ["punctuation.operator",","], ["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","'"], ["punctuation.operator",","], ["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","'"], ["punctuation.operator",","], ["text"," "], ["identifier","book"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":confirm"], ["text"," "], ["punctuation.separator.key-value","=>"], ["text"," "], ["string.start","'"], ["string","Are you sure?"], ["string.end","'"], ["punctuation.operator",","], ["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","'"], ["punctuation.operator",","], ["text"," "], ["identifier","new_book_path"], ["text"," "], ["support.ruby_tag","%>"] ]] ================================================ FILE: src/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: src/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: src/mode/_test/tokens_ion.json ================================================ [[ "start", ["comment.line.ion","// Comment"] ],[ "comment.block.ion", ["comment.block.ion","/*"] ],[ "comment.block.ion", ["comment.block.ion","Multi"] ],[ "comment.block.ion", ["comment.block.ion","Line"] ],[ "comment.block.ion", ["comment.block.ion","Comment"] ],[ "start", ["comment.block.ion","*/"] ],[ "start", ["punctuation.definition.list.begin.ion","["], ["constant.numeric.integer.ion","1"], ["punctuation.definition.list.separator.ion",","], ["constant.numeric.integer.ion","2"], ["punctuation.definition.list.separator.ion",","], ["constant.numeric.integer.ion","3"], ["punctuation.definition.list.separator.ion",","], ["constant.numeric.integer.ion","45"], ["text.ion"," "], ["comment.block.ion","/*TODO: should be 42, obviously*/"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.numeric.timestamp.ion","2016-04-21T08:10:46Z"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.numeric.timestamp.ion","2016-04-21T08:10:46-08:00"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.numeric.timestamp.ion","2016-04-21"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.numeric.integer.ion","2016"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.numeric.integer.hex.ion","0x5"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.numeric.integer.binary.ion","0b0110"], ["punctuation.definition.list.end.ion","]"] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["punctuation.definition.sexp.begin.ion","("], ["constant.numeric.integer.ion","5"], ["text.ion"," "], ["constant.numeric.integer.ion","7"], ["text.ion"," "], ["constant.numeric.integer.ion","1"], ["text.ion"," "], ["constant.numeric.integer.ion","3"], ["text.ion"," "], ["punctuation.definition.list.begin.ion","["] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["text.ion"," "], ["storage.type.symbol.quoted.ion","'a'"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["storage.type.symbol.quoted.ion","'b'"], ["punctuation.definition.list.separator.ion",","] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["text.ion"," "], ["constant.language.null.ion","null"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.language.null.ion","null.int"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.language.null.ion","null.bool"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.language.null.ion","null.list"] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["text.ion"," "], ["constant.language.bool.ion","true"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.language.bool.ion","false"], ["punctuation.definition.list.separator.ion",","] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["text.ion"," "], ["constant.numeric.float.ion","nan"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.numeric.float.ion","-inf"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["constant.numeric.float.ion","+inf"], ["punctuation.definition.list.separator.ion",","] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","str"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.list.separator.ion",","] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","str with embedded \\\" "], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.list.separator.ion",","] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","'''"], ["string.quoted.triple.ion","str with embedded \\''' "], ["punctuation.definition.string.end.ion","'''"], ["punctuation.definition.list.separator.ion",","] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["text.ion"," "], ["punctuation.definition.clob.begin.ion","{{"], ["string.other.clob.ion","\"clob content\""], ["punctuation.definition.clob.end.ion","}}"], ["punctuation.definition.list.separator.ion",","] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.sexp.begin.ion"], ["text.ion"," "], ["punctuation.definition.blob.begin.ion","{{"], ["string.other.blob.ion"," AB/ "], ["punctuation.definition.blob.end.ion","}}"] ],[ "start", ["text.ion"," "], ["punctuation.definition.list.end.ion","]"], ["punctuation.definition.sexp.end.ion",")"] ],[ "start" ],[ "punctuation.definition.string.begin.ion", ["punctuation.definition.string.begin.ion","'''"] ],[ "punctuation.definition.string.begin.ion" ],[ "punctuation.definition.string.begin.ion", ["string.quoted.triple.ion","multi"] ],[ "punctuation.definition.string.begin.ion", ["string.quoted.triple.ion","line"] ],[ "punctuation.definition.string.begin.ion", ["string.quoted.triple.ion","string"] ],[ "punctuation.definition.string.begin.ion" ],[ "start", ["punctuation.definition.string.end.ion","'''"] ],[ "start" ],[ "punctuation.definition.struct.begin.ion", ["variable.language.annotation.ion","states"], ["punctuation.definition.annotation.ion","::"], ["punctuation.definition.struct.begin.ion","{"] ],[ "punctuation.definition.struct.begin.ion", ["text.ion"," "], ["comment.line.ion","// https://amzn.github.io/ion-docs/docs/spec.html"] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","root"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["variable.language.annotation.ion","rules"], ["punctuation.definition.annotation.ion","::"], ["punctuation.definition.list.begin.ion","["] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["variable.language.annotation.ion","include"], ["punctuation.definition.annotation.ion","::"], ["storage.type.symbol.quoted.ion","'value'"] ],[ "punctuation.definition.struct.begin.ion", ["text.ion"," "], ["punctuation.definition.list.end.ion","]"], ["punctuation.definition.struct.separator.ion",","] ],[ "punctuation.definition.struct.begin.ion" ],[ "punctuation.definition.struct.begin.ion", ["text.ion"," "], ["comment.line.ion","// https://amzn.github.io/ion-docs/docs/spec.html#string"] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","string"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["variable.language.annotation.ion","rules"], ["punctuation.definition.annotation.ion","::"], ["punctuation.definition.list.begin.ion","["] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["variable.language.annotation.ion","match"], ["punctuation.definition.annotation.ion","::"], ["punctuation.definition.struct.begin.ion","{"] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","regex"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","(\\\\\\\")((?:\\\\\\\\\\\"|[^\\\"])*)(\\\\\\\")"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","token"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["punctuation.definition.list.begin.ion","["], ["storage.type.symbol.quoted.ion","'string.dblq.punc.start'"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["storage.type.symbol.quoted.ion","'string.dblq'"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["storage.type.symbol.quoted.ion","'string.dblq.punc.end'"], ["punctuation.definition.list.end.ion","]"] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.struct.end.ion","}"], ["punctuation.definition.list.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["variable.language.annotation.ion","push"], ["punctuation.definition.annotation.ion","::"], ["punctuation.definition.struct.begin.ion","{"] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","regex"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","\\'{3}"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","token"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["storage.type.symbol.quoted.ion","'string.trpq.punc.start'"], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","states"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["variable.language.annotation.ion","rules"], ["punctuation.definition.annotation.ion","::"], ["punctuation.definition.list.begin.ion","["] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["variable.language.annotation.ion","pop"], ["punctuation.definition.annotation.ion","::"], ["punctuation.definition.struct.begin.ion","{"] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","regex"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","\\'{3}"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","token"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["storage.type.symbol.quoted.ion","'string.trpq.punc.end'"], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.struct.end.ion","}"], ["punctuation.definition.list.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["variable.language.annotation.ion","match"], ["punctuation.definition.annotation.ion","::"], ["punctuation.definition.struct.begin.ion","{"] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","regex"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","(?:\\\\\\\\'*|.|[^']*)"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["constant.other.symbol.identifier.ion","token"], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["storage.type.symbol.quoted.ion","'string.trpq'"] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.struct.end.ion","}"] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.list.end.ion","]"] ],[ ["punctuation.definition.list.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.struct.end.ion","}"], ["punctuation.definition.list.separator.ion",","] ],[ "punctuation.definition.struct.begin.ion", ["text.ion"," "], ["punctuation.definition.list.end.ion","]"], ["punctuation.definition.struct.separator.ion",","] ],[ "punctuation.definition.struct.begin.ion" ],[ ["comment.block.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["comment.block.ion","/*"] ],[ ["comment.block.ion","punctuation.definition.struct.begin.ion"], ["comment.block.ion"," ..."] ],[ "punctuation.definition.struct.begin.ion", ["comment.block.ion"," */"] ],[ "start", ["punctuation.definition.struct.end.ion","}"] ],[ "punctuation.definition.struct.begin.ion", ["punctuation.definition.struct.begin.ion","{"] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","json"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["punctuation.definition.struct.begin.ion","{"] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","compatibility"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["constant.language.bool.ion","true"], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","open sourced"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","2016-04-21T08:10:46Z"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","foo"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["constant.numeric.integer.ion","9"], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","bar"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["constant.numeric.decimal.ion","1.1"], ["punctuation.definition.struct.separator.ion",","] ],[ ["punctuation.definition.struct.begin.ion","punctuation.definition.struct.begin.ion"], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","baz"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["punctuation.definition.list.begin.ion","["], ["punctuation.definition.struct.begin.ion","{"], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","id"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",":"], ["text.ion"," "], ["constant.numeric.integer.ion","1"], ["punctuation.definition.struct.end.ion","}"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["punctuation.definition.struct.begin.ion","{"], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","id"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.struct.separator.ion",":"], ["constant.numeric.integer.ion","2"], ["punctuation.definition.struct.end.ion","}"], ["punctuation.definition.list.end.ion","]"] ],[ "punctuation.definition.struct.begin.ion", ["text.ion"," "], ["punctuation.definition.struct.end.ion","}"] ],[ "start", ["punctuation.definition.struct.end.ion","}"] ]] ================================================ FILE: src/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: src/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: src/mode/_test/tokens_java.json ================================================ [[ "start", ["keyword","import"], ["text"," "], ["identifier","java"], ["text","."], ["identifier","util"], ["text","."], ["identifier","ArrayList"], ["text",";"] ],[ "start", ["keyword","import"], ["text"," "], ["identifier","java"], ["text","."], ["identifier","util"], ["text","."], ["identifier","Vector"], ["text",";"] ],[ "start" ],[ "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"," "], ["storage.type.annotation","@Override"] ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["keyword","static"], ["text"," "], ["keyword","void"], ["text"," "], ["entity.name.function","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","."], ["entity.name.function","parseDouble"], ["lparen","("], ["string","\"2.2250738585072012e-308\""], ["rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["comment","// unreachable code"] ],[ "start", ["text"," "], ["support.function","System"], ["text","."], ["identifier","out"], ["text","."], ["entity.name.function","println"], ["lparen","("], ["string","\"Value: \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","d"], ["rparen",")"], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["support.function","String"], ["text"," "], ["identifier","name"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Joan\""], ["text","; "], ["support.function","String"], ["text"," "], ["identifier","info"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","STR"], ["punctuation","."], ["string","\""], ["string","My name is "], ["lparen","\\{"], ["identifier","name"], ["rparen","}"], ["string","\""], ["text",";"] ],[ "start" ],[ "start", ["identifier","STR"], ["punctuation","."], ["string","\""], ["string","Today's weather is "], ["lparen","\\{"], ["text"," "], ["entity.name.function","getFeelsLike"], ["lparen","("], ["rparen",")"], ["text"," "], ["rparen","}"], ["string",", with a temperature of "], ["lparen","\\{"], ["text"," "], ["entity.name.function","getTemperature"], ["lparen","("], ["rparen",")"], ["keyword.operator","++"], ["text"," "], ["rparen","}"], ["string"," degrees "], ["lparen","\\{"], ["text"," "], ["entity.name.function","getUnit"], ["lparen","("], ["rparen",")"], ["text"," "], ["rparen","}"], ["string","\""] ],[ "start" ],[ "start", ["support.function","String"], ["text"," "], ["entity.name.function","nestedMultilineTemplates"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "punctuation", ["text"," "], ["keyword","return"], ["text"," "], ["identifier","STR"], ["punctuation","."], ["string","\"\"\""] ],[ "punctuation", ["string"," {"] ],[ "punctuation", ["string"," \"outerKey1\": \"outerValue1\","] ],[ ["lparen","punctuation"], ["string"," \"nestedTemplate\": \""], ["lparen","\\{"] ],[ ["punctuation","lparen","lparen","punctuation"], ["text"," "], ["identifier","STR"], ["punctuation","."], ["string","\"\"\""] ],[ ["punctuation","lparen","lparen","punctuation"], ["string"," {"] ],[ ["punctuation","lparen","lparen","punctuation"], ["string"," \"innerKey\": \""], ["lparen","\\{"], ["identifier","innerValue"], ["text","."], ["entity.name.function","get"], ["lparen","("], ["rparen",")}"], ["string","\""] ],[ ["punctuation","lparen","lparen","punctuation"], ["string"," }"] ],[ ["lparen","punctuation"], ["string"," \"\"\""] ],[ "punctuation", ["text"," "], ["rparen","}"], ["string","\","] ],[ "punctuation", ["string"," \"outerKey2\": \"outerValue2\""] ],[ "punctuation", ["string"," }"] ],[ "start", ["string"," \"\"\""], ["text",";"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","var"], ["text"," "], ["identifier","to"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"working\""], ["text",";"] ],[ "start" ],[ ["paren.lparen","keyword"], ["keyword","module"], ["text"," "], ["identifier","com"], ["punctuation.operator","."], ["identifier","example"], ["punctuation.operator","."], ["identifier","myapp"], ["text"," "], ["paren.lparen","{"] ],[ ["doc-start","paren.lparen","paren.lparen","keyword"], ["text"," "], ["comment.doc","/**"] ],[ ["doc-start","paren.lparen","paren.lparen","keyword"], ["comment.doc.body"," * Test doc comment"] ],[ ["doc-start","paren.lparen","paren.lparen","keyword"], ["comment.doc.body"," * "], ["comment.doc.tag","@property"], ["comment.doc.body"," test"] ],[ ["paren.lparen","keyword"], ["comment.doc.body"," "], ["comment.doc","*/"] ],[ ["paren.lparen","keyword"], ["text"," "], ["keyword","requires"], ["text"," "], ["keyword","transitive"], ["text"," java.base;"] ],[ ["paren.lparen","keyword"], ["text"," "], ["comment","//comment"] ],[ ["paren.lparen","keyword"], ["text"," "], ["keyword","exports"], ["text"," com.example.myapp.api;"] ],[ ["comment","paren.lparen","paren.lparen","keyword"], ["text"," "], ["comment","/*"] ],[ ["comment","paren.lparen","paren.lparen","keyword"], ["comment"," multiline comment"] ],[ ["paren.lparen","keyword"], ["comment"," */"] ],[ ["paren.lparen","keyword"], ["text"," "], ["keyword","opens"], ["text"," com.example.myapp.internal "], ["keyword","to"], ["text"," other.module;"] ],[ ["paren.lparen","keyword"], ["text"," "], ["keyword","uses"], ["text"," com.example.myapp.service.MyService;"] ],[ ["paren.lparen","keyword"], ["text"," "], ["keyword","provides"], ["text"," com.example.myapp.service.MyService "], ["keyword","with"], ["text"," com.example.myapp.impl.MyServiceImpl;"] ],[ "keyword", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: src/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","/**"], ["comment.doc.body","tokenize doc"], ["comment.doc","*/"], ["text"," "], ["identifier","comment"] ],[ "no_regex", ["comment.doc","/**"], ["comment.doc.body","tokenize doc comment with "], ["comment.doc.tag","@tag"], ["comment.doc.body"," {}"], ["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" ],[ "no_regex" ],[ "start", ["storage.type","function"], ["text"," "], ["entity.name.function","foo"], ["paren.lparen","("], ["variable.parameter","items"], ["punctuation.operator",","], ["text"," "], ["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","/**"], ["comment.doc.body","*********************************"], ["comment.doc","*/"] ],[ "no_regex", ["comment.doc","/**"], ["comment.doc.body"," total mess, tricky to highlight*"], ["comment.doc","*/"] ],[ "no_regex" ],[ "start", ["storage.type","function"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "doc-start", ["text","\t"], ["comment.doc","/**"] ],[ "doc-start", ["comment.doc.body","\t * docComment"] ],[ "no_regex", ["comment.doc.body","\t *"], ["comment.doc","*/"] ],[ "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" ],[ "qqstring", ["string","\"trailing space\\"] ],[ "no_regex", ["string","\""], ["text"," "], ["string","\" /not a regexp/g"] ],[ "no_regex" ],[ "doc-start", ["comment.doc","/**"] ],[ "doc-start", ["comment.doc.body"," *doc"] ],[ "no_regex", ["comment.doc.body"," "], ["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","."], ["support.function","prototype"], ["punctuation.operator","."], ["identifier","d"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type","function"], ["paren.lparen","("], ["variable.parameter","a"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","b"], ["punctuation.operator",","] ],[ "no_regex", ["text"," "], ["variable.parameter","c"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","d"], ["paren.rparen",")"] ],[ "no_regex", ["identifier","foo"], ["punctuation.operator","."], ["identifier","d"], ["text"," "], ["keyword.operator","="], ["storage.type","function"], ["paren.lparen","("], ["variable.parameter","a"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","b"], ["paren.rparen",")"] ],[ "no_regex", ["identifier","foo"], ["punctuation.operator","."], ["identifier","d"], ["text"," "], ["keyword.operator","="], ["storage.type","function"], ["paren.lparen","("], ["variable.parameter","a"], ["punctuation.operator",","], ["text"," "], ["comment","/*****/"], ["text"," "], ["variable.parameter","d"], ["string","\"string\""] ],[ "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.xml","1 "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","a"], ["meta.tag.punctuation.tag-close.xml",">"], ["string.xml"," "], ["paren.quasi.start","{"], ["text"," "], ["keyword.operator","++"], ["identifier","x"], ["text"," "], ["paren.quasi.end","}"], ["string.xml"," "], ["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","("], ["variable.parameter","x"], ["text"," "], ["keyword.operator","=>"], ["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",";"] ],[ "start" ],[ "start", ["comment","//test generator function"] ],[ "start", ["storage.type","function"], ["storage.type","*"], ["text"," "], ["entity.name.function","range"], ["text"," "], ["paren.lparen","("], ["variable.parameter","start"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","end"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","step"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","while"], ["text"," "], ["paren.lparen","("], ["identifier","start"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["identifier","end"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "no_regex", ["text"," "], ["keyword","yield"], ["text"," "], ["identifier","start"] ],[ "no_regex", ["text"," "], ["identifier","start"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["identifier","step"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex", ["comment","//test ES6 new built-in methods"] ],[ "no_regex", ["string","\"hello\""], ["punctuation.operator","."], ["support.function","startsWith"], ["paren.lparen","("], ["string","\"ello\""], ["punctuation.operator",","], ["text"," "], ["constant.numeric","1"], ["paren.rparen",")"], ["text"," "], ["comment","// true"] ],[ "no_regex", ["string","\"hello\""], ["punctuation.operator","."], ["support.function","endsWith"], ["paren.lparen","("], ["string","\"hell\""], ["punctuation.operator",","], ["text"," "], ["constant.numeric","4"], ["paren.rparen",")"], ["text"," "], ["comment","// true"] ],[ "no_regex", ["string","\"hello\""], ["punctuation.operator","."], ["support.function","includes"], ["paren.lparen","("], ["string","\"ell\""], ["paren.rparen",")"], ["text"," "], ["comment","// true"] ],[ "no_regex", ["paren.lparen","["], ["text"," "], ["constant.numeric","1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","3"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","4"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","2"], ["text"," "], ["paren.rparen","]"], ["punctuation.operator","."], ["support.function","find"], ["paren.lparen","("], ["variable.parameter","x"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","3"], ["paren.rparen",")"], ["text"," "], ["comment","// 4"] ],[ "no_regex", ["paren.lparen","["], ["text"," "], ["constant.numeric","1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","3"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","4"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","2"], ["text"," "], ["paren.rparen","]"], ["punctuation.operator","."], ["support.function","findIndex"], ["paren.lparen","("], ["variable.parameter","x"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","3"], ["paren.rparen",")"], ["text"," "], ["comment","// 2"] ],[ "no_regex", ["string","\"foo\""], ["punctuation.operator","."], ["support.function","repeat"], ["paren.lparen","("], ["constant.numeric","3"], ["paren.rparen",")"] ],[ "no_regex", ["variable.language","Number"], ["punctuation.operator","."], ["support.function","isSafeInteger"], ["paren.lparen","("], ["constant.numeric","42"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","==="], ["text"," "], ["constant.language.boolean","true"] ],[ "no_regex" ],[ "start", ["storage.type","let"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","="], ["text"," "], ["variable.language","Number"], ["punctuation.operator","."], ["constant.language","MAX_SAFE_INTEGER"], ["punctuation.operator",";"] ],[ "start", ["storage.type","let"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","="], ["text"," "], ["variable.language","Number"], ["punctuation.operator","."], ["constant.language","MIN_SAFE_INTEGER"], ["punctuation.operator",";"] ],[ "start", ["storage.type","let"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","="], ["text"," "], ["variable.language","Number"], ["punctuation.operator","."], ["constant.language","EPSILON"], ["punctuation.operator",";"] ],[ "start", ["comment","//test Promises"] ],[ "no_regex", ["keyword","new"], ["text"," "], ["variable.language","Promise"], ["paren.lparen","("], ["identifier","tetheredGetNumber"], ["paren.rparen",")"] ],[ "no_regex", ["text"," "], ["punctuation.operator","."], ["support.function","then"], ["paren.lparen","("], ["identifier","determineParity"], ["punctuation.operator",","], ["text"," "], ["identifier","troubleWithGetNumber"], ["paren.rparen",")"] ],[ "no_regex", ["text"," "], ["punctuation.operator","."], ["support.function","then"], ["paren.lparen","("], ["identifier","promiseGetWord"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["punctuation.operator","."], ["support.function","then"], ["paren.lparen","(("], ["variable.parameter","info"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","log"], ["paren.lparen","("], ["string.quasi.start","`"], ["string.quasi","Got: "], ["paren.quasi.start","${"], ["identifier","info"], ["punctuation.operator","."], ["identifier","value"], ["paren.quasi.end","}"], ["string.quasi",", "], ["paren.quasi.start","${"], ["identifier","info"], ["punctuation.operator","."], ["identifier","wordEvenOdd"], ["paren.quasi.end","}"], ["string.quasi.end","`"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["identifier","info"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","})"] ],[ "start", ["text"," "], ["punctuation.operator","."], ["support.function","catch"], ["paren.lparen","(("], ["variable.parameter","reason"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","reason"], ["punctuation.operator","."], ["identifier","cause"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","error"], ["paren.lparen","("], ["string","\"Had previously handled error\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword","else"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","error"], ["paren.lparen","("], ["string.quasi.start","`"], ["string.quasi","Trouble with promiseGetWord(): "], ["paren.quasi.start","${"], ["identifier","reason"], ["paren.quasi.end","}"], ["string.quasi.end","`"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["text"," "], ["paren.rparen","})"] ],[ "start", ["text"," "], ["punctuation.operator","."], ["support.function","finally"], ["paren.lparen","(("], ["variable.parameter","info"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","log"], ["paren.lparen","("], ["string","\"All done\""], ["paren.rparen","))"], ["punctuation.operator",";"] ],[ "start", ["comment","//test ES6 arrow functions"] ],[ "start", ["variable.parameter","param"], ["text"," "], ["storage.type","=>"], ["text"," "], ["identifier","expression"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["paren.lparen","("], ["variable.parameter","param"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["identifier","expression"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["paren.lparen","("], ["variable.parameter","param1"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","123"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","paramN"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"test\""], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["identifier","expression"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["variable.parameter","param"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","statements"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"], ["punctuation.operator",";"] ],[ "start", ["paren.lparen","("], ["variable.parameter","param1"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","paramN"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"] ],[ "no_regex", ["text"," "], ["identifier","statements"] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex" ],[ "start", ["paren.lparen","("], ["variable.parameter","a"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","b"], ["punctuation.operator",","], ["text"," "], ["keyword.operator","..."], ["variable.parameter","r"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["identifier","expression"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["paren.lparen","("], ["variable.parameter","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","400"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","b"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","20"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","c"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["identifier","expression"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword","async"], ["text"," "], ["variable.parameter","param"], ["text"," "], ["storage.type","=>"], ["text"," "], ["identifier","expression"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["comment","//test JSX functions arguments in arrow functions"] ],[ ["start","no_regex","start","jsxAttributes","jsxAttributes","jsx",1], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","Component"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","onclick"], ["keyword.operator.attribute-equals.xml","="], ["paren.quasi.start","{"], ["paren.lparen","("], ["variable.parameter","param1"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","param2"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Test\""], ["punctuation.operator",","], ["text"," "], ["keyword.operator","..."], ["variable.parameter","paramN"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"] ],[ ["#tmp","no_regex","start","no_regex","start","jsxAttributes","jsxAttributes","jsx",1], ["text"," "], ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","log"], ["paren.lparen","("], ["string","\"Test\""], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"], ["paren.quasi.end","}"], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ ["start","no_regex","start","jsxAttributes","jsxAttributes","jsx",1], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","Component"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","onclick"], ["keyword.operator.attribute-equals.xml","="], ["paren.quasi.start","{"], ["variable.parameter","param1"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"] ],[ ["#tmp","no_regex","start","no_regex","start","jsxAttributes","jsxAttributes","jsx",1], ["text"," "], ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","log"], ["paren.lparen","("], ["string","\"Test\""], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"], ["paren.quasi.end","}"], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start" ],[ "start", ["comment","//test different generator functions use cases"] ],[ "no_regex", ["storage.type","function"], ["storage.type","*"], ["text"," "], ["entity.name.function","generator"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["paren.rparen","}"] ],[ "no_regex", ["storage.type","function"], ["storage.type","*"], ["entity.name.function","generator"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["paren.rparen","}"] ],[ "no_regex", ["identifier","Sound"], ["punctuation.operator","."], ["identifier","play"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type","function"], ["storage.type","*"], ["text"," "], ["entity.name.function","play"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["entity.name.function","foobar"], ["punctuation.operator",":"], ["text"," "], ["storage.type","function"], ["text"," "], ["storage.type","*"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["paren.rparen","}"] ],[ "no_regex" ],[ "no_regex", ["comment","//func's args shouldn't be determined as arrow function"] ],[ "no_regex", ["identifier","func"], ["text"," "], ["paren.lparen","("], ["identifier","a"], ["punctuation.operator",","], ["identifier","b"], ["punctuation.operator",","], ["constant.numeric","1"], ["punctuation.operator",","], ["constant.numeric","2"], ["punctuation.operator",","], ["constant.numeric","3"], ["punctuation.operator",","], ["text"," "], ["keyword","async"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"], ["paren.rparen","})"] ],[ "no_regex", ["identifier","func"], ["paren.lparen","("], ["identifier","a"], ["punctuation.operator",","], ["identifier","b"], ["punctuation.operator",","], ["identifier","innerCall"], ["paren.lparen","("], ["identifier","c"], ["punctuation.operator",","], ["identifier","d"], ["paren.rparen",")"], ["punctuation.operator",","], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"], ["paren.rparen","})"] ],[ "no_regex" ],[ "no_regex", ["comment","//async arrow function with default params"] ],[ "start", ["keyword","async"], ["text"," "], ["paren.lparen","("], ["variable.parameter","param1"], ["punctuation.operator",","], ["text"," "], ["variable.parameter","param2"], ["punctuation.operator",","], ["text"," "], ["keyword.operator","..."], ["variable.parameter","paramN"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"] ],[ "no_regex", ["text"," "], ["identifier","statements"] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex" ],[ "no_regex" ],[ "no_regex", ["comment","//all should be constant.numeric"] ],[ "no_regex", ["constant.numeric","1_000_000_000_000"] ],[ "no_regex", ["constant.numeric","1_050.95"] ],[ "no_regex", ["constant.numeric","0b1010_0001_1000_0101"] ],[ "no_regex", ["constant.numeric","0o2_2_5_6"] ],[ "no_regex", ["constant.numeric","0xA0_B0_C0"] ],[ "no_regex", ["constant.numeric","1_000_000_000_000_000_000_000"], ["identifier","n"] ],[ "no_regex", ["constant.numeric","1.0_1322323_33"] ],[ "no_regex", ["constant.numeric","1."] ],[ "no_regex", ["constant.numeric","0.4_3223_32"] ]] ================================================ FILE: src/mode/_test/tokens_jexl.json ================================================ [[ "start", ["comment","#pragma"], ["text"," execution.option 42"] ],[ "start" ],[ "start", ["comment","##"] ],[ "start", ["comment","## This is a test script"] ],[ "start", ["comment","##"] ],[ "start" ],[ "comment", ["comment","/* This is"] ],[ "comment", ["comment","a multi-line"] ],[ "comment", ["comment","comment"] ],[ "start", ["comment","*/"] ],[ "start", ["keyword","if"], ["text"," "], ["lparen","("], ["identifier","out"], ["text"," "], ["keyword.operator","!="], ["text"," "], ["constant.language","null"], ["text"," "], ["keyword","and"], ["text"," "], ["identifier","result"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.language","null"], ["rparen",")"], ["text"," "], ["identifier","out"], ["punctuation","."], ["identifier","println"], ["lparen","("], ["string","\"The result is \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","result"], ["rparen",")"], ["text",";"] ],[ "start", ["identifier","x"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.regexp","~/\\w+"], ["constant.language.escape","\\/"], ["string.regexp","test/"], ["text",";"] ],[ "start", ["identifier","y"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","2"], ["text",";"] ],[ "start", ["identifier","result"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["identifier","y"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","5"], ["text",";"] ],[ "start", ["keyword","if"], ["text"," "], ["lparen","("], ["identifier","out"], ["text"," "], ["keyword.operator","!="], ["text"," "], ["constant.language","null"], ["rparen",")"], ["text"," "], ["identifier","out"], ["punctuation","."], ["identifier","println"], ["lparen","("], ["string","\"The result is \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","result"], ["rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["storage.type.annotation","@lenient"], ["text"," "], ["storage.type.annotation","@silent"], ["text"," "], ["identifier","x"], ["punctuation","."], ["identifier","someMethod"], ["lparen","("], ["rparen",")"], ["text",";"] ],[ "start" ],[ "string", ["string","`multi-line string"] ],[ "start", ["string","with "], ["lparen","${"], ["keyword","var"], ["text"," "], ["identifier","interpolation"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Hey!\""], ["rparen","}"], ["string"," and "], ["constant.language.escape","\\"], ["string","escap"], ["constant.language.escape","\\u00E9"], ["string"," chars`"] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_json.json ================================================ [[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"query\""], ["text",": "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"count\""], ["text",": "], ["constant.numeric","10"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"created\""], ["text",": "], ["string","\"2011-06-21T08:10:46Z\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"lang\""], ["text",": "], ["string","\"en-US\""], ["punctuation.operator",","] ],[ "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\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5855620975\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"32021554@N04\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"f1f5e8515d\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"5110\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"title\""], ["text",": "], ["string","\"7087 bandit cat\""] ],[ "start", ["text"," "], ["paren.rparen","}"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"farm\""], ["text",": "], ["string","\"4\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5856170534\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"32021554@N04\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"ff1efb2a6f\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"3217\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"title\""], ["text",": "], ["string","\"6975 rusty cat\""] ],[ "start", ["text"," "], ["paren.rparen","}"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"farm\""], ["text",": "], ["string","\"6\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5856172972\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"51249875@N03\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"6c6887347c\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"5192\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"title\""], ["text",": "], ["string","\"watermarked-cats\""] ],[ "start", ["text"," "], ["paren.rparen","}"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"farm\""], ["text",": "], ["string","\"6\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5856168328\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"32021554@N04\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"0c1cfdf64c\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"5078\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"title\""], ["text",": "], ["string","\"7020 mandy cat\""] ],[ "start", ["text"," "], ["paren.rparen","}"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"farm\""], ["text",": "], ["string","\"3\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5856171774\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"32021554@N04\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"7f5a3180ab\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"2696\""], ["punctuation.operator",","] ],[ "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: src/mode/_test/tokens_json5.json ================================================ [[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","foo"], ["text",": "], ["string","'bar'"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","while"], ["text",": "], ["constant.language.boolean","true"], ["punctuation.operator",","] ],[ "start" ],[ "string0", ["text"," "], ["variable","this"], ["text",": "], ["string","'is a "], ["constant.language.escape","\\"] ],[ "start", ["string","multi-line string'"], ["punctuation.operator",","] ],[ "start" ],[ "start", ["text"," "], ["comment","// this is an inline comment"] ],[ "start", ["text"," "], ["variable","here"], ["text",": "], ["string","'is another'"], ["punctuation.operator",","], ["text"," "], ["comment","// inline comment"] ],[ "start" ],[ "comment", ["text"," "], ["comment.start","/*"], ["comment"," this is a block comment"] ],[ "start", ["comment"," that continues on another line "], ["comment.end","*/"] ],[ "start" ],[ "start", ["text"," "], ["variable","hex"], ["text",": "], ["constant.numeric","0xDEADbeef"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","half"], ["text",": ."], ["constant.numeric","5"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","delta"], ["text",": "], ["constant.numeric","+10"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","to"], ["text",": "], ["constant.numeric","Infinity"], ["punctuation.operator",","], ["text"," "], ["comment","// and beyond!"] ],[ "start" ],[ "start", ["text"," "], ["variable","finally"], ["text",": "], ["string","'a trailing comma'"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["variable","oh"], ["text",": "], ["paren.lparen","["] ],[ "start", ["text"," "], ["string","\"we shouldn't forget\""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["string","'arrays can have'"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["string","'trailing commas too'"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["paren.rparen","]"], ["punctuation.operator",","] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: src/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"], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","#124356"], ["punctuation.operator",";"] ],[ "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","."], ["entity.name.function","Date"], ["lparen","("], ["rparen","))"], ["text","."], ["entity.name.function","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","."], ["entity.name.function","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","."], ["entity.name.function","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","."], ["entity.name.function","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: src/mode/_test/tokens_jssm.json ================================================ [[ "start" ],[ "start", ["constant.language.jssmLanguage","machine_name :"], ["text"," "], ["entity.name.tag.jssmLabel.doublequoted","\"Three-state traffic light, plus off and flash-red\""], ["text",";"] ],[ "start", ["constant.language.jssmLanguage","machine_version :"], ["text"," "], ["constant.numeric","1.2.1"], ["text",";"] ],[ "start" ],[ "start", ["constant.language.jssmLanguage","jssm_version :"], ["text"," >= "], ["constant.numeric","5.0.0"], ["text",";"] ],[ "start", ["constant.language.jssmLanguage","graph_layout :"], ["text"," "], ["entity.name.tag.jssmLabel.atom","dot"], ["text",";"] ],[ "start" ],[ "start", ["entity.name.tag.jssmLabel.atom","on_init"], ["text"," : "], ["entity.name.function","${"], ["keyword.other","setup"], ["entity.name.function","}"], ["text",";"] ],[ "start", ["entity.name.tag.jssmLabel.atom","on_halt"], ["text"," : "], ["entity.name.function","${"], ["keyword.other","finalize"], ["entity.name.function","}"], ["text",";"] ],[ "start" ],[ "start" ],[ "start" ],[ "start", ["punctuation.definition.comment.mn","/*"], ["comment.block.jssm"," turn on "], ["punctuation.definition.comment.mn","*/"] ],[ "start", ["entity.name.tag.jssmLabel.atom","Off"], ["text"," "], ["constant.character.jssmAction","'Enable'"], ["text"," { "], ["entity.name.tag.jssmLabel.atom","follow"], ["text",": "], ["entity.name.function","${"], ["keyword.other","turned_on"], ["entity.name.function","}"], ["text","; } "], ["keyword.control.transition.jssmArrow.none_legal","->"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Red"], ["text",";"] ],[ "start" ],[ "start", ["comment.line.jssm","// main sequence"] ],[ "start", ["entity.name.tag.jssmLabel.atom","Red"], ["text"," "], ["constant.character.jssmAction","'Proceed'"], ["text"," "], ["keyword.control.transition.jssmArrow.none_main","=>"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Green"], ["text"," "], ["constant.character.jssmAction","'Proceed'"], ["text"," "], ["keyword.control.transition.jssmArrow.none_main","=>"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Yellow"], ["text"," "], ["constant.character.jssmAction","'Proceed'"], ["text"," "], ["keyword.control.transition.jssmArrow.none_main","=>"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Red"], ["text",";"] ],[ "start" ],[ "start", ["comment.line.jssm","// emergency flash red"] ],[ "start", ["text","["], ["entity.name.tag.jssmLabel.atom","Red"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Yellow"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Green"], ["text","] "], ["constant.character.jssmAction","'Flash'"], ["text"," "], ["keyword.control.transition.jssmArrow.none_legal","->"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Flash"], ["text",";"] ],[ "start", ["entity.name.tag.jssmLabel.atom","Flash"], ["text"," "], ["constant.character.jssmAction","'Proceed'"], ["text"," { "], ["entity.name.tag.jssmLabel.atom","label"], ["text",": "], ["constant.character.jssmAction","'no change'"], ["text","; } "], ["keyword.control.transition.jssmArrow.none_legal","->"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Flash"], ["text"," "], ["constant.character.jssmAction","'Exit'"], ["text"," "], ["keyword.control.transition.jssmArrow.none_legal","->"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Red"], ["text",";"] ],[ "start" ],[ "start", ["comment.line.jssm","// turn off"] ],[ "start", ["text","["], ["entity.name.tag.jssmLabel.atom","Red"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Yellow"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Green"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Flash"], ["text","] "], ["constant.character.jssmAction","'Disable'"], ["text"," { "], ["entity.name.tag.jssmLabel.atom","follow"], ["text",": "], ["entity.name.function","${"], ["keyword.other","turned_off"], ["entity.name.function","}"], ["text","; } "], ["keyword.control.transition.jssmArrow.none_forced","~>"], ["text"," "], ["entity.name.tag.jssmLabel.atom","Off"], ["text",";"] ],[ "start" ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_jsx.json ================================================ [[ "start", ["keyword","import"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["identifier","as"], ["text"," "], ["identifier","React"], ["text"," "], ["keyword","from"], ["text"," "], ["string","\"react\""], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword","export"], ["text"," "], ["keyword","default"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["paren.lparen","("] ],[ ["jsx",1], ["text"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","variant"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"p\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ ["jsx",1], ["string.xml"," Keywords here are not highlighted, for example class or instance."] ],[ "start", ["string.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text"," "], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "no_regex", ["paren.rparen","}"] ]] ================================================ FILE: src/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: src/mode/_test/tokens_kotlin.json ================================================ [[ "start", ["comment","#!/usr/bin/env kotlinc -script"] ],[ "start" ],[ "start", ["comment","/*Taken from http://try.kotlinlang.org/#/Examples/Longer%20examples/Life/Life.kt*/"] ],[ "comment", ["comment","/**"] ],[ "comment", ["comment"," * This is a straightforward implementation of The Game of Life"] ],[ "comment", ["comment"," * See http://en.wikipedia.org/wiki/Conway's_Game_of_Life"] ],[ "start", ["comment"," */"] ],[ "start", ["keyword.other.kotlin","package"], ["text"," "], ["entity.name.package.kotlin","life"] ],[ "start" ],[ "comment", ["comment","/*"] ],[ "comment", ["comment"," * A field where cells live. Effectively immutable"] ],[ "start", ["comment"," */"] ],[ "start", ["keyword","class"], ["text"," "], ["identifier","Field"], ["paren.lparen","("] ],[ "start", ["text"," "], ["keyword.other.kotlin","val"], ["text"," "], ["entity.name.variable.kotlin","width"], ["keyword.operator.declaration.kotlin",":"], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["punctuation.kotlin",","] ],[ "start", ["text"," "], ["keyword.other.kotlin","val"], ["text"," "], ["entity.name.variable.kotlin","height"], ["keyword.operator.declaration.kotlin",":"], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["punctuation.kotlin",","] ],[ "start", ["text"," "], ["comment","// This function tells the constructor which cells are alive"] ],[ "start", ["text"," "], ["comment","// if init(i, j) is true, the cell (i, j) is alive"] ],[ "start", ["text"," "], ["identifier","init"], ["keyword.operator.declaration.kotlin",":"], ["text"," "], ["paren.lparen","("], ["storage.type.buildin.kotlin","Int"], ["punctuation",","], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.declaration.kotlin","->"], ["text"," "], ["storage.type.buildin.kotlin","Boolean"] ],[ "start", ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.modifier.kotlin","private"], ["text"," "], ["keyword.other.kotlin","val"], ["text"," "], ["entity.name.variable.kotlin","live"], ["keyword.operator.declaration.kotlin",":"], ["text"," "], ["storage.type.buildin.kotlin","Array"], ["punctuation","<"], ["storage.type.generic.kotlin","Array"], ["punctuation","<"], ["storage.type.generic.kotlin","Boolean"], ["punctuation",">>"], ["text"," "], ["keyword.operator.assignment.kotlin","="], ["text"," "], ["identifier","Array"], ["paren.lparen","("], ["identifier","height"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword.operator.kotlin","->"], ["text"," "], ["identifier","Array"], ["paren.lparen","("], ["identifier","width"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator.kotlin","->"], ["text"," "], ["identifier","init"], ["paren.lparen","("], ["identifier","i"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["paren.rparen",")"], ["text"," "], ["paren.rparen","}"], ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier.kotlin","private"], ["text"," "], ["keyword.other.kotlin","fun"], ["text"," "], ["entity.name.variable.kotlin","liveCount"], ["paren.lparen","("], ["variable.parameter.function.kotlin","i"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["punctuation.kotlin",","], ["text"," "], ["variable.parameter.function.kotlin","j"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword.operator.assignment.kotlin","="], ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword","in"], ["text"," "], ["constant.numeric.kotlin","0"], ["keyword.operator.dot.kotlin",".."], ["identifier","height"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["text"," "], ["keyword.operator.logical.kotlin","&&"] ],[ "start", ["text"," "], ["identifier","j"], ["text"," "], ["keyword","in"], ["text"," "], ["constant.numeric.kotlin","0"], ["keyword.operator.dot.kotlin",".."], ["identifier","width"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["text"," "], ["keyword.operator.logical.kotlin","&&"] ],[ "start", ["text"," "], ["identifier","live"], ["paren.lparen","["], ["identifier","i"], ["paren.rparen","]"], ["paren.lparen","["], ["identifier","j"], ["paren.rparen","])"], ["text"," "], ["constant.numeric.kotlin","1"], ["text"," "], ["keyword","else"], ["text"," "], ["constant.numeric.kotlin","0"] ],[ "start" ],[ "start", ["text"," "], ["comment","// How many neighbors of (i, j) are alive?"] ],[ "start", ["text"," "], ["keyword.other.kotlin","fun"], ["text"," "], ["entity.name.variable.kotlin","liveNeighbors"], ["paren.lparen","("], ["variable.parameter.function.kotlin","i"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["punctuation.kotlin",","], ["text"," "], ["variable.parameter.function.kotlin","j"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.assignment.kotlin","="] ],[ "start", ["text"," "], ["identifier","liveCount"], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"] ],[ "start", ["text"," "], ["identifier","liveCount"], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"] ],[ "start", ["text"," "], ["identifier","liveCount"], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"], ["text"," "], ["constant.numeric.kotlin","1"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"] ],[ "start", ["text"," "], ["identifier","liveCount"], ["paren.lparen","("], ["identifier","i"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"] ],[ "start", ["text"," "], ["identifier","liveCount"], ["paren.lparen","("], ["identifier","i"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"], ["text"," "], ["constant.numeric.kotlin","1"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"] ],[ "start", ["text"," "], ["identifier","liveCount"], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"], ["text"," "], ["constant.numeric.kotlin","1"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"] ],[ "start", ["text"," "], ["identifier","liveCount"], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"], ["text"," "], ["constant.numeric.kotlin","1"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"] ],[ "start", ["text"," "], ["identifier","liveCount"], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"], ["text"," "], ["constant.numeric.kotlin","1"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator.arithmetic.kotlin","+"], ["text"," "], ["constant.numeric.kotlin","1"], ["paren.rparen",")"] ],[ "start" ],[ "start", ["text"," "], ["comment","// You can say field[i, j], and this function gets called"] ],[ "start", ["text"," "], ["storage.modifier.kotlin","operator"], ["text"," "], ["keyword.other.kotlin","fun"], ["text"," "], ["entity.name.variable.kotlin","get"], ["paren.lparen","("], ["variable.parameter.function.kotlin","i"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["punctuation.kotlin",","], ["text"," "], ["variable.parameter.function.kotlin","j"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["paren.rparen",")"], ["text"," "], ["keyword.operator.assignment.kotlin","="], ["text"," "], ["identifier","live"], ["paren.lparen","["], ["identifier","i"], ["paren.rparen","]"], ["paren.lparen","["], ["identifier","j"], ["paren.rparen","]"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","class"], ["text"," "], ["identifier","Test"], ["text"," "], ["keyword","public"], ["text"," "], ["keyword","constructor"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["paren.rparen","}"] ],[ "start", ["keyword.other.kotlin","var"], ["text"," "], ["entity.name.variable.kotlin","test"], ["text"," "], ["keyword.operator.assignment.kotlin","="], ["text"," "], ["string","\"test\""] ],[ "start" ],[ "comment", ["comment","/**"] ],[ "comment", ["comment"," * This function takes the present state of the field"] ],[ "comment", ["comment"," * and returns a new field representing the next moment of time"] ],[ "start", ["comment"," */"] ],[ "start", ["keyword.other.kotlin","fun"], ["text"," "], ["entity.name.variable.kotlin","next"], ["paren.lparen","("], ["variable.parameter.function.kotlin","field"], ["keyword.operator",":"], ["text"," Field"], ["paren.rparen",")"], ["keyword.operator.declaration.kotlin",":"], ["text"," Field "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["identifier","Field"], ["paren.lparen","("], ["identifier","field"], ["keyword.operator.dot.kotlin","."], ["identifier","width"], ["punctuation.kotlin",","], ["text"," "], ["identifier","field"], ["keyword.operator.dot.kotlin","."], ["identifier","height"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","i"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator.kotlin","->"] ],[ "start", ["text"," "], ["keyword.other.kotlin","val"], ["text"," "], ["entity.name.variable.kotlin","n"], ["text"," "], ["keyword.operator.assignment.kotlin","="], ["text"," "], ["identifier","field"], ["keyword.operator.dot.kotlin","."], ["identifier","liveNeighbors"], ["paren.lparen","("], ["identifier","i"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","field"], ["paren.lparen","["], ["identifier","i"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["paren.rparen","])"] ],[ "start", ["text"," "], ["comment","// (i, j) is alive"] ],[ "start", ["text"," "], ["identifier","n"], ["text"," "], ["keyword","in"], ["text"," "], ["constant.numeric.kotlin","2"], ["keyword.operator.dot.kotlin",".."], ["constant.numeric.kotlin","3"], ["text"," "], ["comment","// It remains alive iff it has 2 or 3 neighbors"] ],[ "start", ["text"," "], ["keyword","else"] ],[ "start", ["text"," "], ["comment","// (i, j) is dead"] ],[ "start", ["text"," "], ["identifier","n"], ["text"," "], ["keyword.operator.kotlin","=="], ["text"," "], ["constant.numeric.kotlin","3"], ["text"," "], ["comment","// A new cell is born if there are 3 neighbors alive"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","/** A few colony examples here */"] ],[ "start", ["keyword.other.kotlin","fun"], ["text"," "], ["entity.name.variable.kotlin","main"], ["paren.lparen","("], ["variable.parameter.function.kotlin","args"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","Array"], ["punctuation","<"], ["storage.type.generic.kotlin","String"], ["punctuation",">"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["comment","// Simplistic demo"] ],[ "start", ["text"," "], ["identifier","runGameOfLife"], ["paren.lparen","("], ["string","\"***\""], ["punctuation.kotlin",","], ["text"," "], ["constant.numeric.kotlin","3"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["comment","// \"Star burst\""] ],[ "string", ["text"," "], ["identifier","runGameOfLife"], ["paren.lparen","("], ["string","\"\"\""] ],[ "string", ["string"," _______"] ],[ "string", ["string"," ___*___"] ],[ "string", ["string"," __***__"] ],[ "string", ["string"," ___*___"] ],[ "string", ["string"," _______"] ],[ "start", ["string"," \"\"\""], ["punctuation.kotlin",","], ["text"," "], ["constant.numeric.kotlin","10"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["comment","// Stable colony"] ],[ "string", ["text"," "], ["identifier","runGameOfLife"], ["paren.lparen","("], ["string","\"\"\""] ],[ "string", ["string"," _____"] ],[ "string", ["string"," __*__"] ],[ "string", ["string"," _*_*_"] ],[ "string", ["string"," __*__"] ],[ "string", ["string"," _____"] ],[ "start", ["string"," \"\"\""], ["punctuation.kotlin",","], ["text"," "], ["constant.numeric.kotlin","3"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["comment","// Stable from the step 2"] ],[ "string", ["text"," "], ["identifier","runGameOfLife"], ["paren.lparen","("], ["string","\"\"\""] ],[ "string", ["string"," __**__"] ],[ "string", ["string"," __**__"] ],[ "string", ["string"," __**__"] ],[ "start", ["string"," \"\"\""], ["punctuation.kotlin",","], ["text"," "], ["constant.numeric.kotlin","3"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["comment","// Oscillating colony"] ],[ "string", ["text"," "], ["identifier","runGameOfLife"], ["paren.lparen","("], ["string","\"\"\""] ],[ "string", ["string"," __**____"] ],[ "string", ["string"," __**____"] ],[ "string", ["string"," ____**__"] ],[ "string", ["string"," ____**__"] ],[ "start", ["string"," \"\"\""], ["punctuation.kotlin",","], ["text"," "], ["constant.numeric.kotlin","6"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["comment","// A fancier oscillating colony"] ],[ "string", ["text"," "], ["identifier","runGameOfLife"], ["paren.lparen","("], ["string","\"\"\""] ],[ "string", ["string"," -------------------"] ],[ "string", ["string"," -------***---***---"] ],[ "string", ["string"," -------------------"] ],[ "string", ["string"," -----*----*-*----*-"] ],[ "string", ["string"," -----*----*-*----*-"] ],[ "string", ["string"," -----*----*-*----*-"] ],[ "string", ["string"," -------***---***---"] ],[ "string", ["string"," -------------------"] ],[ "string", ["string"," -------***---***---"] ],[ "string", ["string"," -----*----*-*----*-"] ],[ "string", ["string"," -----*----*-*----*-"] ],[ "string", ["string"," -----*----*-*----*-"] ],[ "string", ["string"," -------------------"] ],[ "string", ["string"," -------***---***---"] ],[ "string", ["string"," -------------------"] ],[ "start", ["string"," \"\"\""], ["punctuation.kotlin",","], ["text"," "], ["constant.numeric.kotlin","10"], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","// UTILITIES"] ],[ "start" ],[ "start", ["keyword.other.kotlin","fun"], ["text"," "], ["entity.name.variable.kotlin","runGameOfLife"], ["paren.lparen","("], ["variable.parameter.function.kotlin","fieldText"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","String"], ["punctuation.kotlin",","], ["text"," "], ["variable.parameter.function.kotlin","steps"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","Int"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.other.kotlin","var"], ["text"," "], ["entity.name.variable.kotlin","field"], ["text"," "], ["keyword.operator.assignment.kotlin","="], ["text"," "], ["identifier","makeField"], ["paren.lparen","("], ["identifier","fieldText"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["paren.lparen","("], ["identifier","step"], ["text"," "], ["keyword","in"], ["text"," "], ["constant.numeric.kotlin","1"], ["keyword.operator.dot.kotlin",".."], ["identifier","steps"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","println"], ["paren.lparen","("], ["string","\"Step: "], ["variable.parameter.template.kotlin","$step"], ["string","\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword","in"], ["text"," "], ["constant.numeric.kotlin","0"], ["keyword.operator.dot.kotlin",".."], ["identifier","field"], ["keyword.operator.dot.kotlin","."], ["identifier","height"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["paren.lparen","("], ["identifier","j"], ["text"," "], ["keyword","in"], ["text"," "], ["constant.numeric.kotlin","0"], ["keyword.operator.dot.kotlin",".."], ["identifier","field"], ["keyword.operator.dot.kotlin","."], ["identifier","width"], ["text"," "], ["keyword.operator.arithmetic.kotlin","-"], ["text"," "], ["constant.numeric.kotlin","1"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","print"], ["paren.lparen","("], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","field"], ["paren.lparen","["], ["identifier","i"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["paren.rparen","])"], ["text"," "], ["string","\"*\""], ["text"," "], ["keyword","else"], ["text"," "], ["string","\" \""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["identifier","println"], ["paren.lparen","("], ["string","\"\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["identifier","field"], ["text"," "], ["keyword.operator.assignment.kotlin","="], ["text"," "], ["identifier","next"], ["paren.lparen","("], ["identifier","field"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword.other.kotlin","fun"], ["text"," "], ["entity.name.variable.kotlin","makeField"], ["paren.lparen","("], ["variable.parameter.function.kotlin","s"], ["keyword.operator",":"], ["text"," "], ["storage.type.buildin.kotlin","String"], ["paren.rparen",")"], ["keyword.operator.declaration.kotlin",":"], ["text"," Field "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.other.kotlin","val"], ["text"," "], ["entity.name.variable.kotlin","lines"], ["text"," "], ["keyword.operator.assignment.kotlin","="], ["text"," "], ["identifier","s"], ["keyword.operator.dot.kotlin","."], ["identifier","replace"], ["paren.lparen","("], ["string","\" \""], ["punctuation.kotlin",","], ["text"," "], ["string","\"\""], ["paren.rparen",")"], ["keyword.operator.dot.kotlin","."], ["identifier","split"], ["paren.lparen","("], ["string","'"], ["constant.character.escape.kotlin","\\n"], ["string","'"], ["paren.rparen",")"], ["keyword.operator.dot.kotlin","."], ["identifier","filter"], ["paren.lparen","({"], ["text"," "], ["identifier","it"], ["keyword.operator.dot.kotlin","."], ["identifier","isNotEmpty"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.rparen","})"] ],[ "start", ["text"," "], ["keyword.other.kotlin","val"], ["text"," "], ["entity.name.variable.kotlin","longestLine"], ["text"," "], ["keyword.operator.assignment.kotlin","="], ["text"," "], ["identifier","lines"], ["keyword.operator.dot.kotlin","."], ["identifier","toList"], ["paren.lparen","("], ["paren.rparen",")"], ["keyword.operator.dot.kotlin","."], ["identifier","maxBy"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","it"], ["keyword.operator.dot.kotlin","."], ["identifier","length"], ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword.operator.kotlin","?:"], ["text"," "], ["string","\"\""] ],[ "start" ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["identifier","Field"], ["paren.lparen","("], ["identifier","longestLine"], ["keyword.operator.dot.kotlin","."], ["identifier","length"], ["punctuation.kotlin",","], ["text"," "], ["identifier","lines"], ["keyword.operator.dot.kotlin","."], ["identifier","size"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","i"], ["punctuation.kotlin",","], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator.kotlin","->"], ["text"," "], ["identifier","lines"], ["paren.lparen","["], ["identifier","i"], ["paren.rparen","]"], ["paren.lparen","["], ["identifier","j"], ["paren.rparen","]"], ["text"," "], ["keyword.operator.kotlin","=="], ["text"," "], ["string","'*'"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_latte.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",">"], ["meta.tag.punctuation.tag-open.latte","{"], ["variable","$title"], ["meta.tag.punctuation.tag-close.latte","}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "comment.start.latte", ["text.xml"," "], ["comment.start.latte","{*"], ["comment"," "] ],[ "comment.start.latte", ["comment"," \tcomment"] ],[ "start", ["comment.end.latte"," *}"] ],[ "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"," \t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h1"], ["text.tag-whitespace.xml"," "], ["meta.attribute.latte","n:inner-if"], ["keyword.operator.attribute-equals.xml","="], ["constant.numeric","0"], ["meta.tag.punctuation.tag-close.xml",">"], ["entity.other.attribute-name.xml","My"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","Webpage"], ["text",""] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","ul"], ["text.tag-whitespace.xml"," "], ["meta.attribute.latte","n:if"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["string.unquoted","count"], ["paren.lparen","("], ["variable","$navigation"], ["paren.rparen",")"], ["keyword.operator"," > "], ["constant.numeric","0"], ["string.attribute-value.xml","\""], ["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.punctuation.tag-open.latte","{"], ["meta.tag.latte","foreach"], ["keyword.operator"," "], ["paren.lparen","["], ["string.unquoted","a"], ["keyword.operator",", "], ["string.unquoted","b"], ["keyword.operator",", "], ["string.start","'"], ["string","x"], ["string.end","'"], ["keyword.operator",", "], ["constant.numeric","10"], ["paren.rparen","]"], ["keyword.operator"," "], ["keyword.control","as"], ["keyword.operator"," "], ["variable","$item"], ["meta.tag.punctuation.tag-close.latte","}"] ],[ "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","\""], ["meta.tag.punctuation.tag-open.latte","{"], ["variable","$item"], ["meta.tag.punctuation.tag-close.latte","}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.latte","{"], ["meta.tag.latte","test"], ["paren.lparen","("], ["variable","$item"], ["keyword.operator","->"], ["string.unquoted","caption"], ["paren.rparen",")"], ["meta.tag.punctuation.tag-close.latte","}"], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.latte","{/"], ["meta.tag.latte","foreach"], ["meta.tag.punctuation.tag-close.latte","}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.latte","{"], ["variable","$variable"], ["meta.tag.punctuation.tag-close.latte","}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.latte","{"], ["meta.tag.latte","="], ["variable","$variable"], ["meta.tag.punctuation.tag-close.latte","}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.latte","{"], ["variable","$variable"], ["keyword.operator","|"], ["string.unquoted","filter"], ["meta.tag.punctuation.tag-close.latte","}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.latte","{"], ["variable","$variable"], ["keyword.operator","|"], ["string.unquoted","filter"], ["keyword.operator",":"], ["constant.numeric","10"], ["keyword.operator",","], ["constant.numeric","20"], ["keyword.operator","|"], ["string.unquoted","filter2"], ["meta.tag.punctuation.tag-close.latte","}"] ],[ "start" ],[ "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","\t "], ["storage.type","var"], ["text"," "], ["identifier","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["meta.tag.punctuation.tag-open.latte","{"], ["variable","$a"], ["meta.tag.punctuation.tag-close.latte","}"], ["punctuation.operator",","], ["text"," "], ["identifier","b"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"], ["string","'a'"], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","1"], ["paren.rparen","}"], ["punctuation.operator",","], ["text"," "], ["identifier","c"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"], ["string","'a'"], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","1"], ["paren.rparen","}"], ["punctuation.operator",";"] ],[ "js-start", ["text","\t "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["constant.language.boolean","true"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "js-start", ["text","\t \t"], ["support.function","alert"], ["paren.lparen","("], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-no_regex", ["text","\t "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "css-start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.style.tag-name.xml","style"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "css-start", ["text"," \t"], ["constant","body"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["support.type","color"], ["punctuation.operator",":"], ["text"," "], ["meta.tag.punctuation.tag-open.latte","{"], ["variable","$color"], ["meta.tag.punctuation.tag-close.latte","}"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_liquid.json ================================================ [[ "start", ["text.xml","There are a couple of different Liquid variations in circulation. This grammars supports"] ],[ "start", ["text.xml","both the Standard and Shopify Liquid variations. The following examples can be found in full at:"] ],[ "start" ],[ "start", ["text.xml","Standard Variation: https://shopify.github.io/liquid"] ],[ "start", ["text.xml","Shopify Variation: https://shopify.dev/docs/api/liquid"] ],[ "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"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," for"], ["text"," product"], ["keyword.operator"," in "], ["text","products "], ["meta.tag.punctuation.tag-close","%}"] ],[ "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",">"], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["support.class","product"], ["keyword.operator","."], ["support.object","title"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," Only "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["support.class","product"], ["keyword.operator","."], ["support.object","price"], ["text"," "], ["keyword.operator","| "], ["support.function","format_as_money"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["support.class","product"], ["keyword.operator","."], ["support.object","description"], ["text"," "], ["keyword.operator","| "], ["support.function","prettyprint"], ["text"," "], ["keyword.operator","| "], ["support.function","truncate"], ["text",": "], ["constant.numeric","200"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," endfor"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "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: "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["string","'tobi'"], ["text"," "], ["keyword.operator","| "], ["support.function","upcase"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"], ["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 "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["string","'tobi'"], ["text"," "], ["keyword.operator","| "], ["support.function","size"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"], ["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\": "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["string","'Hello world'"], ["text"," "], ["keyword.operator","| "], ["support.function","replace"], ["text",": "], ["string","'Hello'"], ["text",", "], ["string","'Hi'"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"], ["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 "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["string","'now'"], ["text"," "], ["keyword.operator","| "], ["support.function","date"], ["text",": "], ["string","\"%Y %b %d\""], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"], ["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"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," if"], ["text"," "], ["support.class","user"], ["keyword.operator","."], ["support.object","name"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","'tobi'"], ["text"," or "], ["support.class","user"], ["keyword.operator","."], ["support.object","name"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","'marc'"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," hi marc or tobi"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," endif"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Comments"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["comment.line","{% #"], ["comment"," Line Comment "], ["comment.line","%}"] ],[ "start" ],[ "comment.block", ["comment.block","{% comment %}"] ],[ "comment.block", ["comment"," Block Comment"] ],[ "start", ["comment.block","{% endcomment %}"] ],[ "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"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," case"], ["text"," template "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," when"], ["text"," "], ["string","'index'"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," Welcome"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," when"], ["text"," "], ["string","'product'"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["support.class","product"], ["keyword.operator","."], ["support.object","vendor"], ["text"," "], ["keyword.operator","| "], ["support.function","link_to_vendor"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"], ["text.xml"," / "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["support.class","product"], ["keyword.operator","."], ["support.object","title"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," else"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," page_title "], ["meta.tag.punctuation.ouput-close","}}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," endcase"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "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"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," for"], ["text"," item"], ["keyword.operator"," in "], ["text","array "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," item "], ["meta.tag.punctuation.ouput-close","}}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," endfor"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "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"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," tablerow"], ["text"," item"], ["keyword.operator"," in "], ["text","items"], ["support.function"," cols"], ["text",": "], ["constant.numeric","3"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," if"], ["text"," "], ["support.class","tablerowloop"], ["keyword.operator","."], ["support.object","col_first"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," First column: "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["support.class","item"], ["keyword.operator","."], ["support.object","variable"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," else"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," Different column: "], ["meta.tag.punctuation.ouput-open","{{"], ["text"," "], ["support.class","item"], ["keyword.operator","."], ["support.object","variable"], ["text"," "], ["meta.tag.punctuation.ouput-close","}}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," endif"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open","{%"], ["keyword.block"," endtablerow"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Embedded Code Blocks"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml","This support Shopify Liquid variation JSON schema code blocks"] ],[ "start" ],[ "schema-start", ["meta.tag.punctuation.tag-open","{%"], ["text"," "], ["keyword.tagschema.tag-name","schema"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "schema-start", ["text"," "], ["paren.lparen","{"] ],[ "schema-start", ["text"," "], ["variable","\"string\""], ["text",": "], ["string","\"bar\""], ["punctuation.operator",","] ],[ "schema-start", ["text"," "], ["variable","\"boolean\""], ["text",": "], ["constant.language.boolean","true"], ["punctuation.operator",","] ],[ "schema-start", ["text"," "], ["variable","\"number\""], ["text",": "], ["constant.numeric","100"], ["punctuation.operator",","] ],[ "schema-start", ["text"," "], ["variable","\"object\""], ["text",": "], ["paren.lparen","{"] ],[ "schema-start", ["text"," "], ["variable","\"array\""], ["text",": "], ["paren.lparen","["], ["constant.numeric","100"], ["punctuation.operator",","], ["text"," "], ["constant.language.boolean","false"], ["punctuation.operator",","], ["text"," "], ["string","\"string\""], ["punctuation.operator",","], ["text"," "], ["paren.lparen","{"], ["paren.rparen","}"], ["punctuation.operator",","], ["text"," "], ["paren.lparen","["], ["paren.rparen","]"], ["text"," "], ["paren.rparen","]"] ],[ "schema-start", ["text"," "], ["paren.rparen","}"] ],[ "schema-start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["meta.tag.punctuation.tag-open","{%"], ["text"," "], ["keyword.tagendschema.tag-name","endschema"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start" ],[ "start", ["text.xml","This support Shopify Liquid variation Stylesheet and Style code blocks"] ],[ "start" ],[ "style-start", ["meta.tag.punctuation.tag-open","{%"], ["text"," "], ["keyword.tagstyle.tag-name","style"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "style-ruleset", ["text"," "], ["variable",".class"], ["text"," "], ["paren.lparen","{"] ],[ "style-ruleset", ["text"," "], ["support.type","font-size"], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","10"], ["keyword","px"], ["punctuation.operator",";"], ["text"," "], ["comment","/* comment */"] ],[ "style-start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["meta.tag.punctuation.tag-open","{%"], ["text"," "], ["keyword.tagendstyle.tag-name","endstyle"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start" ],[ "stylesheet-start", ["meta.tag.punctuation.tag-open","{%"], ["text"," "], ["keyword.tagstylesheet.tag-name","stylesheet"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "stylesheet-ruleset", ["text"," "], ["variable",".class"], ["text"," "], ["paren.lparen","{"] ],[ "stylesheet-ruleset", ["text"," "], ["support.type","font-size"], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","10"], ["keyword","px"], ["punctuation.operator",";"], ["text"," "], ["comment","/* comment */"] ],[ "stylesheet-start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["meta.tag.punctuation.tag-open","{%"], ["text"," "], ["keyword.tagendstylesheet.tag-name","endstylesheet"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start" ],[ "start", ["text.xml","This support Shopify Liquid variation JavaScript code blocks"] ],[ "start" ],[ "javascript-start", ["meta.tag.punctuation.tag-open","{%"], ["text"," "], ["keyword.tagjavascript.tag-name","javascript"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "javascript-start" ],[ "javascript-start", ["text"," "], ["storage.type","function"], ["text"," "], ["entity.name.function","foo"], ["text"," "], ["paren.lparen","("], ["variable.parameter","param"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "javascript-start" ],[ "javascript-no_regex", ["text"," "], ["keyword","return"], ["text"," "], ["string","'something'"], ["text"," "], ["comment","// comment"] ],[ "javascript-no_regex", ["text"," "], ["paren.rparen","}"] ],[ "javascript-no_regex" ],[ "start", ["meta.tag.punctuation.tag-open","{%"], ["text"," "], ["keyword.tagendjavascript.tag-name","endjavascript"], ["text"," "], ["meta.tag.punctuation.tag-close","%}"] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_livescript.json ================================================ [[ "start", ["comment","# comment"] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_logtalk.json ================================================ [[ "start", ["storage.type.opening.logtalk",":- object"], ["text","(bottles)"], ["keyword.operator.misc.logtalk","."] ],[ "start" ],[ "start", ["text","\t"], ["storage.modifier.others.logtalk",":- initialization"], ["text","(sing("], ["constant.numeric.logtalk","99"], ["text","))"], ["keyword.operator.misc.logtalk","."] ],[ "start" ],[ "start", ["text","\tsing("], ["constant.numeric.logtalk","0"], ["text",") "], ["keyword.operator.message-sending.logtalk",":"], ["keyword.operator.evaluable.logtalk","-"] ],[ "start", ["text","\t\t"], ["support.function.term-io.logtalk","write"], ["text","("], ["punctuation.definition.string.begin.logtalk","'"], ["string.quoted.single.logtalk","No more bottles of beer on the wall, no more bottles of beer."], ["punctuation.definition.string.end.logtalk","'"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.chars-and-bytes-io.logtalk","nl"], ["keyword.operator.misc.logtalk",","] ],[ "start", ["text","\t\t"], ["support.function.term-io.logtalk","write"], ["text","("], ["punctuation.definition.string.begin.logtalk","'"], ["string.quoted.single.logtalk","Go to the store and buy some more, 99 bottles of beer on the wall."], ["punctuation.definition.string.end.logtalk","'"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.chars-and-bytes-io.logtalk","nl"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.chars-and-bytes-io.logtalk","nl"], ["keyword.operator.misc.logtalk","."] ],[ "start", ["text","\tsing("], ["variable.other.logtalk","N"], ["text",") "], ["keyword.operator.message-sending.logtalk",":"], ["keyword.operator.evaluable.logtalk","-"] ],[ "start", ["text","\t\t"], ["variable.other.logtalk","N"], ["text"," "], ["keyword.operator.comparison.arithmetic.logtalk",">"], ["text"," "], ["constant.numeric.logtalk","0"], ["keyword.operator.misc.logtalk",","] ],[ "start", ["text","\t\t"], ["variable.other.logtalk","N2"], ["text"," "], ["keyword.operator.misc.logtalk","is"], ["text"," "], ["variable.other.logtalk","N"], ["text"," "], ["keyword.operator.evaluable.logtalk","-"], ["text"," "], ["constant.numeric.logtalk","1"], ["keyword.operator.misc.logtalk",","] ],[ "start", ["text","\t\tbeers("], ["variable.other.logtalk","N"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.term-io.logtalk","write"], ["text","("], ["punctuation.definition.string.begin.logtalk","'"], ["string.quoted.single.logtalk"," of beer on the wall, "], ["punctuation.definition.string.end.logtalk","'"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," beers("], ["variable.other.logtalk","N"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.term-io.logtalk","write"], ["text","("], ["punctuation.definition.string.begin.logtalk","'"], ["string.quoted.single.logtalk"," of beer."], ["punctuation.definition.string.end.logtalk","'"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.chars-and-bytes-io.logtalk","nl"], ["keyword.operator.misc.logtalk",","] ],[ "start", ["text","\t\t"], ["support.function.term-io.logtalk","write"], ["text","("], ["punctuation.definition.string.begin.logtalk","'"], ["string.quoted.single.logtalk","Take one down and pass it around, "], ["punctuation.definition.string.end.logtalk","'"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," beers("], ["variable.other.logtalk","N2"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.term-io.logtalk","write"], ["text","("], ["punctuation.definition.string.begin.logtalk","'"], ["string.quoted.single.logtalk"," of beer on the wall."], ["punctuation.definition.string.end.logtalk","'"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.chars-and-bytes-io.logtalk","nl"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.chars-and-bytes-io.logtalk","nl"], ["keyword.operator.misc.logtalk",","] ],[ "start", ["text","\t\tsing("], ["variable.other.logtalk","N2"], ["text",")"], ["keyword.operator.misc.logtalk","."] ],[ "start" ],[ "start", ["text","\tbeers("], ["constant.numeric.logtalk","0"], ["text",") "], ["keyword.operator.message-sending.logtalk",":"], ["keyword.operator.evaluable.logtalk","-"] ],[ "start", ["text","\t\t"], ["support.function.term-io.logtalk","write"], ["text","("], ["punctuation.definition.string.begin.logtalk","'"], ["string.quoted.single.logtalk","no more bottles"], ["punctuation.definition.string.end.logtalk","'"], ["text",")"], ["keyword.operator.misc.logtalk","."] ],[ "start", ["text","\tbeers("], ["constant.numeric.logtalk","1"], ["text",") "], ["keyword.operator.message-sending.logtalk",":"], ["keyword.operator.evaluable.logtalk","-"] ],[ "start", ["text","\t\t"], ["support.function.term-io.logtalk","write"], ["text","("], ["punctuation.definition.string.begin.logtalk","'"], ["string.quoted.single.logtalk","1 bottle"], ["punctuation.definition.string.end.logtalk","'"], ["text",")"], ["keyword.operator.misc.logtalk","."] ],[ "start", ["text","\tbeers("], ["variable.other.logtalk","N"], ["text",") "], ["keyword.operator.message-sending.logtalk",":"], ["keyword.operator.evaluable.logtalk","-"] ],[ "start", ["text","\t\t"], ["variable.other.logtalk","N"], ["text"," "], ["keyword.operator.comparison.arithmetic.logtalk",">"], ["text"," "], ["constant.numeric.logtalk","1"], ["keyword.operator.misc.logtalk",","] ],[ "start", ["text","\t\t"], ["support.function.term-io.logtalk","write"], ["text","("], ["variable.other.logtalk","N"], ["text",")"], ["keyword.operator.misc.logtalk",","], ["text"," "], ["support.function.term-io.logtalk","write"], ["text","("], ["punctuation.definition.string.begin.logtalk","'"], ["string.quoted.single.logtalk"," bottles"], ["punctuation.definition.string.end.logtalk","'"], ["text",")"], ["keyword.operator.misc.logtalk","."] ],[ "start" ],[ "start", ["storage.type.closing.logtalk",":- end_object"], ["keyword.operator.misc.logtalk","."] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_lua.json ================================================ [[ ["bracketedComment",2,"start"], [ "comment", "--[[" ], [ "comment.body", "--" ] ],[ ["bracketedComment",2,"start"], [ "comment.body", "num_args takes in 5.1 byte code and extracts the number of arguments" ] ],[ ["bracketedComment",2,"start"], [ "comment.body", "from its function header." ] ],[ "start", [ "comment.body", "--" ], [ "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", "--[=[" ], [ "comment.body", "--" ] ],[ ["bracketedComment",3,"start"], [ "comment.body", "table.maxn is deprecated, use # instead." ] ],[ "start", [ "comment.body", "--" ], [ "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", "--[[" ], [ "comment.body", " blah " ], [ "comment", "]]" ], ["paren.rparen",")"] ]] ================================================ FILE: src/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", "--[[" ], [ "comment.body", "--" ] ],[ ["lua-bracketedComment",2,"lua-start"], [ "comment.body", " index.lp from the Kepler Project's LuaDoc HTML doclet." ] ],[ ["lua-bracketedComment",2,"lua-start"], [ "comment.body", " http://keplerproject.github.com/luadoc/" ] ],[ "start", [ "comment.body", "--" ], [ "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: src/mode/_test/tokens_lucene.json ================================================ [[ "start", ["text"," "], ["term","foo"] ],[ "start", ["keyword","foo:"], ["text"," "], ["term","foo"], ["text"," "], ["keyword.operator","AND"], ["text"," "], ["term","bar"] ],[ "start", ["term","foo"], ["text"," "], ["keyword.operator","AND"], ["text"," "], ["term","bar"] ],[ "start", ["term","foo"], ["text"," "], ["keyword.operator","OR"], ["text"," "], ["term","bar"] ],[ "start", ["term","foo"], ["text"," "], ["keyword.operator","NOT"], ["text"," "], ["term","bar"] ],[ "start", ["string","\"foo bar\""] ],[ "start", ["term","bar"], ["text"," "], ["string","\"foo bar\""] ],[ "start", ["term","bar"], ["text"," "], ["constant.character.negation","-"], ["term","foo"] ],[ "start", ["term","bar"], ["text"," "], ["constant.character.negation","-"], ["string","\"foo bar\""] ],[ "start", ["constant.character.negation","-"], ["term","foo"] ],[ "start", ["constant.character.negation","-"], ["string","\"foo bar\""] ],[ "start", ["term","bar"], ["text"," "], ["term","foo"], ["constant.character.proximity","~100"] ],[ "start", ["term","foo"], ["constant.character.proximity","~100"] ],[ "start", ["term","foo"], ["constant.character.proximity","~100"], ["text"," "], ["term","bar"] ],[ "start", ["string","\"foo bar\""], ["constant.character.proximity","~10"] ],[ "start", ["term","foo"], ["constant.character.proximity","~"] ],[ "start", ["term","bar"], ["text"," "], ["term","foo"], ["constant.character.proximity","~"] ],[ "start", ["term","foo"], ["constant.character.proximity","~"], ["text"," "], ["term","bar"] ],[ "start", ["term","foo"], ["constant.character.proximity","~0.8"] ],[ "start", ["keyword","field:"], ["term","foo"] ],[ "start", ["keyword","field:"], ["term","foo"], ["text"," "], ["term","bar"] ],[ "start", ["keyword","field:"], ["string","\"foo bar\""] ],[ "start", ["paren.lparen","("], ["term","foo"], ["text"," "], ["keyword.operator","AND"], ["text"," "], ["term","bar"], ["paren.rparen",")"] ],[ "start", ["paren.lparen","("], ["keyword","field:"], ["term","foo"], ["text"," "], ["keyword.operator","AND"], ["text"," "], ["keyword","field:"], ["string","\"bar baz\""], ["paren.rparen",")"] ],[ "start", ["term","foo"], ["constant.character.asterisk","*"] ],[ "start", ["term","f"], ["constant.character.interro","?"], ["term","o"] ],[ "start", ["term","f"], ["constant.character.asterisk","*"], ["term","o"] ],[ "start", ["constant.character.required","+"], ["term","foo"] ],[ "start", ["constant.character.required","+"], ["string","\"foo bar\""] ],[ "start", ["term","foo"], ["constant.character.interro","?"] ],[ "start", ["constant.character.interro","?"], ["term","oo"] ],[ "start", ["term","foo"] ],[ "start", ["keyword","field:"], ["paren.lparen","("], ["constant.character.negation","-"], ["term","foo"], ["text"," "], ["constant.character.required","+"], ["term","bar"], ["text"," "], ["constant.character.required","+"], ["string","\"foo bar\""], ["paren.rparen",")"] ],[ "start", ["keyword","field:"], ["paren.lparen","{"], ["term","foo"], ["text"," "], ["keyword.operator","TO"], ["text"," "], ["term","bar"], ["paren.rparen","}"] ],[ "start", ["keyword","field:"], ["paren.lparen","["], ["term","foo"], ["text"," "], ["keyword.operator","TO"], ["text"," "], ["term","bar"], ["paren.rparen","]"] ],[ "start", ["keyword","field:"], ["paren.lparen","["], ["string","\"a b c\""], ["text"," "], ["keyword.operator","TO"], ["text"," "], ["term","def"], ["paren.rparen","]"] ],[ "start", ["keyword","field:"], ["paren.lparen","{"], ["string","\"a b c\""], ["text"," "], ["keyword.operator","TO"], ["text"," "], ["term","def"], ["paren.rparen","}"] ],[ "start", ["keyword","field:"], ["paren.lparen","{"], ["term","foo"], ["text"," "], ["keyword.operator","TO"], ["text"," "], ["string","\"bar\""], ["paren.rparen","}"] ],[ "start", ["keyword","field:"], ["paren.lparen","{"], ["constant.numeric","20180101"], ["text"," "], ["keyword.operator","TO"], ["text"," "], ["constant.numeric","20190202"], ["paren.rparen","}"] ],[ "start", ["keyword","field:"], ["paren.lparen","{"], ["string","\"2018-01-01\""], ["text"," "], ["keyword.operator","TO"], ["text"," "], ["string","\"2019-02-02\""], ["paren.rparen","}"] ],[ "start", ["constant.language.escape","\\+"], ["term","escaped"] ],[ "start", ["constant.language.escape","\\-"], ["term","escaped"] ],[ "start", ["term","esc"], ["constant.language.escape","\\&"], ["term","aped"] ],[ "start", ["term","esc"], ["constant.language.escape","\\|"], ["term","aped"] ],[ "start", ["constant.language.escape","\\!"], ["term","escaped"] ],[ "start", ["constant.language.escape","\\("], ["term","escaped"], ["constant.language.escape","\\)"] ],[ "start", ["constant.language.escape","\\{"], ["term","escaped"], ["constant.language.escape","\\}"] ],[ "start", ["constant.language.escape","\\["], ["term","escaped"], ["constant.language.escape","\\]"] ],[ "start", ["term","escaped"], ["constant.language.escape","\\^"], ["constant.numeric","4"] ],[ "start", ["constant.language.escape","\\\""], ["term","escaped"], ["constant.language.escape","\\\""] ],[ "start", ["term","escaped"], ["constant.language.escape","\\~"], ["constant.numeric","0.4"] ],[ "start", ["term","escaped"], ["constant.language.escape","\\*"] ],[ "start", ["term","escaped"], ["constant.language.escape","\\?"] ],[ "start", ["term","esc"], ["constant.language.escape","\\:"], ["term","aped"] ],[ "start", ["term","esc"], ["constant.language.escape","\\\\"], ["term","aped"] ],[ "start", ["keyword","esc\\ aped:"], ["term","foo"] ],[ "start", ["string","\"foo\\\"bar\""] ],[ "start", ["keyword","foo:"], ["string.regexp.start","/"], ["string.regexp","bar"], ["string.regexp.end","/"] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_markdown.json ================================================ [[ "start", ["text.xml","test: header 1 "] ],[ "start", ["text.xml","#f"] ],[ "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 a valid header"] ],[ "start", ["markup.heading.1","#"], ["heading"," "] ],[ "start", ["text.xml","test: only space between #s is a valid header"] ],[ "start", ["markup.heading.1","#"], ["heading"," #"] ],[ "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: src/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"], ["punctuation.operator",":"], ["text"," "], ["support.function","url("], ["string","'name.png'"], ["support.function",")"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["support.constant","no-repeat"], ["punctuation.operator",";"] ],[ ["#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: src/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: src/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: src/mode/_test/tokens_mediawiki.json ================================================ [[ "start", ["storage.type.function","{{"], ["entity.name.function","Languages"], ["storage.type.function","}}"] ],[ "start" ],[ "start", ["punctuation.definition.tag.begin","'''"], ["markup.bold","Ace"], ["punctuation.definition.tag.end","'''"], ["text"," is a standalone code editor written in "], ["punctuation.definition.tag.begin","[["], ["entity.name.tag","wikipedia"], ["meta.tag.link.internal",":"], ["string.other.link.title","JavaScript"], ["punctuation.definition.tag","|"], ["meta.tag.link.internal","JavaScript"], ["punctuation.definition.tag.end","]]"], ["text",". 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 "], ["punctuation.definition.tag.begin","''"], ["markup.italic","easily"], ["punctuation.definition.tag.end","''"], ["text"," embedded in any web page or JavaScript application. Ace is developed as the primary editor for "], ["punctuation.definition.tag.begin","["], ["meta.tag.link.external","http://www.cloud9ide.com/"], ["meta.tag.link.external"," "], ["string.unquoted","Cloud9 IDE"], ["punctuation.definition.tag.end","]"], ["text"," and the successor of the Mozilla Skywriter (Bespin) Project."] ],[ "start" ],[ "start", ["punctuation.definition.heading","=="], ["entity.name.section"," Features "], ["punctuation.definition.heading","=="] ],[ "start", ["markup.bold","*"], ["markup.list"," Syntax highlighting"] ],[ "start", ["markup.bold","*"], ["markup.list"," Automatic indent and outdent"] ],[ "start", ["markup.bold","*"], ["markup.list"," An optional command line"] ],[ "start", ["markup.bold","*"], ["markup.list"," Handles huge documents (100,000 lines and more are no problem)"] ],[ "start", ["markup.bold","*"], ["markup.list"," Fully customizable key bindings including VI and Emacs modes"] ],[ "start", ["markup.bold","*"], ["markup.list"," Themes (TextMate themes can be imported)"] ],[ "start", ["markup.bold","*"], ["markup.list"," Search and replace with regular expressions"] ],[ "start", ["markup.bold","*"], ["markup.list"," Highlight matching parentheses"] ],[ "start", ["markup.bold","*"], ["markup.list"," Toggle between soft tabs and real tabs"] ],[ "start", ["markup.bold","*"], ["markup.list"," Displays hidden characters"] ],[ "start", ["markup.bold","*"], ["markup.list"," Drag and drop text using the mouse"] ],[ "start", ["markup.bold","*"], ["markup.list"," Line wrapping"] ],[ "start", ["markup.bold","*"], ["markup.list"," Unstructured / user code folding"] ],[ "start", ["markup.bold","*"], ["markup.list"," Live syntax checker (currently JavaScript/CoffeeScript)"] ],[ "start" ],[ "start", ["punctuation.definition.heading","=="], ["entity.name.section"," Take Ace for a spin! "], ["punctuation.definition.heading","=="] ],[ "start", ["text","Check out the Ace live "], ["punctuation.definition.tag.begin","["], ["meta.tag.link.external","http://ajaxorg.github.com/ace/"], ["meta.tag.link.external"," "], ["string.unquoted","demo"], ["punctuation.definition.tag.end","]"], ["text"," or get a "], ["punctuation.definition.tag.begin","["], ["meta.tag.link.external","http://run.cloud9ide.com"], ["meta.tag.link.external"," "], ["string.unquoted","Cloud9 IDE account"], ["punctuation.definition.tag.end","]"], ["text"," to experience Ace while editing one of your own GitHub projects."] ],[ "start" ],[ "start", ["text","If you want, you can use Ace as a textarea replacement thanks to the "], ["punctuation.definition.tag.begin","["], ["meta.tag.link.external","http://ajaxorg.github.com/ace/build/textarea/editor.html"], ["meta.tag.link.external"," "], ["string.unquoted","Ace Bookmarklet"], ["punctuation.definition.tag.end","]"], ["text","."] ],[ "start" ],[ "start", ["punctuation.definition.heading","=="], ["entity.name.section"," Documentation "], ["punctuation.definition.heading","=="] ],[ "start", ["text","You find a lot more sample code in the "], ["punctuation.definition.tag.begin","["], ["meta.tag.link.external","https://github.com/ajaxorg/ace/blob/master/demo/demo.js"], ["meta.tag.link.external"," "], ["string.unquoted","demo app"], ["punctuation.definition.tag.end","]"], ["text","."] ],[ "start" ],[ "start", ["text","There is also some documentation on the "], ["punctuation.definition.tag.begin","["], ["meta.tag.link.external","https://github.com/ajaxorg/ace/wiki"], ["meta.tag.link.external"," "], ["string.unquoted","wiki page"], ["punctuation.definition.tag.end","]"], ["text","."] ],[ "start" ],[ "start", ["text","If you still need help, feel free to drop a mail on the "], ["punctuation.definition.tag.begin","["], ["meta.tag.link.external","http://groups.google.com/group/ace-discuss"], ["meta.tag.link.external"," "], ["string.unquoted","ace mailing list"], ["punctuation.definition.tag.end","]"], ["text","."] ],[ "start" ]] ================================================ FILE: src/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"," ("], ["storage.type.mel","int"], ["meta.function.mel"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","rangeStart"], ["meta.function.mel",", "], ["storage.type.mel","int"], ["meta.function.mel"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","rangeEnd"], ["meta.function.mel",", "], ["storage.type.mel","int"], ["meta.function.mel"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","numOfDuplicates"], ["meta.function.mel",", "], ["storage.type.mel","int"], ["meta.function.mel"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","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: src/mode/_test/tokens_mips.json ================================================ [[ "start", ["comment.assembly","# Original source from https://eng.libretexts.org"] ],[ "start", ["comment.assembly","# Kann, Charles W., \"Introduction To MIPS Assembly Language Programming\" (2015). Open Textbooks. 2."] ],[ "start", ["comment.assembly","# https://cupola.gettysburg.edu/oer/2"] ],[ "start" ],[ "start", ["comment.assembly","# Program File: Program2-1.asm"] ],[ "start", ["comment.assembly","# Author: Charles Kann"] ],[ "start", ["comment.assembly","# Purpose: First program, Hello World"] ],[ "start", ["entity.name.section.mips",".text"], ["text"," "], ["comment.assembly","# Define the program instructions."] ],[ "start", ["entity.name.tag.mips","main:"], ["text"," "], ["comment.assembly","# Label to define the main program."] ],[ "start", ["text"," "], ["support.function.other.mips","li"], ["text"," "], ["variable.parameter.mips","$v0"], ["text",","], ["constant.numeric.mips","4"], ["text"," "], ["comment.assembly","# Load 4 into $v0 to indicate a print string."] ],[ "start", ["text"," "], ["support.function.other.mips","la"], ["text"," "], ["variable.parameter.mips","$a0"], ["text",", greeting "], ["comment.assembly","# Load the address of the greeting into $a0."] ],[ "start", ["text"," "], ["entity.name.function.mips","syscall"], ["text"," "], ["comment.assembly","# Print greeting. The print is indicated by"] ],[ "start", ["text"," "], ["comment.assembly","# $v0 having a value of 4, and the string to"] ],[ "start", ["text"," "], ["comment.assembly","# print is stored at the address in $a0."] ],[ "start", ["text"," "], ["support.function.other.mips","li"], ["text"," "], ["variable.parameter.mips","$v0"], ["text",", "], ["constant.numeric.mips","10"], ["text"," "], ["comment.assembly","# Load a 10 (halt) into $v0."] ],[ "start", ["text"," "], ["entity.name.function.mips","syscall"], ["text"," "], ["comment.assembly","# The program ends."] ],[ "start", ["entity.name.section.mips",".data"], ["text"," "], ["comment.assembly","# Define the program data."] ],[ "start", ["entity.name.tag.mips","greeting:"], ["text"," "], ["storage.modifier.mips",".asciiz"], ["text"," "], ["string.start","\""], ["string","Hello World"], ["string.end","\""], ["text"," "], ["comment.assembly","#The string to print."] ],[ "start" ]] ================================================ FILE: src/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: src/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: src/mode/_test/tokens_mysql.json ================================================ [[ "start", ["comment","-- Single line comment"] ],[ "start" ],[ "comment", ["comment","/*"] ],[ "comment", ["comment"," * Multi-line comment block"] ],[ "comment", ["comment"," *"] ],[ "start", ["comment"," */"] ],[ "start" ],[ "start", ["comment","# Hash-style comment (MySQL specific)"] ],[ "start" ],[ "start", ["comment","-- Database and Table Operations"] ],[ "start", ["keyword","CREATE"], ["text"," "], ["keyword","DATABASE"], ["text"," "], ["keyword","IF"], ["text"," "], ["keyword","NOT"], ["text"," "], ["keyword","EXISTS"], ["text"," "], ["identifier","demo_db"] ],[ "start", ["text"," "], ["keyword","CHARACTER"], ["text"," "], ["keyword","SET"], ["text"," "], ["identifier","utf8mb4"] ],[ "start", ["text"," "], ["keyword","COLLATE"], ["text"," "], ["identifier","utf8mb4_unicode_ci"], ["text",";"] ],[ "start" ],[ "start", ["keyword","USE"], ["text"," "], ["identifier","demo_db"], ["text",";"] ],[ "start" ],[ "start", ["keyword","CREATE"], ["text"," "], ["keyword","TABLE"], ["text"," "], ["identifier","users"], ["text"," "], ["paren.lparen","("] ],[ "start", ["text"," "], ["identifier","id"], ["text"," "], ["storage.type","INT"], ["text"," "], ["keyword","AUTO_INCREMENT"], ["text"," "], ["keyword","PRIMARY"], ["text"," "], ["keyword","KEY"], ["text",","] ],[ "start", ["text"," "], ["identifier","username"], ["text"," "], ["storage.type","VARCHAR"], ["paren.lparen","("], ["constant.numeric","50"], ["paren.rparen",")"], ["text"," "], ["keyword","NOT"], ["text"," "], ["constant","NULL"], ["text"," "], ["keyword","UNIQUE"], ["text",","] ],[ "start", ["text"," "], ["identifier","email"], ["text"," "], ["storage.type","VARCHAR"], ["paren.lparen","("], ["constant.numeric","100"], ["paren.rparen",")"], ["text"," "], ["keyword","NOT"], ["text"," "], ["constant","NULL"], ["text",","] ],[ "start", ["text"," "], ["identifier","password_hash"], ["text"," "], ["storage.type","CHAR"], ["paren.lparen","("], ["constant.numeric","64"], ["paren.rparen",")"], ["text",","] ],[ "start", ["text"," "], ["identifier","balance"], ["text"," "], ["storage.type","DECIMAL"], ["paren.lparen","("], ["constant.numeric","10"], ["text",", "], ["constant.numeric","2"], ["paren.rparen",")"], ["text"," "], ["keyword","DEFAULT"], ["text"," "], ["constant.numeric","0.00"], ["text",","] ],[ "start", ["text"," "], ["identifier","is_active"], ["text"," "], ["storage.type","BOOLEAN"], ["text"," "], ["keyword","DEFAULT"], ["text"," "], ["constant","TRUE"], ["text",","] ],[ "start", ["text"," "], ["identifier","created_at"], ["text"," "], ["storage.type","TIMESTAMP"], ["text"," "], ["keyword","DEFAULT"], ["text"," "], ["keyword","CURRENT_TIMESTAMP"], ["text",","] ],[ "start", ["text"," "], ["identifier","updated_at"], ["text"," "], ["storage.type","DATETIME"], ["text"," "], ["keyword","ON"], ["text"," "], ["keyword","UPDATE"], ["text"," "], ["keyword","CURRENT_TIMESTAMP"], ["text",","] ],[ "start", ["text"," "], ["identifier","profile_data"], ["text"," "], ["identifier","JSON"], ["text",","] ],[ "start", ["text"," "], ["keyword","INDEX"], ["text"," "], ["identifier","idx_email"], ["text"," "], ["paren.lparen","("], ["identifier","email"], ["paren.rparen",")"], ["text",","] ],[ "start", ["text"," "], ["keyword","FULLTEXT"], ["text"," "], ["keyword","INDEX"], ["text"," "], ["identifier","idx_username"], ["text"," "], ["paren.lparen","("], ["identifier","username"], ["paren.rparen",")"] ],[ "start", ["paren.rparen",")"], ["text"," "], ["keyword","ENGINE"], ["keyword.operator","="], ["keyword","InnoDB"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Insert Statements"] ],[ "start", ["keyword","INSERT"], ["text"," "], ["keyword","INTO"], ["text"," "], ["identifier","users"], ["text"," "], ["paren.lparen","("], ["identifier","username"], ["text",", "], ["identifier","email"], ["text",", "], ["identifier","password_hash"], ["paren.rparen",")"] ],[ "start", ["keyword","VALUES"] ],[ "start", ["text"," "], ["paren.lparen","("], ["string.start","'"], ["string","john_doe"], ["string.end","'"], ["text",", "], ["string.start","'"], ["string","john@example.com"], ["string.end","'"], ["text",", "], ["identifier","SHA2"], ["paren.lparen","("], ["string.start","'"], ["string","password123"], ["string.end","'"], ["text",", "], ["constant.numeric","256"], ["paren.rparen","))"], ["text",","] ],[ "start", ["text"," "], ["paren.lparen","("], ["string.start","'"], ["string","jane_smith"], ["string.end","'"], ["text",", "], ["string.start","'"], ["string","jane@example.com"], ["string.end","'"], ["text",", "], ["identifier","SHA2"], ["paren.lparen","("], ["string.start","'"], ["string","secure456"], ["string.end","'"], ["text",", "], ["constant.numeric","256"], ["paren.rparen","))"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Select with Various Clauses"] ],[ "start", ["keyword","SELECT"] ],[ "start", ["text"," "], ["identifier","u"], ["text","."], ["identifier","id"], ["text",","] ],[ "start", ["text"," "], ["identifier","u"], ["text","."], ["identifier","username"], ["text",","] ],[ "start", ["text"," "], ["support.function","CONCAT"], ["paren.lparen","("], ["support.function","UPPER"], ["paren.lparen","("], ["keyword","LEFT"], ["paren.lparen","("], ["identifier","u"], ["text","."], ["identifier","username"], ["text",", "], ["constant.numeric","1"], ["paren.rparen","))"], ["text",", "], ["support.function","LOWER"], ["paren.lparen","("], ["support.function","SUBSTRING"], ["paren.lparen","("], ["identifier","u"], ["text","."], ["identifier","username"], ["text",", "], ["constant.numeric","2"], ["paren.rparen",")))"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","formatted_name"], ["text",","] ],[ "start", ["text"," "], ["support.function","COALESCE"], ["paren.lparen","("], ["identifier","u"], ["text","."], ["identifier","balance"], ["text",", "], ["constant.numeric","0"], ["paren.rparen",")"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","balance"], ["text",","] ],[ "start", ["text"," "], ["support.function","DATE_FORMAT"], ["paren.lparen","("], ["identifier","u"], ["text","."], ["identifier","created_at"], ["text",", "], ["string.start","'"], ["string","%Y-%m-%d"], ["string.end","'"], ["paren.rparen",")"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","join_date"] ],[ "start", ["keyword","FROM"], ["text"," "], ["identifier","users"], ["text"," "], ["identifier","u"] ],[ "start", ["keyword","WHERE"], ["text"," "], ["identifier","u"], ["text","."], ["identifier","is_active"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant","TRUE"] ],[ "start", ["text"," "], ["keyword","AND"], ["text"," "], ["identifier","u"], ["text","."], ["identifier","created_at"], ["text"," "], ["keyword.operator",">="], ["text"," "], ["string.start","'"], ["string","2024-01-01"], ["string.end","'"] ],[ "start", ["text"," "], ["keyword","AND"], ["text"," "], ["identifier","u"], ["text","."], ["identifier","email"], ["text"," "], ["keyword","LIKE"], ["text"," "], ["string.start","'"], ["string","%@example.com"], ["string.end","'"] ],[ "start", ["text"," "], ["keyword","AND"], ["text"," "], ["identifier","u"], ["text","."], ["identifier","id"], ["text"," "], ["keyword","BETWEEN"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword","AND"], ["text"," "], ["constant.numeric","1000"] ],[ "start", ["text"," "], ["keyword","AND"], ["text"," "], ["identifier","u"], ["text","."], ["identifier","username"], ["text"," "], ["keyword","IN"], ["text"," "], ["paren.lparen","("], ["string.start","'"], ["string","john_doe"], ["string.end","'"], ["text",", "], ["string.start","'"], ["string","jane_smith"], ["string.end","'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","AND"], ["text"," "], ["identifier","u"], ["text","."], ["identifier","profile_data"], ["text"," "], ["keyword","IS"], ["text"," "], ["keyword","NOT"], ["text"," "], ["constant","NULL"] ],[ "start", ["keyword","GROUP"], ["text"," "], ["keyword","BY"], ["text"," "], ["identifier","u"], ["text","."], ["identifier","id"] ],[ "start", ["keyword","HAVING"], ["text"," "], ["keyword","COUNT"], ["paren.lparen","("], ["text","*"], ["paren.rparen",")"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","0"] ],[ "start", ["keyword","ORDER"], ["text"," "], ["keyword","BY"], ["text"," "], ["identifier","u"], ["text","."], ["identifier","created_at"], ["text"," "], ["keyword","DESC"] ],[ "start", ["keyword","LIMIT"], ["text"," "], ["constant.numeric","10"], ["text"," "], ["keyword","OFFSET"], ["text"," "], ["constant.numeric","0"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Update Statement"] ],[ "start", ["keyword","UPDATE"], ["text"," "], ["identifier","users"] ],[ "start", ["keyword","SET"], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","100.50"], ["text",","] ],[ "start", ["text"," "], ["identifier","updated_at"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","NOW"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["keyword","WHERE"], ["text"," "], ["identifier","username"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","john_doe"], ["string.end","'"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Delete Statement"] ],[ "start", ["keyword","DELETE"], ["text"," "], ["keyword","FROM"], ["text"," "], ["identifier","users"] ],[ "start", ["keyword","WHERE"], ["text"," "], ["identifier","is_active"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant","FALSE"] ],[ "start", ["text"," "], ["keyword","AND"], ["text"," "], ["identifier","created_at"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["support.function","DATE_SUB"], ["paren.lparen","("], ["support.function","NOW"], ["paren.lparen","("], ["paren.rparen",")"], ["text",", "], ["keyword","INTERVAL"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["storage.type","YEAR"], ["paren.rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Join Example"] ],[ "start", ["keyword","SELECT"] ],[ "start", ["text"," "], ["identifier","u"], ["text","."], ["identifier","username"], ["text",","] ],[ "start", ["text"," "], ["identifier","o"], ["text","."], ["identifier","order_id"], ["text",","] ],[ "start", ["text"," "], ["identifier","o"], ["text","."], ["identifier","total_amount"] ],[ "start", ["keyword","FROM"], ["text"," "], ["identifier","users"], ["text"," "], ["identifier","u"] ],[ "start", ["keyword","INNER"], ["text"," "], ["keyword","JOIN"], ["text"," "], ["identifier","orders"], ["text"," "], ["identifier","o"], ["text"," "], ["keyword","ON"], ["text"," "], ["identifier","u"], ["text","."], ["identifier","id"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","o"], ["text","."], ["identifier","user_id"] ],[ "start", ["keyword","LEFT"], ["text"," "], ["keyword","JOIN"], ["text"," "], ["identifier","order_items"], ["text"," "], ["identifier","oi"], ["text"," "], ["keyword","ON"], ["text"," "], ["identifier","o"], ["text","."], ["identifier","order_id"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","oi"], ["text","."], ["identifier","order_id"] ],[ "start", ["keyword","WHERE"], ["text"," "], ["identifier","o"], ["text","."], ["variable.language","status"], ["text"," "], ["keyword.operator","!="], ["text"," "], ["string.start","'"], ["string","cancelled"], ["string.end","'"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Subquery and EXISTS"] ],[ "start", ["keyword","SELECT"], ["text"," * "], ["keyword","FROM"], ["text"," "], ["identifier","users"] ],[ "start", ["keyword","WHERE"], ["text"," "], ["keyword","EXISTS"], ["text"," "], ["paren.lparen","("] ],[ "start", ["text"," "], ["keyword","SELECT"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword","FROM"], ["text"," "], ["identifier","orders"] ],[ "start", ["text"," "], ["keyword","WHERE"], ["text"," "], ["identifier","orders"], ["text","."], ["identifier","user_id"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","users"], ["text","."], ["identifier","id"] ],[ "start", ["text"," "], ["keyword","AND"], ["text"," "], ["identifier","orders"], ["text","."], ["identifier","total_amount"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","500"] ],[ "start", ["paren.rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- CASE Expression"] ],[ "start", ["keyword","SELECT"] ],[ "start", ["text"," "], ["identifier","username"], ["text",","] ],[ "start", ["text"," "], ["keyword","CASE"] ],[ "start", ["text"," "], ["keyword","WHEN"], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword.operator",">="], ["text"," "], ["constant.numeric","1000"], ["text"," "], ["keyword","THEN"], ["text"," "], ["string.start","'"], ["string","Premium"], ["string.end","'"] ],[ "start", ["text"," "], ["keyword","WHEN"], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword.operator",">="], ["text"," "], ["constant.numeric","100"], ["text"," "], ["keyword","THEN"], ["text"," "], ["string.start","'"], ["string","Standard"], ["string.end","'"] ],[ "start", ["text"," "], ["keyword","ELSE"], ["text"," "], ["string.start","'"], ["string","Basic"], ["string.end","'"] ],[ "start", ["text"," "], ["keyword","END"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","tier"] ],[ "start", ["keyword","FROM"], ["text"," "], ["identifier","users"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Window Functions"] ],[ "start", ["keyword","SELECT"] ],[ "start", ["text"," "], ["identifier","username"], ["text",","] ],[ "start", ["text"," "], ["identifier","balance"], ["text",","] ],[ "start", ["text"," "], ["identifier","ROW_NUMBER"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["identifier","OVER"], ["text"," "], ["paren.lparen","("], ["keyword","ORDER"], ["text"," "], ["keyword","BY"], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword","DESC"], ["paren.rparen",")"], ["text"," "], ["keyword","AS"], ["text"," "], ["support.function","rank"], ["text",","] ],[ "start", ["text"," "], ["keyword","SUM"], ["paren.lparen","("], ["identifier","balance"], ["paren.rparen",")"], ["text"," "], ["identifier","OVER"], ["text"," "], ["paren.lparen","("], ["keyword","PARTITION"], ["text"," "], ["keyword","BY"], ["text"," "], ["identifier","is_active"], ["paren.rparen",")"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","total_by_status"] ],[ "start", ["keyword","FROM"], ["text"," "], ["identifier","users"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Variables"] ],[ "start", ["keyword","SET"], ["text"," "], ["constant.class","@user_count"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["keyword","SELECT"], ["text"," "], ["keyword","COUNT"], ["paren.lparen","("], ["text","*"], ["paren.rparen",")"], ["text"," "], ["keyword","FROM"], ["text"," "], ["identifier","users"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["keyword","SET"], ["text"," "], ["constant.class","@tax_rate"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0.08"], ["text",";"] ],[ "start" ],[ "start", ["keyword","SELECT"], ["text"," "], ["constant.class","@user_count"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","total_users"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Stored Procedure"] ],[ "start", ["keyword","DELIMITER"], ["text"," "], ["keyword.operator","//"] ],[ "start", ["keyword","CREATE"], ["text"," "], ["keyword","PROCEDURE"], ["text"," "], ["identifier","GetUserByEmail"], ["paren.lparen","("], ["keyword","IN"], ["text"," "], ["identifier","user_email"], ["text"," "], ["storage.type","VARCHAR"], ["paren.lparen","("], ["constant.numeric","100"], ["paren.rparen","))"] ],[ "start", ["keyword","BEGIN"] ],[ "start", ["text"," "], ["keyword","DECLARE"], ["text"," "], ["identifier","user_exists"], ["text"," "], ["storage.type","INT"], ["text"," "], ["keyword","DEFAULT"], ["text"," "], ["constant.numeric","0"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword","SELECT"], ["text"," "], ["keyword","COUNT"], ["paren.lparen","("], ["text","*"], ["paren.rparen",")"], ["text"," "], ["keyword","INTO"], ["text"," "], ["identifier","user_exists"] ],[ "start", ["text"," "], ["keyword","FROM"], ["text"," "], ["identifier","users"], ["text"," "], ["keyword","WHERE"], ["text"," "], ["identifier","email"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","user_email"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword","IF"], ["text"," "], ["identifier","user_exists"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["keyword","THEN"] ],[ "start", ["text"," "], ["keyword","SELECT"], ["text"," * "], ["keyword","FROM"], ["text"," "], ["identifier","users"], ["text"," "], ["keyword","WHERE"], ["text"," "], ["identifier","email"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","user_email"], ["text",";"] ],[ "start", ["text"," "], ["keyword","ELSE"] ],[ "start", ["text"," "], ["keyword","SELECT"], ["text"," "], ["string.start","'"], ["string","User not found"], ["string.end","'"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","message"], ["text",";"] ],[ "start", ["text"," "], ["keyword","END"], ["text"," "], ["keyword","IF"], ["text",";"] ],[ "start", ["keyword","END"], ["text"," "], ["keyword.operator","//"] ],[ "start", ["keyword","DELIMITER"], ["text"," ;"] ],[ "start" ],[ "start", ["comment","-- Function"] ],[ "start", ["keyword","CREATE"], ["text"," "], ["keyword","FUNCTION"], ["text"," "], ["identifier","CalculateDiscount"], ["paren.lparen","("], ["identifier","price"], ["text"," "], ["storage.type","DECIMAL"], ["paren.lparen","("], ["constant.numeric","10"], ["text",","], ["constant.numeric","2"], ["paren.rparen",")"], ["text",", "], ["identifier","discount_pct"], ["text"," "], ["storage.type","INT"], ["paren.rparen",")"] ],[ "start", ["keyword","RETURNS"], ["text"," "], ["storage.type","DECIMAL"], ["paren.lparen","("], ["constant.numeric","10"], ["text",","], ["constant.numeric","2"], ["paren.rparen",")"] ],[ "start", ["keyword","DETERMINISTIC"] ],[ "start", ["keyword","BEGIN"] ],[ "start", ["text"," "], ["keyword","RETURN"], ["text"," "], ["identifier","price"], ["text"," * "], ["paren.lparen","("], ["constant.numeric","1"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["identifier","discount_pct"], ["text"," "], ["keyword.operator","/"], ["text"," "], ["constant.numeric","100"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["keyword","END"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Trigger"] ],[ "start", ["keyword","CREATE"], ["text"," "], ["keyword","TRIGGER"], ["text"," "], ["identifier","before_user_update"] ],[ "start", ["keyword","BEFORE"], ["text"," "], ["keyword","UPDATE"], ["text"," "], ["keyword","ON"], ["text"," "], ["identifier","users"] ],[ "start", ["keyword","FOR"], ["text"," "], ["keyword","EACH"], ["text"," "], ["keyword","ROW"] ],[ "start", ["keyword","BEGIN"] ],[ "start", ["text"," "], ["keyword","SET"], ["text"," "], ["identifier","NEW"], ["text","."], ["identifier","updated_at"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","NOW"], ["paren.lparen","("], ["paren.rparen",")"], ["text",";"] ],[ "start", ["keyword","END"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Transaction"] ],[ "start", ["keyword","START"], ["text"," "], ["keyword","TRANSACTION"], ["text",";"] ],[ "start", ["text"," "], ["keyword","UPDATE"], ["text"," "], ["identifier","users"], ["text"," "], ["keyword","SET"], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["constant.numeric","50"], ["text"," "], ["keyword","WHERE"], ["text"," "], ["identifier","id"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"], ["text",";"] ],[ "start", ["text"," "], ["keyword","UPDATE"], ["text"," "], ["identifier","users"], ["text"," "], ["keyword","SET"], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","50"], ["text"," "], ["keyword","WHERE"], ["text"," "], ["identifier","id"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","2"], ["text",";"] ],[ "start", ["keyword","COMMIT"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Common Table Expression (CTE)"] ],[ "start", ["keyword","WITH"], ["text"," "], ["identifier","active_users"], ["text"," "], ["keyword","AS"], ["text"," "], ["paren.lparen","("] ],[ "start", ["text"," "], ["keyword","SELECT"], ["text"," * "], ["keyword","FROM"], ["text"," "], ["identifier","users"], ["text"," "], ["keyword","WHERE"], ["text"," "], ["identifier","is_active"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant","TRUE"] ],[ "start", ["paren.rparen",")"] ],[ "start", ["keyword","SELECT"], ["text"," * "], ["keyword","FROM"], ["text"," "], ["identifier","active_users"], ["text"," "], ["keyword","WHERE"], ["text"," "], ["identifier","balance"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","100"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- EXPLAIN for query analysis"] ],[ "start", ["keyword","EXPLAIN"], ["text"," "], ["keyword","SELECT"], ["text"," * "], ["keyword","FROM"], ["text"," "], ["identifier","users"], ["text"," "], ["keyword","WHERE"], ["text"," "], ["identifier","email"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","test@example.com"], ["string.end","'"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- Numeric literals"] ],[ "start", ["keyword","SELECT"], ["text"," "], ["constant.numeric","42"], ["text",", "], ["constant.numeric","3.14159"], ["text",", "], ["constant.numeric","1e10"], ["text",", "], ["constant.numeric","0x1A2B"], ["text",", "], ["constant.numeric","b'101010'"], ["text",";"] ],[ "start" ],[ "start", ["comment","-- String literals"] ],[ "start", ["keyword","SELECT"], ["text"," "], ["string.start","'"], ["string","single quotes"], ["string.end","'"], ["text",", "], ["string.start","\""], ["string","double quotes"], ["string.end","\""], ["text",", "], ["constant.buildin","`backtick identifiers`"], ["text",";"] ]] ================================================ FILE: src/mode/_test/tokens_nasal.json ================================================ [[ "start", ["storage.type.nasal","var"], ["text"," sayHello "], ["keyword.operator.nasal","="], ["text"," func(names, favorite) {"] ],[ "start", ["text"," "], ["keyword.control.nasal","foreach"], ["text"," ("], ["storage.type.nasal","var"], ["text"," name"], ["punctuation.terminator.statement.nasal",";"], ["text"," names) {"] ],[ "start", ["text"," "], ["variable.language.nasal","printf"], ["text","("], ["punctuation.definition.string.begin.nasal","\""], ["string.quoted.double.nasal","Hello "], ["constant.character.escape.nasal","%s"], ["string.quoted.double.nasal",", "], ["constant.character.escape.nasal","%s"], ["string.quoted.double.nasal"," is the best!"], ["punctuation.definition.string.end.nasal","\""], ["text",", name, favorite)"], ["punctuation.terminator.statement.nasal",";"] ],[ "start", ["text"," }"] ],[ "start", ["text","}"] ],[ "start" ],[ "start", ["text","sayHello(["], ["punctuation.definition.string.begin.nasal","\""], ["string.quoted.double.nasal","World"], ["punctuation.definition.string.end.nasal","\""], ["text",", "], ["punctuation.definition.string.begin.nasal","\""], ["string.quoted.double.nasal","FlightGear"], ["punctuation.definition.string.end.nasal","\""], ["text","], "], ["punctuation.definition.string.begin.nasal","\""], ["string.quoted.double.nasal","Nasal"], ["punctuation.definition.string.end.nasal","\""], ["text",")"], ["punctuation.terminator.statement.nasal",";"] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_nginx.json ================================================ [[ "start", ["keyword","user"], ["text"," www www"], ["punctuation",";"], ["text"," "], ["comment","## Default: nobody"] ],[ "start", ["keyword","worker_processes"], ["text"," 5"], ["punctuation",";"], ["text"," "], ["comment","## Default: 1"] ],[ "start", ["keyword","error_log"], ["text"," logs/error.log"], ["punctuation",";"] ],[ "start", ["keyword","pid"], ["text"," logs/nginx.pid"], ["punctuation",";"] ],[ "start", ["keyword","worker_rlimit_nofile"], ["text"," 8192"], ["punctuation",";"] ],[ "start" ],[ "start", ["storage.type","events"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","worker_connections"], ["text"," 4096"], ["punctuation",";"], ["text"," "], ["comment","## Default: 1024"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.type","http"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","include"], ["text"," conf/mime.types"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","include"], ["text"," /etc/nginx/proxy.conf"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","include"], ["text"," /etc/nginx/fastcgi.conf"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","index"], ["text"," index.html index.htm index.php"], ["punctuation",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword","default_type"], ["text"," application/octet-stream"], ["punctuation",";"] ],[ "keyword", ["text"," "], ["keyword","log_format"], ["text"," "], ["constant.language","main"], ["text"," "], ["string","'"], ["variable","$remote_addr"], ["string"," - "], ["variable","$remote_user"], ["string"," ["], ["variable","$time_local"], ["string","] "], ["variable","$status"], ["string"," '"] ],[ "keyword", ["text"," "], ["string","'\""], ["variable","$request"], ["string","\" "], ["variable","$body_bytes_sent"], ["string"," \""], ["variable","$http_referer"], ["string","\" '"] ],[ "start", ["text"," "], ["string","'\""], ["variable","$http_user_agent"], ["string","\" \""], ["variable","$http_x_forwarded_for"], ["string","\"'"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","access_log"], ["text"," logs/access.log "], ["constant.language","main"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","sendfile"], ["text"," "], ["constant.language","on"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","tcp_nopush"], ["text"," "], ["constant.language","on"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","server_names_hash_bucket_size"], ["text"," 128"], ["punctuation",";"], ["text"," "], ["comment","# this seems to be required for some vhosts"] ],[ "start" ],[ "start", ["text"," "], ["storage.type","server"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["comment","# php/fastcgi"] ],[ "start", ["text"," "], ["keyword","listen"], ["text"," 80"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","server_name"], ["text"," domain1.com www.domain1.com"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","access_log"], ["text"," logs/domain1.access.log "], ["constant.language","main"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","root"], ["text"," html"], ["punctuation",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.type","location"], ["text"," "], ["string.regexp","~ \\.php$ "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","fastcgi_pass"], ["text"," 127.0.0.1:1025"], ["punctuation",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["storage.type","server"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["comment","# simple reverse-proxy"] ],[ "start", ["text"," "], ["keyword","listen"], ["text"," 80"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","server_name"], ["text"," domain2.com www.domain2.com"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","access_log"], ["text"," logs/domain2.access.log "], ["constant.language","main"], ["punctuation",";"] ],[ "start" ],[ "start", ["text"," "], ["comment","# serve static files"] ],[ "start", ["text"," "], ["storage.type","location"], ["text"," "], ["string.regexp","~ ^/(images|javascript|js|css|flash|media|static)/ "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","root"], ["text"," /var/www/virtual/big.server.com/htdocs"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","expires"], ["text"," 30d"], ["punctuation",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["comment","# pass requests for dynamic content to rails/turbogears/zope, et al"] ],[ "start", ["text"," "], ["storage.type","location"], ["text"," "], ["text","/ "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","proxy_pass"], ["text"," http://127.0.0.1:8080"], ["punctuation",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["storage.type","upstream"], ["text"," "], ["text","big_server_com "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","server"], ["text"," 127.0.0.3:8000 weight=5"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","server"], ["text"," 127.0.0.3:8001 weight=5"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","server"], ["text"," 192.168.0.1:8000"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","server"], ["text"," 192.168.0.1:8001"], ["punctuation",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["storage.type","server"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["comment","# simple load balancing"] ],[ "start", ["text"," "], ["keyword","listen"], ["text"," 80"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","server_name"], ["text"," big.server.com"], ["punctuation",";"] ],[ "start", ["text"," "], ["keyword","access_log"], ["text"," logs/big.server.access.log "], ["constant.language","main"], ["punctuation",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.type","location"], ["text"," "], ["text","/ "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","proxy_pass"], ["text"," http://big_server_com"], ["punctuation",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: src/mode/_test/tokens_nim.json ================================================ [[ ["blockComment","blockComment"], ["comment.start","#["], ["comment"," "], ["comment.start","#["], ["comment"," Multiline comment in already"] ],[ "blockComment", ["comment"," commented out code. "], ["comment.end","]#"] ],[ "blockComment", ["comment","proc p[T](x: T) = discard"] ],[ "start", ["comment.end","]#"] ],[ "start", ["keyword","echo"], ["text"," "], ["string","\"This is code\""] ],[ "start", ["variable","var"] ],[ "start", ["text"," "], ["identifier","p"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.float","0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64"] ],[ "start" ],[ "start", ["keyword","proc"], ["text"," "], ["support.function","getAlphabet"], ["paren.lparen","("], ["paren.rparen",")"], ["keyword.operator",":"], ["text"," "], ["storage.type","string"], ["text"," "], ["keyword.operator","="] ],[ "start", ["text"," "], ["variable","var"], ["text"," "], ["identifier","accm"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"\""] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["identifier","letter"], ["text"," "], ["keyword","in"], ["text"," "], ["string","'a'"], ["keyword.operator",".."], ["string","'z'"], ["keyword.operator",":"], ["text"," "], ["comment","# see iterators"] ],[ "start", ["text"," "], ["identifier","accm"], ["keyword.operator","."], ["support.function","add"], ["paren.lparen","("], ["identifier","letter"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["identifier","accm"] ],[ "start" ],[ "start", ["support.function","assert"], ["paren.lparen","("], ["string","\"a\""], ["text"," "], ["keyword.operator","*"], ["text"," "], ["constant.integer","10"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","\"aaaaaaaaaa\""], ["paren.rparen",")"] ],[ "start" ]] ================================================ FILE: src/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: src/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: src/mode/_test/tokens_nunjucks.json ================================================ [[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","foo"], ["punctuation","."], ["variable.parameter","bar"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","foo"], ["paren.lpar","["], ["string","\"bar\""], ["paren.rpar","]"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","foo"], ["text"," "], ["punctuation","|"], ["text"," "], ["support.other","title"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","foo"], ["text"," "], ["punctuation","|"], ["text"," "], ["support.other","join"], ["paren.lpar","("], ["string","\",\""], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","foo"], ["text"," "], ["punctuation","|"], ["text"," "], ["support.other","replace"], ["paren.lpar","("], ["string","\"foo\""], ["punctuation",","], ["text"," "], ["string","\"bar\""], ["paren.rpar",")"], ["text"," "], ["punctuation","|"], ["text"," "], ["support.other","capitalize"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","block"], ["text"," "], ["variable","header"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml","This is the default content"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endblock"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","section"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"left\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["punctuation.begin","{%"], ["text"," "], ["keyword.control","block"], ["text"," "], ["variable","left"], ["text"," "], ["punctuation.end","%}"], ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endblock"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","section"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"right\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["punctuation.begin","{%"], ["text"," "], ["keyword.control","block"], ["text"," "], ["variable","right"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," This is more content"] ],[ "start", ["text.xml"," "], ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endblock"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","extends"], ["text"," "], ["string","\"parent.html\""], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","block"], ["text"," "], ["variable","left"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml","This is the left side!"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endblock"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","block"], ["text"," "], ["variable","right"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml","This is the right side!"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endblock"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","block"], ["text"," "], ["variable","right"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["support.function","super"], ["paren.lpar","("], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["text.xml","Right side!"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endblock"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","if"], ["text"," "], ["variable","variable"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," It is true"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endif"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","if"], ["text"," "], ["variable","hungry"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," I am hungry"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","elif"], ["text"," "], ["variable","tired"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," I am tired"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","else"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," I am good!"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endif"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h1"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Posts"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","ul"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","for"], ["text"," "], ["variable","item"], ["text"," "], ["keyword.control","in"], ["text"," "], ["variable","items"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.xml",">"], ["punctuation.begin","{{"], ["text"," "], ["variable","item"], ["punctuation","."], ["variable.parameter","title"], ["text"," "], ["punctuation.end","}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","else"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","This would display if the 'item' collection were empty"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endfor"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","for"], ["text"," "], ["variable","ingredient"], ["punctuation",","], ["text"," "], ["variable","amount"], ["text"," "], ["keyword.control","in"], ["text"," "], ["variable","food"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," Use "], ["punctuation.begin","{{"], ["text"," "], ["variable","amount"], ["text"," "], ["punctuation.end","}}"], ["text.xml"," of "], ["punctuation.begin","{{"], ["text"," "], ["variable","ingredient"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endfor"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","for"], ["text"," "], ["variable","fruit"], ["punctuation",","], ["text"," "], ["variable","color"], ["text"," "], ["keyword.control","in"], ["text"," "], ["variable","fruits"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," Did you know that "], ["punctuation.begin","{{"], ["text"," "], ["variable","fruit"], ["text"," "], ["punctuation.end","}}"], ["text.xml"," is "], ["punctuation.begin","{{"], ["text"," "], ["variable","color"], ["text"," "], ["punctuation.end","}}"], ["text.xml","?"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endfor"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","for"], ["text"," "], ["variable","x"], ["punctuation",","], ["text"," "], ["variable","y"], ["punctuation",","], ["text"," "], ["variable","z"], ["text"," "], ["keyword.control","in"], ["text"," "], ["variable","points"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," Point: "], ["punctuation.begin","{{"], ["text"," "], ["variable","x"], ["text"," "], ["punctuation.end","}}"], ["text.xml",", "], ["punctuation.begin","{{"], ["text"," "], ["variable","y"], ["text"," "], ["punctuation.end","}}"], ["text.xml",", "], ["punctuation.begin","{{"], ["text"," "], ["variable","z"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endfor"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h1"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Posts"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","ul"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","asyncEach"], ["text"," "], ["variable","item"], ["text"," "], ["keyword.control","in"], ["text"," "], ["variable","items"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," "], ["punctuation.begin","{%"], ["text"," "], ["keyword.control","include"], ["text"," "], ["string","\"item-template.html\""], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endeach"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h1"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Posts"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","ul"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","asyncAll"], ["text"," "], ["variable","item"], ["text"," "], ["keyword.control","in"], ["text"," "], ["variable","items"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.xml",">"], ["punctuation.begin","{{"], ["text"," "], ["variable","item"], ["punctuation","."], ["variable.parameter","id"], ["text"," "], ["punctuation","|"], ["text"," "], ["support.other","lookup"], ["text"," "], ["punctuation.end","}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endall"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","macro"], ["text"," "], ["support.function","field"], ["paren.lpar","("], ["variable","name"], ["punctuation",","], ["text"," "], ["variable","value"], ["text","="], ["string","''"], ["punctuation",","], ["text"," "], ["variable","type"], ["text","="], ["string","'text'"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"field\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "tag_stuff", ["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","\""], ["punctuation.begin","{{"], ["text"," "], ["variable","type"], ["text"," "], ["punctuation.end","}}"], ["string.attribute-value.xml","\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","name"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["punctuation.begin","{{"], ["text"," "], ["variable","name"], ["text"," "], ["punctuation.end","}}"], ["string.attribute-value.xml","\""] ],[ "start", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","value"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["punctuation.begin","{{"], ["text"," "], ["variable","value"], ["text"," "], ["punctuation","|"], ["text"," "], ["support.other","escape"], ["text"," "], ["punctuation.end","}}"], ["string.attribute-value.xml","\""], ["text.tag-whitespace.xml"," "], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endmacro"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","username"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","set"], ["text"," "], ["variable","username"], ["text"," = "], ["string","\"joe\""], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","username"], ["text"," "], ["punctuation.end","}}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","set"], ["text"," "], ["variable","standardModal"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," "], ["punctuation.begin","{%"], ["text"," "], ["keyword.control","include"], ["text"," "], ["string","'standardModalData.html'"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endset"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"js-modal\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","data-modal"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["punctuation.begin","{{"], ["variable","standardModal"], ["text"," "], ["punctuation","|"], ["text"," "], ["support.other","e"], ["punctuation.end","}}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","set"], ["text"," "], ["variable","standardModal"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," "], ["punctuation.begin","{%"], ["text"," "], ["keyword.control","include"], ["text"," "], ["string","'standardModalData.html'"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endset"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"js-modal\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","data-modal"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["punctuation.begin","{{"], ["variable","standardModal"], ["text"," "], ["punctuation","|"], ["text"," "], ["support.other","e"], ["punctuation.end","}}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","include"], ["text"," "], ["string","\"missing.html\""], ["text"," "], ["keyword.control","ignore missing"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","import"], ["text"," "], ["string","\"forms.html\""], ["text"," "], ["keyword.control","as"], ["text"," "], ["variable","forms"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","forms"], ["punctuation","."], ["support.function","label"], ["paren.lpar","("], ["string","'Username'"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","forms"], ["punctuation","."], ["support.function","field"], ["paren.lpar","("], ["string","'user'"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","forms"], ["punctuation","."], ["support.function","label"], ["paren.lpar","("], ["string","'Password'"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["variable","forms"], ["punctuation","."], ["support.function","field"], ["paren.lpar","("], ["string","'pass'"], ["punctuation",","], ["text"," "], ["variable","type"], ["text","="], ["string","'password'"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","from"], ["text"," "], ["string","\"forms.html\""], ["text"," "], ["keyword.control","import"], ["text"," "], ["variable","field"], ["punctuation",","], ["text"," "], ["variable","label"], ["text"," "], ["keyword.control","as"], ["text"," "], ["variable","description"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["support.function","description"], ["paren.lpar","("], ["string","'Username'"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["support.function","field"], ["paren.lpar","("], ["string","'user'"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["support.function","description"], ["paren.lpar","("], ["string","'Password'"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["support.function","field"], ["paren.lpar","("], ["string","'pass'"], ["punctuation",","], ["text"," "], ["variable","type"], ["text","="], ["string","'password'"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start" ],[ "start", ["punctuation.begin","{{"], ["text"," "], ["support.function","foo"], ["paren.lpar","("], ["constant.numeric","1"], ["punctuation",","], ["text"," "], ["constant.numeric","2"], ["punctuation",","], ["text"," "], ["variable","bar"], ["text","="], ["constant.numeric","3"], ["punctuation",","], ["text"," "], ["variable","baz"], ["text","="], ["constant.numeric","4"], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"] ],[ "start" ],[ "start", ["comment.begin","{#"], ["comment"," Loop through all the users "], ["comment.end","#}"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","for"], ["text"," "], ["variable","user"], ["text"," "], ["keyword.control","in"], ["text"," "], ["variable","users"], ["text"," "], ["punctuation.end","%}"], ["text.xml","..."], ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endfor"], ["text"," "], ["punctuation.end","%}"] ],[ "start" ],[ "start" ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","set"], ["text"," "], ["variable","cls"], ["text"," = "], ["support.function","cycler"], ["paren.lpar","("], ["string","\"odd\""], ["punctuation",","], ["text"," "], ["string","\"even\""], ["paren.rpar",")"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","for"], ["text"," "], ["variable","row"], ["text"," "], ["keyword.control","in"], ["text"," "], ["variable","rows"], ["text"," "], ["punctuation.end","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["punctuation.begin","{{"], ["text"," "], ["variable","cls"], ["punctuation","."], ["support.function","next"], ["paren.lpar","("], ["paren.rpar",")"], ["text"," "], ["punctuation.end","}}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["punctuation.begin","{{"], ["text"," "], ["variable","row"], ["punctuation","."], ["variable.parameter","name"], ["text"," "], ["punctuation.end","}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["punctuation.begin","{%"], ["text"," "], ["keyword.control","endfor"], ["text"," "], ["punctuation.end","%}"] ]] ================================================ FILE: src/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: src/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: src/mode/_test/tokens_odin.json ================================================ [[ "start", ["keyword","package"], ["text"," "], ["identifier","main"] ],[ "start" ],[ "start", ["keyword","import"], ["text"," "], ["string","\"core:fmt\""] ],[ "start" ],[ "start", ["entity.name.function","main"], ["text"," "], ["keyword.operator","::"], ["text"," "], ["keyword","proc"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["identifier","program"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["string","\"+ + * 😃 - /\""] ],[ "start", ["text","\t"], ["identifier","accumulator"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["constant.numeric","0"] ],[ "start" ],[ "start", ["text","\t"], ["keyword","for"], ["text"," "], ["identifier","token"], ["text"," "], ["keyword","in"], ["text"," "], ["identifier","program"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["keyword","switch"], ["text"," "], ["identifier","token"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["keyword","case"], ["text"," "], ["constant.numeric","'+'"], ["keyword.operator",":"], ["text"," "], ["identifier","accumulator"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text","\t\t"], ["keyword","case"], ["text"," "], ["constant.numeric","'-'"], ["keyword.operator",":"], ["text"," "], ["identifier","accumulator"], ["text"," "], ["keyword.operator","-="], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text","\t\t"], ["keyword","case"], ["text"," "], ["constant.numeric","'*'"], ["keyword.operator",":"], ["text"," "], ["identifier","accumulator"], ["text"," "], ["keyword.operator","*="], ["text"," "], ["constant.numeric","2"] ],[ "start", ["text","\t\t"], ["keyword","case"], ["text"," "], ["constant.numeric","'/'"], ["keyword.operator",":"], ["text"," "], ["identifier","accumulator"], ["text"," "], ["keyword.operator","/="], ["text"," "], ["constant.numeric","2"] ],[ "start", ["text","\t\t"], ["keyword","case"], ["text"," "], ["constant.numeric","'😃'"], ["keyword.operator",":"], ["text"," "], ["identifier","accumulator"], ["text"," "], ["keyword.operator","*="], ["text"," "], ["identifier","accumulator"] ],[ "start", ["text","\t\t"], ["keyword","case"], ["keyword.operator",":"], ["text"," "], ["comment","// Ignore everything else"] ],[ "start", ["text","\t\t"], ["paren.rparen","}"] ],[ "start", ["text","\t"], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text","\t"], ["identifier","fmt"], ["punctuation.operator","."], ["support.function","printf"], ["paren.lparen","("], ["string","\"The program \\\"%s\\\" calculates the value %d\\n\""], ["punctuation.operator",","], ["text"," "], ["identifier","program"], ["punctuation.operator",","], ["text"," "], ["identifier","accumulator"], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_partiql.json ================================================ [[ "start", ["comment.line.partiql","-- comment"] ],[ "comment__1", ["comment.block.partiql","/* multi"] ],[ "comment__1", ["comment.block.partiql"," line"] ],[ "start", ["comment.block.partiql"," comment */"] ],[ "start" ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["variable.language.identifier.partiql","a"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","b"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","c"], ["text.partiql"," "], ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","stuff"], ["text.partiql"," "], ["variable.language.identifier.partiql","s"], ["text.partiql"," "], ["keyword.other.partiql","INNER"], ["text.partiql"," "], ["keyword.other.partiql","CROSS"], ["text.partiql"," "], ["keyword.other.partiql","JOIN"], ["text.partiql"," "], ["variable.language.identifier.at.partiql","@s"], ["text.partiql"," "], ["keyword.other.partiql","WHERE"], ["text.partiql"," "], ["variable.language.identifier.partiql","f"], ["punctuation.partiql","("], ["variable.language.identifier.partiql","s"], ["punctuation.partiql",")"], ["text.partiql"," "], ["comment.line.partiql","-- comment"] ],[ "start", ["comment.line.partiql","-- comment"] ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["variable.language.identifier.quoted.partiql","\"a\""], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","b"], ["text.partiql"," "], ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","stuff"], ["text.partiql"," "], ["variable.language.identifier.partiql","s"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.at.partiql","@s"], ["text.partiql"," "], ["keyword.other.partiql","WHERE"], ["text.partiql"," "], ["variable.language.identifier.partiql","f"], ["punctuation.partiql","("], ["variable.language.identifier.partiql","s"], ["punctuation.partiql",")"] ],[ "start" ],[ "punctuation.definition.tuple.begin.partiql", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["keyword.other.partiql","VALUE"], ["text.partiql"," "], ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","sensor"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["text.partiql"," "], ["variable.language.identifier.partiql","s"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","sensor"], ["punctuation.definition.tuple.separator.partiql",","] ],[ "punctuation.definition.tuple.begin.partiql", ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","readings"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["text.partiql"," "], ["punctuation.partiql","("], ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["keyword.other.partiql","VALUE"], ["text.partiql"," "], ["variable.language.identifier.partiql","l"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","co"] ],[ "punctuation.definition.tuple.begin.partiql", ["text.partiql"," "], ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","logs"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","l"] ],[ "punctuation.definition.tuple.begin.partiql", ["text.partiql"," "], ["keyword.other.partiql","WHERE"], ["text.partiql"," "], ["variable.language.identifier.partiql","l"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","sensor"], ["text.partiql"," "], ["keyword.operator.partiql","="], ["text.partiql"," "], ["variable.language.identifier.partiql","s"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","sensor"] ],[ "punctuation.definition.tuple.begin.partiql", ["text.partiql"," "], ["punctuation.partiql",")"] ],[ "start", ["text.partiql"," "], ["punctuation.definition.tuple.end.partiql","}"] ],[ "start", ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","sensors"], ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], ["variable.language.identifier.partiql","s"] ],[ "start" ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["keyword.other.partiql","VALUE"], ["text.partiql"," "], ["punctuation.partiql","("], ["keyword.other.partiql","PIVOT"], ["text.partiql"," "], ["variable.language.identifier.partiql","v"], ["text.partiql"," "], ["keyword.other.partiql","AT"], ["text.partiql"," "], ["variable.language.identifier.partiql","g"] ],[ "start", ["text.partiql"," "], ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["keyword.other.partiql","UNPIVOT"], ["text.partiql"," "], ["variable.language.identifier.partiql","r"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","v"], ["text.partiql"," "], ["keyword.other.partiql","At"], ["text.partiql"," "], ["variable.language.identifier.partiql","g"] ],[ "start", ["text.partiql"," "], ["keyword.other.partiql","WHERE"], ["text.partiql"," "], ["variable.language.identifier.partiql","g"], ["text.partiql"," "], ["keyword.other.partiql","LIKE"], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","co%"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.partiql",")"] ],[ "start", ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","sensors"], ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], ["variable.language.identifier.partiql","r"] ],[ "start" ],[ "start" ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["variable.language.identifier.partiql","x"], ["punctuation.partiql","."], ["keyword.operator.partiql","*"] ],[ "start", ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["punctuation.definition.array.begin.partiql","["], ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","a"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","1"], ["punctuation.definition.tuple.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","b"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","1"], ["punctuation.definition.tuple.end.partiql","}"], ["punctuation.definition.array.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","a"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","2"], ["punctuation.definition.tuple.end.partiql","}"], ["punctuation.definition.array.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","foo"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.array.end.partiql","]"], ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], ["variable.language.identifier.partiql","x"] ],[ "start" ],[ "start", ["comment.line.partiql","-- NOTE: the embedded ion values parse as ion (inside the backticks \"`\")"] ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["variable.language.identifier.partiql","x"], ["punctuation.partiql","."], ["keyword.operator.partiql","*"] ],[ "start", ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["punctuation.definition.ion.begin.partiql","`"], ["punctuation.definition.list.begin.ion","["], ["punctuation.definition.struct.begin.ion","{"], ["storage.type.symbol.quoted.ion","'a'"], ["punctuation.definition.struct.separator.ion",":"], ["constant.numeric.integer.ion","1"], ["punctuation.definition.struct.separator.ion",","], ["text.ion"," "], ["storage.type.symbol.quoted.ion","'b'"], ["punctuation.definition.struct.separator.ion",":"], ["constant.numeric.integer.ion","1"], ["punctuation.definition.struct.end.ion","}"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["punctuation.definition.struct.begin.ion","{"], ["storage.type.symbol.quoted.ion","'a'"], ["punctuation.definition.struct.separator.ion",":"], ["constant.numeric.integer.ion","2"], ["punctuation.definition.struct.end.ion","}"], ["punctuation.definition.list.separator.ion",","], ["text.ion"," "], ["punctuation.definition.string.begin.ion","\""], ["string.quoted.double.ion","foo"], ["punctuation.definition.string.end.ion","\""], ["punctuation.definition.list.end.ion","]"], ["punctuation.definition.ion.end.partiql","`"], ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], ["variable.language.identifier.partiql","x"] ],[ "start" ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["keyword.other.partiql","VALUE"], ["text.partiql"," "], ["punctuation.definition.tuple.begin.partiql","{"], ["variable.language.identifier.partiql","v"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","a"], ["punctuation.definition.tuple.separator.partiql",":"], ["text.partiql"," "], ["variable.language.identifier.partiql","v"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","b"], ["punctuation.definition.tuple.separator.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","v"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","c"], ["punctuation.definition.tuple.separator.partiql",":"], ["text.partiql"," "], ["variable.language.identifier.partiql","v"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","d"], ["punctuation.definition.tuple.end.partiql","}"] ],[ "start", ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["punctuation.definition.bag.begin.partiql","<<"], ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","a"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","same"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","b"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","1"], ["punctuation.definition.tuple.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","c"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","same"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","d"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","2"], ["punctuation.definition.tuple.end.partiql","}"], ["punctuation.definition.bag.end.partiql",">>"], ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], ["variable.language.identifier.partiql","v"] ],[ "start" ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["variable.language.identifier.partiql","u"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","id"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","feedbackId"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","commentId"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","upvoteId"] ],[ "start", ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","users"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","u"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","u"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","feedbacks"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","feedback"], ["text.partiql"," "], ["keyword.other.partiql","at"], ["text.partiql"," "], ["variable.language.identifier.partiql","feedbackId"] ],[ "start", ["keyword.other.partiql","LEFT"], ["text.partiql"," "], ["keyword.other.partiql","CROSS"], ["text.partiql"," "], ["keyword.other.partiql","JOIN"], ["text.partiql"," "], ["variable.language.identifier.partiql","feedback"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","comments"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","comment"], ["text.partiql"," "], ["keyword.other.partiql","AT"], ["text.partiql"," "], ["variable.language.identifier.partiql","commentId"] ],[ "start", ["keyword.other.partiql","LEFT"], ["text.partiql"," "], ["keyword.other.partiql","CROSS"], ["text.partiql"," "], ["keyword.other.partiql","JOIN"], ["text.partiql"," "], ["keyword.other.partiql","UNPIVOT"], ["text.partiql"," "], ["variable.language.identifier.partiql","comment"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","upvotes"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","upvote"], ["text.partiql"," "], ["keyword.other.partiql","at"], ["text.partiql"," "], ["variable.language.identifier.partiql","upvoteId"] ],[ "start" ],[ "start" ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["punctuation.partiql","("] ],[ "start", ["text.partiql"," "], ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["variable.language.identifier.partiql","numRec"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","tabulated"] ],[ "start", ["text.partiql"," "], ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","committed"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","changes"], ["text.partiql"," "], ["variable.language.identifier.partiql","changes"], ["punctuation.partiql",","] ],[ "start", ["text.partiql"," "], ["punctuation.partiql","("], ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["variable.language.identifier.partiql","u"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","id"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","feedbackId"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","commentId"], ["punctuation.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","upvoteId"] ],[ "start", ["text.partiql"," "], ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","changes"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","tabulated"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","u"], ["punctuation.partiql",","] ],[ "start", ["text.partiql"," "], ["variable.language.identifier.partiql","u"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","feedbacks"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","feedback"], ["text.partiql"," "], ["keyword.other.partiql","at"], ["text.partiql"," "], ["variable.language.identifier.partiql","feedbackId"], ["text.partiql"," "], ["keyword.other.partiql","LEFT"], ["text.partiql"," "], ["keyword.other.partiql","CROSS"], ["text.partiql"," "], ["keyword.other.partiql","JOIN"], ["text.partiql"," "], ["variable.language.identifier.partiql","feedback"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","comments"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","comment"], ["text.partiql"," "], ["keyword.other.partiql","AT"], ["text.partiql"," "], ["variable.language.identifier.partiql","commentId"] ],[ "start", ["text.partiql"," "], ["keyword.other.partiql","LEFT"], ["text.partiql"," "], ["keyword.other.partiql","CROSS"], ["text.partiql"," "], ["keyword.other.partiql","JOIN"], ["text.partiql"," "], ["keyword.other.partiql","UNPIVOT"], ["text.partiql"," "], ["variable.language.identifier.partiql","comment"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","upvotes"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","upvote"], ["text.partiql"," "], ["keyword.other.partiql","at"], ["text.partiql"," "], ["variable.language.identifier.partiql","upvoteId"] ],[ "start", ["text.partiql"," "], ["punctuation.partiql",")"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","tabulated"], ["punctuation.partiql",","] ],[ "start", ["text.partiql"," "], ["variable.language.identifier.partiql","changes"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","numRec"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","numRec"] ],[ "start", ["text.partiql"," "], ["punctuation.partiql",")"] ],[ "start", ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], ["variable.language.identifier.partiql","changes"] ],[ "start", ["text.partiql"," "], ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","incoming_committed"], ["text.partiql"," "], ["variable.language.identifier.partiql","committed"] ],[ "start" ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["support.function.aggregation.partiql","SUM"], ["punctuation.partiql","("], ["support.function.aggregation.partiql","AVG"], ["punctuation.partiql","("], ["variable.language.identifier.partiql","n"], ["punctuation.partiql","))"], ["text.partiql"," "], ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["punctuation.definition.bag.begin.partiql","<<"], ["variable.language.identifier.partiql","numbers"], ["punctuation.definition.bag.separator.partiql",","], ["text.partiql"," "], ["variable.language.identifier.partiql","numbers"], ["punctuation.definition.bag.end.partiql",">>"], ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], ["variable.language.identifier.partiql","n"] ],[ "start" ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["keyword.other.partiql","VALUES"], ["text.partiql"," "], ["variable.language.identifier.partiql","v"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","a"] ],[ "start", ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["punctuation.definition.array.begin.partiql","["], ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","a"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","1"], ["punctuation.definition.tuple.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","b"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.language.partiql","true"], ["punctuation.definition.tuple.end.partiql","}"], ["punctuation.definition.array.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","a"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","2"], ["punctuation.definition.tuple.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","b"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.language.partiql","null"], ["punctuation.definition.tuple.end.partiql","}"], ["punctuation.definition.array.separator.partiql",","], ["text.partiql"," "], ["punctuation.definition.tuple.begin.partiql","{"], ["punctuation.definition.string.begin.partiql","'"], ["string.quoted.single.partiql","a"], ["punctuation.definition.string.end.partiql","'"], ["punctuation.definition.tuple.separator.partiql",":"], ["constant.numeric.partiql","3"], ["punctuation.definition.tuple.end.partiql","}"], ["punctuation.definition.array.end.partiql","]"], ["text.partiql"," "], ["variable.language.identifier.partiql","v"] ],[ "start", ["keyword.other.partiql","WHERE"], ["text.partiql"," "], ["variable.language.identifier.partiql","v"], ["punctuation.partiql","."], ["variable.language.identifier.partiql","b"] ],[ "start" ],[ "start", ["keyword.other.partiql","SELECT"], ["text.partiql"," "], ["variable.language.identifier.partiql","attributeId"], ["punctuation.partiql",","], ["text.partiql"," "], ["support.function.aggregation.partiql","COUNT"], ["punctuation.partiql","("], ["keyword.operator.partiql","*"], ["punctuation.partiql",")"], ["text.partiql"," "], ["keyword.other.partiql","as"], ["text.partiql"," "], ["variable.language.identifier.partiql","the_count"] ],[ "start", ["keyword.other.partiql","FROM"], ["text.partiql"," "], ["variable.language.identifier.partiql","repeating_things"] ],[ "start", ["keyword.other.partiql","GROUP"], ["text.partiql"," "], ["keyword.other.partiql","BY"], ["text.partiql"," "], ["variable.language.identifier.partiql","attributeId"], ["text.partiql"," "], ["keyword.other.partiql","GROUP"], ["text.partiql"," "], ["keyword.other.partiql","AS"], ["text.partiql"," "], ["variable.language.identifier.partiql","g"] ],[ "start", ["keyword.other.partiql","HAVING"], ["text.partiql"," "], ["constant.numeric.partiql","1"], ["text.partiql"," "], ["keyword.operator.partiql","="], ["text.partiql"," "], ["constant.numeric.partiql","0"] ]] ================================================ FILE: src/mode/_test/tokens_pascal.json ================================================ [[ "punctuation.definition.comment", ["punctuation.definition.comment","(*"], ["comment.block.one","****************************************************************************"] ],[ "punctuation.definition.comment", ["comment.block.one"," * A simple bubble sort program. Reads integers, one per line, and prints *"] ],[ "punctuation.definition.comment", ["comment.block.one"," * them out in sorted order. Blows up if there are more than 49. *"] ],[ "start", ["comment.block.one"," ****************************************************************************"], ["punctuation.definition.comment","*)"] ],[ "start", ["keyword.control","PROGRAM"], ["text"," "], ["identifier","Sort"], ["text","("], ["identifier","input"], ["keyword.operator",","], ["text"," "], ["identifier","output"], ["text",")"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control","CONST"] ],[ "start", ["text"," "], ["punctuation.definition.comment","(*"], ["comment.block.one"," Max array size. "], ["punctuation.definition.comment","*)"] ],[ "start", ["text"," "], ["identifier","MaxElts"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","50"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control","TYPE"], ["text"," "] ],[ "start", ["text"," "], ["punctuation.definition.comment","(*"], ["comment.block.one"," Type of the element array. "], ["punctuation.definition.comment","*)"] ],[ "start", ["text"," "], ["identifier","IntArrType"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.control","ARRAY"], ["text"," ["], ["constant.numeric","1"], ["text",".."], ["identifier","MaxElts"], ["text","] "], ["keyword.control","OF"], ["text"," "], ["identifier","Integer"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control","VAR"] ],[ "start", ["text"," "], ["punctuation.definition.comment","(*"], ["comment.block.one"," Indexes, exchange temp, array size. "], ["punctuation.definition.comment","*)"] ],[ "start", ["text"," "], ["identifier","i"], ["keyword.operator",","], ["text"," "], ["identifier","j"], ["keyword.operator",","], ["text"," "], ["identifier","tmp"], ["keyword.operator",","], ["text"," "], ["identifier","size"], ["text",": "], ["identifier","integer"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.comment","(*"], ["comment.block.one"," Array of ints "], ["punctuation.definition.comment","*)"] ],[ "start", ["text"," "], ["identifier","arr"], ["text",": "], ["identifier","IntArrType"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.comment","(*"], ["comment.block.one"," Read in the integers. "], ["punctuation.definition.comment","*)"] ],[ "start", ["text"," "], ["variable","PROCEDURE"], ["text"," "], ["storage.type.function","ReadArr"], ["text","("], ["keyword.control","VAR"], ["text"," "], ["identifier","size"], ["text",": "], ["identifier","Integer"], ["keyword.operator",";"], ["text"," "], ["keyword.control","VAR"], ["text"," "], ["identifier","a"], ["text",": "], ["identifier","IntArrType"], ["text",")"], ["keyword.operator",";"], ["text"," "] ],[ "start", ["text"," "], ["keyword.control","BEGIN"] ],[ "start", ["text"," "], ["identifier","size"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["constant.numeric","1"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control","WHILE"], ["text"," "], ["keyword.control","NOT"], ["text"," "], ["identifier","eof"], ["text"," "], ["keyword.control","DO"], ["text"," "], ["keyword.control","BEGIN"] ],[ "start", ["text"," "], ["identifier","readln"], ["text","("], ["identifier","a"], ["text","["], ["identifier","size"], ["text","])"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control","IF"], ["text"," "], ["keyword.control","NOT"], ["text"," "], ["identifier","eof"], ["text"," "], ["keyword.control","THEN"], ["text"," "] ],[ "start", ["text"," "], ["identifier","size"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["identifier","size"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword.control","END"] ],[ "start", ["text"," "], ["keyword.control","END"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control","BEGIN"] ],[ "start", ["text"," "], ["punctuation.definition.comment","(*"], ["comment.block.one"," Read "], ["punctuation.definition.comment","*)"] ],[ "start", ["text"," "], ["identifier","ReadArr"], ["text","("], ["identifier","size"], ["keyword.operator",","], ["text"," "], ["identifier","arr"], ["text",")"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.comment","(*"], ["comment.block.one"," Sort using bubble sort. "], ["punctuation.definition.comment","*)"] ],[ "start", ["text"," "], ["keyword.control","FOR"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["identifier","size"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["identifier","DOWNTO"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword.control","DO"] ],[ "start", ["text"," "], ["keyword.control","FOR"], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword.control","TO"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword.control","DO"], ["text"," "] ],[ "start", ["text"," "], ["keyword.control","IF"], ["text"," "], ["identifier","arr"], ["text","["], ["identifier","j"], ["text","] > "], ["identifier","arr"], ["text","["], ["identifier","j"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"], ["text","] "], ["keyword.control","THEN"], ["text"," "], ["keyword.control","BEGIN"] ],[ "start", ["text"," "], ["identifier","tmp"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["identifier","arr"], ["text","["], ["identifier","j"], ["text","]"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["identifier","arr"], ["text","["], ["identifier","j"], ["text","] "], ["keyword.operator",":="], ["text"," "], ["identifier","arr"], ["text","["], ["identifier","j"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"], ["text","]"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["identifier","arr"], ["text","["], ["identifier","j"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"], ["text","] "], ["keyword.operator",":="], ["text"," "], ["identifier","tmp"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control","END"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.comment","(*"], ["comment.block.one"," Print. "], ["punctuation.definition.comment","*)"] ],[ "start", ["text"," "], ["keyword.control","FOR"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword.control","TO"], ["text"," "], ["identifier","size"], ["text"," "], ["keyword.control","DO"] ],[ "start", ["text"," "], ["identifier","writeln"], ["text","("], ["identifier","arr"], ["text","["], ["identifier","i"], ["text","])"] ],[ "start", ["text"," "], ["keyword.control","END"], ["text","."] ],[ "start", ["text"," "] ]] ================================================ FILE: src/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: src/mode/_test/tokens_pgsql.json ================================================ [[ "start" ],[ "start", ["keyword.statementBegin","BEGIN"], ["statementEnd",";"] ],[ "start" ],[ "doc-start", ["comment.doc","/**"] ],[ "doc-start", [ "comment.doc.body", "* 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.body", "* Dollar quotes starting at the end of the line are colored as SQL unless" ] ],[ "doc-start", [ "comment.doc.body", "* a special language tag is used. Dollar quote syntax coloring is implemented" ] ],[ "doc-start", [ "comment.doc.body", "* 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"], ["punctuation","."], ["function.support","has_key"], ["paren.lparen","("], ["string","\"plan\""], ["paren.rparen",")"], ["punctuation",":"] ],[ "python-start", ["text"," "], ["identifier","plan"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","SD"], ["paren.lparen","["], ["string","\"plan\""], ["paren.rparen","]"] ],[ "python-start", ["text"," "], ["keyword","else"], ["punctuation",":"] ],[ "python-start", ["text"," "], ["identifier","plan"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","plpy"], ["punctuation","."], ["function.support","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"], ["punctuation.operator",","] ],[ "json-start", ["text"," "], ["variable","\"f2\""], ["text",": "], ["string","\"test\""], ["punctuation.operator",","] ],[ "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" ],[ "start", ["comment","-- Anonymous code block"] ],[ "dollarSql", ["keyword.statementBegin","DO"], ["text"," "], ["keyword","LANGUAGE"], ["text"," "], ["identifier","plpgsql"], ["text"," "], ["string","$$"] ],[ "dollarSql", ["keyword","BEGIN"] ],[ "dollarSql", ["text"," "], ["comment","-- code block"] ],[ "start", ["keyword","END"], ["text"," "], ["string","$$"], ["statementEnd",";"] ],[ "start" ],[ "dollarSql", ["keyword.statementBegin","DO"], ["text"," "], ["string","$$"] ],[ "dollarSql", ["keyword","BEGIN"] ],[ "dollarSql", ["text"," "], ["comment","-- code block"] ],[ "start", ["keyword","END"], ["statementEnd",";"], ["text"," "], ["string","$$"], ["statementEnd",";"] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_php_laravel_blade.json ================================================ [[ "start", ["comment.start.xml",""] ],[ "start" ],[ "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","App Name - "], ["directive.declaration.blade","@"], ["keyword.directives.blade","yield"], ["parenthesis.begin.blade","("], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","title"], ["punctuation.definition.string.end.blade","'"], ["parenthesis.end.blade",")"], ["meta.tag.punctuation.end-tag-open.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","app"], ["text"," "], ["keyword.operator","="], ["text"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","json"], ["parenthesis.begin.blade","("], ["variable.blade","$array"], ["parenthesis.end.blade",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["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"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","extends"], ["parenthesis.begin.blade","("], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","layouts.app"], ["punctuation.definition.string.end.blade","'"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","section"], ["parenthesis.begin.blade","("], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","sidebar"], ["punctuation.definition.string.end.blade","'"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","parent"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","This is appended to the master sidebar."], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","endsection"] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","if"], ["text.xml"," "], ["parenthesis.begin.blade","("], ["source.blade","count"], ["parenthesis.begin.blade","("], ["variable.blade","$records"], ["parenthesis.end.blade",")"], ["source.blade"," "], ["keyword.operator.blade","==="], ["source.blade"," 1"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," I have one record!"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","else"], ["text.xml","if "], ["parenthesis.begin.blade","("], ["source.blade","count"], ["parenthesis.begin.blade","("], ["variable.blade","$records"], ["parenthesis.end.blade",")"], ["source.blade"," "], ["keyword.operator.blade",">"], ["source.blade"," 1"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," I have multiple records!"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","else"] ],[ "start", ["text.xml"," I don't have any records!"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","endif"] ],[ "start" ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","foreach"], ["text.xml"," "], ["parenthesis.begin.blade","("], ["variable.blade","$users"], ["source.blade"," "], ["keyword.operator.blade","as"], ["source.blade"," "], ["variable.blade","$user"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","if"], ["text.xml"," "], ["parenthesis.begin.blade","("], ["variable.blade","$user"], ["keyword.operator.blade","->"], ["constant.other.property.blade","type"], ["source.blade"," "], ["keyword.operator.blade","=="], ["source.blade"," 1"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","continue"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","endif"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.xml",">"], ["injections.begin.blade","{{"], ["source.blade"," "], ["variable.blade","$user"], ["keyword.operator.blade","->"], ["constant.other.property.blade","name"], ["source.blade"," "], ["injections.end.blade","}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","if"], ["text.xml"," "], ["parenthesis.begin.blade","("], ["variable.blade","$user"], ["keyword.operator.blade","->"], ["constant.other.property.blade","number"], ["source.blade"," "], ["keyword.operator.blade","=="], ["source.blade"," 5"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","break"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","endif"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","endforeach"] ],[ "start" ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","foreach"], ["text.xml"," "], ["parenthesis.begin.blade","("], ["variable.blade","$users"], ["source.blade"," "], ["keyword.operator.blade","as"], ["source.blade"," "], ["variable.blade","$user"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","continue"], ["parenthesis.begin.blade","("], ["variable.blade","$user"], ["keyword.operator.blade","->"], ["constant.other.property.blade","type"], ["source.blade"," "], ["keyword.operator.blade","=="], ["source.blade"," 1"], ["parenthesis.end.blade",")"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.xml",">"], ["injections.begin.blade","{{"], ["source.blade"," "], ["variable.blade","$user"], ["keyword.operator.blade","->"], ["constant.other.property.blade","name"], ["source.blade"," "], ["injections.end.blade","}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","break"], ["parenthesis.begin.blade","("], ["variable.blade","$user"], ["keyword.operator.blade","->"], ["constant.other.property.blade","number"], ["source.blade"," "], ["keyword.operator.blade","=="], ["source.blade"," 5"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","endforeach"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","include"], ["parenthesis.begin.blade","("], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","shared.errors"], ["punctuation.definition.string.end.blade","'"], ["parenthesis.end.blade",")"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.form.tag-name.xml","form"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["comment.start.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","includeIf"], ["parenthesis.begin.blade","("], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","view.name"], ["punctuation.definition.string.end.blade","'"], ["keyword.operator.blade",","], ["source.blade"," ["], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","some"], ["punctuation.definition.string.end.blade","'"], ["source.blade"," "], ["keyword.operator.blade","=>"], ["source.blade"," "], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","data"], ["punctuation.definition.string.end.blade","'"], ["source.blade","]"], ["parenthesis.end.blade",")"] ],[ "start" ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","env"], ["parenthesis.begin.blade","("], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","local"], ["punctuation.definition.string.end.blade","'"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," // The application is in the local environment..."] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","elseenv"], ["parenthesis.begin.blade","("], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","testing"], ["punctuation.definition.string.end.blade","'"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," // The application is in the testing environment..."] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.control.blade","else"] ],[ "start", ["text.xml"," // The application is not in the local or testing environment..."] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","endenv"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"container\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["directive.declaration.blade","@"], ["keyword.directives.blade","yield"], ["parenthesis.begin.blade","("], ["punctuation.definition.string.begin.blade","'"], ["string.quoted.double.blade","content"], ["punctuation.definition.string.end.blade","'"], ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start" ],[ "start", ["punctuation.definition.comment.begin.blade","{{--"], ["comment.block.blade"," comment "], ["punctuation.definition.comment.end.blade","--}}"] ],[ "start" ],[ "parenthesis.begin.blade", ["directive.declaration.blade","@"], ["keyword.control.blade","if"], ["text.xml"," "], ["parenthesis.begin.blade","("] ],[ "parenthesis.begin.blade", ["source.blade"," "], ["punctuation.definition.comment.begin.blade","{{--"], ["comment.block.blade"," comment "], ["punctuation.definition.comment.end.blade","--}}"] ],[ "parenthesis.begin.blade", ["source.blade"," "], ["punctuation.definition.comment.begin.php","/*"], ["comment.block.blade","block comment"], ["punctuation.definition.comment.end.php","*/"] ],[ "parenthesis.begin.blade", ["source.blade"," "], ["punctuation.definition.comment.blade","#another comment"] ],[ "parenthesis.begin.blade", ["source.blade"," "], ["variable.blade","$user"], ["keyword.operator.blade","->"], ["constant.other.property.blade","type"], ["source.blade"," "], ["keyword.operator.blade","=="], ["source.blade"," 1"] ],[ "parenthesis.begin.blade", ["source.blade"," "], ["punctuation.definition.comment.blade","// c comment"] ],[ "parenthesis.begin.blade", ["source.blade"," "], ["punctuation.definition.comment.begin.php","/*"], ["comment.block.blade"," comment"], ["punctuation.definition.comment.end.php","*/"] ],[ "start", ["parenthesis.end.blade",")"] ],[ "start", ["text.xml"," # not a comment "], ["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","\"#//x\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["directive.declaration.blade","@"], ["keyword.control.blade","endif"] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_pig.json ================================================ [[ "start", ["text","A = "], ["keyword.control.pig","load"], ["text"," "], ["string.quoted.single.pig","'mobydick.txt'"], ["text",";"] ],[ "start", ["text","B = "], ["keyword.control.pig","foreach"], ["text"," A "], ["keyword.control.pig","generate"], ["text"," "], ["support.function.udf.pig","flatten"], ["text","("], ["support.function.udf.string.pig","TOKENIZE"], ["text","(("], ["storage.datatypes.pig","chararray"], ["text",")"], ["variable.pig","$0"], ["text",")) "], ["keyword.control.pig","as"], ["text"," word;"] ],[ "start", ["text","C = "], ["keyword.control.pig","filter"], ["text"," B "], ["keyword.control.pig","by"], ["text"," word "], ["keyword.operator.comparison.pig","matches"], ["text"," "], ["string.quoted.single.pig","'"], ["constant.character.escape.pig","\\\\"], ["string.quoted.single.pig","w+'"], ["text",";"] ],[ "start", ["text","D = "], ["keyword.control.pig","group"], ["text"," C "], ["keyword.control.pig","by"], ["text"," word;"] ],[ "start", ["text","E = "], ["keyword.control.pig","foreach"], ["text"," D "], ["keyword.control.pig","generate"], ["text"," "], ["support.function.udf.math.pig","COUNT"], ["text","(C) "], ["keyword.control.pig","as"], ["text"," "], ["support.function.udf.math.pig","count"], ["text",", "], ["keyword.control.pig","group"], ["text"," "], ["keyword.control.pig","as"], ["text"," word;"] ],[ "start", ["text","F = "], ["keyword.control.pig","order"], ["text"," E "], ["keyword.control.pig","by"], ["text"," "], ["support.function.udf.math.pig","count"], ["text"," "], ["keyword.control.pig","desc"], ["text",";"] ],[ "start", ["comment.line.double-dash.asciidoc","-- one comment"] ],[ "start", ["comment.block.pig","/* another comment */"] ],[ "start", ["keyword.control.pig","dump"], ["text"," F;"] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_plsql.json ================================================ [[ "start", ["keyword","create"], ["text"," "], ["keyword","table"], ["text"," "], ["identifier","t"], ["text"," "], ["paren.lparen","("] ],[ "start", ["text"," "], ["identifier","id"], ["text"," "], ["storage.type","integer"], ["text",", "] ],[ "start", ["text"," "], ["identifier","month"], ["text"," "], ["identifier","varchar"], ["paren.lparen","("], ["constant.numeric","3"], ["paren.rparen",")"], ["text",", "] ],[ "start", ["text"," "], ["identifier","value"], ["text"," "], ["storage.type","integer"] ],[ "start", ["paren.rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["keyword","insert"], ["text"," "], ["keyword","into"], ["text"," "], ["identifier","t"], ["text"," "], ["paren.lparen","("], ["identifier","month"], ["text",", "], ["identifier","value"], ["paren.rparen",")"], ["text"," "], ["keyword","values"], ["text"," "], ["paren.lparen","("], ["string","'jan'"], ["text",", "], ["constant.numeric","1"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["keyword","insert"], ["text"," "], ["keyword","into"], ["text"," "], ["identifier","t"], ["text"," "], ["paren.lparen","("], ["identifier","month"], ["text",", "], ["identifier","value"], ["paren.rparen",")"], ["text"," "], ["keyword","values"], ["text"," "], ["paren.lparen","("], ["string","'jan'"], ["text",", "], ["constant.numeric","1"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["keyword","insert"], ["text"," "], ["keyword","into"], ["text"," "], ["identifier","t"], ["text"," "], ["paren.lparen","("], ["identifier","month"], ["text",", "], ["identifier","value"], ["paren.rparen",")"], ["text"," "], ["keyword","values"], ["text"," "], ["paren.lparen","("], ["string","'oct'"], ["text",", "], ["constant.numeric","3"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["keyword","insert"], ["text"," "], ["keyword","into"], ["text"," "], ["identifier","t"], ["text"," "], ["paren.lparen","("], ["identifier","month"], ["text",", "], ["identifier","value"], ["paren.rparen",")"], ["text"," "], ["keyword","values"], ["text"," "], ["paren.lparen","("], ["string","'dec'"], ["text",", "], ["constant.numeric","96"], ["paren.rparen",")"], ["text",";"] ],[ "start" ],[ "start" ],[ "start", ["keyword","select"], ["text"," * "], ["keyword","from"], ["text"," "], ["paren.lparen","("], ["keyword","select"], ["text"," "], ["identifier","month"], ["text",", "], ["identifier","value"], ["text"," "], ["keyword","from"], ["text"," "], ["identifier","t"], ["paren.rparen",")"] ],[ "start", ["identifier","pivot"] ],[ "start", ["paren.lparen","("] ],[ "start", ["text"," "], ["support.function","sum"], ["paren.lparen","("], ["identifier","value"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["identifier","month"], ["text"," "], ["keyword","in"], ["text"," "], ["paren.lparen","("], ["string","'jan'"], ["text",", "], ["string","'oct'"], ["text",", "], ["string","'dec'"], ["paren.rparen",")"] ],[ "start", ["paren.rparen",")"], ["text",";"] ]] ================================================ FILE: src/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 "], ["variable.instance","$name"], ["string","\""] ],[ "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"," "], ["variable.instance","$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"], ["punctuation",";"] ],[ "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"," "], ["keyword.operator","@("], ["constant.numeric","1"], ["text",", "], ["constant.numeric","2"], ["text",", "], ["constant.numeric","3"], ["keyword.operator",")"] ],[ "start", ["variable.instance","$a_hash"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.operator","@{"], ["string","\"something\""], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"something else\""], ["keyword.operator","}"] ],[ "start" ],[ "start", ["keyword.operator","&"], ["text"," "], ["identifier","notepad"], ["text"," .\\"], ["identifier","readme"], ["text","."], ["identifier","md"] ],[ "start" ],[ "start", ["variable.instance","$h1"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.operator","@{"], ["text"," "], ["identifier","FirstName"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"James\""], ["punctuation",";"], ["text"," "], ["identifier","LastName"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Anderson\""], ["punctuation",";"], ["text"," "], ["identifier","IDNum"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","123"], ["text"," "], ["keyword.operator","}"] ],[ "start", ["variable.instance","$last"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Anderson\""], ["punctuation",";"], ["text"," "], ["variable.instance","$IDNum"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","120"] ],[ "start", ["variable.instance","$h2"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.operator","@{"], ["text"," "], ["identifier","FirstName"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"James\""], ["punctuation",";"], ["text"," "], ["identifier","LastName"], ["text"," "], ["keyword.operator","="], ["text"," "], ["variable.instance","$last"], ["punctuation",";"], ["text"," "], ["identifier","IDNum"], ["text"," "], ["keyword.operator","="], ["text"," "], ["variable.instance","$IDNum"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","3"], ["text"," "], ["keyword.operator","}"] ],[ "start", ["variable.instance","$h3"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.operator","@{"], ["text"," "], ["keyword.operator","}"] ],[ "start", ["variable.instance","$h4"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.operator","@{"], ["text"," "], ["constant.numeric","10"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"James\""], ["punctuation",";"], ["text"," "], ["constant.numeric","20.5"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Anderson\""], ["punctuation",";"], ["text"," "], ["variable.instance","$true"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","123"], ["text"," "], ["keyword.operator","}"] ],[ "start" ],[ "start", ["variable.braced","${Maximum_Count_26}"] ],[ "start", ["variable.braced","${Name with"], ["constant.language.escape","`t"], ["variable.braced","white space and "], ["constant.language.escape","`{"], ["variable.braced","punctuation"], ["constant.language.escape","`}"], ["variable.braced","}"] ],[ "start", ["variable.braced","${E:\\\\File.txt}"] ],[ "start" ],[ "start", ["string","\"C:\\Temp\\\""], ["text"," "], ["lparen","{"], ["identifier","mkdir"], ["text"," "], ["string","\"C:\\Temp\\\""], ["rparen","}"] ],[ "start", ["string","\"C:\\Temp\\\""] ],[ "start" ],[ "string0", ["string","@\""] ],[ "string0", ["string","This is a here string"] ],[ "string0", ["variable.instance","$h1"], ["string"," = "], ["keyword.operator","@{"], ["text"," "], ["identifier","FirstName"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"James\""], ["punctuation",";"], ["text"," "], ["identifier","LastName"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Anderson\""], ["punctuation",";"], ["text"," "], ["identifier","IDNum"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","123"], ["text"," "], ["keyword.operator","}"] ],[ "string0", ["variable.instance","$last"], ["string"," = \"Anderson\"; "], ["variable.instance","$IDNum"], ["string"," = 120"] ],[ "string0", ["variable.instance","$h2"], ["string"," = "], ["keyword.operator","@{"], ["text"," "], ["identifier","FirstName"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"James\""], ["punctuation",";"], ["text"," "], ["identifier","LastName"], ["text"," "], ["keyword.operator","="], ["text"," "], ["variable.instance","$last"], ["punctuation",";"], ["text"," "], ["identifier","IDNum"], ["text"," "], ["keyword.operator","="], ["text"," "], ["variable.instance","$IDNum"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","3"], ["text"," "], ["keyword.operator","}"] ],[ "string0", ["variable.instance","$h3"], ["string"," = "], ["keyword.operator","@{"], ["text"," "], ["keyword.operator","}"] ],[ "string0", ["variable.instance","$h4"], ["string"," = "], ["keyword.operator","@{"], ["text"," "], ["constant.numeric","10"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"James\""], ["punctuation",";"], ["text"," "], ["constant.numeric","20.5"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Anderson\""], ["punctuation",";"], ["text"," "], ["variable.instance","$true"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","123"], ["text"," "], ["keyword.operator","}"] ],[ "string0", ["variable.instance","$j"], ["string"," = 20"] ],[ "string0" ],[ "string0", ["string","still string"] ],[ "string0", ["keyword.operator","$("], ["variable.instance","$i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"], ["keyword.operator",")"], ["string"," # pipeline gets nothing"] ],[ "string0", ["keyword.operator","$("], ["paren.lparen","("], ["variable.instance","$i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"], ["paren.rparen",")"], ["keyword.operator",")"], ["string"," # pipeline gets int 10"] ],[ "string0", ["keyword.operator","$("], ["variable.instance","$i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"], ["punctuation",";"], ["text"," "], ["variable.instance","$j"], ["keyword.operator",")"], ["string"," # pipeline gets int 20"] ],[ "string0", ["keyword.operator","$("], ["paren.lparen","("], ["variable.instance","$i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"], ["paren.rparen",")"], ["punctuation",";"], ["text"," "], ["variable.instance","$j"], ["keyword.operator",")"], ["string"," # pipeline gets [object[]](10,20)"] ],[ "string0", ["keyword.operator","$("], ["paren.lparen","("], ["variable.instance","$i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"], ["paren.rparen",")"], ["punctuation",";"], ["text"," "], ["keyword.operator","++"], ["variable.instance","$j"], ["keyword.operator",")"], ["string"," # pipeline gets int 10"] ],[ "string0", ["keyword.operator","$("], ["paren.lparen","("], ["variable.instance","$i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"], ["paren.rparen",")"], ["punctuation",";"], ["text"," "], ["paren.lparen","("], ["keyword.operator","++"], ["variable.instance","$j"], ["paren.rparen",")"], ["keyword.operator",")"], ["string"," # pipeline gets [object[]](10,22)"] ],[ "string0", ["keyword.operator","$("], ["variable.instance","$i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"], ["punctuation",";"], ["text"," "], ["keyword.operator","++"], ["variable.instance","$j"], ["keyword.operator",")"], ["string"," # pipeline gets nothing"] ],[ "string0", ["keyword.operator","$("], ["constant.numeric","2"], ["text",","], ["constant.numeric","4"], ["text",","], ["constant.numeric","6"], ["keyword.operator",")"], ["string"," # pipeline gets [object[]](2,4,6)"] ],[ "start", ["string","\"@"] ],[ "start" ],[ "string", ["string","@'"] ],[ "string", ["string","Expressions inside should be recognised as string"] ],[ "string", ["string","$h1 = @{ FirstName = \"James\"; LastName = \"Anderson\"; IDNum = 123 }"] ],[ "string", ["string","$last = \"Anderson\"; $IDNum = 120"] ],[ "string", ["string","$h2 = @{ FirstName = \"James\"; LastName = $last; IDNum = $IDNum + 3 }"] ],[ "string", ["string","$h3 = @{ }"] ],[ "string", ["string","$h4 = @{ 10 = \"James\"; 20.5 = \"Anderson\"; $true = 123 }"] ],[ "start", ["string","'@"] ],[ "start" ]] ================================================ FILE: src/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"," "], ["keyword","nocheck"], ["text"," "], ["keyword","editor"], ["text"," "], ["string.interpolated","'editor_name$'"] ],[ "start", ["text"," "], ["keyword","nocheck"], ["text"," "], ["keyword","Close"] ],[ "start", ["text"," "], ["keyword","nocheck"], ["text"," "], ["keyword","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: src/mode/_test/tokens_prisma.json ================================================ [[ "source.prisma.embedded.source1", ["storage.type.config.prisma","generator"], ["source.prisma.embedded.source"," "], ["entity.name.type.config.prisma","photon"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ ["text","source.prisma.embedded.source1"], ["text"," "], ["variable.other.assignment.prisma","provider"], ["text"," "], ["keyword.operator.terraform","="], ["text"," "], ["string.quoted.double.start.prisma","\""], ["string.quoted.double.prisma","photonjs"], ["string.quoted.double.end.prisma","\""] ],[ "source.prisma.embedded.source1", ["text","}"] ],[ "source.prisma.embedded.source1" ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source","model User {"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," id String @default(cuid()) @id"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," createdAt DateTime @default(now())"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," updatedAt DateTime @updatedAt"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," firstName String"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," lastName String"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," email String @unique"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," password String"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," phone String"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," responseRate Float?"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," responseTime Int?"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," ReportsTo User? @relation(\"EmployeeToEmployee_ReportsTo\")"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," employees User[] @relation(\"EmployeeToEmployee_ReportsTo\")"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," isSuperHost Boolean"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," ownedPlaces Place[]"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," location Location?"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," bookings Booking[]"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," paymentAccount PaymentAccount[]"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," sentMessages Message[] @relation(\"SentMessages\")"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," receivedMessages Message[] @relation(\"ReceivedMessages\")"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," notifications Notification[]"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," profilePicture Picture?"] ],[ "source.prisma.embedded.source1", ["source.prisma.embedded.source"," hostingExperiences Experience[]"] ],[ "start", ["source.prisma.embedded.source","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Place"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","name"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","size"], ["text"," "], ["support.type.primitive.prisma","PLACE_SIZES"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","shortDescription"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","description"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","slug"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","maxGuests"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","numBedrooms"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","numBeds"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","numBaths"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","reviews"], ["text"," "], ["support.type.primitive.prisma","Review"], ["keyword.operator.list_type.prisma","[]"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","amenities"], ["text"," "], ["support.type.primitive.prisma","Amenities"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","host"], ["text"," "], ["support.type.primitive.prisma","User"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","pricing"], ["text"," "], ["support.type.primitive.prisma","Pricing"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","location"], ["text"," "], ["support.type.primitive.prisma","Location"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","views"], ["text"," "], ["support.type.primitive.prisma","Views"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","guestRequirements"], ["text"," "], ["support.type.primitive.prisma","GuestRequirements"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","policies"], ["text"," "], ["support.type.primitive.prisma","Policies"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","houseRules"], ["text"," "], ["support.type.primitive.prisma","HouseRules"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","bookings"], ["text"," "], ["support.type.primitive.prisma","Booking"], ["keyword.operator.list_type.prisma","[]"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","pictures"], ["text"," "], ["support.type.primitive.prisma","Picture"], ["keyword.operator.list_type.prisma","[]"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","popularity"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Pricing"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","place"], ["text"," "], ["support.type.primitive.prisma","Place"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","monthlyDiscount"], ["text"," "], ["support.type.primitive.prisma","Int"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","weeklyDiscount"], ["text"," "], ["support.type.primitive.prisma","Int"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","perNight"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","smartPricing"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","basePrice"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","averageWeekly"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","averageMonthly"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","cleaningFee"], ["text"," "], ["support.type.primitive.prisma","Int"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","securityDeposit"], ["text"," "], ["support.type.primitive.prisma","Int"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","extraGuests"], ["text"," "], ["support.type.primitive.prisma","Int"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","weekendPricing"], ["text"," "], ["support.type.primitive.prisma","Int"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","currency"], ["text"," "], ["support.type.primitive.prisma","CURRENCY"], ["keyword.operator.optional_type.prisma","?"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","GuestRequirements"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","govIssuedId"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","recommendationsFromOtherHosts"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","guestTripInformation"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","place"], ["text"," "], ["support.type.primitive.prisma","Place"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Policies"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","updatedAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@updatedAt"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","checkInStartTime"], ["text"," "], ["support.type.primitive.prisma","Float"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","checkInEndTime"], ["text"," "], ["support.type.primitive.prisma","Float"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","checkoutTime"], ["text"," "], ["support.type.primitive.prisma","Float"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","place"], ["text"," "], ["support.type.primitive.prisma","Place"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","HouseRules"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","updatedAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@updatedAt"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","suitableForChildren"], ["text"," "], ["support.type.primitive.prisma","Boolean"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","suitableForInfants"], ["text"," "], ["support.type.primitive.prisma","Boolean"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","petsAllowed"], ["text"," "], ["support.type.primitive.prisma","Boolean"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","smokingAllowed"], ["text"," "], ["support.type.primitive.prisma","Boolean"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","partiesAndEventsAllowed"], ["text"," "], ["support.type.primitive.prisma","Boolean"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","additionalRules"], ["text"," "], ["support.type.primitive.prisma","String"], ["keyword.operator.optional_type.prisma","?"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Views"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","lastWeek"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","place"], ["text"," "], ["support.type.primitive.prisma","Place"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Location"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","lat"], ["text"," "], ["support.type.primitive.prisma","Float"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","lng"], ["text"," "], ["support.type.primitive.prisma","Float"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","neighbourHood"], ["text"," "], ["support.type.primitive.prisma","Neighbourhood"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","user"], ["text"," "], ["support.type.primitive.prisma","User"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","place"], ["text"," "], ["support.type.primitive.prisma","Place"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","address"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","directions"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","experience"], ["text"," "], ["support.type.primitive.prisma","Experience"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","restaurant"], ["text"," "], ["support.type.primitive.prisma","Restaurant"], ["keyword.operator.optional_type.prisma","?"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Neighbourhood"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","locations"], ["text"," "], ["support.type.primitive.prisma","Location"], ["keyword.operator.list_type.prisma","[]"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","name"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","slug"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","homePreview"], ["text"," "], ["support.type.primitive.prisma","Picture"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","city"], ["text"," "], ["support.type.primitive.prisma","City"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","featured"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","popularity"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","City"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","name"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","neighbourhoods"], ["text"," "], ["support.type.primitive.prisma","Neighbourhood"], ["keyword.operator.list_type.prisma","[]"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Picture"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","url"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Experience"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","category"], ["text"," "], ["support.type.primitive.prisma","ExperienceCategory"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","title"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","host"], ["text"," "], ["support.type.primitive.prisma","User"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","location"], ["text"," "], ["support.type.primitive.prisma","Location"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","pricePerPerson"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","reviews"], ["text"," "], ["support.type.primitive.prisma","Review"], ["keyword.operator.list_type.prisma","[]"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","preview"], ["text"," "], ["support.type.primitive.prisma","Picture"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","popularity"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","ExperienceCategory"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","mainColor"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","name"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","experience"], ["text"," "], ["support.type.primitive.prisma","Experience"], ["keyword.operator.optional_type.prisma","?"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Amenities"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","place"], ["text"," "], ["support.type.primitive.prisma","Place"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","elevator"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","petsAllowed"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","internet"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","kitchen"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","wirelessInternet"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","familyKidFriendly"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","freeParkingOnPremises"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","hotTub"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","pool"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","smokingAllowed"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","wheelchairAccessible"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","breakfast"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","cableTv"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","suitableForEvents"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","dryer"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","washer"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","indoorFireplace"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","tv"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","heating"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","hangers"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","iron"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","hairDryer"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","doorman"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","paidParkingOffPremises"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","freeParkingOnStreet"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","gym"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","airConditioning"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","shampoo"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","essentials"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","laptopFriendlyWorkspace"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","privateEntrance"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","buzzerWirelessIntercom"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","babyBath"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","babyMonitor"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","babysitterRecommendations"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","bathtub"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","changingTable"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","childrensBooksAndToys"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","childrensDinnerware"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","crib"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Review"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","text"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","stars"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","accuracy"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","location"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","checkIn"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","value"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","cleanliness"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","communication"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","place"], ["text"," "], ["support.type.primitive.prisma","Place"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","experience"], ["text"," "], ["support.type.primitive.prisma","Experience"], ["keyword.operator.optional_type.prisma","?"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Booking"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","bookee"], ["text"," "], ["support.type.primitive.prisma","User"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","place"], ["text"," "], ["support.type.primitive.prisma","Place"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","startDate"], ["text"," "], ["support.type.primitive.prisma","DateTime"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","endDate"], ["text"," "], ["support.type.primitive.prisma","DateTime"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","payment"], ["text"," "], ["support.type.primitive.prisma","Payment"], ["keyword.operator.optional_type.prisma","?"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Payment"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","serviceFee"], ["text"," "], ["support.type.primitive.prisma","Float"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","placePrice"], ["text"," "], ["support.type.primitive.prisma","Float"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","totalPrice"], ["text"," "], ["support.type.primitive.prisma","Float"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","booking"], ["text"," "], ["support.type.primitive.prisma","Booking"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","paymentMethod"], ["text"," "], ["support.type.primitive.prisma","PaymentAccount"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","PaymentAccount"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","type"], ["text"," "], ["support.type.primitive.prisma","PAYMENT_PROVIDER"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","user"], ["text"," "], ["support.type.primitive.prisma","User"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","payments"], ["text"," "], ["support.type.primitive.prisma","Payment"], ["keyword.operator.list_type.prisma","[]"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","paypal"], ["text"," "], ["support.type.primitive.prisma","PaypalInformation"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","creditcard"], ["text"," "], ["support.type.primitive.prisma","CreditCardInformation"], ["keyword.operator.optional_type.prisma","?"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","PaypalInformation"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","email"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","paymentAccount"], ["text"," "], ["support.type.primitive.prisma","PaymentAccount"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","CreditCardInformation"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","cardNumber"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","expiresOnMonth"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","expiresOnYear"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","securityCode"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","firstName"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","lastName"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","postalCode"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","country"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","paymentAccount"], ["text"," "], ["support.type.primitive.prisma","PaymentAccount"], ["keyword.operator.optional_type.prisma","?"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Message"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","from"], ["text"," "], ["support.type.primitive.prisma","User"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@relation"], ["punctuation.definition.tag.prisma","("], ["string.quoted.double.start.prisma","\""], ["string.quoted.double.prisma","SentMessages"], ["string.quoted.double.end.prisma","\""], ["punctuation.definition.tag.prisma",")"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","to"], ["text"," "], ["support.type.primitive.prisma","User"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@relation"], ["punctuation.definition.tag.prisma","("], ["string.quoted.double.start.prisma","\""], ["string.quoted.double.prisma","ReceivedMessages"], ["string.quoted.double.end.prisma","\""], ["punctuation.definition.tag.prisma",")"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","deliveredAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","readAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Notification"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","type"], ["text"," "], ["support.type.primitive.prisma","NOTIFICATION_TYPE"], ["keyword.operator.optional_type.prisma","?"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","user"], ["text"," "], ["support.type.primitive.prisma","User"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","link"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","readDate"], ["text"," "], ["support.type.primitive.prisma","DateTime"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source", ["storage.type.model.prisma","model"], ["source.prisma.embedded.source"," "], ["entity.name.type.model.prisma","Restaurant"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","id"], ["text"," "], ["support.type.primitive.prisma","String"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","cuid"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@id"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","createdAt"], ["text"," "], ["support.type.primitive.prisma","DateTime"], ["source.prisma.embedded.source"," "], ["entity.name.function.attribute.prisma","@default"], ["punctuation.definition.tag.prisma","("], ["support.function.functional.prisma","now"], ["punctuation.definition.tag.prisma","("], ["punctuation.definition.tag.prisma","))"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","title"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","avgPricePerPerson"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","pictures"], ["text"," "], ["support.type.primitive.prisma","Picture"], ["keyword.operator.list_type.prisma","[]"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","location"], ["text"," "], ["support.type.primitive.prisma","Location"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","isCurated"], ["text"," "], ["support.type.primitive.prisma","Boolean"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","slug"], ["text"," "], ["support.type.primitive.prisma","String"] ],[ "source.prisma.embedded.source", ["text"," "], ["variable.other.assignment.prisma","popularity"], ["text"," "], ["support.type.primitive.prisma","Int"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source2", ["storage.type.enum.prisma","enum"], ["source.prisma.embedded.source"," "], ["entity.name.type.enum.prisma","CURRENCY"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","CAD"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","CHF"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","EUR"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","JPY"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","USD"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","ZAR"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source2", ["storage.type.enum.prisma","enum"], ["source.prisma.embedded.source"," "], ["entity.name.type.enum.prisma","PLACE_SIZES"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","ENTIRE_HOUSE"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","ENTIRE_APARTMENT"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","ENTIRE_EARTH_HOUSE"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","ENTIRE_CABIN"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","ENTIRE_VILLA"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","ENTIRE_PLACE"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","ENTIRE_BOAT"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","PRIVATE_ROOM"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source2", ["storage.type.enum.prisma","enum"], ["source.prisma.embedded.source"," "], ["entity.name.type.enum.prisma","PAYMENT_PROVIDER"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","PAYPAL"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","CREDIT_CARD"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ],[ "start" ],[ "source.prisma.embedded.source2", ["storage.type.enum.prisma","enum"], ["source.prisma.embedded.source"," "], ["entity.name.type.enum.prisma","NOTIFICATION_TYPE"], ["source.prisma.embedded.source"," "], ["punctuation.definition.tag.prisma","{"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","OFFER"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","INSTANT_BOOK"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","RESPONSIVENESS"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","NEW_AMENITIES"] ],[ "source.prisma.embedded.source2", ["text"," "], ["variable.other.assignment.prisma","HOUSE_RULES"] ],[ "start", ["punctuation.definition.tag.prisma","}"] ]] ================================================ FILE: src/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: src/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: src/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: src/mode/_test/tokens_puppet.json ================================================ [[ "start", ["storage.function.puppet","define"], ["name.function.puppet"," apache::vhost "], ["punctuation.lpar","("], ["variable.puppet","$port"], ["keyword.operator",","], ["string"," "], ["variable.puppet","$docroot"], ["keyword.operator",","], ["string"," "], ["variable.puppet","$servername"], ["string"," "], ["keyword.operator","="], ["string"," "], ["variable.puppet","$title"], ["keyword.operator",","], ["string"," "], ["variable.puppet","$vhost_name"], ["string"," "], ["keyword.operator","="], ["string"," "], ["punctuation.quote.puppet","'"], ["string","*"], ["punctuation.quote.puppet","'"], ["punctuation.rpar.puppet",")"], ["keyword.name.resource.puppet"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.control.puppet","include"], ["text"," apache"] ],[ "start", ["text"," "], ["keyword.control.puppet","include"], ["text"," apache"], ["keyword.operator","::"], ["text","params"] ],[ "start", ["text"," "], ["variable.puppet","$vhost_dir"], ["text"," "], ["keyword.operator","="], ["text"," "], ["qualified.variable.puppet","$apache::params::vhost_dir"] ],[ "start", ["keyword.name.resource.puppet"," file"], ["paren.lparen"," {"], ["text"," "], ["punctuation.quote.puppet","\""], ["variable.puppet","${vhost_dir"], ["string","}/"], ["variable.puppet","${servername"], ["string","}.conf"], ["punctuation.quote.puppet","\""], ["text",":"] ],[ "start", ["text"," "], ["language.support.class","content"], ["keyword.operator"," =>"], ["text"," "], ["support.function.puppet","template"], ["paren.lparen","("], ["punctuation.quote.puppet","'"], ["string","apache/vhost-default.conf.erb"], ["punctuation.quote.puppet","'"], ["paren.rparen",")"], ["keyword.operator",","] ],[ "start", ["text"," "], ["language.support.class","owner"], ["keyword.operator"," =>"], ["text"," "], ["punctuation.quote.puppet","'"], ["string","www"], ["punctuation.quote.puppet","'"], ["keyword.operator",","] ],[ "start", ["text"," "], ["language.support.class","group"], ["keyword.operator"," =>"], ["text"," "], ["punctuation.quote.puppet","'"], ["string","www"], ["punctuation.quote.puppet","'"], ["keyword.operator",","] ],[ "start", ["text"," "], ["language.support.class","mode"], ["keyword.operator"," =>"], ["text"," "], ["punctuation.quote.puppet","'"], ["string","644"], ["punctuation.quote.puppet","'"], ["keyword.operator",","] ],[ "start", ["text"," "], ["language.support.class","require"], ["keyword.operator"," =>"], ["text"," "], ["constant.types.puppet","Package"], ["paren.lparen","["], ["punctuation.quote.puppet","'"], ["string","httpd"], ["punctuation.quote.puppet","'"], ["paren.rparen","]"], ["keyword.operator",","] ],[ "start", ["text"," "], ["language.support.class","notify"], ["keyword.operator"," =>"], ["text"," "], ["constant.types.puppet","Service"], ["paren.lparen","["], ["punctuation.quote.puppet","'"], ["string","httpd"], ["punctuation.quote.puppet","'"], ["paren.rparen","]"], ["keyword.operator",","] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["support.function.puppet","type"], ["text"," MyModule"], ["keyword.operator","::"], ["text","Tree "], ["keyword.operator","="], ["text"," "], ["constant.types.puppet","Array"], ["paren.lparen","["], ["constant.types.puppet","Variant"], ["paren.lparen","["], ["constant.types.puppet","Data"], ["keyword.operator",","], ["text"," Tree"], ["paren.rparen","]]"] ],[ "start" ],[ "start", ["keyword.control.puppet","function"], ["text"," apache"], ["keyword.operator","::"], ["text","bool2http"], ["paren.lparen","("], ["constant.types.puppet","Variant"], ["paren.lparen","["], ["constant.types.puppet","String"], ["keyword.operator",","], ["text"," "], ["constant.types.puppet","Boolean"], ["paren.rparen","]"], ["text"," "], ["variable.puppet","$arg"], ["paren.rparen",")"], ["text"," "], ["keyword.operator",">>"], ["keyword.name.resource.puppet"," String"], ["paren.lparen"," {"] ],[ "start", ["text"," "], ["keyword.control.puppet","case "], ["variable.puppet","$arg"], ["keyword.name.resource.puppet"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["constant.language.puppet","false"], ["keyword.operator",","], ["text"," "], ["constant.language.puppet","undef"], ["keyword.operator",","], ["regexp.begin.string.puppet"," /(?i:false)/"], ["text"," :"], ["keyword.name.resource.puppet"," "], ["paren.lparen","{"], ["text"," "], ["punctuation.quote.puppet","'"], ["string","Off"], ["punctuation.quote.puppet","'"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["constant.language.puppet","true"], ["keyword.operator",","], ["regexp.begin.string.puppet"," /(?i:true)/"], ["text"," :"], ["keyword.name.resource.puppet"," "], ["paren.lparen","{"], ["text"," "], ["punctuation.quote.puppet","'"], ["string","On"], ["punctuation.quote.puppet","'"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword.control.puppet","default"], ["text"," :"], ["keyword.name.resource.puppet"," "], ["paren.lparen","{"], ["text"," "], ["punctuation.quote.puppet","\""], ["variable.puppet","$arg"], ["punctuation.quote.puppet","\""], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["singleline.comment.puppet","# A class with parameters"] ],[ "start", ["keyword.type.puppet","class"], ["constant.class.puppet"," apache "], ["paren.lparen","("], ["constant.types.puppet","String"], ["text"," "], ["variable.puppet","$version"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.quote.puppet","'"], ["string","latest"], ["punctuation.quote.puppet","'"], ["paren.rparen",")"], ["keyword.name.resource.puppet"," "], ["paren.lparen","{"] ],[ "start", ["keyword.name.resource.puppet"," package"], ["paren.lparen"," {"], ["punctuation.quote.puppet","'"], ["string","httpd"], ["punctuation.quote.puppet","'"], ["text",":"] ],[ "start", ["text"," "], ["language.support.class","ensure"], ["keyword.operator"," =>"], ["text"," "], ["variable.puppet","$version"], ["keyword.operator",","], ["text"," "], ["singleline.comment.puppet","# Using the class parameter from above"] ],[ "start", ["text"," "], ["language.support.class","before"], ["keyword.operator"," =>"], ["text"," "], ["constant.types.puppet","File"], ["paren.lparen","["], ["punctuation.quote.puppet","'"], ["string","/etc/httpd.conf"], ["punctuation.quote.puppet","'"], ["paren.rparen","]"], ["keyword.operator",","] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["keyword.name.resource.puppet"," file"], ["paren.lparen"," {"], ["punctuation.quote.puppet","'"], ["string","/etc/httpd.conf"], ["punctuation.quote.puppet","'"], ["text",":"] ],[ "start", ["text"," "], ["language.support.class","ensure"], ["keyword.operator"," =>"], ["text"," "], ["support.function.puppet","file"], ["keyword.operator",","] ],[ "start", ["text"," "], ["language.support.class","owner"], ["keyword.operator"," =>"], ["text"," "], ["punctuation.quote.puppet","'"], ["string","httpd"], ["punctuation.quote.puppet","'"], ["keyword.operator",","] ],[ "start", ["text"," "], ["language.support.class","content"], ["keyword.operator"," =>"], ["text"," "], ["support.function.puppet","template"], ["paren.lparen","("], ["punctuation.quote.puppet","'"], ["string","apache/httpd.conf.erb"], ["punctuation.quote.puppet","'"], ["paren.rparen",")"], ["keyword.operator",","], ["text"," "], ["singleline.comment.puppet","# Template from a module"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["keyword.name.resource.puppet"," service"], ["paren.lparen"," {"], ["punctuation.quote.puppet","'"], ["string","httpd"], ["punctuation.quote.puppet","'"], ["text",":"] ],[ "start", ["text"," "], ["language.support.class","ensure"], ["keyword.operator"," =>"], ["text"," "], ["constant.language.puppet","running"], ["keyword.operator",","] ],[ "start", ["text"," "], ["language.support.class","enable"], ["keyword.operator"," =>"], ["text"," "], ["constant.language.puppet","true"], ["keyword.operator",","] ],[ "start", ["text"," "], ["language.support.class","subscribe"], ["keyword.operator"," =>"], ["text"," "], ["constant.types.puppet","File"], ["paren.lparen","["], ["punctuation.quote.puppet","'"], ["string","/etc/httpd.conf"], ["punctuation.quote.puppet","'"], ["paren.rparen","]"], ["keyword.operator",","] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start" ],[ "start", ["keyword.control.puppet","if "], ["variable.puppet","$is_virtual"], ["keyword.name.resource.puppet"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function.puppet","warning"], ["paren.lparen","("], ["text"," "], ["punctuation.quote.puppet","'"], ["string","Tried to include class ntp on virtual machine; this node might be misclassified."], ["punctuation.quote.puppet","'"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"] ],[ "start", ["keyword.control.puppet","elsif "], ["variable.puppet","$operatingsystem"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["punctuation.quote.puppet","'"], ["string","Darwin"], ["punctuation.quote.puppet","'"], ["keyword.name.resource.puppet"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function.puppet","warning"], ["paren.lparen","("], ["text"," "], ["punctuation.quote.puppet","'"], ["string","This NTP module does not yet work on our Mac laptops."], ["punctuation.quote.puppet","'"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["keyword.name.resource.puppet","else"], ["paren.lparen"," {"] ],[ "start", ["text"," "], ["keyword.control.puppet","include"], ["text"," ntp"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: src/mode/_test/tokens_python.json ================================================ [[ "start", ["comment","#!/usr/local/bin/python"] ],[ "start" ],[ "start", ["keyword","import"], ["text"," "], ["identifier","string"], ["punctuation",","], ["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"], ["punctuation","."], ["function.support","argv"], ["paren.rparen",")"], ["keyword.operator","=="], ["constant.numeric","1"], ["punctuation",":"] ],[ "qstring3", ["text"," "], ["keyword","print"], ["text"," "], ["string","'''Usage:"] ],[ "start", ["string","celsius temp1 temp2 ...'''"] ],[ "start", ["text"," "], ["identifier","sys"], ["punctuation","."], ["function.support","exit"], ["paren.lparen","("], ["constant.numeric","0"], ["paren.rparen",")"] ],[ "start", ["identifier","a"], ["paren.lparen","["], ["string","\"x\""], ["paren.rparen","]"] ],[ "start", ["comment","# Loop over the arguments"] ],[ "start", ["keyword","for"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword","in"], ["text"," "], ["identifier","sys"], ["punctuation","."], ["function.support","argv"], ["paren.lparen","["], ["constant.numeric","1"], ["punctuation",":"], ["paren.rparen","]"], ["punctuation",":"] ],[ "start", ["text"," "], ["keyword","try"], ["punctuation",":"] ],[ "start", ["text"," "], ["identifier","fahrenheit"], ["keyword.operator","="], ["support.function","float"], ["paren.lparen","("], ["identifier","string"], ["punctuation","."], ["function.support","atoi"], ["paren.lparen","("], ["identifier","i"], ["paren.rparen","))"] ],[ "start", ["text"," "], ["keyword","except"], ["text"," "], ["identifier","string"], ["punctuation","."], ["function.support","atoi_error"], ["punctuation",":"] ],[ "start", ["text"," "], ["keyword","print"], ["text"," "], ["support.function","repr"], ["paren.lparen","("], ["identifier","i"], ["paren.rparen",")"], ["punctuation",","], ["text"," "], ["string","\"not a numeric value\""] ],[ "start", ["text"," "], ["keyword","else"], ["punctuation",":"] ],[ "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",")"], ["punctuation",","], ["text"," "], ["support.function","int"], ["paren.lparen","("], ["identifier","celsius"], ["keyword.operator","+"], ["constant.numeric",".5"], ["paren.rparen","))"] ],[ "start" ],[ "start", ["identifier","name"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Fred\""] ],[ "start", ["string","f\"He said his name is "], ["paren.lparen","{"], ["identifier","name"], ["function.support","!r"], ["paren.rparen","}"], ["string",".\""] ],[ "start" ],[ "start", ["string","f\"He said his name is "], ["paren.lparen","{"], ["support.function","repr"], ["paren.lparen","("], ["identifier","name"], ["text","+"], ["constant.numeric","12"], ["paren.rparen",")}"], ["string",".\""], ["text"," "], ["comment","# repr() is equivalent to !r"] ],[ "start" ],[ "start", ["identifier","width"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"] ],[ "start", ["identifier","precision"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","4"] ],[ "start", ["identifier","value"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","decimal"], ["punctuation","."], ["function.support","Decimal"], ["paren.lparen","("], ["string","\"12.34567\""], ["paren.rparen",")"] ],[ "start", ["string","f\"result: "], ["paren.lparen","{"], ["identifier","value"], ["text",":"], ["paren.lparen","{"], ["identifier","width"], ["paren.rparen","}"], ["text","."], ["paren.lparen","{"], ["identifier","precision"], ["paren.rparen","}}"], ["string","\""], ["text"," "], ["comment","# nested fields"] ],[ "start", ["string","'result: 12.35'"] ],[ "start", ["identifier","today"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","datetime"], ["paren.lparen","("], ["identifier","year"], ["keyword.operator","="], ["constant.numeric","2017"], ["punctuation",","], ["text"," "], ["identifier","month"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation",","], ["text"," "], ["identifier","day"], ["keyword.operator","="], ["constant.numeric","27"], ["paren.rparen",")"] ],[ "start", ["string","f\""], ["paren.lparen","{"], ["identifier","today"], ["text",":%"], ["identifier","B"], ["string"," "], ["text","%"], ["identifier","d"], ["text",","], ["string"," "], ["text","%"], ["identifier","Y"], ["paren.rparen","}"], ["string","\""], ["text"," "], ["comment","# using date format specifier"] ],[ "start", ["string","'January 27, 2017'"] ],[ "start", ["identifier","number"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1024"] ],[ "start", ["string","f\""], ["paren.lparen","{"], ["identifier","number"], ["text",":#0"], ["identifier","x"], ["paren.rparen","}"], ["string","\""], ["text"," "], ["comment","# using integer format specifier"] ],[ "start", ["string","'0x400'"] ],[ "start" ],[ "start", ["string","F\"Hello, "], ["paren.lparen","{"], ["identifier","name"], ["paren.rparen","}"], ["string",". You are "], ["paren.lparen","{"], ["identifier","age"], ["paren.rparen","}"], ["string",".\""] ],[ "start", ["string","'Hello, Eric. You are 74.'"] ],[ "start", ["string","f\""], ["paren.lparen","{"], ["constant.numeric","2"], ["string"," "], ["text","*"], ["string"," "], ["constant.numeric","37"], ["paren.rparen","}"], ["string","\""] ],[ "start", ["string","'74'"] ],[ "start", ["keyword","def"], ["text"," "], ["entity.name.function","to_lowercase"], ["paren.lparen","("], ["support.function","input"], ["paren.rparen",")"], ["punctuation",":"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["support.function","input"], ["punctuation","."], ["function.support","lower"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start" ],[ "start", ["identifier","name"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Eric Idle\""] ],[ "start", ["string","f\""], ["paren.lparen","{"], ["identifier","to_lowercase"], ["paren.lparen","("], ["identifier","name"], ["paren.rparen",")}"], ["string"," is funny.\""] ],[ "start" ],[ "start", ["string","f\""], ["paren.lparen","{"], ["string","'Eric Idle'"], ["paren.rparen","}"], ["string","\""] ],[ "start" ],[ "start", ["string","f'"], ["paren.lparen","{"], ["string","\"Eric Idle\""], ["paren.rparen","}"], ["string","'"] ],[ "start" ],[ "start", ["string","f\"\"\""], ["paren.lparen","{"], ["identifier","Eric"], ["string"," "], ["identifier","Idle"], ["paren.rparen","}"], ["string","\"\"\""] ],[ "start" ],[ "start", ["string","f'''"], ["paren.lparen","{"], ["identifier","Eric"], ["string"," "], ["identifier","Idle"], ["paren.rparen","}"], ["string","'''"] ],[ "start", ["string","f\"The "], ["constant.language.escape","\\\""], ["string","comedian"], ["constant.language.escape","\\\""], ["string"," is "], ["paren.lparen","{"], ["identifier","name"], ["paren.rparen","}"], ["string",", aged "], ["paren.lparen","{"], ["identifier","age"], ["paren.rparen","}"], ["string",".\""] ],[ "start", ["string","f\""], ["paren.lparen","{{"], ["constant.numeric","74"], ["paren.rparen","}}"], ["string","\""] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_qml.json ================================================ [[ "start", ["comment","// A simple example"] ],[ "start", ["keyword","import"], ["text"," "], ["identifier","QtQuick"], ["text"," "], ["constant.numeric","2.7"] ],[ "start", ["keyword","import"], ["text"," "], ["identifier","QtQuick"], ["text","."], ["identifier","Controls"], ["text"," "], ["constant.numeric","2.3"] ],[ "start" ],[ "start", ["keyword","Rectangle"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","color"], ["text",": "], ["string","\"red\""] ],[ "start", ["text"," "], ["keyword","anchors"], ["text","."], ["identifier","fill"], ["text",": "], ["keyword","parent"] ],[ "start" ],[ "start", ["text"," "], ["keyword","Text"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","text"], ["text",": "], ["string","\"WEEEEEEEEEE\""] ],[ "start", ["text"," "], ["identifier","font"], ["text","."], ["identifier","pixelSize"], ["text",": "], ["constant.numeric","50"] ],[ "start", ["text"," "], ["keyword","color"], ["text",": "], ["string","\"white\""] ],[ "start", ["text"," "], ["keyword","anchors"], ["text","."], ["identifier","centerIn"], ["text",": "], ["keyword","parent"] ],[ "start", ["text"," "], ["keyword","RotationAnimator"], ["text"," "], ["identifier","on"], ["text"," "], ["identifier","rotation"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","running"], ["text",": "], ["constant.language.boolean","true"] ],[ "start", ["text"," "], ["identifier","loops"], ["text",": "], ["keyword","Animation"], ["text","."], ["identifier","Infinite"] ],[ "start", ["text"," "], ["identifier","from"], ["text",": "], ["constant.numeric","0"] ],[ "start", ["text"," "], ["identifier","to"], ["text",": "], ["constant.numeric","360"] ],[ "start", ["text"," "], ["identifier","duration"], ["text",": "], ["constant.numeric","1500"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_raku.json ================================================ [[ "block_comment", ["comment.doc","=begin comment"] ],[ "block_comment", ["comment.doc","Raku example for ace"] ],[ "start", ["comment.doc","=end comment"] ],[ "start", ["keyword","class"], ["text"," "], ["identifier","Cook"], ["text"," "], ["keyword","is"], ["text"," "], ["identifier","Employee"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","has"], ["text"," "], ["variable.language","@.utensils"], ["text"," "], ["keyword","is"], ["text"," "], ["support.function","rw"], ["text",";"] ],[ "start", ["text"," "], ["keyword","has"], ["text"," "], ["variable.language","@.cookbooks"], ["text"," "], ["keyword","is"], ["text"," "], ["support.function","rw"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword","method"], ["text"," "], ["identifier","cook"], ["lparen","("], ["text"," "], ["variable.language","$food"], ["text"," "], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function","say"], ["text"," "], ["string.quoted.double","\"Cooking "], ["variable.language","$food"], ["string.quoted.double","\""], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword","method"], ["text"," "], ["identifier","clean_utensils"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function","say"], ["text"," "], ["string.quoted.double","\"Cleaning "], ["variable.language","$_"], ["string.quoted.double","\""], ["text"," "], ["keyword","for"], ["text"," "], ["variable.language","@.utensils"], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","class"], ["text"," "], ["identifier","Baker"], ["text"," "], ["keyword","is"], ["text"," "], ["identifier","Cook"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","method"], ["text"," "], ["identifier","cook"], ["lparen","("], ["text"," "], ["variable.language","$confection"], ["text"," "], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function","say"], ["text"," "], ["string.quoted.double","\"Baking a tasty "], ["variable.language","$confection"], ["string.quoted.double","\""], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","my"], ["text"," "], ["variable.language","$cook"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","Cook"], ["keyword.operator","."], ["support.function","new"], ["lparen","("] ],[ "start", ["text"," "], ["identifier","utensils"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["string.quoted.single",""], ["keyword.operator",","] ],[ "start", ["text"," "], ["identifier","cookbooks"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["string.quoted.single","'The Joy of Cooking'"], ["keyword.operator",","] ],[ "start", ["text"," "], ["identifier","salary"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["constant.numeric","40000"], ["rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["variable.language","$cook"], ["keyword.operator","."], ["identifier","cook"], ["lparen","("], ["text"," "], ["string.quoted.single","'pizza'"], ["text"," "], ["rparen",")"], ["text","; "], ["comment","# OUTPUT: «Cooking pizza␤»"] ],[ "start", ["support.function","say"], ["text"," "], ["variable.language","$cook"], ["keyword.operator","."], ["identifier","utensils"], ["keyword.operator","."], ["support.function","perl"], ["text","; "], ["comment","# OUTPUT: «[\"spoon\", \"ladle\", \"knife\", \"pan\"]␤»"] ],[ "start", ["support.function","say"], ["text"," "], ["variable.language","$cook"], ["keyword.operator","."], ["identifier","cookbooks"], ["keyword.operator","."], ["support.function","perl"], ["text","; "], ["comment","# OUTPUT: «[\"The Joy of Cooking\"]␤»"] ],[ "start", ["support.function","say"], ["text"," "], ["variable.language","$cook"], ["keyword.operator","."], ["identifier","salary"], ["text","; "], ["comment","# OUTPUT: «40000␤»"] ],[ "start" ],[ "start", ["keyword","my"], ["text"," "], ["variable.language","$baker"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","Baker"], ["keyword.operator","."], ["support.function","new"], ["lparen","("] ],[ "start", ["text"," "], ["identifier","utensils"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["string.quoted.single","'self cleaning oven'"], ["keyword.operator",","] ],[ "start", ["text"," "], ["identifier","cookbooks"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["string.quoted.double","\"The Baker's Apprentice\""], ["keyword.operator",","] ],[ "start", ["text"," "], ["identifier","salary"], ["text"," "], ["keyword.operator","=>"], ["text"," "], ["constant.numeric","50000"], ["rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["variable.language","$baker"], ["keyword.operator","."], ["identifier","cook"], ["lparen","("], ["string.quoted.single","'brioche'"], ["rparen",")"], ["text","; "], ["comment","# OUTPUT: «Baking a tasty brioche␤»"] ],[ "start", ["support.function","say"], ["text"," "], ["variable.language","$baker"], ["keyword.operator","."], ["identifier","utensils"], ["keyword.operator","."], ["support.function","perl"], ["text","; "], ["comment","# OUTPUT: «[\"self cleaning oven\"]␤»"] ],[ "start", ["support.function","say"], ["text"," "], ["variable.language","$baker"], ["keyword.operator","."], ["identifier","cookbooks"], ["keyword.operator","."], ["support.function","perl"], ["text","; "], ["comment","# OUTPUT: «[\"The Baker's Apprentice\"]␤»"] ],[ "start", ["support.function","say"], ["text"," "], ["variable.language","$baker"], ["keyword.operator","."], ["identifier","salary"], ["text","; "], ["comment","# OUTPUT: «50000␤» "] ]] ================================================ FILE: src/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","}"] ],[ ["razor-block-start","@code{"], ["punctuation.block.razor","@code{"] ],[ ["razor-block-start","@code{"], ["text","\t"], ["keyword","private"], ["text"," "], ["keyword","int"], ["text"," "], ["identifier","count"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["punctuation.block.razor","}"] ],[ ["razor-block-start","@code {"], ["punctuation.block.razor","@code {"] ],[ ["razor-block-start","@code {"], ["text","\t"], ["keyword","private"], ["text"," "], ["keyword","string"], ["text"," "], ["identifier","name"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","\""], ["string","Test"], ["string.end","\""], ["punctuation.operator",";"] ],[ "start", ["punctuation.block.razor","}"] ],[ ["razor-block-start","@functions{"], ["punctuation.block.razor","@functions{"] ],[ ["razor-block-start","@functions{"], ["text","\t"], ["keyword","public"], ["text"," "], ["keyword","void"], ["text"," "], ["identifier","DoSomething"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["punctuation.block.razor","}"] ],[ "start", ["meta.directive.razor","@model"], ["text"," "], ["identifier","MyApp.Models.User"] ],[ "start", ["meta.directive.razor","@inject"], ["text"," "], ["identifier","IUserService UserService"] ],[ "start", ["meta.directive.razor","@inherits"], ["text"," "], ["identifier","CustomBasePage"] ],[ "start", ["meta.directive.razor","@implements"], ["text"," "], ["identifier","IDisposable"] ],[ "start", ["meta.directive.razor","@attribute"], ["text"," "], ["identifier","[Authorize]"] ],[ "start", ["meta.directive.razor","@layout"], ["text"," "], ["identifier","MainLayout"] ],[ "start", ["meta.directive.razor","@namespace"], ["text"," "], ["identifier","MyApp.Pages"] ],[ "start", ["meta.directive.razor","@rendermode"], ["text"," "], ["identifier","InteractiveServer"] ],[ "start", ["meta.directive.razor","@using"], ["text"," "], ["identifier","System.Collections.Generic"] ],[ "start", ["meta.directive.razor","@page"], ["text"," "], ["string","\"/counter\""] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_red.json ================================================ [[ "start", ["keyword","Red"], ["text"," "], ["paren.block-start","["], ["paren.block-end","]"] ],[ "start", ["variable.set-word","info:"], ["text"," "], ["keyword.native","func"], ["text"," "], ["paren.block-start","["], ["variable.lit-word","'fn"], ["text"," "], ["variable.refinement","/name"], ["text"," "], ["variable.refinement","/intro"], ["text"," "], ["variable.refinement","/args"], ["text"," "], ["variable.refinement","/refinements"], ["text"," "], ["keyword","/local"], ["text","s "], ["variable.refinement","/return"], ["text"," "], ["variable.refinement","/spec"], ["text"," "] ],[ "start", ["text","\t"], ["variable.refinement","/arg-num"], ["text"," "], ["variable.refinement","/arg-names"], ["text"," "], ["variable.refinement","/arg-types"], ["text"," "], ["variable.refinement","/ref-names"], ["text"," "], ["variable.refinement","/ref-types"], ["text"," "], ["variable.refinement","/ref-num"], ["text"," "], ["variable.refinement","/type"] ],[ "start", ["text","\t"], ["keyword","/local"], ["text"," "], ["variable.word","intr"], ["text"," "], ["variable.word","ars"], ["text"," "], ["variable.word","refs"], ["text"," "], ["variable.word","locs"], ["text"," "], ["variable.word","ret"], ["text"," "], ["variable.word","arg"], ["text"," "], ["variable.word","ref"], ["text"," "], ["variable.word","typ"] ],[ "start", ["paren.block-end","]"], ["paren.block-start","["] ],[ "start", ["text","\t"], ["variable.set-word","intr:"], ["text"," "], ["keyword.action","copy"], ["text"," "], ["string","\"\""], ["text"," "], ["variable.set-word","ars:"], ["text"," "], ["keyword.action","make"], ["text"," "], ["constant.datatype!","map!"], ["text"," "], ["keyword.action","copy"], ["text"," "], ["paren.block-start","["], ["paren.block-end","]"], ["text"," "], ["variable.set-word","refs:"], ["text"," "], ["keyword.action","make"], ["text"," "], ["constant.datatype!","map!"], ["text"," "], ["keyword.action","copy"], ["text"," "], ["paren.block-start","["], ["paren.block-end","]"], ["text"," "], ["variable.set-word","locs:"], ["text"," "], ["keyword.action","copy"], ["text"," "], ["paren.block-start","["], ["paren.block-end","]"], ["text"," "], ["variable.set-word","ret:"], ["text"," "], ["keyword.action","copy"], ["text"," "], ["paren.block-start","["], ["paren.block-end","]"], ["text"," "], ["variable.set-word","typ:"], ["text"," "], ["variable.set-word","ref-arg:"], ["text"," "], ["variable.set-word","ref-arg-type:"], ["text"," "], ["constant.language","none"] ],[ "start", ["text","\t"], ["keyword.control","if"], ["text"," "], ["keyword.function","lit-word?"], ["text"," "], ["variable.word","fn"], ["text"," "], ["paren.block-start","["], ["variable.set-word","fn:"], ["text"," "], ["keyword.function","to-word"], ["text"," "], ["variable.word","fn"], ["paren.block-end","]"] ],[ "start", ["text","\t"], ["keyword.control","unless"], ["text"," "], ["keyword.action","find"], ["text"," "], ["paren.block-start","["], ["constant.datatype!","op!"], ["text"," "], ["constant.datatype!","native!"], ["text"," "], ["constant.datatype!","function!"], ["text"," "], ["constant.datatype!","action!"], ["paren.block-end","]"], ["text"," "], ["keyword.native","type?"], ["variable.refinement","/word"], ["text"," "], ["keyword.native","get"], ["text"," "], ["variable.word","fn"], ["text"," "], ["paren.block-start","["] ],[ "start", ["text","\t\t"], ["keyword.function","cause-error"], ["text"," "], ["variable.lit-word","'user"], ["text"," "], ["variable.lit-word","'message"], ["text"," "], ["paren.block-start","["], ["string","\"Only function types accepted!\""], ["paren.block-end","]"] ],[ "start", ["text","\t"], ["paren.block-end","]"] ],[ "start", ["text","\t"], ["variable.set-word","out:"], ["text"," "], ["keyword.action","make"], ["text"," "], ["constant.datatype!","map!"], ["text"," "], ["keyword.action","copy"], ["text"," "], ["paren.block-start","["], ["paren.block-end","]"] ],[ "start", ["text","\t"], ["variable.set-word","specs:"], ["text"," "], ["keyword.function","spec-of"], ["text"," "], ["keyword.native","get"], ["text"," "], ["variable.word","fn"], ["text"," "] ],[ "start", ["text","\t"], ["keyword.native","parse"], ["text"," "], ["variable.word","specs"], ["text"," "], ["paren.block-start","["] ],[ "start", ["text","\t\t"], ["variable.word","opt"], ["text"," "], ["paren.block-start","["], ["keyword.native","set"], ["text"," "], ["variable.word","intr"], ["text"," "], ["constant.datatype!","string!"], ["paren.block-end","]"] ],[ "start", ["text","\t\t"], ["keyword.native","any"], ["text"," "], ["paren.block-start","["], ["keyword.native","set"], ["text"," "], ["variable.word","arg"], ["text"," "], ["paren.block-start","["], ["constant.datatype!","word!"], ["text"," | "], ["constant.datatype!","lit-word!"], ["paren.block-end","]"], ["text"," "], ["variable.word","opt"], ["text"," "], ["paren.block-start","["], ["keyword.native","set"], ["text"," "], ["variable.word","typ"], ["text"," "], ["constant.datatype!","block!"], ["paren.block-end","]"], ["text"," "], ["variable.word","opt"], ["text"," "], ["constant.datatype!","string!"], ["text"," "], ["paren.parens-start","("], ["keyword.action","put"], ["text"," "], ["variable.word","ars"], ["text"," "], ["variable.word","arg"], ["text"," "], ["keyword.control","either"], ["text"," "], ["variable.word","typ"], ["text"," "], ["paren.block-start","["], ["variable.word","typ"], ["paren.block-end","]"], ["paren.block-start","[["], ["constant.datatype!","any-type!"], ["paren.block-end","]]"], ["paren.parens-end",")"], ["paren.block-end","]"] ],[ "start", ["text","\t\t"], ["keyword.native","any"], ["text"," "], ["paren.block-start","["], ["keyword.native","set"], ["text"," "], ["variable.word","ref"], ["text"," "], ["constant.datatype!","refinement!"], ["text"," "], ["paren.block-start","["] ],[ "start", ["text","\t\t\t"], ["keyword.control","if"], ["text"," "], ["paren.parens-start","("], ["variable.word","ref"], ["keyword.operator"," <> "], ["keyword","/local"], ["paren.parens-end",")"], ["text"," "], ["paren.parens-start","("], ["keyword.action","put"], ["text"," "], ["variable.word","refs"], ["text"," "], ["keyword.function","to-lit-word"], ["text"," "], ["variable.word","ref"], ["text"," "], ["keyword.action","make"], ["text"," "], ["constant.datatype!","map!"], ["text"," "], ["keyword.action","copy"], ["text"," "], ["paren.block-start","["], ["paren.block-end","]"], ["paren.parens-end",")"], ["text"," "] ],[ "start", ["text","\t\t\t\t"], ["variable.word","opt"], ["text"," "], ["constant.datatype!","string!"], ["text"," "] ],[ "start", ["text","\t\t\t\t"], ["keyword.native","any"], ["text"," "], ["paren.block-start","["], ["keyword.native","set"], ["text"," "], ["variable.word","ref-arg"], ["text"," "], ["constant.datatype!","word!"], ["text"," "], ["variable.word","opt"], ["text"," "], ["paren.block-start","["], ["keyword.native","set"], ["text"," "], ["variable.word","ref-arg-type"], ["text"," "], ["constant.datatype!","block!"], ["paren.block-end","]"], ["text"," "] ],[ "start", ["text","\t\t\t\t\t"], ["paren.parens-start","("], ["keyword.action","put"], ["text"," "], ["variable.word","refs"], ["text","/"], ["paren.parens-start","("], ["keyword.function","to-word"], ["text"," "], ["variable.word","ref"], ["paren.parens-end",")"], ["text"," "], ["keyword.function","to-lit-word"], ["text"," "], ["variable.word","ref-arg"], ["text"," "], ["keyword.control","either"], ["text"," "], ["variable.word","ref-arg-type"], ["text"," "], ["paren.block-start","["], ["variable.word","ref-arg-type"], ["paren.block-end","]"], ["paren.block-start","[["], ["constant.datatype!","any-type!"], ["paren.block-end","]]"], ["paren.parens-end",")"] ],[ "start", ["text","\t\t\t\t"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t|\t"], ["keyword.native","any"], ["text"," "], ["paren.block-start","["], ["keyword.native","set"], ["text"," "], ["variable.word","loc"], ["text"," "], ["constant.datatype!","word!"], ["text"," "], ["paren.parens-start","("], ["keyword.action","append"], ["text"," "], ["variable.word","locs"], ["text"," "], ["variable.word","loc"], ["paren.parens-end",")"], ["text"," "], ["variable.word","opt"], ["text"," "], ["constant.datatype!","string!"], ["paren.block-end","]"], ["text"," "] ],[ "start", ["text","\t\t\t\t"], ["variable.word","opt"], ["text"," "], ["paren.block-start","["], ["constant.datatype!","set-word!"], ["text"," "], ["keyword.native","set"], ["text"," "], ["variable.word","ret"], ["text"," "], ["constant.datatype!","block!"], ["paren.block-end","]"] ],[ "start", ["text","\t\t"], ["paren.block-end","]]"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\t"], ["paren.parens-start","("] ],[ "start", ["text","\t\t"], ["variable.set-word","out:"], ["text"," "], ["keyword.control","case"], ["text"," "], ["paren.block-start","["] ],[ "start", ["text","\t\t\t"], ["keyword.view.option","name"], ["text","\t\t"], ["paren.block-start","["], ["keyword.function","to-word"], ["text"," "], ["variable.word","fn"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["variable.word","intro"], ["text"," \t\t"], ["paren.block-start","["], ["variable.word","intr"], ["paren.block-end","]"], ["text"," "] ],[ "start", ["text","\t\t\t"], ["variable.word","args"], ["text","\t\t"], ["paren.block-start","["], ["variable.word","ars"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["variable.word","arg-num"], ["text","\t\t"], ["paren.block-start","["], ["keyword.action","length?"], ["text"," "], ["variable.word","ars"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["variable.word","arg-names"], ["text"," \t"], ["paren.block-start","["], ["keyword.action","copy"], ["text"," "], ["keyword.function","keys-of"], ["text"," "], ["variable.word","ars"], ["paren.block-end","]"], ["text"," "] ],[ "start", ["text","\t\t\t"], ["variable.word","arg-types"], ["text","\t"], ["paren.block-start","["], ["keyword.action","copy"], ["text"," "], ["keyword.function","values-of"], ["text"," "], ["variable.word","ars"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["variable.word","refinements"], ["text"," "], ["paren.block-start","["], ["variable.word","refs"], ["paren.block-end","]"], ["text"," "] ],[ "start", ["text","\t\t\t"], ["variable.word","ref-names"], ["text","\t"], ["paren.block-start","["], ["keyword.action","copy"], ["text"," "], ["keyword.function","keys-of"], ["text"," "], ["variable.word","refs"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["variable.word","ref-types"], ["text","\t"], ["paren.block-start","["], ["keyword.action","copy"], ["text"," "], ["keyword.function","values-of"], ["text"," "], ["variable.word","refs"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["variable.word","ref-num"], ["text","\t\t"], ["paren.block-start","["], ["keyword.action","length?"], ["text"," "], ["variable.word","refs"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["variable.word","locals"], ["text"," \t\t"], ["paren.block-start","["], ["variable.word","locs"], ["paren.block-end","]"], ["text"," "] ],[ "start", ["text","\t\t\t"], ["keyword.control","return"], ["text"," \t\t"], ["paren.block-start","["], ["variable.word","ret"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["variable.word","spec"], ["text","\t\t"], ["paren.block-start","["], ["variable.word","specs"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["constant.language","true"], ["text"," \t\t"], ["paren.block-start","["] ],[ "start", ["text","\t\t\t\t"], ["keyword.action","make"], ["text"," "], ["constant.datatype!","object!"], ["text"," "], ["paren.block-start","["] ],[ "start", ["text","\t\t\t\t\t"], ["keyword.view.option","name"], ["text",": \t\t"], ["keyword.function","to-word"], ["text"," "], ["variable.word","fn"], ["text"," "] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","intro:"], ["text"," \t\t"], ["variable.word","intr"], ["text"," "] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","args:"], ["text"," \t\t"], ["variable.word","ars"], ["text"," "] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","refinements:"], ["text"," "], ["variable.word","refs"], ["text"," "] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","locals:"], ["text"," \t"], ["variable.word","locs"], ["text"," "] ],[ "start", ["text","\t\t\t\t\t"], ["keyword.control","return"], ["text",": \t"], ["variable.word","ret"], ["text"," "] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","spec:"], ["text"," \t\t"], ["variable.word","specs"], ["text"," "] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","type:"], ["text"," \t\t"], ["keyword.native","type?"], ["text"," "], ["keyword.native","get"], ["text"," "], ["variable.word","fn"] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","arg-num:"], ["text"," \t"], ["keyword.action","length?"], ["text"," "], ["variable.word","args"] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","arg-names:"], ["text"," \t"], ["keyword.action","copy"], ["text"," "], ["keyword.function","keys-of"], ["text"," "], ["variable.word","args"] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","arg-types:"], ["text"," \t"], ["keyword.action","copy"], ["text"," "], ["keyword.function","values-of"], ["text"," "], ["variable.word","args"] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","ref-names:"], ["text"," \t"], ["keyword.action","copy"], ["text"," "], ["keyword.function","keys-of"], ["text"," "], ["variable.word","refinements"] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","ref-types:"], ["text"," \t"], ["keyword.action","copy"], ["text"," "], ["keyword.function","values-of"], ["text"," "], ["variable.word","refinements"] ],[ "start", ["text","\t\t\t\t\t"], ["variable.set-word","ref-num:"], ["text","\t"], ["keyword.action","length?"], ["text"," "], ["variable.word","refinements"] ],[ "start", ["text","\t\t\t\t"], ["paren.block-end","]"] ],[ "start", ["text","\t\t\t"], ["paren.block-end","]"] ],[ "start", ["text","\t\t"], ["paren.block-end","]"], ["paren.parens-end",")"] ],[ "start", ["text","\t"], ["paren.block-end","]"] ],[ "start", ["text","\t"], ["variable.word","out"] ],[ "start", ["paren.block-end","]"] ],[ "start" ]] ================================================ FILE: src/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: src/mode/_test/tokens_robot.json ================================================ [[ "start", ["string.robot.header","*** Settings ***"] ],[ "comment", ["comment","Documentation Robot Framework 4 syntax recipes cheat sheet robot."] ],[ "comment", ["comment","... Demonstrates Robot Framework syntax in a concise format."] ],[ "start", ["keyword.control.robot","Library"], ["text"," MyLibrary"] ],[ "start", ["keyword.control.robot","Library"], ["text"," MyLibrary"], ["keyword"," WITH NAME "], ["text","HelloLibrary"] ],[ "start", ["keyword.control.robot","Library"], ["text"," MyLibrary greeting=Howdy!"], ["keyword"," WITH NAME "], ["text","HowdyLibrary"] ],[ "start", ["keyword.control.robot","Resource"], ["text"," keywords.robot"] ],[ "start", ["keyword.control.robot","Suite Setup"], ["text"," Log Suite Setup!"] ],[ "start", ["keyword.control.robot","Suite Teardown"], ["text"," Log Suite Teardown!"] ],[ "start", ["keyword.control.robot","Test Setup"], ["text"," Log Test Setup!"] ],[ "start", ["keyword.control.robot","Test Teardown"], ["text"," Log Test Teardown!"] ],[ "start", ["keyword.control.robot","Test Timeout"], ["text"," "], ["constant.numeric.robot","2"], ["text"," minutes"] ],[ "start", ["keyword.control.robot","Variables"], ["text"," variables.py"] ],[ "start" ],[ "start", ["string.robot.header","*** Variables ***"] ],[ "start", ["entity.name.variable.wrapper","${"], ["entity.name.variable","STRING"], ["entity.name.variable.wrapper","}="], ["text"," cat"] ],[ "start", ["entity.name.variable.wrapper","${"], ["entity.name.variable","NUMBER"], ["entity.name.variable.wrapper","}="], ["text"," "], ["entity.name.variable.wrapper","${"], ["constant.numeric.robot","1"], ["entity.name.variable.wrapper","}"] ],[ "start", ["entity.name.variable.wrapper","@{"], ["entity.name.variable","LIST"], ["entity.name.variable.wrapper","}="], ["text"," one two three"] ],[ "start", ["entity.name.variable.wrapper","&{"], ["entity.name.variable","DICTIONARY"], ["entity.name.variable.wrapper","}="], ["text"," string="], ["entity.name.variable.wrapper","${"], ["entity.name.variable","STRING"], ["entity.name.variable.wrapper","}"], ["text"," number="], ["entity.name.variable.wrapper","${"], ["entity.name.variable","NUMBER"], ["entity.name.variable.wrapper","}"], ["text"," list="], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","LIST"], ["entity.name.variable.wrapper","}"] ],[ "start", ["entity.name.variable.wrapper","${"], ["entity.name.variable","ENVIRONMENT_VARIABLE"], ["entity.name.variable.wrapper","}="], ["text"," "], ["entity.name.variable.wrapper","%{"], ["entity.name.variable","PATH=Default value"], ["entity.name.variable.wrapper","}"] ],[ "start" ],[ "start", ["string.robot.header","*** Keywords ***"] ],[ "start", ["keyword.control.robot","A keyword without arguments"] ],[ "start", ["storage.type.function"," Log"], ["text"," No arguments."] ],[ "start" ],[ "start", ["keyword.control.robot","A keyword with a required argument"] ],[ "start", ["text"," "], ["storage.type.method.robot","[Arguments]"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","argument"], ["entity.name.variable.wrapper","}"] ],[ "start", ["storage.type.function"," Log"], ["text"," Required argument: "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","argument"], ["entity.name.variable.wrapper","}"] ],[ "start" ],[ "start", ["keyword.control.robot","A keyword with an optional argument"] ],[ "start", ["text"," "], ["storage.type.method.robot","[Arguments]"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","argument"], ["entity.name.variable.wrapper","}="], ["text","Default value"] ],[ "start", ["storage.type.function"," Log"], ["text"," Optional argument: "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","argument"], ["entity.name.variable.wrapper","}"] ],[ "start", ["text"," ... Another arg"] ],[ "start" ],[ "start", ["keyword.control.robot","A keyword with any number of arguments"] ],[ "start", ["text"," "], ["storage.type.method.robot","[Arguments]"], ["text"," "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","varargs"], ["entity.name.variable.wrapper","}"] ],[ "start", ["storage.type.function"," Log"], ["text"," Any number of arguments: "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","varargs"], ["entity.name.variable.wrapper","}"] ],[ "start" ],[ "start", ["keyword.control.robot","A keyword with one or more arguments"] ],[ "start", ["text"," "], ["storage.type.method.robot","[Arguments]"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","argument"], ["entity.name.variable.wrapper","}"], ["text"," "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","varargs"], ["entity.name.variable.wrapper","}"] ],[ "start", ["storage.type.function"," Log"], ["text"," One or more arguments: "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","argument"], ["entity.name.variable.wrapper","}"], ["text"," "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","varargs"], ["entity.name.variable.wrapper","}"] ],[ "start" ],[ "start", ["keyword.control.robot","A keyword that returns a value"] ],[ "start", ["text"," "], ["storage.type.method.robot","[Return]"], ["text"," Return value"] ],[ "start" ],[ "start", ["keyword.control.robot","A keyword with documentation"] ],[ "comment", ["comment"," [Documentation] This is keyword documentation."] ],[ "start", ["storage.type.function"," No Operation"] ],[ "start" ],[ "start", ["string.robot.header","*** Test Cases ***"] ],[ "start", ["keyword.control.robot","Call keywords with a varying number of arguments"] ],[ "storage.type.method.robot", ["text"," "], ["storage.type.method.robot","[Tags] Test Another Tag"] ],[ "start", ["storage.type.function"," A keyword without arguments"] ],[ "start", ["storage.type.function"," A keyword with a required argument"], ["text"," Argument"] ],[ "start", ["storage.type.function"," A keyword with a required argument"], ["text"," argument=Argument"] ],[ "start", ["storage.type.function"," A keyword with an optional argument"] ],[ "start", ["storage.type.function"," A keyword with an optional argument"], ["text"," Argument"] ],[ "start", ["storage.type.function"," A keyword with an optional argument"], ["text"," argument=Argument"] ],[ "start", ["storage.type.function"," A keyword with any number of arguments"] ],[ "start", ["storage.type.function"," A keyword with any number of arguments"], ["text"," arg1 arg2 arg3 arg4 arg5"] ],[ "start", ["storage.type.function"," A keyword with one or more arguments"], ["text"," arg1"] ],[ "start", ["storage.type.function"," A keyword with one or more arguments"], ["text"," arg1 arg2 arg3"] ],[ "start" ],[ "start", ["keyword.control.robot","Call a keyword that returns a value"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","value"], ["entity.name.variable.wrapper","}="], ["text"," A keyword that returns a value"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","value"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # Return value"] ],[ "start" ],[ "start", ["keyword.control.robot","Do conditional IF - ELSE IF - ELSE execution"] ],[ "start", ["keyword"," IF "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","NUMBER"], ["entity.name.variable.wrapper","}"], ["text"," > "], ["constant.numeric.robot","1"] ],[ "start", ["storage.type.function"," Log"], ["text"," Greater than one."] ],[ "start", ["keyword"," ELSE IF "], ["text","\""], ["entity.name.variable.wrapper","${"], ["entity.name.variable","STRING"], ["entity.name.variable.wrapper","}"], ["text","\" == \"dog\""] ],[ "start", ["storage.type.function"," Log"], ["text"," It's a dog!"] ],[ "start", ["keyword"," ELSE"] ],[ "start", ["storage.type.function"," Log"], ["text"," Probably a cat. 🤔"] ],[ "start", ["keyword"," END"] ],[ "start" ],[ "start", ["keyword.control.robot","Loop a list"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","LIST"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # ['one', 'two', 'three']"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","item"], ["entity.name.variable.wrapper","}"], ["keyword"," IN "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","LIST"], ["entity.name.variable.wrapper","}"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","item"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # one, two, three"] ],[ "start", ["keyword"," END"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","item"], ["entity.name.variable.wrapper","}"], ["keyword"," IN "], ["text","one two three"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","item"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # one, two, three"] ],[ "start", ["keyword"," END"] ],[ "start" ],[ "start", ["keyword.control.robot","Loop a dictionary"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","DICTIONARY"], ["entity.name.variable.wrapper","}"] ],[ "start", ["comment.robot"," # {'string': 'cat', 'number': 1, 'list': ['one', 'two', 'three']}"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","key_value_tuple"], ["entity.name.variable.wrapper","}"], ["keyword"," IN "], ["entity.name.variable.wrapper","&{"], ["entity.name.variable","DICTIONARY"], ["entity.name.variable.wrapper","}"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","key_value_tuple"], ["entity.name.variable.wrapper","}"] ],[ "start", ["comment.robot"," # ('string', 'cat'), ('number', 1), ('list', ['one', 'two', 'three'])"] ],[ "start", ["keyword"," END"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","key"], ["entity.name.variable.wrapper","}"], ["keyword"," IN "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","DICTIONARY"], ["entity.name.variable.wrapper","}"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","key"], ["entity.name.variable.wrapper","}=${"], ["entity.name.variable","DICTIONARY"], ["entity.name.variable.wrapper","}"], ["text","["], ["entity.name.variable.wrapper","${"], ["entity.name.variable","key"], ["entity.name.variable.wrapper","}"], ["text","]"] ],[ "start", ["comment.robot"," # string=cat, number=1, list=['one', 'two', 'three']"] ],[ "start", ["keyword"," END"] ],[ "start" ],[ "start", ["keyword.control.robot","Loop a range from 0 to end index"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","index"], ["entity.name.variable.wrapper","}"], ["keyword"," IN RANGE "], ["constant.numeric.robot","10"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","index"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # 0-9"] ],[ "start", ["keyword"," END"] ],[ "start" ],[ "start", ["keyword.control.robot","Loop a range from start to end index"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","index"], ["entity.name.variable.wrapper","}"], ["keyword"," IN RANGE "], ["constant.numeric.robot","1"], ["text"," "], ["constant.numeric.robot","10"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","index"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # 1-9"] ],[ "start", ["keyword"," END"] ],[ "start" ],[ "start", ["keyword.control.robot","Loop a range from start to end index with steps"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","index"], ["entity.name.variable.wrapper","}"], ["keyword"," IN RANGE "], ["constant.numeric.robot","0"], ["text"," "], ["constant.numeric.robot","10"], ["text"," "], ["constant.numeric.robot","2"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","index"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # 0, 2, 4, 6, 8"] ],[ "start", ["keyword"," END"] ],[ "start" ],[ "start", ["keyword.control.robot","Nest loops"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","alphabets"], ["entity.name.variable.wrapper","}="], ["text"," Create List a b c"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","alphabets"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # ['a', 'b', 'c']"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","numbers"], ["entity.name.variable.wrapper","}="], ["text"," Create List "], ["entity.name.variable.wrapper","${"], ["constant.numeric.robot","1"], ["entity.name.variable.wrapper","}"], ["text"," "], ["entity.name.variable.wrapper","${"], ["constant.numeric.robot","2"], ["entity.name.variable.wrapper","}"], ["text"," "], ["entity.name.variable.wrapper","${"], ["constant.numeric.robot","3"], ["entity.name.variable.wrapper","}"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","numbers"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # [1, 2, 3]"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","alphabet"], ["entity.name.variable.wrapper","}"], ["keyword"," IN "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","alphabets"], ["entity.name.variable.wrapper","}"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","number"], ["entity.name.variable.wrapper","}"], ["keyword"," IN "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","numbers"], ["entity.name.variable.wrapper","}"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","alphabet"], ["entity.name.variable.wrapper","}${"], ["entity.name.variable","number"], ["entity.name.variable.wrapper","}"] ],[ "start", ["comment.robot"," # a1, a2, a3, b1, b2, b3, c1, c2, c3"] ],[ "start", ["keyword"," END"] ],[ "start", ["keyword"," END"] ],[ "start" ],[ "start", ["keyword.control.robot","Exit a loop on condition"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","i"], ["entity.name.variable.wrapper","}"], ["keyword"," IN RANGE "], ["constant.numeric.robot","5"] ],[ "start", ["storage.type.function"," Exit For Loop If"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","i"], ["entity.name.variable.wrapper","} ="], ["text","= "], ["constant.numeric.robot","2"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","i"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # 0, 1"] ],[ "start", ["keyword"," END"] ],[ "start" ],[ "start", ["keyword.control.robot","Continue a loop from the next iteration on condition"] ],[ "start", ["keyword"," FOR "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","i"], ["entity.name.variable.wrapper","}"], ["keyword"," IN RANGE "], ["constant.numeric.robot","3"] ],[ "start", ["storage.type.function"," Continue For Loop If"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","i"], ["entity.name.variable.wrapper","} ="], ["text","= "], ["constant.numeric.robot","1"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","i"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # 0, 2"] ],[ "start", ["keyword"," END"] ],[ "start" ],[ "start", ["keyword.control.robot","Create a scalar variable"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","animal"], ["entity.name.variable.wrapper","}="], ["text"," Set Variable dog"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","animal"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # dog"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","animal"], ["entity.name.variable.wrapper","}"], ["text","["], ["constant.numeric.robot","0"], ["text","]"], ["comment.robot"," # d"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","animal"], ["entity.name.variable.wrapper","}"], ["text","[-"], ["constant.numeric.robot","1"], ["text","]"], ["comment.robot"," # g"] ],[ "start" ],[ "start", ["keyword.control.robot","Create a number variable"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","π"], ["entity.name.variable.wrapper","}="], ["text"," Set Variable "], ["entity.name.variable.wrapper","${"], ["constant.numeric.robot","3.14"], ["entity.name.variable.wrapper","}"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","π"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # 3.14"] ],[ "start" ],[ "start", ["keyword.control.robot","Create a list variable"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","animals"], ["entity.name.variable.wrapper","}="], ["text"," Create List dog cat bear"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","animals"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # ['dog', 'cat', 'bear']"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","animals"], ["entity.name.variable.wrapper","}"], ["text","["], ["constant.numeric.robot","0"], ["text","]"], ["comment.robot"," # dog"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","animals"], ["entity.name.variable.wrapper","}"], ["text","[-"], ["constant.numeric.robot","1"], ["text","]"], ["comment.robot"," # bear"] ],[ "start" ],[ "start", ["keyword.control.robot","Create a dictionary variable"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","&{"], ["entity.name.variable","dictionary"], ["entity.name.variable.wrapper","}="], ["text"," Create Dictionary key1=value1 key2=value2"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","dictionary"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # {'key1': 'value1', 'key2': 'value2'}"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","dictionary"], ["entity.name.variable.wrapper","}"], ["text","[key1]"], ["comment.robot"," # value1"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","dictionary.key2"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # value2"] ],[ "start" ],[ "start", ["keyword.control.robot","Access the items in a sequence (list, string)"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","string"], ["entity.name.variable.wrapper","}="], ["text"," Set Variable Hello world!"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","string"], ["entity.name.variable.wrapper","}"], ["text","["], ["constant.numeric.robot","0"], ["text","]"], ["comment.robot"," # H"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","string"], ["entity.name.variable.wrapper","}"], ["text","[:"], ["constant.numeric.robot","5"], ["text","]"], ["comment.robot"," # Hello"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","string"], ["entity.name.variable.wrapper","}"], ["text","["], ["constant.numeric.robot","6"], ["text",":]"], ["comment.robot"," # world!"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","string"], ["entity.name.variable.wrapper","}"], ["text","[-"], ["constant.numeric.robot","1"], ["text","]"], ["comment.robot"," # !"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","@{"], ["entity.name.variable","list"], ["entity.name.variable.wrapper","}="], ["text"," Create List one two three four five"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","list"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # ['one', 'two', 'three', 'four', 'five']"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","list"], ["entity.name.variable.wrapper","}"], ["text","["], ["constant.numeric.robot","0"], ["text",":"], ["constant.numeric.robot","6"], ["text",":"], ["constant.numeric.robot","2"], ["text","]"], ["comment.robot"," # ['one', 'three', 'five']"] ],[ "start" ],[ "start", ["keyword.control.robot","Call a custom Python library"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","greeting"], ["entity.name.variable.wrapper","}="], ["text"," MyLibrary.Get Greeting"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","greeting"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # Hello!"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","greeting"], ["entity.name.variable.wrapper","}="], ["text"," HelloLibrary.Get Greeting"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","greeting"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # Hello!"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","greeting"], ["entity.name.variable.wrapper","}="], ["text"," HowdyLibrary.Get Greeting"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","greeting"], ["entity.name.variable.wrapper","}"], ["comment.robot"," # Howdy!"] ],[ "start" ],[ "start", ["keyword.control.robot","Call a keyword from a separate resource file"] ],[ "start", ["storage.type.function"," My keyword in a separate resource file"] ],[ "start" ],[ "start", ["keyword.control.robot","Access a variable in a separate variable file"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","MY_VARIABLE_FROM_A_SEPARATE_VARIABLE_FILE"], ["entity.name.variable.wrapper","}"] ],[ "start" ],[ "start", ["keyword.control.robot","Split arguments to multiple lines"] ],[ "start", ["storage.type.function"," A keyword with any number of arguments"] ],[ "start", ["text"," ... arg1"] ],[ "start", ["text"," ... arg2"] ],[ "start", ["text"," ... arg3"] ],[ "start" ],[ "start", ["keyword.control.robot","Log available variables"] ],[ "start", ["storage.type.function"," Log Variables"] ],[ "start", ["comment.robot"," # ${/} = /"] ],[ "start", ["comment.robot"," # &{DICTIONARY} = { string=cat | number=1 | list=['one', 'two', 'three'] }"] ],[ "start", ["comment.robot"," # ${OUTPUT_DIR} = /Users//..."] ],[ "start", ["comment.robot"," # ..."] ],[ "start" ],[ "start", ["keyword.control.robot","Evaluate Python expressions"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","path"], ["entity.name.variable.wrapper","}="], ["text"," Evaluate os.environ.get(\"PATH\")"] ],[ "start", ["text"," "], ["entity.name.variable.wrapper","${"], ["entity.name.variable","path"], ["entity.name.variable.wrapper","}="], ["text"," Set Variable "], ["entity.name.variable.wrapper","${{"], ["entity.name.variable","os.environ.get(\"PATH\")"], ["entity.name.variable.wrapper","}}"] ],[ "start" ],[ "start", ["keyword.control.robot","Use special variables"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["constant.language","${EMPTY}"], ["comment.robot"," # Like the ${SPACE}, but without the space."] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["constant.language","${False}"], ["comment.robot"," # Boolean False."] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["constant.language","${None}"], ["comment.robot"," # Python None"] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["constant.language","${null}"], ["comment.robot"," # Java null."] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["constant.language","${SPACE}"], ["comment.robot"," # ASCII space (\\x20)."] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["constant.language","${SPACE * 4}"], ["comment.robot"," # Four spaces."] ],[ "start", ["storage.type.function"," Log"], ["text"," \""], ["constant.language","${SPACE}"], ["text","\""], ["comment.robot"," # Quoted space (\" \")."] ],[ "start", ["storage.type.function"," Log"], ["text"," "], ["constant.language","${True}"], ["comment.robot"," # Boolean True."] ],[ "start", ["storage.type.function"," LOG"], ["text"," "], ["constant.language","${CURDIR}"], ["comment.robot"," # Current directory"] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_rst.json ================================================ [[ "start", ["markup.heading","=========================================="] ],[ "start", ["markup.italic","*"], ["markup.italic","reStructuredText*"], ["text"," Highlighter for"], ["text"," "], ["markup.bold","**"], ["markup.bold","Ace**"] ],[ "start", ["markup.heading","=========================================="] ],[ "start" ],[ "codeblock", ["text",".. "], ["keyword.operator","seealso::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," http://docutils.sourceforge.net/docs/user/rst/quickstart.html"] ],[ "codeblock" ],[ "codeblock" ],[ "start", ["text","ReStructuredText Primer"] ],[ "start", ["markup.heading","======================="] ],[ "start" ],[ "start", ["text",":Author: Richard Jones"] ],[ "start", ["text",":Version: $Revision: 5801 $"] ],[ "start", ["text",":Copyright: This document has been placed in the public domain."] ],[ "start" ],[ "codeblock", ["text",".. "], ["keyword.operator","contents::"] ],[ "codeblock" ],[ "codeblock" ],[ "start", ["text","The text below contains links that look like \"("], ["markup.underline.list","quickref__"], ["text",")\". These"] ],[ "start", ["text","are relative links that point to the"], ["text"," "], ["markup.underline.list","`"], ["markup.underline.list","Quick reStructuredText`_"], ["text"," user"] ],[ "link", ["text","reference. If these links don't work, please refer to the"], ["text"," "], ["markup.underline.list","`"], ["markup.underline.list","master"] ],[ "start", ["markup.underline.list","quick reference`_"], ["text"," document."] ],[ "start" ],[ "start", ["text","__"] ],[ "start", ["string",".. _Quick reStructuredText:"], ["markup.underline.list"," quickref.html"] ],[ "start", ["string",".. _master quick reference:"] ],[ "start", ["text"," "], ["markup.underline.list","http://docutils.sourceforge.net/docs/user/rst/quickref.html"] ],[ "start" ],[ "codeblock", ["text",".. "], ["keyword.operator","Note::"], ["support.function"," This document is an informal introduction to"] ],[ "codeblock", ["support.function"," reStructuredText. The `What Next?`_ section below has links to"] ],[ "codeblock", ["support.function"," further resources, including a formal reference."] ],[ "codeblock" ],[ "codeblock" ],[ "start", ["text","Structure"] ],[ "start", ["markup.heading","---------"] ],[ "start" ],[ "start", ["text","From the outset, let me say that \"Structured Text\" is probably a bit"] ],[ "start", ["text","of a misnomer. It's more like \"Relaxed Text\" that uses certain"] ],[ "start", ["text","consistent patterns. These patterns are interpreted by a HTML"] ],[ "start", ["text","converter to produce \"Very Structured Text\" that can be used by a web"] ],[ "start", ["text","browser."] ],[ "start" ],[ "start", ["text","The most basic pattern recognised is a"], ["text"," "], ["markup.bold","**"], ["markup.bold","paragraph**"], ["text"," ("], ["markup.underline.list","quickref__"], ["text",")."] ],[ "start", ["text","That's a chunk of text that is separated by blank lines (one is"] ],[ "start", ["text","enough). Paragraphs must have the same indentation -- that is, line"] ],[ "start", ["text","up at their left edge. Paragraphs that start indented will result in"] ],[ "codeblock", ["text","indented quote paragraphs. For example"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," This is a paragraph. It's quite"] ],[ "codeblock", ["support.function"," short."] ],[ "codeblock" ],[ "codeblock", ["support.function"," This paragraph will result in an indented block of"] ],[ "codeblock", ["support.function"," text, typically used for quoting other text."] ],[ "codeblock" ],[ "codeblock", ["support.function"," This is another one."] ],[ "codeblock" ],[ "start", ["text","Results in:"] ],[ "start" ],[ "start", ["text"," This is a paragraph. It's quite"] ],[ "start", ["text"," short."] ],[ "start" ],[ "start", ["text"," This paragraph will result in an indented block of"] ],[ "start", ["text"," text, typically used for quoting other text."] ],[ "start" ],[ "start", ["text"," This is another one."] ],[ "start" ],[ "start", ["text","__ quickref.html#paragraphs"] ],[ "start" ],[ "start" ],[ "start", ["text","Text styles"] ],[ "start", ["markup.heading","-----------"] ],[ "start" ],[ "start", ["text","("], ["markup.underline.list","quickref__"], ["text",")"] ],[ "start" ],[ "start", ["text","__ quickref.html#inline-markup"] ],[ "start" ],[ "start", ["text","Inside paragraphs and other bodies of text, you may additionally mark"] ],[ "start", ["text","text for"], ["text"," "], ["markup.italic","*"], ["markup.italic","italics*"], ["text"," with "], ["text","\""], ["support.function","``"], ["support.function","*italics*``"], ["text","\" or"], ["text"," "], ["markup.bold","**"], ["markup.bold","bold**"], ["text"," with"] ],[ "start", ["text","\""], ["support.function","``"], ["support.function","**bold**``"], ["text","\". This is called \"inline markup\"."] ],[ "start" ],[ "start", ["text","If you want something to appear as a fixed-space literal, use"] ],[ "start", ["text","\""], ["support.function","``"], ["support.function","``double back-quotes````"], ["text","\". Note that no further fiddling is done"] ],[ "start", ["text","inside the double back-quotes -- so asterisks "], ["text","\""], ["support.function","``"], ["support.function","*``"], ["text","\" etc. are left"] ],[ "start", ["text","alone."] ],[ "start" ],[ "start", ["text","If you find that you want to use one of the \"special\" characters in"] ],[ "start", ["text","text, it will generally be OK -- reStructuredText is pretty smart."] ],[ "start", ["text","For example, this lone asterisk * is handled just fine, as is the"] ],[ "start", ["text","asterisk in this equation: 5*6=30. If you actually"] ],[ "start", ["text","want text \\*surrounded by asterisks* to"], ["text"," "], ["markup.bold","**"], ["markup.bold","not**"], ["text"," be italicised, then"] ],[ "start", ["text","you need to indicate that the asterisk is not special. You do this by"] ],[ "start", ["text","placing a backslash just before it, like so "], ["text","\""], ["support.function","``"], ["support.function","\\*``"], ["text","\" ("], ["markup.underline.list","quickref__"], ["text","), or"] ],[ "codeblock", ["text","by enclosing it in double back-quotes (inline literals), like this"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," ``*``"] ],[ "codeblock" ],[ "start", ["text","__ quickref.html#escaping"] ],[ "start" ],[ "codeblock", ["text",".. "], ["keyword.operator","Tip::"], ["support.function"," Think of inline markup as a form of (parentheses) and use it"] ],[ "codeblock", ["support.function"," the same way: immediately before and after the text being marked"] ],[ "codeblock", ["support.function"," up. Inline markup by itself (surrounded by whitespace) or in the"] ],[ "codeblock", ["support.function"," middle of a word won't be recognized. See the `markup spec`__ for"] ],[ "codeblock", ["support.function"," full details."] ],[ "codeblock" ],[ "start", ["text","__ ../../ref/rst/restructuredtext.html#inline-markup"] ],[ "start" ],[ "start" ],[ "start", ["text","Lists"] ],[ "start", ["markup.heading","-----"] ],[ "start" ],[ "start", ["text","Lists of items come in three main flavours:"], ["text"," "], ["markup.bold","**"], ["markup.bold","enumerated**"], ["text",","] ],[ "start", ["markup.bold","**"], ["markup.bold","bulleted**"], ["text"," and"], ["text"," "], ["markup.bold","**"], ["markup.bold","definitions**"], ["text",". In all list cases, you may have as"] ],[ "start", ["text","many paragraphs, sublists, etc. as you want, as long as the left-hand"] ],[ "start", ["text","side of the paragraph or whatever aligns with the first line of text"] ],[ "start", ["text","in the list item."] ],[ "start" ],[ "start", ["text","Lists must always start a new paragraph -- that is, they must appear"] ],[ "start", ["text","after a blank line."] ],[ "start" ],[ "start", ["markup.bold","**"], ["markup.bold","enumerated**"], ["text"," lists (numbers, letters or roman numerals; "], ["markup.underline.list","quickref__"], ["text",")"] ],[ "start", ["text","__ quickref.html#enumerated-lists"] ],[ "start" ],[ "start", ["text","Start a line off with a number or letter followed by a period \".\","] ],[ "start", ["text","right bracket \")\" or surrounded by brackets \"( )\" -- whatever you're"] ],[ "codeblock", ["text","comfortable with. All of the following forms are recognised"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," 1. numbers"] ],[ "codeblock" ],[ "codeblock", ["support.function"," A. upper-case letters"] ],[ "codeblock", ["support.function"," and it goes over many lines"] ],[ "codeblock" ],[ "codeblock", ["support.function"," with two paragraphs and all!"] ],[ "codeblock" ],[ "codeblock", ["support.function"," a. lower-case letters"] ],[ "codeblock" ],[ "codeblock", ["support.function"," 3. with a sub-list starting at a different number"] ],[ "codeblock", ["support.function"," 4. make sure the numbers are in the correct sequence though!"] ],[ "codeblock" ],[ "codeblock", ["support.function"," I. upper-case roman numerals"] ],[ "codeblock" ],[ "codeblock", ["support.function"," i. lower-case roman numerals"] ],[ "codeblock" ],[ "codeblock", ["support.function"," (1) numbers again"] ],[ "codeblock" ],[ "codeblock", ["support.function"," 1) and again"] ],[ "codeblock" ],[ "start", ["text","Results in (note: the different enumerated list styles are not"] ],[ "start", ["text","always supported by every web browser, so you may not get the full"] ],[ "start", ["text","effect here):"] ],[ "start" ],[ "start", ["markup.heading","1. "], ["text","numbers"] ],[ "start" ],[ "start", ["markup.heading","A. "], ["text","upper-case letters"] ],[ "start", ["text"," and it goes over many lines"] ],[ "start" ],[ "start", ["text"," with two paragraphs and all!"] ],[ "start" ],[ "start", ["markup.heading","a. "], ["text","lower-case letters"] ],[ "start" ],[ "start", ["markup.heading"," 3. "], ["text","with a sub-list starting at a different number"] ],[ "start", ["markup.heading"," 4. "], ["text","make sure the numbers are in the correct sequence though!"] ],[ "start" ],[ "start", ["markup.heading","I. "], ["text","upper-case roman numerals"] ],[ "start" ],[ "start", ["markup.heading","i. "], ["text","lower-case roman numerals"] ],[ "start" ],[ "start", ["markup.heading","(1) "], ["text","numbers again"] ],[ "start" ],[ "start", ["markup.heading","1) "], ["text","and again"] ],[ "start" ],[ "start", ["markup.bold","**"], ["markup.bold","bulleted**"], ["text"," lists ("], ["markup.underline.list","quickref__"], ["text",")"] ],[ "start", ["text","__ quickref.html#bullet-lists"] ],[ "start" ],[ "start", ["text","Just like enumerated lists, start the line off with a bullet point"] ],[ "codeblock", ["text","character - either \"-\", \"+\" or \"\\*\""], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," * a bullet point using \"\\*\""] ],[ "codeblock" ],[ "codeblock", ["support.function"," - a sub-list using \"-\""] ],[ "codeblock" ],[ "codeblock", ["support.function"," + yet another sub-list"] ],[ "codeblock" ],[ "codeblock", ["support.function"," - another item"] ],[ "codeblock" ],[ "start", ["text","Results in:"] ],[ "start" ],[ "start", ["markup.heading","* "], ["text","a bullet point using \"\\*\""] ],[ "start" ],[ "start", ["markup.heading"," - "], ["text","a sub-list using \"-\""] ],[ "start" ],[ "start", ["markup.heading"," + "], ["text","yet another sub-list"] ],[ "start" ],[ "start", ["markup.heading"," - "], ["text","another item"] ],[ "start" ],[ "start", ["markup.bold","**"], ["markup.bold","definition**"], ["text"," lists ("], ["markup.underline.list","quickref__"], ["text",")"] ],[ "start", ["text","__ quickref.html#definition-lists"] ],[ "start" ],[ "start", ["text","Unlike the other two, the definition lists consist of a term, and"] ],[ "codeblock", ["text","the definition of that term. The format of a definition list is"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," what"] ],[ "codeblock", ["support.function"," Definition lists associate a term with a definition."] ],[ "codeblock" ],[ "codeblock", ["support.function"," *how*"] ],[ "codeblock", ["support.function"," The term is a one-line phrase, and the definition is one or more"] ],[ "codeblock", ["support.function"," paragraphs or body elements, indented relative to the term."] ],[ "codeblock", ["support.function"," Blank lines are not allowed between term and definition."] ],[ "codeblock" ],[ "start", ["text","Results in:"] ],[ "start" ],[ "start", ["text","what"] ],[ "start", ["text"," Definition lists associate a term with a definition."] ],[ "start" ],[ "start", ["markup.italic","*"], ["markup.italic","how*"] ],[ "start", ["text"," The term is a one-line phrase, and the definition is one or more"] ],[ "start", ["text"," paragraphs or body elements, indented relative to the term."] ],[ "start", ["text"," Blank lines are not allowed between term and definition."] ],[ "start" ],[ "start" ],[ "start", ["text","Preformatting (code samples)"] ],[ "start", ["markup.heading","----------------------------"] ],[ "start", ["text","("], ["markup.underline.list","quickref__"], ["text",")"] ],[ "start" ],[ "start", ["text","__ quickref.html#literal-blocks"] ],[ "start" ],[ "start", ["text","To just include a chunk of preformatted, never-to-be-fiddled-with"] ],[ "start", ["text","text, finish the prior paragraph with "], ["text","\""], ["support.function","``"], ["support.function","::``"], ["text","\". The preformatted"] ],[ "start", ["text","block is finished when the text falls back to the same indentation"] ],[ "codeblock", ["text","level as a paragraph prior to the preformatted block. For example"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," An example::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," Whitespace, newlines, blank lines, and all kinds of markup"] ],[ "codeblock", ["support.function"," (like *this* or \\this) is preserved by literal blocks."] ],[ "codeblock", ["support.function"," Lookie here, I've dropped an indentation level"] ],[ "codeblock", ["support.function"," (but not far enough)"] ],[ "codeblock" ],[ "codeblock", ["support.function"," no more example"] ],[ "codeblock" ],[ "start", ["text","Results in:"] ],[ "start" ],[ "codeblock", ["text","An example"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," Whitespace, newlines, blank lines, and all kinds of markup"] ],[ "codeblock", ["support.function"," (like *this* or \\this) is preserved by literal blocks."] ],[ "codeblock", ["support.function"," Lookie here, I've dropped an indentation level"] ],[ "codeblock", ["support.function"," (but not far enough)"] ],[ "codeblock" ],[ "start", ["text","no more example"] ],[ "start" ],[ "start", ["text","Note that if a paragraph consists only of "], ["text","\""], ["support.function","``"], ["support.function","::``"], ["text","\", then it's removed"] ],[ "codeblock", ["text","from the output"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," ::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," This is preformatted text, and the"] ],[ "codeblock", ["support.function"," last \"::\" paragraph is removed"] ],[ "codeblock" ],[ "start", ["text","Results in:"] ],[ "start" ],[ "codeblock", ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," This is preformatted text, and the"] ],[ "codeblock", ["support.function"," last \"::\" paragraph is removed"] ],[ "codeblock" ],[ "codeblock" ],[ "start", ["text","Sections"] ],[ "start", ["markup.heading","--------"] ],[ "start" ],[ "start", ["text","("], ["markup.underline.list","quickref__"], ["text",")"] ],[ "start" ],[ "start", ["text","__ quickref.html#section-structure"] ],[ "start" ],[ "start", ["text","To break longer text up into sections, you use"], ["text"," "], ["markup.bold","**"], ["markup.bold","section headers**"], ["text","."] ],[ "start", ["text","These are a single line of text (one or more words) with adornment: an"] ],[ "start", ["text","underline alone, or an underline and an overline together, in dashes"] ],[ "start", ["text","\""], ["support.function","``"], ["support.function","-----``"], ["text","\", equals "], ["text","\""], ["support.function","``"], ["support.function","======``"], ["text","\", tildes "], ["text","\""], ["support.function","``"], ["support.function","~~~~~~``"], ["text","\" or any of the"] ],[ "start", ["text","non-alphanumeric characters"], ["text"," "], ["support.function","``"], ["support.function","= - ` : ' \" ~ ^ _ * + # < >``"], ["text"," that you"] ],[ "start", ["text","feel comfortable with. An underline-only adornment is distinct from"] ],[ "start", ["text","an overline-and-underline adornment using the same character. The"] ],[ "start", ["text","underline/overline must be at least as long as the title text. Be"] ],[ "start", ["text","consistent, since all sections marked with the same adornment style"] ],[ "codeblock", ["text","are deemed to be at the same level"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," Chapter 1 Title"] ],[ "codeblock", ["support.function"," ==============="] ],[ "codeblock" ],[ "codeblock", ["support.function"," Section 1.1 Title"] ],[ "codeblock", ["support.function"," -----------------"] ],[ "codeblock" ],[ "codeblock", ["support.function"," Subsection 1.1.1 Title"] ],[ "codeblock", ["support.function"," ~~~~~~~~~~~~~~~~~~~~~~"] ],[ "codeblock" ],[ "codeblock", ["support.function"," Section 1.2 Title"] ],[ "codeblock", ["support.function"," -----------------"] ],[ "codeblock" ],[ "codeblock", ["support.function"," Chapter 2 Title"] ],[ "codeblock", ["support.function"," ==============="] ],[ "codeblock" ],[ "start", ["text","This results in the following structure, illustrated by simplified"] ],[ "codeblock", ["text","pseudo-XML"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function","
    "] ],[ "codeblock", ["support.function"," "] ],[ "codeblock", ["support.function"," Chapter 1 Title"] ],[ "codeblock", ["support.function"," <section>"] ],[ "codeblock", ["support.function"," <title>"] ],[ "codeblock", ["support.function"," Section 1.1 Title"] ],[ "codeblock", ["support.function"," <section>"] ],[ "codeblock", ["support.function"," <title>"] ],[ "codeblock", ["support.function"," Subsection 1.1.1 Title"] ],[ "codeblock", ["support.function"," <section>"] ],[ "codeblock", ["support.function"," <title>"] ],[ "codeblock", ["support.function"," Section 1.2 Title"] ],[ "codeblock", ["support.function"," <section>"] ],[ "codeblock", ["support.function"," <title>"] ],[ "codeblock", ["support.function"," Chapter 2 Title"] ],[ "codeblock" ],[ "start", ["text","(Pseudo-XML uses indentation for nesting and has no end-tags. It's"] ],[ "start", ["text","not possible to show actual processed output, as in the other"] ],[ "start", ["text","examples, because sections cannot exist inside block quotes. For a"] ],[ "start", ["text","concrete example, compare the section structure of this document's"] ],[ "start", ["text","source text and processed output.)"] ],[ "start" ],[ "start", ["text","Note that section headers are available as link targets, just using"] ],[ "start", ["text","their name. To link to the "], ["markup.underline.list","Lists_"], ["text"," heading, I write "], ["text","\""], ["support.function","``"], ["support.function","Lists_``"], ["text","\". If"] ],[ "start", ["text","the heading has a space in it like"], ["text"," "], ["markup.underline.list","`"], ["markup.underline.list","text styles`_"], ["text",", we need to quote"] ],[ "start", ["text","the heading "], ["text","\""], ["support.function","``"], ["support.function","`text styles`_``"], ["text","\"."] ],[ "start" ],[ "start" ],[ "start", ["text","Document Title / Subtitle"] ],[ "start", ["markup.heading","`````````````````````````"] ],[ "start" ],[ "start", ["text","The title of the whole document is distinct from section titles and"] ],[ "start", ["text","may be formatted somewhat differently (e.g. the HTML writer by default"] ],[ "start", ["text","shows it as a centered heading)."] ],[ "start" ],[ "start", ["text","To indicate the document title in reStructuredText, use a unique adornment"] ],[ "start", ["text","style at the beginning of the document. To indicate the document subtitle,"] ],[ "start", ["text","use another unique adornment style immediately after the document title. For"] ],[ "codeblock", ["text","example"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," ================"] ],[ "codeblock", ["support.function"," Document Title"] ],[ "codeblock", ["support.function"," ================"] ],[ "codeblock", ["support.function"," ----------"] ],[ "codeblock", ["support.function"," Subtitle"] ],[ "codeblock", ["support.function"," ----------"] ],[ "codeblock" ],[ "codeblock", ["support.function"," Section Title"] ],[ "codeblock", ["support.function"," ============="] ],[ "codeblock" ],[ "codeblock", ["support.function"," ..."] ],[ "codeblock" ],[ "start", ["text","Note that \"Document Title\" and \"Section Title\" above both use equals"] ],[ "start", ["text","signs, but are distict and unrelated styles. The text of"] ],[ "start", ["text","overline-and-underlined titles (but not underlined-only) may be inset"] ],[ "start", ["text","for aesthetics."] ],[ "start" ],[ "start" ],[ "start", ["text","Images"] ],[ "start", ["markup.heading","------"] ],[ "start" ],[ "start", ["text","("], ["markup.underline.list","quickref__"], ["text",")"] ],[ "start" ],[ "start", ["text","__ quickref.html#directives"] ],[ "start" ],[ "start", ["text","To include an image in your document, you use the the"], ["text"," "], ["support.function","``"], ["support.function","image``"], ["text"," "], ["markup.underline.list","directive__"], ["text","."] ],[ "codeblock", ["text","For example"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," .. image:: images/biohazard.png"] ],[ "codeblock" ],[ "start", ["text","results in:"] ],[ "start" ],[ "codeblock", ["text",".. "], ["keyword.operator","image::"], ["support.function"," images/biohazard.png"] ],[ "codeblock" ],[ "start", ["text","The"], ["text"," "], ["support.function","``"], ["support.function","images/biohazard.png``"], ["text"," part indicates the filename of the image"] ],[ "start", ["text","you wish to appear in the document. There's no restriction placed on"] ],[ "start", ["text","the image (format, size etc). If the image is to appear in HTML and"] ],[ "codeblock", ["text","you wish to supply additional information, you may"], ["keyword.operator","::"] ],[ "codeblock" ],[ "codeblock", ["support.function"," .. image:: images/biohazard.png"] ],[ "codeblock", ["support.function"," :height: 100"] ],[ "codeblock", ["support.function"," :width: 200"] ],[ "codeblock", ["support.function"," :scale: 50"] ],[ "codeblock", ["support.function"," :alt: alternate text"] ],[ "codeblock" ],[ "start", ["text","See the full"], ["text"," "], ["markup.underline.list","`"], ["markup.underline.list","image directive documentation`__"], ["text"," for more info."] ],[ "start" ],[ "start", ["text","__ ../../ref/rst/directives.html"] ],[ "start", ["text","__ ../../ref/rst/directives.html#images"] ],[ "start" ],[ "start" ],[ "start", ["text","What Next?"] ],[ "start", ["markup.heading","----------"] ],[ "start" ],[ "start", ["text","This primer introduces the most common features of reStructuredText,"] ],[ "start", ["text","but there are a lot more to explore. The"], ["text"," "], ["markup.underline.list","`"], ["markup.underline.list","Quick reStructuredText`_"] ],[ "start", ["text","user reference is a good place to go next. For complete details, the"] ],[ "start", ["markup.underline.list","`"], ["markup.underline.list","reStructuredText Markup Specification`_"], ["text"," is the place to go "], ["markup.underline.list","[#]_"], ["text","."] ],[ "start" ],[ "start", ["text","Users who have questions or need assistance with Docutils or"] ],[ "start", ["text","reStructuredText should post a message to the "], ["markup.underline.list","Docutils-users_"], ["text"," mailing"] ],[ "start", ["text","list."] ],[ "start" ],[ "start", ["string",".. [#] "], ["text","If that relative link doesn't work, try the master document:"] ],[ "start", ["text"," "], ["markup.underline.list","http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html."] ],[ "start" ],[ "start", ["string",".. _reStructuredText Markup Specification:"] ],[ "start", ["text"," ../../ref/rst/restructuredtext.html"] ],[ "start", ["string",".. _Docutils-users:"], ["markup.underline.list"," ../mailing-lists.html#docutils-users"] ],[ "start", ["string",".. _Docutils project web site:"], ["markup.underline.list"," http://docutils.sourceforge.net/"] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_ruby.json ================================================ [[ "start", ["text"," "], ["comment","#test: symbol tokenizer"] ],[ "start", ["text"," "], ["paren.lparen","["], ["constant.other.symbol.ruby",":@thing"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":$thing"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":_thing"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":thing"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":Thing"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":thing1"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":thing_a"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["constant.other.symbol.ruby",":THING"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":thing!"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":thing="], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":thing?"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":t?"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["punctuation.operator",":,"], ["text"," "], ["punctuation.operator",":"], ["text","@"], ["punctuation.operator",","], ["text"," "], ["punctuation.operator",":"], ["keyword.operator","$"], ["punctuation.operator",","], ["text"," "], ["punctuation.operator",":"], ["constant.numeric","1"], ["punctuation.operator",","], ["text"," "], ["punctuation.operator",":"], ["text","1"], ["identifier","thing"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":th?"], ["identifier","ing"], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":thi="], ["identifier","ng"], ["punctuation.operator",","], ["text"," "], ["punctuation.operator",":"], ["text","1"], ["identifier","thing"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["constant.other.symbol.ruby",":th!"], ["identifier","ing"], ["punctuation.operator",","], ["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"], ["punctuation","::"], ["support.class","Class"] ],[ "start", ["text"," "], ["comment","#test: hex tokenizer "] ],[ "start", ["text"," "], ["constant.numeric","0x9a"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","0XA1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","0x9_a"], ["punctuation.operator",","], ["text"," 0"], ["identifier","x"], ["punctuation.operator",","], ["text"," 0"], ["identifier","x_9a"], ["punctuation.operator",","], ["text"," 0"], ["identifier","x9a_"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["comment","#test: float tokenizer"] ],[ "start", ["text"," "], ["paren.lparen","["], ["constant.numeric","1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","+1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","-1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","12_345"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","0.000_1"], ["punctuation.operator",","] ],[ "start", ["text"," "], ["identifier","_"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","3_1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","1_2"], ["punctuation.operator",","], ["text"," 1"], ["identifier","_"], ["punctuation.operator","."], ["constant.numeric","0"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","0"], ["punctuation.operator","."], ["identifier","_1"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["text"," "] ],[ "start", ["paren.lparen","{"], ["constant.other.symbol.ruby",":id"], ["text"," "], ["punctuation.separator.key-value","=>"], ["text"," "], ["string.character","?\""], ["punctuation.operator",","], ["text"," "], ["constant.other.symbol.ruby",":key"], ["text"," "], ["punctuation.separator.key-value","=>"], ["text"," "], ["string.start","\""], ["string","value"], ["string.end","\""], ["punctuation.operator",","], ["text"," "], ["identifier","anotherKey"], ["punctuation.operator",":"], ["text"," "], ["paren.lparen","["], ["identifier","x"], ["punctuation.operator",","], ["text"," "], ["identifier","y"], ["punctuation.operator","?"], ["paren.rparen","]}"] ],[ "start" ],[ "comment", ["comment.multiline","=begin"] ],[ "start", ["comment.multiline","=end"] ],[ "start" ],[ "comment", ["comment.multiline","=begin"], ["comment"," x"] ],[ "comment", ["comment","=end-"] ],[ "start", ["comment.multiline","=end"], ["text"," "], ["identifier","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","'"], ["punctuation.operator",","], ["text"," "], ["constant","<<"], ["string",""], ["support.class","BAR"], ["string",""], ["punctuation.operator",","], ["text"," "], ["constant","<<-"], ["string",""], ["support.class","BAZ"], ["string",""], ["punctuation.operator",","], ["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: src/mode/_test/tokens_rust.json ================================================ [[ "start", ["keyword.source.rust","use"], ["text"," "], ["support.constant","core::rand::"], ["identifier","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","."], ["identifier","each"], ["text"," "], ["keyword.operator","|&"], ["identifier","name"], ["keyword.operator","|"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.source.rust","do"], ["text"," "], ["identifier","spawn"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.source.rust","let"], ["text"," "], ["identifier","v"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.constant","rand::"], ["identifier","Rng"], ["paren.lparen","("], ["paren.rparen",")"], ["punctuation.operator","."], ["identifier","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"," "], ["identifier","v"], ["punctuation.operator","."], ["identifier","each"], ["text"," "], ["keyword.operator","|&"], ["identifier","num"], ["keyword.operator","|"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","print"], ["paren.lparen","("], ["identifier","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"," "], ["identifier","name"], ["punctuation.operator",","], ["text"," "], ["identifier","num"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric.source.rust","1"], ["paren.rparen","))"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword.source.rust","let"], ["text"," "], ["identifier","_"], ["punctuation.operator",":"], ["text"," "], ["storage.type.source.rust","i128"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.operator","-"], ["constant.numeric.source.rust","42i128"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.source.rust","let"], ["text"," "], ["identifier","_"], ["punctuation.operator",":"], ["text"," "], ["storage.type.source.rust","u128"], ["text"," "], ["keyword.operator","="], ["text"," "], ["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"], ["punctuation","<"], ["identifier","T"], ["punctuation.operator",","], ["text"," "], ["identifier","U"], ["punctuation",">"], ["paren.lparen","("], ["identifier","vector"], ["punctuation.operator",":"], ["text"," "], ["keyword.operator","&"], ["paren.lparen","["], ["identifier","T"], ["paren.rparen","]"], ["punctuation.operator",","], ["text"," "], ["identifier","function"], ["punctuation.operator",":"], ["text"," "], ["keyword.operator","&"], ["identifier","fn"], ["paren.lparen","("], ["identifier","v"], ["punctuation.operator",":"], ["text"," "], ["keyword.operator","&"], ["identifier","T"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","U"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","->"], ["text"," ~"], ["paren.lparen","["], ["identifier","U"], ["paren.rparen","]"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.source.rust","let"], ["text"," "], ["keyword.source.rust","mut"], ["text"," "], ["identifier","accumulator"], ["text"," "], ["keyword.operator","="], ["text"," ~"], ["paren.lparen","["], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.source.rust","for"], ["text"," "], ["support.constant","vec::"], ["identifier","each"], ["paren.lparen","("], ["identifier","vector"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","|"], ["identifier","element"], ["keyword.operator","|"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","accumulator"], ["punctuation.operator","."], ["identifier","push"], ["paren.lparen","("], ["identifier","function"], ["paren.lparen","("], ["identifier","element"], ["paren.rparen","))"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword.source.rust","return"], ["text"," "], ["identifier","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","."], ["identifier","_E"], ["keyword.operator","-"], ["constant.numeric.source.rust","111_f64"], ["punctuation.operator",";"], ["text"," 0"], ["identifier","xi32"], ["punctuation.operator",";"], ["text"," 0"], ["identifier","b777u"] ],[ "start" ],[ "start", ["comment.line.double-dash.source.rust","// identifiers ending in constant.numeric"] ],[ "start", ["identifier","foo1"], ["punctuation.operator",";"], ["text"," "], ["identifier","foo1u32"], ["punctuation.operator",";"], ["text"," "], ["identifier","foo1f32"], ["punctuation.operator",";"], ["text"," "], ["identifier","foo0xF"], ["punctuation.operator",";"], ["text"," "], ["identifier","foo1"], ["punctuation.operator","."], ["constant.numeric.source.rust","0"] ],[ "start" ],[ "start" ],[ "start", ["keyword.source.rust","pub"], ["text"," "], ["keyword.source.rust","fn"], ["text"," "], ["entity.name.function.source.rust","g"], ["punctuation","<"], ["identifier","T"], ["punctuation",">"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["support.constant","std::mem::"], ["identifier","MaybeUninit"], ["punctuaction","<"], ["paren.lparen","["], ["identifier","T"], ["punctuation.operator",";"], ["text"," "], ["constant.numeric.source.rust","1"], ["text"," "], ["keyword.operator","<<"], ["text"," "], ["constant.numeric.source.rust","2"], ["paren.rparen","]"], ["punctuation",">"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.constant","std::mem::MaybeUninit::"], ["identifier","uninit"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start" ],[ "start" ],[ ["bracketedComment",3,"start"], ["keyword.source.rust","let"], ["text"," "], ["identifier","multiline"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.quoted.raw.source.rust","r##\""] ],[ ["bracketedComment",3,"start"], ["string.quoted.raw.source.rust"," This is a raw string."] ],[ ["bracketedComment",3,"start"], ["string.quoted.raw.source.rust"," r#\"nested string\"#"] ],[ "start", ["string.quoted.raw.source.rust","\"##"], ["punctuation.operator",";"] ],[ "start", ["keyword.source.rust","let"], ["text"," "], ["identifier","_strings"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","["], ["string.quoted.raw.source.rust","br##\"\"##"], ["punctuation.operator",","], ["text"," "], ["string.quoted.raw.source.rust","r\"hello\\\""], ["punctuation.operator",","], ["text"," "], ["string.quoted.raw.source.rust","br\"hello\\\""], ["punctuation.operator",","], ["text"," "], ["string.quoted.raw.source.rust","cr\"hello\\\""], ["text"," "], ["paren.rparen","]"], ["punctuation.operator",";"] ]] ================================================ FILE: src/mode/_test/tokens_sac.json ================================================ [[ "doc-start", [ "comment.doc", "/**" ], [ "comment.doc.body", "***************************************************************************" ] ],[ "doc-start", [ "comment.doc.body", " *" ] ],[ "doc-start", [ "comment.doc.body", " * SAC demo program" ] ],[ "doc-start", [ "comment.doc.body", " *" ] ],[ "doc-start", [ "comment.doc.body", " * This SAC demo program implements 2-dimensional relaxation on double" ] ],[ "doc-start", [ "comment.doc.body", " * precision floating point numbers applying a 4-point stencil and fixed" ] ],[ "doc-start", [ "comment.doc.body", " * boundary conditions." ] ],[ "doc-start", [ "comment.doc.body", " *" ] ],[ "doc-start", [ "comment.doc.body", " * The vertical (SIZE1) and the horizontal (SIZE2) array size as well as" ] ],[ "doc-start", [ "comment.doc.body", " * the number of iterations to be performed (LOOP) may be set at compile" ] ],[ "doc-start", [ "comment.doc.body", " * time." ] ],[ "doc-start", [ "comment.doc.body", " *" ] ],[ "start", [ "comment.doc.body", " ****************************************************************************" ], [ "comment.doc", "*/" ] ],[ "start" ],[ "start", ["keyword","#ifndef"], ["text"," "], ["identifier","LOOP"] ],[ "start", ["keyword","#define"], ["constant.other"," LOOP 100"] ],[ "start", ["keyword","#endif"] ],[ "start" ],[ "start", ["keyword","#ifndef"], ["text"," "], ["identifier","SIZE1"] ],[ "start", ["keyword","#define"], ["constant.other"," SIZE1 1000"] ],[ "start", ["keyword","#endif"] ],[ "start" ],[ "start", ["keyword","#ifndef"], ["text"," "], ["identifier","SIZE2"] ],[ "start", ["keyword","#define"], ["constant.other"," SIZE2 1000"] ],[ "start", ["keyword","#endif"] ],[ "start" ],[ "start", ["keyword.control","use"], ["text"," "], ["identifier","Array"], ["punctuation.operator",":"], ["text"," "], ["keyword.control","all"], ["punctuation.operator",";"] ],[ "start", ["keyword.control","use"], ["text"," "], ["identifier","StdIO"], ["punctuation.operator",":"], ["text"," "], ["keyword.control","all"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["storage.modifier","inline"] ],[ "start", ["storage.type","double"], ["paren.lparen","["], ["keyword.operator","+"], ["paren.rparen","]"], ["text"," "], ["identifier","onestep"], ["paren.lparen","("], ["storage.type","double"], ["paren.lparen","["], ["keyword.operator","+"], ["paren.rparen","]"], ["text"," "], ["identifier","B"], ["paren.rparen",")"] ],[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","A"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.control","with"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["paren.lparen","("], ["text"," "], ["punctuation.operator","."], ["text"," "], ["keyword.operator","<"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["punctuation.operator","."], ["text"," "], ["paren.rparen",")"], ["text"," "], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","0.25"], ["keyword.operator","*"], ["paren.lparen","("], ["identifier","B"], ["paren.lparen","["], ["identifier","x"], ["keyword.operator","+"], ["paren.lparen","["], ["constant.numeric","1"], ["punctuation.operator",","], ["constant.numeric","0"], ["paren.rparen","]]"] ],[ "start", ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","B"], ["paren.lparen","["], ["identifier","x"], ["keyword.operator","-"], ["paren.lparen","["], ["constant.numeric","1"], ["punctuation.operator",","], ["constant.numeric","0"], ["paren.rparen","]]"] ],[ "start", ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","B"], ["paren.lparen","["], ["identifier","x"], ["keyword.operator","+"], ["paren.lparen","["], ["constant.numeric","0"], ["punctuation.operator",","], ["constant.numeric","1"], ["paren.rparen","]]"] ],[ "start", ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","B"], ["paren.lparen","["], ["identifier","x"], ["keyword.operator","-"], ["paren.lparen","["], ["constant.numeric","0"], ["punctuation.operator",","], ["constant.numeric","1"], ["paren.rparen","]])"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text"," "], ["punctuation.operator",":"], ["text"," "], ["support.function","modarray"], ["paren.lparen","("], ["text"," "], ["identifier","B"], ["text"," "], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control","return"], ["paren.lparen","("], ["identifier","A"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.modifier","inline"] ],[ "start", ["storage.type","double"], ["paren.lparen","["], ["keyword.operator","+"], ["paren.rparen","]"], ["text"," "], ["identifier","relax"], ["paren.lparen","("], ["storage.type","double"], ["paren.lparen","["], ["keyword.operator","+"], ["paren.rparen","]"], ["text"," "], ["identifier","A"], ["punctuation.operator",","], ["text"," "], ["storage.type","int"], ["text"," "], ["identifier","steps"], ["paren.rparen",")"] ],[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.control","for"], ["text"," "], ["paren.lparen","("], ["identifier","k"], ["keyword.operator","="], ["constant.numeric","0"], ["punctuation.operator",";"], ["text"," "], ["identifier","k"], ["keyword.operator","<"], ["identifier","steps"], ["punctuation.operator",";"], ["text"," "], ["identifier","k"], ["keyword.operator","++"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","A"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","onestep"], ["paren.lparen","("], ["identifier","A"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control","return"], ["paren.lparen","("], ["identifier","A"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.type","int"], ["text"," "], ["identifier","main"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","A"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.control","with"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["paren.lparen","("], ["text"," "], ["punctuation.operator","."], ["text"," "], ["keyword.operator","<="], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["punctuation.operator","."], ["text"," "], ["paren.rparen",")"], ["text"," "], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","0."], ["text","0"], ["identifier","d"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text"," "], ["punctuation.operator",":"], ["text"," "], ["support.function","genarray"], ["paren.lparen","("], ["text"," "], ["paren.lparen","["], ["identifier","SIZE1"], ["punctuation.operator",","], ["identifier","SIZE2"], ["paren.rparen","]"], ["text"," "], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["identifier","A"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","modarray"], ["paren.lparen","("], ["identifier","A"], ["punctuation.operator",","], ["text"," "], ["paren.lparen","["], ["constant.numeric","0"], ["punctuation.operator",","], ["constant.numeric","1"], ["paren.rparen","]"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","500."], ["text","0"], ["identifier","d"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["identifier","A"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","relax"], ["paren.lparen","("], ["text"," "], ["identifier","A"], ["punctuation.operator",","], ["text"," "], ["identifier","LOOP"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["identifier","z"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.control","with"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["paren.lparen","("], ["text"," "], ["constant.numeric","0"], ["keyword.operator","*"], ["identifier","shape"], ["paren.lparen","("], ["identifier","A"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["identifier","shape"], ["paren.lparen","("], ["identifier","A"], ["paren.rparen",")"], ["text"," "], ["paren.rparen",")"], ["text"," "], ["punctuation.operator",":"], ["text"," "], ["identifier","A"], ["paren.lparen","["], ["identifier","x"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text"," "], ["punctuation.operator",":"], ["text"," "], ["support.function","fold"], ["paren.lparen","("], ["text"," "], ["keyword.operator","+"], ["punctuation.operator",","], ["text"," 0"], ["identifier","d"], ["text"," "], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword","#if"], ["text"," "], ["constant.numeric","0"] ],[ "start", ["text"," "], ["identifier","printf"], ["paren.lparen","("], ["string.start","\""], ["constant.language.escape","%.10g\\n"], ["string.end","\""], ["punctuation.operator",","], ["text"," "], ["identifier","z"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.control","return"], ["paren.lparen","("], ["constant.numeric","0"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["keyword","#else"] ],[ "start", ["text"," "], ["identifier","print"], ["paren.lparen","("], ["text"," "], ["identifier","z"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.control","return"], ["paren.lparen","("], ["text"," "], ["constant.numeric","0"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["keyword","#endif"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start" ],[ "start" ]] ================================================ FILE: src/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: src/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: src/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: src/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: src/mode/_test/tokens_scrypt.json ================================================ [[ "start", ["comment","// https://github.com/sCrypt-Inc/boilerplate/blob/master/contracts/ackermann.scrypt"] ],[ "start" ],[ "start", ["keyword","contract"], ["text"," "], ["identifier","Ackermann"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function","int"], ["text"," "], ["identifier","a"], ["text","; "], ["comment","// a = 2"] ],[ "start", ["text"," "], ["support.function","int"], ["text"," "], ["identifier","b"], ["text","; "], ["comment","// b = 1"] ],[ "start" ],[ "start", ["text"," "], ["keyword","static"], ["text"," "], ["keyword","const"], ["text"," "], ["support.function","int"], ["text"," "], ["identifier","LOOPCOUNT"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","14"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["support.function","function"], ["text"," "], ["identifier","ackermann"], ["lparen","("], ["support.function","int"], ["text"," "], ["identifier","m"], ["text",", "], ["support.function","int"], ["text"," "], ["identifier","n"], ["rparen",")"], ["text"," "], ["keyword.operator",":"], ["text"," "], ["support.function","int"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function","bytes"], ["text"," "], ["identifier","stk"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function.math.scrypt","num2bin"], ["text","("], ["identifier","m"], ["text",", "], ["constant.numeric","1"], ["rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["comment","// run this function off chain to get the loop count and set it here"] ],[ "start", ["text"," "], ["comment","// e.g., (2, 1) requires 14 loops, (3, 5) 42438"] ],[ "start", ["text"," "], ["keyword","loop"], ["text"," "], ["lparen","("], ["identifier","LOOPCOUNT"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["support.function.math.scrypt","len"], ["text","("], ["identifier","stk"], ["rparen",")"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","0"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function","bytes"], ["text"," "], ["identifier","top"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","stk"], ["lparen","["], ["constant.numeric","0"], ["text"," "], ["keyword.operator",":"], ["text"," "], ["constant.numeric","1"], ["rparen","]"], ["text",";"] ],[ "start", ["text"," "], ["identifier","m"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function.math.scrypt","unpack"], ["text","("], ["identifier","top"], ["rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["comment","// pop"] ],[ "start", ["text"," "], ["identifier","stk"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","stk"], ["lparen","["], ["constant.numeric","1"], ["text"," "], ["keyword.operator",":"], ["text"," "], ["support.function.math.scrypt","len"], ["text","("], ["identifier","stk"], ["rparen",")]"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["identifier","m"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.numeric","0"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier","n"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","n"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","m"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["keyword","else"], ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["identifier","n"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.numeric","0"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier","n"], ["keyword.operator","++"], ["text",";"] ],[ "start", ["text"," "], ["identifier","m"], ["keyword.operator","--"], ["text",";"] ],[ "start", ["text"," "], ["comment","// push"] ],[ "start", ["text"," "], ["identifier","stk"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function.math.scrypt","num2bin"], ["text","("], ["identifier","m"], ["text",", "], ["constant.numeric","1"], ["rparen",")"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","stk"], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["keyword","else"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier","stk"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function.math.scrypt","num2bin"], ["text","("], ["identifier","m"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["constant.numeric","1"], ["text",", "], ["constant.numeric","1"], ["rparen",")"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","stk"], ["text",";"] ],[ "start", ["text"," "], ["identifier","stk"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function.math.scrypt","num2bin"], ["text","("], ["identifier","m"], ["text",", "], ["constant.numeric","1"], ["rparen",")"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","stk"], ["text",";"] ],[ "start", ["text"," "], ["identifier","n"], ["keyword.operator","--"], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["identifier","n"], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["comment","// y = 5"] ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["support.function","function"], ["text"," "], ["identifier","unlock"], ["lparen","("], ["support.function","int"], ["text"," "], ["identifier","y"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","require"], ["lparen","("], ["identifier","y"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["variable.language","this"], ["punctuation.separator.period.scrypt","."], ["entity.name.function.scrypt","ackermann"], ["punctuation.definition.parameters.begin.bracket.round.scrypt","("], ["start","this.a, this.b"], ["punctuation.definition.parameters.end.bracket.round.scrypt",")"], ["rparen",")"], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ]] ================================================ FILE: src/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: src/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: src/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",","], ["text"," "], ["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: src/mode/_test/tokens_slim.json ================================================ [[ "start", ["keyword.html.tags.slim","doctype html"] ],[ "start", ["keyword.html.tags.slim","html"] ],[ "start", ["keyword.html.tags.slim"," head"] ],[ "start", ["keyword.html.tags.slim"," title"], ["text"," Slim Examples"] ],[ "start", ["keyword.html.tags.slim"," meta"], ["text"," name"], ["keyword.operator.equals.slim","="], ["string","\"keywords\""], ["text"," content"], ["keyword.operator.equals.slim","="], ["string","\"template language\""] ],[ "start", ["keyword.html.tags.slim"," meta"], ["text"," name"], ["keyword.operator.equals.slim","="], ["string","\"author\""], ["text"," content"], ["keyword.operator.equals.slim","="], ["text","author"] ],[ "start", ["keyword.html.tags.slim"," link"], ["text"," rel"], ["keyword.operator.equals.slim","="], ["string","\"icon\""], ["text"," type"], ["keyword.operator.equals.slim","="], ["string","\"image/png\""], ["text"," href"], ["keyword.operator.equals.slim","="], ["text","file_path"], ["paren","("], ["string","\"favicon.png\""], ["paren",")"] ],[ ["language-embed",[],[" ","javascript"],"start"], ["keyword"," javascript:"] ],[ ["language-embed","no_regex",[" ","javascript"],"start"], ["text"," "], ["text"," "], ["support.function","alert"], ["paren.lparen","("], ["string","'Slim supports embedded javascript!'"], ["paren.rparen",")"] ],[ "start" ],[ "start", ["keyword.html.tags.slim"," body"] ],[ "start", ["keyword.html.tags.slim"," h1"], ["text"," Markup examples"] ],[ "start" ],[ "start", ["keyword.slim"," #content"] ],[ "start", ["keyword.html.tags.slim"," p"], ["text"," This example shows you how a basic Slim file looks."] ],[ "start" ],[ "start", ["keyword.control.slim"," =="], ["text"," "], ["list.ruby.operators.slim","yield"] ],[ "start" ],[ "start", ["keyword.control.slim"," -"], ["text"," "], ["list.ruby.operators.slim","if"], ["text"," items.any?"] ],[ "start", ["keyword.html.tags.slim"," table#items"] ],[ "start", ["keyword.control.slim"," -"], ["text"," "], ["list.ruby.operators.slim","for"], ["text"," item "], ["list.ruby.operators.slim","in"], ["text"," items"] ],[ "start", ["keyword.html.tags.slim"," tr"] ],[ "start", ["keyword.html.tags.slim"," td.name"], ["text"," "], ["keyword.operator.equals.slim","="], ["text"," item.name"] ],[ "start", ["keyword.html.tags.slim"," td.price"], ["text"," "], ["keyword.operator.equals.slim","="], ["text"," item.price"] ],[ "start", ["keyword.control.slim"," -"], ["text"," "], ["list.ruby.operators.slim","else"] ],[ "start", ["keyword.html.tags.slim"," p"], ["text"," No items found. Please add some inventory."] ],[ "start", ["text"," Thank you!"] ],[ "start" ],[ "start", ["keyword.html.tags.slim"," div"], ["text"," id"], ["keyword.operator.equals.slim","="], ["string","\"footer\""] ],[ "start", ["keyword.control.slim"," =="], ["text"," render "], ["string","'footer'"] ],[ ["mlString",6], ["string"," | Copyright © #{@year} #{@author}"] ],[ ["mlString",6], ["indent"," "], ["string","indenting test"] ],[ "start" ],[ "start", ["keyword.control.slim"," -"], ["text"," "], ["class.variable.slim","@page_current"], ["text"," "], ["keyword.operator.ruby.embedded.slim","="], ["text"," "], ["list.meta.slim","true"] ]] ================================================ FILE: src/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","</"], ["meta.tag.anchor.tag-name.xml","a"], ["meta.tag.punctuation.tag-close.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","</"], ["meta.tag.anchor.tag-name.xml","a"], ["meta.tag.punctuation.tag-close.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","</"], ["meta.tag.anchor.tag-name.xml","a"], ["meta.tag.punctuation.tag-close.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: src/mode/_test/tokens_smithy.json ================================================ [[ "start", ["keyword.statement.smithy","namespace"], ["text"," "], ["entity.name.type.namespace.smithy","example.weather"] ],[ "start" ],[ "start", ["comment.block.documentation.smithy","/// Provides weather forecasts."] ],[ "start", ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","paginated"], ["text","("], ["support.type.property-name.smithy","inputToken"], ["punctuation.separator.dictionary.pair.smithy",":"], ["text"," "], ["punctuation.definition.string.begin.smithy","\""], ["string.quoted.double.smithy","nextToken"], ["punctuation.definition.string.end.smithy","\""], ["text",", "], ["support.type.property-name.smithy","outputToken"], ["punctuation.separator.dictionary.pair.smithy",":"], ["text"," "], ["punctuation.definition.string.begin.smithy","\""], ["string.quoted.double.smithy","nextToken"], ["punctuation.definition.string.end.smithy","\""], ["text",","] ],[ "start", ["text"," "], ["support.type.property-name.smithy","pageSize"], ["punctuation.separator.dictionary.pair.smithy",":"], ["text"," "], ["punctuation.definition.string.begin.smithy","\""], ["string.quoted.double.smithy","pageSize"], ["punctuation.definition.string.end.smithy","\""], ["text",")"] ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","service"], ["text"," "], ["entity.name.type.smithy","Weather"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","version"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["punctuation.definition.string.begin.smithy","\""], ["string.quoted.double.smithy","2006-03-01"], ["punctuation.definition.string.end.smithy","\""], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","resources"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["punctuation.definition.array.begin.smithy","["], ["storage.type.smithy","City"], ["punctuation.definition.array.end.smithy","]"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","operations"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["punctuation.definition.array.begin.smithy","["], ["storage.type.smithy","GetCurrentTime"], ["punctuation.definition.array.end.smithy","]"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","resource"], ["text"," "], ["entity.name.type.smithy","City"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","identifiers"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["punctuation.definition.dictionary.begin.smithy","{"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","cityId"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","CityId"], ["meta.structure.dictionary.value.smithy"," "], ["punctuation.definition.dictionary.end.smithy","}"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","read"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","GetCity"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","list"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","ListCities"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","resources"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["punctuation.definition.array.begin.smithy","["], ["storage.type.smithy","Forecast"], ["punctuation.definition.array.end.smithy","]"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","resource"], ["text"," "], ["entity.name.type.smithy","Forecast"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","identifiers"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["punctuation.definition.dictionary.begin.smithy","{"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","cityId"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","CityId"], ["meta.structure.dictionary.value.smithy"," "], ["punctuation.definition.dictionary.end.smithy","}"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","read"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","GetForecast"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "start", ["comment.line.double-slash.smithy","// \"pattern\" is a trait."] ],[ "start", ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","pattern"], ["text","("], ["punctuation.definition.string.begin.smithy","\""], ["string.quoted.double.smithy","^[A-Za-z0-9 ]+$"], ["punctuation.definition.string.end.smithy","\""], ["text",")"] ],[ "start", ["keyword.statement.smithy","string"], ["text"," "], ["entity.name.type.smithy","CityId"] ],[ "start" ],[ "start", ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","readonly"] ],[ "punctuation.definition.dictionary.begin.smithy", ["storage.type.smithy","operation"], ["text"," "], ["storage.type.smithy","GetCity"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","input"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","GetCityInput"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","output"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","GetCityOutput"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","errors"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["punctuation.definition.array.begin.smithy","["], ["storage.type.smithy","NoSuchResource"], ["punctuation.definition.array.end.smithy","]"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","GetCityInput"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["comment.line.double-slash.smithy","// \"cityId\" provides the identifier for the resource and"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["comment.line.double-slash.smithy","// has to be marked as required."] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","cityId"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","CityId"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","GetCityOutput"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["comment.line.double-slash.smithy","// \"required\" is used on output to indicate if the service"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["comment.line.double-slash.smithy","// will always provide a value for the member."] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","name"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","String"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy" ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","coordinates"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","CityCoordinates"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "start", ["comment.line.double-slash.smithy","// This structure is nested within GetCityOutput."] ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","CityCoordinates"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","latitude"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","Float"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy" ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","longitude"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","Float"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "start", ["comment.line.double-slash.smithy","// \"error\" is a trait that is used to specialize"] ],[ "start", ["comment.line.double-slash.smithy","// a structure as an error."] ],[ "start", ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","error"], ["text","("], ["punctuation.definition.string.begin.smithy","\""], ["string.quoted.double.smithy","client"], ["punctuation.definition.string.end.smithy","\""], ["text",")"] ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","NoSuchResource"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","resourceType"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","String"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "start", ["comment.line.double-slash.smithy","// The paginated trait indicates that the operation may"] ],[ "start", ["comment.line.double-slash.smithy","// return truncated results."] ],[ "start", ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","readonly"] ],[ "start", ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","paginated"], ["text","("], ["support.type.property-name.smithy","items"], ["punctuation.separator.dictionary.pair.smithy",":"], ["text"," "], ["punctuation.definition.string.begin.smithy","\""], ["string.quoted.double.smithy","items"], ["punctuation.definition.string.end.smithy","\""], ["text",")"] ],[ "punctuation.definition.dictionary.begin.smithy", ["storage.type.smithy","operation"], ["text"," "], ["storage.type.smithy","ListCities"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","input"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","ListCitiesInput"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","output"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","ListCitiesOutput"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","ListCitiesInput"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","nextToken"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","String"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","pageSize"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","Integer"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","ListCitiesOutput"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","nextToken"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","String"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy" ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","items"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","CitySummaries"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "start", ["comment.line.double-slash.smithy","// CitySummaries is a list of CitySummary structures."] ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","list"], ["text"," "], ["entity.name.type.smithy","CitySummaries"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","member"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","CitySummary"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "start", ["comment.line.double-slash.smithy","// CitySummary contains a reference to a City."] ],[ "start", ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","references"], ["text","("], ["punctuation.definition.array.begin.smithy","["], ["punctuation.definition.dictionary.begin.smithy","{"], ["support.type.property-name.smithy","resource"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","City"], ["punctuation.definition.dictionary.end.smithy","}"], ["punctuation.definition.array.end.smithy","]"], ["text",")"] ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","CitySummary"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","cityId"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","CityId"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "punctuation.definition.dictionary.begin.smithy" ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","name"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","String"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "start", ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","readonly"] ],[ "punctuation.definition.dictionary.begin.smithy", ["storage.type.smithy","operation"], ["text"," "], ["storage.type.smithy","GetCurrentTime"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","output"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","GetCurrentTimeOutput"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","GetCurrentTimeOutput"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","time"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","Timestamp"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "start", ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","readonly"] ],[ "punctuation.definition.dictionary.begin.smithy", ["storage.type.smithy","operation"], ["text"," "], ["storage.type.smithy","GetForecast"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","input"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","GetForecastInput"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","output"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","GetForecastOutput"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "start", ["comment.line.double-slash.smithy","// \"cityId\" provides the only identifier for the resource since"] ],[ "start", ["comment.line.double-slash.smithy","// a Forecast doesn't have its own."] ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","GetForecastInput"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["punctuation.definition.annotation.smithy","@"], ["storage.type.annotation.smithy","required"] ],[ "punctuation.definition.dictionary.begin.smithy", ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","cityId"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","CityId"], ["punctuation.separator.dictionary.pair.smithy",","] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ],[ "start" ],[ "punctuation.definition.dictionary.begin.smithy", ["keyword.statement.smithy","structure"], ["text"," "], ["entity.name.type.smithy","GetForecastOutput"], ["text"," "], ["punctuation.definition.dictionary.begin.smithy","{"] ],[ ["punctuation.separator.dictionary.key-value.smithy","punctuation.definition.dictionary.begin.smithy"], ["meta.structure.dictionary.smithy"," "], ["support.type.property-name.smithy","chanceOfRain"], ["punctuation.separator.dictionary.key-value.smithy",":"], ["meta.structure.dictionary.value.smithy"," "], ["storage.type.smithy","Float"] ],[ "start", ["punctuation.definition.dictionary.end.smithy","}"] ]] ================================================ FILE: src/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: src/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: src/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: src/mode/_test/tokens_sparql.json ================================================ [[ "start", ["keyword.other.sparql","PREFIX"], ["text"," "], ["entity.name.other.qname.sparql","dbpedia-owl:"], ["text"," "], ["keyword.operator.logical.sparql","<"], ["entity.name.other.qname.sparql","http:"], ["keyword.operator.logical.sparql","//"], ["text","dbpedia"], ["keyword.operator.punctuation.sparql","."], ["text","org"], ["keyword.operator.logical.sparql","/"], ["text","on"], ["keyword.other.sparql","to"], ["text","logy"], ["keyword.operator.logical.sparql","/>"] ],[ "start", ["keyword.other.sparql","PREFIX"], ["text"," "], ["entity.name.other.qname.sparql","rdfs:"], ["text"," "], ["keyword.operator.logical.sparql","<"], ["entity.name.other.qname.sparql","http:"], ["keyword.operator.logical.sparql","//"], ["text","www"], ["keyword.operator.punctuation.sparql","."], ["text","w3"], ["keyword.operator.punctuation.sparql","."], ["text","org"], ["keyword.operator.logical.sparql","/"], ["text","2000"], ["keyword.operator.logical.sparql","/"], ["text","01"], ["keyword.operator.logical.sparql","/"], ["text","rdf"], ["keyword.operator.logical.sparql","-"], ["text","schema"], ["punctuation.definition.comment.sparql","#"], ["comment.line.hash.sparql",">"] ],[ "start" ],[ "start", ["punctuation.definition.comment.sparql","#"], ["comment.line.hash.sparql"," 1. Directors of movies starring Brad Pitt"] ],[ "start", ["punctuation.definition.comment.sparql","#"], ["comment.line.hash.sparql"," Datasource: http://fragments.dbpedia.org/*/en"] ],[ "start", ["keyword.other.sparql","SELECT"], ["text"," "], ["variable.other.sparql","?movie"], ["text"," "], ["variable.other.sparql","?title"], ["text"," "], ["variable.other.sparql","?name"] ],[ "start", ["keyword.other.sparql","WHERE"], ["text"," "], ["keyword.operator.punctuation.sparql","{"] ],[ "start", ["text"," "], ["variable.other.sparql","?movie"], ["text"," "], ["entity.name.other.qname.sparql","dbpedia-owl:starring"], ["text"," [ "], ["support.type.datatype.rdf.schema.sparql","rdfs:label"], ["text"," "], ["string.quoted.double.sparql","\"Brad Pitt\""], ["keyword.operator.language.suffix.sparql","@"], ["constant.language.suffix.sparql","en"], ["text"," ]"], ["keyword.operator.punctuation.sparql",";"] ],[ "start", ["text"," "], ["support.type.datatype.rdf.schema.sparql","rdfs:label"], ["text"," "], ["variable.other.sparql","?title"], ["keyword.operator.punctuation.sparql",";"] ],[ "start", ["text"," "], ["entity.name.other.qname.sparql","dbpedia-owl:director"], ["text"," [ "], ["support.type.datatype.rdf.schema.sparql","rdfs:label"], ["text"," "], ["variable.other.sparql","?name"], ["text"," ]"], ["keyword.operator.punctuation.sparql","."] ],[ "start", ["text"," "], ["keyword.other.sparql","FILTER"], ["text"," "], ["support.function.sparql","LANG"], ["text","MATCHES"], ["keyword.operator.punctuation.sparql","("], ["support.function.sparql","LANG"], ["keyword.operator.punctuation.sparql","("], ["variable.other.sparql","?title"], ["keyword.operator.punctuation.sparql","),"], ["text"," "], ["string.quoted.double.sparql","\"EN\""], ["keyword.operator.punctuation.sparql",")"] ],[ "start", ["text"," "], ["keyword.other.sparql","FILTER"], ["text"," "], ["support.function.sparql","LANG"], ["text","MATCHES"], ["keyword.operator.punctuation.sparql","("], ["support.function.sparql","LANG"], ["keyword.operator.punctuation.sparql","("], ["variable.other.sparql","?name"], ["keyword.operator.punctuation.sparql","),"], ["text"," "], ["string.quoted.double.sparql","\"EN\""], ["keyword.operator.punctuation.sparql",")"] ],[ "start", ["keyword.operator.punctuation.sparql","}"] ],[ "start" ]] ================================================ FILE: src/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: src/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.body", "\t * These comments will produce a fold widget" ] ],[ "start", [ "comment.doc.body", "\t " ], [ "comment.doc", "*/" ] ],[ "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: src/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: src/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","</"], ["meta.tag.tag-name.xml","title"], ["meta.tag.punctuation.tag-close.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","</"], ["meta.tag.tag-name.xml","desc"], ["meta.tag.punctuation.tag-close.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","<![CDATA["] ],[ "js-start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","timevalue"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","timer_increment"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","max_time"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","100"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","hickory"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","dickory"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","dock"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","i"], ["punctuation.operator",";"] ],[ "js-start" ],[ "js-start", ["text"," "], ["storage.type","function"], ["text"," "], ["entity.name.function","StartAnimation"], ["paren.lparen","("], ["variable.parameter","evt"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "js-start", ["text"," "], ["identifier","hickory"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","evt"], ["punctuation.operator","."], ["identifier","target"], ["punctuation.operator","."], ["identifier","ownerDocument"], ["punctuation.operator","."], ["support.function.dom","getElementById"], ["paren.lparen","("], ["string","\"hickory\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["identifier","dickory"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","evt"], ["punctuation.operator","."], ["identifier","target"], ["punctuation.operator","."], ["identifier","ownerDocument"], ["punctuation.operator","."], ["support.function.dom","getElementById"], ["paren.lparen","("], ["string","\"dickory\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["identifier","dock"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","evt"], ["punctuation.operator","."], ["identifier","target"], ["punctuation.operator","."], ["identifier","ownerDocument"], ["punctuation.operator","."], ["support.function.dom","getElementById"], ["paren.lparen","("], ["string","\"dock\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-start" ],[ "js-start", ["text"," "], ["identifier","ShowAndGrowElement"], ["paren.lparen","("], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-no_regex", ["text"," "], ["paren.rparen","}"] ],[ "js-start", ["text"," "], ["storage.type","function"], ["text"," "], ["entity.name.function","ShowAndGrowElement"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "js-start", ["text"," "], ["identifier","timevalue"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","timevalue"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","timer_increment"], ["punctuation.operator",";"] ],[ "js-no_regex", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","timevalue"], ["text"," "], ["keyword.operator",">"], ["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 <timer_increment> 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","</"], ["meta.tag.script.tag-name.xml","script"], ["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","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.tag-name.xml","text"], ["meta.tag.punctuation.tag-close.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.tag-name.xml","text"], ["meta.tag.punctuation.tag-close.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","</"], ["meta.tag.tag-name.xml","text"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","svg"], ["meta.tag.punctuation.tag-close.xml",">"] ]] ================================================ FILE: src/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: src/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","{["], ["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","{["], ["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: src/mode/_test/tokens_terraform.json ================================================ [[ "start", ["storage.function.terraform","export"], ["text"," "], ["variable.assignment.terraform","TF_LOG"], ["keyword.operator","="], ["text","TRACE"] ],[ "start" ],[ "start", ["singleline.comment.terraform","# An AMI"] ],[ "start", ["storage.function.terraform","variable"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","ami"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","description"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["string","the AMI to use"], ["punctuation.quote.terraform","\""] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "blockComment", ["multiline.comment.begin.terraform","/*"], ["comment"," A multi"] ],[ "start", ["comment"," line comment. "], ["multiline.comment.end.terraform","*/"] ],[ "start", ["storage.function.terraform","resource"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","aws_instance"], ["punctuation.quote.terraform","\""], ["text"," "], ["punctuation.quote.terraform","\""], ["string","web"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","ami"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["variable.terraform","var.ami"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["variable.assignment.terraform","count"], ["keyword.operator"," ="], ["text"," "], ["constant.numeric.terraform","2"] ],[ "start", ["text"," "], ["variable.assignment.terraform","source_dest_check"], ["keyword.operator"," ="], ["text"," "], ["constant.language.terraform","false"] ],[ "start" ],[ "start", ["text"," "], ["language.support.class","connection"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","user"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["string","root"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.function.terraform","resource"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","aws_instance"], ["punctuation.quote.terraform","\""], ["text"," "], ["punctuation.quote.terraform","\""], ["string","web"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","subnet"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["variable.terraform","var.env"], ["punctuation"," "], ["keyword.operator","=="], ["punctuation"," "], ["punctuation.quote.terraform","\""], ["string","production"], ["punctuation.quote.terraform","\""], ["punctuation"," "], ["keyword.operator","?"], ["punctuation"," "], ["variable.terraform","var.prod_subnet"], ["punctuation"," "], ["keyword.operator",":"], ["punctuation"," "], ["variable.terraform","var.dev_subnet"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.function.terraform","variable"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","count"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","default"], ["keyword.operator"," ="], ["text"," "], ["constant.numeric.terraform","2"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.function.terraform","variable"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","hostnames"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","default"], ["keyword.operator"," ="], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["punctuation.quote.terraform","\""], ["string","0"], ["punctuation.quote.terraform","\""], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.quote.terraform","\""], ["string","example1.org"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["punctuation.quote.terraform","\""], ["string","1"], ["punctuation.quote.terraform","\""], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.quote.terraform","\""], ["string","example2.net"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.function.terraform","data"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","template_file"], ["punctuation.quote.terraform","\""], ["text"," "], ["punctuation.quote.terraform","\""], ["string","web_init"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["singleline.comment.terraform","# Render the template once for each instance"] ],[ "start", ["text"," "], ["variable.assignment.terraform","count"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["keyword.function.terraform","length"], ["punctuation","("], ["variable.terraform","var.hostnames"], ["punctuation",")"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["variable.assignment.terraform","template"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["keyword.function.terraform","file"], ["punctuation","("], ["punctuation.quote.terraform","\""], ["string","templates/web_init.tpl"], ["punctuation.quote.terraform","\""], ["punctuation",")"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," vars "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["singleline.comment.terraform","# count.index tells us the index of the instance we are rendering"] ],[ "start", ["text"," "], ["variable.assignment.terraform","hostname"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["variable.terraform","var.hostnames"], ["paren.lparen","["], ["variable.terraform","count.index"], ["paren.rparen","]"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.function.terraform","resource"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","aws_instance"], ["punctuation.quote.terraform","\""], ["text"," "], ["punctuation.quote.terraform","\""], ["string","web"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["singleline.comment.terraform","# Create one instance for each hostname"] ],[ "start", ["text"," "], ["variable.assignment.terraform","count"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["keyword.function.terraform","length"], ["punctuation","("], ["variable.terraform","var.hostnames"], ["punctuation",")"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start" ],[ "start", ["text"," "], ["singleline.comment.terraform","# Pass each instance its corresponding template_file"] ],[ "start", ["text"," "], ["variable.assignment.terraform","user_data"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["punctuation","data.template_file.web_init."], ["keyword.operator","*"], ["punctuation",".rendered"], ["paren.lparen","["], ["variable.terraform","count.index"], ["paren.rparen","]"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.function.terraform","variable"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","count"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","default"], ["keyword.operator"," ="], ["text"," "], ["constant.numeric.terraform","2"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["singleline.comment.terraform","# Define the common tags for all resources"] ],[ "start", ["storage.function.terraform","locals {"] ],[ "start", ["text"," "], ["variable.assignment.terraform","common_tags"], ["keyword.operator"," ="], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","Component"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["string","awesome-app"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["variable.assignment.terraform","Environment"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["string","production"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["singleline.comment.terraform","# Create a resource that blends the common tags with instance-specific tags."] ],[ "start", ["storage.function.terraform","resource"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","aws_instance"], ["punctuation.quote.terraform","\""], ["text"," "], ["punctuation.quote.terraform","\""], ["string","server"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","ami"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["string","ami-123456"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["variable.assignment.terraform","instance_type"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["string","t2.micro"], ["punctuation.quote.terraform","\""] ],[ "start" ],[ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"], ["text"," "], ["variable.assignment.terraform","tags"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["keyword.function.terraform","merge"], ["punctuation","("] ],[ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"], ["punctuation"," "], ["variable.terraform","local.common_tags"], ["punctuation",","] ],[ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"], ["punctuation"," "], ["keyword.function.terraform","map"], ["punctuation","("] ],[ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"], ["punctuation"," "], ["punctuation.quote.terraform","\""], ["string","Name"], ["punctuation.quote.terraform","\""], ["punctuation",", "], ["punctuation.quote.terraform","\""], ["string","awesome-app-server"], ["punctuation.quote.terraform","\""], ["punctuation",","] ],[ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"], ["punctuation"," "], ["punctuation.quote.terraform","\""], ["string","Role"], ["punctuation.quote.terraform","\""], ["punctuation",", "], ["punctuation.quote.terraform","\""], ["string","server"], ["punctuation.quote.terraform","\""] ],[ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"], ["punctuation"," )"] ],[ "start", ["punctuation"," )"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["variable.terraform","$ "], ["text","terraform apply "], ["keyword.terraform","-var"], ["text"," "], ["variable.assignment.terraform","foo"], ["keyword.operator","="], ["text","bar "], ["keyword.terraform","-var"], ["text"," "], ["variable.assignment.terraform","foo"], ["keyword.operator","="], ["text","baz"] ],[ "variable.terraform", ["variable.terraform","$ "], ["text","terraform apply "], ["keyword.terraform","-var"], ["text"," "], ["punctuation.quote.terraform","'"], ["string","foo={quux=\"bar\"}"], ["punctuation.quote.terraform","'"], ["text"," "], ["keyword.terraform","-var"], ["text"," "], ["punctuation.quote.terraform","'"], ["string","foo={bar=\"baz\"}"], ["punctuation.quote.terraform","'"] ],[ "start" ],[ "start", ["variable.terraform","$ "], ["text","terraform apply "], ["keyword.terraform","-var-file"], ["keyword.operator","="], ["text","foo.tfvars "], ["keyword.terraform","-var-file"], ["keyword.operator","="], ["text","bar.tfvars"] ],[ "start", ["variable.terraform","$ "], ["variable.assignment.terraform","TF_VAR_somemap"], ["keyword.operator","="], ["punctuation.quote.terraform","'"], ["string","{foo = \"bar\", baz = \"qux\"}"], ["punctuation.quote.terraform","'"], ["text"," terraform plan"] ],[ "start" ],[ "start", ["storage.function.terraform","resource"], ["text"," "], ["punctuation.quote.terraform","\""], ["string","aws_instance"], ["punctuation.quote.terraform","\""], ["text"," "], ["punctuation.quote.terraform","\""], ["string","web"], ["punctuation.quote.terraform","\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["singleline.comment.terraform","# ..."] ],[ "start" ],[ "start", ["text"," "], ["variable.assignment.terraform","count"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["variable.terraform","var.count"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start" ],[ "start", ["text"," "], ["singleline.comment.terraform","# Tag the instance with a counter starting at 1, ie. web-001"] ],[ "start", ["text"," tags "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.assignment.terraform","Name"], ["keyword.operator"," ="], ["text"," "], ["punctuation.quote.terraform","\""], ["punctuation.interpolated.begin.terraform","${"], ["keyword.function.terraform","format"], ["punctuation","("], ["punctuation.quote.terraform","\""], ["string","web-%03d"], ["punctuation.quote.terraform","\""], ["punctuation",", "], ["variable.terraform","count.index"], ["punctuation"," "], ["keyword.operator","+"], ["punctuation"," "], ["constant.numeric.terraform","1"], ["punctuation",")"], ["punctuation.interpolated.end.terraform","}"], ["punctuation.quote.terraform","\""] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: src/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: src/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: src/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: src/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: src/mode/_test/tokens_tsv.json ================================================ [[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator","\t"], ["text.csv_1","col2 long"], ["string.csv_2.csv_separator","\t"], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator","\t"], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator","\t"] ],[ "start", ["keyword.csv_0","\""], ["keyword.csv_0","col1"], ["keyword.csv_0","\t"], ["keyword.csv_0","with quotes"], ["keyword.csv_0","\""], ["text.csv_1.csv_separator","\t"], ["text.csv_1","col2"], ["string.csv_2.csv_separator","\t"], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator","\t"], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator","\t"] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator","\t"], ["text.csv_1","col2"], ["string.csv_2.csv_separator","\t"], ["string.csv_2","col"], ["string.csv_2","\""], ["string.csv_2","\""], ["string.csv_2","\""], ["string.csv_2","3"], ["string.regex.csv_3.csv_separator","\t"], ["string.regex.csv_3","co"], ["string.regex.csv_3","\""], ["string.regex.csv_3","\""], ["string.regex.csv_3","l4"], ["variable.csv_4.csv_separator","\t"] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator","\t"], ["text.csv_1","col2"], ["string.csv_2.csv_separator","\t"], ["string.csv_2","col3"], ["string.csv_2","\""], ["string.csv_2","broken"], ["string.csv_2","\""], ["string.regex.csv_3.csv_separator","\t"], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator","\t"] ],[ "start", ["keyword.csv_0","col1"], ["keyword.csv_0","\""], ["text.csv_1.csv_separator","\t"], ["text.csv_1","-"], ["text.csv_1","\""], ["text.csv_1","col2"], ["string.csv_2.csv_separator","\t"], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator","\t"], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator","\t"], ["variable.csv_4","col5"] ],[ "string-1", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator","\t"], ["text.csv_1","\""], ["text.csv_1","col2"] ],[ "string-2", ["text.csv_1","multiline"], ["text.csv_1","\""], ["string.csv_2.csv_separator","\t"], ["string.csv_2","\""], ["string.csv_2","col3"] ],[ "string-2", ["string.csv_2","multiline"], ["string.csv_2","\"\""], ["string.csv_2","string"] ],[ "string-3", ["string.csv_2","3"], ["string.csv_2","\""], ["string.regex.csv_3.csv_separator","\t"], ["string.regex.csv_3","\""], ["string.regex.csv_3","col4"] ],[ "string-3", ["string.regex.csv_3","multiline string"] ],[ "string-3" ],[ "start", ["string.regex.csv_3","4"], ["string.regex.csv_3","\""] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator","\t"], ["text.csv_1","col2"], ["string.csv_2.csv_separator","\t"], ["string.csv_2","\""], ["string.csv_2","c"], ["string.csv_2","\t"], ["string.csv_2","o"], ["string.csv_2","\t"], ["string.csv_2","l"], ["string.csv_2","\"\""], ["string.csv_2","3"], ["string.csv_2","\""], ["string.regex.csv_3.csv_separator","\t"], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator","\t"], ["variable.csv_4","col5"], ["constant.numeric.csv_5.csv_separator","\t"], ["constant.numeric.csv_5","col6"], ["keyword.csv_6.csv_separator","\t"], ["keyword.csv_6","col7"], ["text.csv_7.csv_separator","\t"], ["text.csv_7","col8"], ["string.csv_8.csv_separator","\t"], ["string.csv_8","col9"], ["string.regex.csv_9.csv_separator","\t"], ["string.regex.csv_9","col10"], ["variable.csv_10.csv_separator","\t"], ["variable.csv_10","col11"], ["constant.numeric.csv_11.csv_separator","\t"], ["constant.numeric.csv_11","col12"], ["keyword.csv_12.csv_separator","\t"], ["keyword.csv_12","col13"] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator","\t"], ["text.csv_1","col2"], ["string.csv_2.csv_separator","\t"], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator","\t"], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator","\t"], ["variable.csv_4","col5"], ["constant.numeric.csv_5.csv_separator","\t"], ["constant.numeric.csv_5","col6"], ["keyword.csv_6.csv_separator","\t"], ["keyword.csv_6","col7"], ["text.csv_7.csv_separator","\t"], ["text.csv_7","col8"], ["string.csv_8.csv_separator","\t"], ["string.csv_8","col9"], ["string.regex.csv_9.csv_separator","\t"], ["string.regex.csv_9","col10"], ["variable.csv_10.csv_separator","\t"], ["variable.csv_10","col11"], ["constant.numeric.csv_11.csv_separator","\t"], ["constant.numeric.csv_11","col12"], ["keyword.csv_12.csv_separator","\t"], ["keyword.csv_12","col13"] ],[ "start", ["keyword.csv_0","col1"], ["text.csv_1.csv_separator","\t"], ["text.csv_1","col2"], ["string.csv_2.csv_separator","\t"], ["string.csv_2","col3"], ["string.regex.csv_3.csv_separator","\t"], ["string.regex.csv_3","col4"], ["variable.csv_4.csv_separator","\t"], ["variable.csv_4","col5"], ["constant.numeric.csv_5.csv_separator","\t"], ["constant.numeric.csv_5","col6"], ["keyword.csv_6.csv_separator","\t"], ["keyword.csv_6","co"], ["keyword.csv_6","\""], ["keyword.csv_6","l7"], ["text.csv_7.csv_separator","\t"], ["text.csv_7","col8"], ["string.csv_8.csv_separator","\t"], ["string.csv_8","col9"], ["string.regex.csv_9.csv_separator","\t"], ["string.regex.csv_9","col10"], ["variable.csv_10.csv_separator","\t"], ["variable.csv_10","11"], ["constant.numeric.csv_11.csv_separator","\t"], ["constant.numeric.csv_11","col12"], ["keyword.csv_12.csv_separator","\t"], ["keyword.csv_12","col13"] ],[ "start" ]] ================================================ FILE: src/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.xml", " " ] ],[ ["jsx",1], [ "string.xml", " Typescript + " ], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","b"], ["meta.tag.punctuation.tag-close.xml",">"], [ "string.xml", " JSX " ], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","b"], ["meta.tag.punctuation.tag-close.xml",">"], [ "string.xml", " " ] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"], ["punctuation.operator",";"] ]] ================================================ FILE: src/mode/_test/tokens_turtle.json ================================================ [[ "start", ["keyword.other.prefix.turtle","@base"], ["text"," "], ["string.quoted.other.relative.url.turtle","<http://example.org/>"], ["text"," "], ["keyword.operator.punctuation.turtle","."] ],[ "start", ["keyword.other.prefix.turtle","@prefix"], ["text"," "], ["entity.name.other.qname.turtle","rdf:"], ["text"," "], ["string.quoted.other.relative.url.turtle","<http://www.w3.org/1999/02/22-rdf-syntax-ns#>"], ["text"," "], ["keyword.operator.punctuation.turtle","."] ],[ "start", ["keyword.other.prefix.turtle","@prefix"], ["text"," "], ["entity.name.other.qname.turtle","rdfs:"], ["text"," "], ["string.quoted.other.relative.url.turtle","<http://www.w3.org/2000/01/rdf-schema#>"], ["text"," "], ["keyword.operator.punctuation.turtle","."] ],[ "start", ["keyword.other.prefix.turtle","@prefix"], ["text"," "], ["entity.name.other.qname.turtle","foaf:"], ["text"," "], ["string.quoted.other.relative.url.turtle","<http://xmlns.com/foaf/0.1/>"], ["text"," "], ["keyword.operator.punctuation.turtle","."] ],[ "start", ["keyword.other.prefix.turtle","@prefix"], ["text"," "], ["entity.name.other.qname.turtle","rel:"], ["text"," "], ["string.quoted.other.relative.url.turtle","<http://www.perceive.net/schemas/relationship/>"], ["text"," "], ["keyword.operator.punctuation.turtle","."] ],[ "start" ],[ "start", ["string.quoted.other.relative.url.turtle","<#green-goblin>"] ],[ "start", ["text"," "], ["entity.name.other.qname.turtle","rel:enemyOf"], ["text"," "], ["string.quoted.other.relative.url.turtle","<#spiderman>"], ["text"," "], ["keyword.operator.punctuation.turtle",";"] ],[ "start", ["text"," "], ["support.type.datatype.rdf.schema.turtle"," a "], ["entity.name.other.qname.turtle","foaf:Person"], ["text"," "], ["keyword.operator.punctuation.turtle",";"], ["text"," "], ["punctuation.definition.comment.turtle","#"], ["comment.line.hash.turtle"," in the context of the Marvel universe"] ],[ "start", ["text"," "], ["entity.name.other.qname.turtle","foaf:name"], ["text"," "], ["string.quoted.double.turtle","\"Green Goblin\""], ["text"," "], ["keyword.operator.punctuation.turtle","."] ],[ "start" ],[ "start", ["string.quoted.other.relative.url.turtle","<#spiderman>"] ],[ "start", ["text"," "], ["entity.name.other.qname.turtle","rel:enemyOf"], ["text"," "], ["string.quoted.other.relative.url.turtle","<#green-goblin>"], ["text"," "], ["keyword.operator.punctuation.turtle",";"] ],[ "start", ["text"," "], ["support.type.datatype.rdf.schema.turtle"," a "], ["entity.name.other.qname.turtle","foaf:Person"], ["text"," "], ["keyword.operator.punctuation.turtle",";"] ],[ "start", ["text"," "], ["entity.name.other.qname.turtle","foaf:name"], ["text"," "], ["string.quoted.double.turtle","\"Spiderman\""], ["keyword.operator.punctuation.turtle",","], ["text"," "], ["string.quoted.double.turtle","\"Человек-паук\""], ["keyword.operator.language.suffix.turtle","@"], ["constant.language.suffix.turtle","ru"], ["text"," "], ["keyword.operator.punctuation.turtle","."] ]] ================================================ FILE: src/mode/_test/tokens_twig.json ================================================ [[ "start", ["xml-pe.doctype.xml","<!"], ["xml-pe.doctype.xml","DOCTYPE"], ["text.whitespace.xml"," "], ["xml-pe.xml","html"], ["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","</"], ["meta.tag.tag-name.xml","title"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-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","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.anchor.tag-name.xml","a"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.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","</"], ["meta.tag.tag-name.xml","ul"], ["meta.tag.punctuation.tag-close.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","</"], ["meta.tag.tag-name.xml","h1"], ["meta.tag.punctuation.tag-close.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","</"], ["meta.tag.tag-name.xml","body"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","html"], ["meta.tag.punctuation.tag-close.xml",">"] ]] ================================================ FILE: src/mode/_test/tokens_typescript.json ================================================ [[ "start", ["keyword","class"], ["storage.type.variable.ts"," Greeter"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["identifier","greeting"], ["punctuation.operator",":"], ["text"," "], ["storage.type.variable.ts","string"], ["punctuation.operator",";"] ],[ "start", ["text","\t"], ["keyword","constructor"], ["text"," "], ["paren.lparen","("], ["identifier","message"], ["punctuation.operator",":"], ["text"," "], ["storage.type.variable.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", ["identifier","button"], ["punctuation.operator","."], ["identifier","onclick"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type","function"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "no_regex", ["text","\t"], ["support.function","alert"], ["paren.lparen","("], ["identifier","greeter"], ["punctuation.operator","."], ["identifier","greet"], ["paren.lparen","("], ["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"], ["storage.type.variable.ts"," Snake"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","Animal"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","move"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function","alert"], ["paren.lparen","("], ["string","\"Slithering...\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","super"], ["paren.lparen","("], ["constant.numeric","5"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex" ],[ "start", ["keyword","class"], ["storage.type.variable.ts"," Horse"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","Animal"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","move"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function","alert"], ["paren.lparen","("], ["string","\"Galloping...\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","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", ["keyword","module"], ["text"," "], ["identifier","Sayings"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","export"], ["text"," "], ["keyword","class"], ["storage.type.variable.ts"," Greeter"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","greeting"], ["punctuation.operator",":"], ["text"," "], ["storage.type.variable.ts","string"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","constructor"], ["text"," "], ["paren.lparen","("], ["identifier","message"], ["punctuation.operator",":"], ["text"," "], ["storage.type.variable.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", ["keyword","module"], ["text"," "], ["identifier","Mankala"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","export"], ["text"," "], ["keyword","class"], ["storage.type.variable.ts"," Features"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["identifier","turnContinues"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type.variable.ts","false"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["identifier","seedStoredCount"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["identifier","capturedCount"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["identifier","spaceCaptured"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","NoSpace"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["identifier","clear"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type.variable.ts","this."], ["identifier","turnContinues"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type.variable.ts","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: src/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<string[](), MyBar<string, int>>"], ["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: src/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",", "], ["support.type.vb.asp","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"," "], ["support.type.vb.asp","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",", "], ["support.type.vb.asp","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"," "], ["support.type.vb.asp","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: src/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","</"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.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","</"], ["meta.tag.tag-name.xml","ul"], ["meta.tag.punctuation.tag-close.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",","], ["text"," "], ["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","</"], ["meta.tag.script.tag-name.xml","script"], ["meta.tag.punctuation.tag-close.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"], ["punctuation.operator",":"], ["text"," Monaco, "], ["string.start","\""], ["string","Courier New"], ["string.end","\""], ["text",", "], ["support.constant.fonts","monospace"], ["punctuation.operator",";"] ],[ "css-ruleset", ["text"," "], ["support.type","font-size"], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","12"], ["keyword","px"], ["punctuation.operator",";"] ],[ "css-ruleset", ["text"," "], ["support.type","cursor"], ["punctuation.operator",":"], ["text"," "], ["support.constant","text"], ["punctuation.operator",";"] ],[ "css-start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.style.tag-name.xml","style"], ["meta.tag.punctuation.tag-close.xml",">"] ]] ================================================ FILE: src/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","];"] ],[ "start" ],[ "start", ["keyword","module"], ["text"," "], ["identifier","test"], ["text",";"] ],[ "start", ["text"," "], ["keyword","assign"], ["text"," "], ["identifier","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","\""], ["string","1"], ["string.end","\""], ["text",";"] ],[ "start", ["text"," "], ["keyword","initial"], ["text"," "], ["keyword","begin"] ],[ "string.start", ["text"," "], ["identifier","$display"], ["paren.lparen","("], ["string.start","\""], ["string","Hello "], ["constant.language.escape","\\77"], ["string","8"], ["constant.language.escape","\\xaa\\"] ],[ "start", ["string"," "], ["constant.language.escape","\\n"], ["string"," world"], ["string.end","\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","$finish"], ["text",";"] ],[ "start", ["text"," "], ["keyword","end"] ],[ "start", ["keyword","endmodule"] ]] ================================================ FILE: src/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"," "], ["keyword","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: src/mode/_test/tokens_visualforce.json ================================================ [[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","apex:stylesheet"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","value"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["keyword.start","{!"], ["support.function","URLFOR"], ["keyword.operator","("], ["variable.language","$Resource"], ["punctuation.operator","."], ["identifier","BrowserCompatibility"], ["punctuation.operator",","], ["text"," "], ["string.start","'"], ["string","css/style.css"], ["string.end","'"], ["keyword.operator",")"], ["keyword.end","}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start" ],[ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","apex:page"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","action"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["keyword.start","{!"], ["support.function","IF"], ["keyword.operator","("], ["variable.language","$User"], ["punctuation.operator","."], ["identifier","Alias"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","JohnDoe"], ["string.end","'"], ["text"," "], ["keyword.operator","||"], ["text"," "], ["variable.language","$User"], ["punctuation.operator","."], ["identifier","Alias"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","JBloggs"], ["string.end","'"], ["text"," "], ["keyword.operator","||"], ["text"," "], ["variable.language","$User"], ["punctuation.operator","."], ["identifier","Alias"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","FooBar"], ["string.end","'"], ["punctuation.operator",","] ],[ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"], ["text"," "], ["constant.language","null"], ["punctuation.operator",","] ],[ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"], ["text"," "], ["identifier","urlFor"], ["keyword.operator","("], ["variable.language","$Action"], ["punctuation.operator","."], ["identifier","Account"], ["punctuation.operator","."], ["identifier","Delete"], ["punctuation.operator",","], ["text"," "], ["variable.language","$CurrentPage"], ["punctuation.operator","."], ["identifier","Parameters"], ["punctuation.operator","."], ["identifier","id"], ["punctuation.operator",","], ["text"," "], ["paren.lparen","["], ["identifier","retURL"], ["keyword.operator","="], ["string.start","'"], ["string","/001"], ["string.end","'"], ["paren.rparen","]"], ["punctuation.operator",","], ["text"," "], ["constant.language","true"], ["keyword.operator",")"] ],[ "start", ["keyword.operator",")"], ["keyword.end","}"], ["string.attribute-value.xml","\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","standardController"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"Account\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","apex:page"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","apex:page"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","action"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["keyword.start","{!"], ["support.function","IF"], ["keyword.operator","("], ["support.function","OR"], ["keyword.operator","("], ["variable.language","$User"], ["punctuation.operator","."], ["identifier","Alias"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","JohnDoe"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["variable.language","$User"], ["punctuation.operator","."], ["identifier","Alias"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","JBloggs"], ["string.end","'"], ["punctuation.operator",","], ["text"," "], ["variable.language","$User"], ["punctuation.operator","."], ["identifier","Alias"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","FooBar"], ["string.end","'"], ["keyword.operator",")"], ["punctuation.operator",","] ],[ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"], ["text"," "], ["constant.language","NULL"], ["punctuation.operator",","] ],[ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"], ["text"," "], ["support.function","URLFOR"], ["keyword.operator","("], ["variable.language","$Action"], ["punctuation.operator","."], ["identifier","Account"], ["punctuation.operator","."], ["identifier","Delete"], ["punctuation.operator",","], ["text"," "], ["variable.language","$CurrentPage"], ["punctuation.operator","."], ["identifier","Parameters"], ["punctuation.operator","."], ["identifier","id"], ["punctuation.operator",","], ["text"," "], ["paren.lparen","["], ["identifier","retURL"], ["keyword.operator","="], ["string.start","'"], ["string","/001"], ["string.end","'"], ["paren.rparen","]"], ["punctuation.operator",","], ["text"," "], ["constant.language","TRUE"], ["keyword.operator",")"] ],[ "start", ["keyword.operator",")"], ["keyword.end","}"], ["string.attribute-value.xml","\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","standardController"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"Account\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","apex:page"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "tag_stuff", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","apex:commandLink"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","action"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["keyword.start","{!"], ["support.function","URLFOR"], ["keyword.operator","("], ["string.start","'"], ["string","/apex/"], ["string.end","'"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable.language","$CurrentPage"], ["punctuation.operator","."], ["identifier","Name"], ["punctuation.operator",","], ["text"," "], ["constant.language","null"], ["punctuation.operator",","], ["text"," "], ["paren.lparen","["], ["string.start","'"], ["string","id"], ["string.end","'"], ["keyword.operator","="], ["identifier","id"], ["paren.rparen","]"], ["keyword.operator",")"], ["keyword.end","}"], ["string.attribute-value.xml","\""], ["text.tag-whitespace.xml"," "] ],[ "start", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","value"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"Full List\""], ["text.tag-whitespace.xml"," "], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","ideas:listOutputLink"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","stickyAttributes"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"false\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","ideas:listOutputLink"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["keyword.start","{!"], ["support.function","IF"], ["keyword.operator","("], ["support.function","AND"], ["keyword.operator","("], ["identifier","Price"], ["text"," "], ["keyword.operator","<"], ["text"," 1"], ["punctuation.operator",","], ["text"," "], ["identifier","Quantity"], ["text"," "], ["keyword.operator","<"], ["text"," 1"], ["keyword.operator",")"], ["punctuation.operator",","], ["text"," "], ["string.start","\""], ["string","Small"], ["string.end","\""], ["punctuation.operator",","], ["text"," "], ["constant.language","null"], ["keyword.operator",")"], ["keyword.end","}"] ]] ================================================ FILE: src/mode/_test/tokens_vue.json ================================================ [[ "comment", ["comment.start.xml","<!--"] ],[ "comment", ["comment.xml","Things to verify:"] ],[ "comment", ["comment.xml","- comments (this block) are properly highlighted"] ],[ "comment", ["comment.xml","- expressions are highlighted as JS"] ],[ "comment", ["comment.xml","- <script> highlights ES2015 syntax"] ],[ "comment", ["comment.xml","- <style> highlights as CSS"] ],[ "start", ["comment.end.xml","-->"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","template"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["punctuation","{{"], ["text"," "], ["identifier","foo"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["constant.numeric","10"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","'hi'"], ["text"," "], ["punctuation","}}"] ],[ "tag_stuff", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","span"] ],[ "tag_stuff", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","v-"], ["entity.other.attribute-name.xml","text"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["identifier","foo"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["constant.numeric","10"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","'hi'"], ["string","\""], ["text.tag-whitespace.xml"," "], ["punctuation.separator.key-value.xml",":"], ["entity.other.attribute-name.xml","id"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["identifier","foo"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","'baz'"], ["string","\""] ],[ "tag_stuff", ["text.tag-whitespace.xml"," "], ["punctuation.separator.key-value.xml","@"], ["entity.other.attribute-name.xml","click"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["identifier","onClick"], ["paren.lparen","("], ["string","'hello'"], ["paren.rparen",")"], ["string","\""] ],[ "start", ["text.tag-whitespace.xml"," "], ["punctuation.separator.key-value.xml","@"], ["entity.other.attribute-name.xml","click.prevent"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["identifier","onClick"], ["paren.lparen","("], ["string","'hello'"], ["paren.rparen",")"], ["string","\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," Hello"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","span"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","router-link"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","v-"], ["entity.other.attribute-name.xml","bind"], ["entity.other.attribute-name.xml",":to"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["identifier","item"], ["punctuation.operator","."], ["identifier","url"], ["string","\""], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start", ["text.xml"," "], ["comment.start.xml","<!--"], ["comment.xml"," v-bind with dynamic key "], ["comment.end.xml","-->"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","v-"], ["entity.other.attribute-name.xml","bind"], ["entity.other.attribute-name.xml",":[key]"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["identifier","value"], ["string","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["text.xml"," "], ["comment.start.xml","<!--"], ["comment.xml"," v-bind shorthand with dynamic key "], ["comment.end.xml","-->"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["punctuation.separator.key-value.xml",":"], ["entity.other.attribute-name.xml","[key]"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["identifier","value"], ["string","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["text.xml"," "], ["comment.start.xml","<!--"], ["comment.xml"," v-on with dynamic event "], ["comment.end.xml","-->"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","v-"], ["entity.other.attribute-name.xml","on"], ["entity.other.attribute-name.xml",":[event]"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["identifier","handler"], ["string","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["text.xml"," "], ["comment.start.xml","<!--"], ["comment.xml"," v-on shorthand with dynamic event "], ["comment.end.xml","-->"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["punctuation.separator.key-value.xml","@"], ["entity.other.attribute-name.xml","[event]"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["identifier","handler"], ["string","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","template"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "js-start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.script.tag-name.xml","script"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "js-start", ["keyword","export"], ["text"," "], ["keyword","default"], ["text"," "], ["paren.lparen","{"] ],[ "js-start", ["text"," "], ["identifier","data"], ["punctuation.operator",":"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","({"] ],[ "js-no_regex", ["text"," "], ["identifier","foo"], ["punctuation.operator",":"], ["text"," "], ["string","'bar'"] ],[ "js-no_regex", ["text"," "], ["paren.rparen","})"] ],[ "js-start", ["paren.rparen","}"], ["punctuation.operator",";"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.script.tag-name.xml","script"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "css-start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.style.tag-name.xml","style"], ["meta.tag.punctuation.tag-close.style.xml",">"] ],[ "css-ruleset", ["constant","div"], ["text"," "], ["paren.lparen","{"] ],[ "css-ruleset", ["text"," "], ["support.type","color"], ["punctuation.operator",":"], ["text"," "], ["support.constant.color","red"], ["punctuation.operator",";"] ],[ "css-start", ["paren.rparen","}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.style.tag-name.xml","style"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "sass-start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.style.tag-name.xml","style"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","lang"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"sass\""], ["meta.tag.punctuation.tag-close.style.xml",">"] ],[ "sass-start", ["comment","// sass ace mode;"] ],[ "sass-start" ],[ "sass-start", ["keyword","@import"], ["text"," "], ["support.function","url("], ["string","http://fonts.googleapis.com/css?family=Ace:700"], ["support.function",")"] ],[ "sass-start" ],[ "sass-start", ["variable.language","html"], ["text",", "], ["variable.language","body"] ],[ "sass-start", ["support.type"," :background-color "], ["constant.numeric","#ace"] ],[ "sass-start", ["text"," "], ["support.type","text-align"], ["text",": "], ["constant.language","center"] ],[ "sass-start", ["text"," "], ["support.type","height"], ["text",": "], ["constant.numeric","100%"] ],[ ["sass-comment",-1,2,"sass-start"], ["comment"," /*;*********;"] ],[ ["sass-comment",3,2,"sass-start"], ["comment"," ;comment ;"] ],[ ["sass-comment",3,2,"sass-start"], ["comment"," ;*********;"] ],[ "sass-start" ],[ "sass-start" ],[ "sass-start", ["text"," &"], ["variable.language",":before"] ],[ "sass-start", ["text"," "], ["variable","$radius"], ["text",": "], ["variable","$size"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["constant.numeric","0.845"] ],[ "sass-start", ["text"," "], ["variable","$glow"], ["text",": "], ["variable","$size"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["constant.numeric","0.125"] ],[ "sass-start" ],[ "sass-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"] ],[ "sass-start", ["text"," "], ["support.type","border-radius"], ["text",": "], ["variable","$radius"] ],[ "sass-start" ],[ "sass-start", ["text"," &"], ["variable.language",":active"] ],[ "sass-start", ["text"," ~ "], ["variable.language",".button"] ],[ "sass-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",")"] ],[ "sass-start" ],[ "sass-start", ["text"," ~ "], ["variable.language",".label"] ],[ "sass-start", ["text"," "], ["support.type","font-size"], ["text",": "], ["constant.numeric","40px"] ],[ "sass-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",")"] ],[ "sass-start" ],[ "sass-start", ["text"," &"], ["variable.language",":checked"] ],[ "sass-start", ["text"," ~ "], ["variable.language",".button"] ],[ "sass-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"] ],[ "sass-start" ],[ "sass-start", ["text"," ~ "], ["variable.language",".label"] ],[ "sass-start", ["text"," "], ["support.type","font-size"], ["text",": "], ["constant.numeric","40px"] ],[ "sass-start", ["text"," "], ["support.type","color"], ["text",": "], ["constant.numeric","#c9c9c9"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.style.tag-name.xml","style"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "scss-start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.style.tag-name.xml","style"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","lang"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"scss\""], ["meta.tag.punctuation.tag-close.style.xml",">"] ],[ "scss-start", ["comment","/* style.scss */"] ],[ "scss-start" ],[ "scss-start", ["variable.language","#navbar"], ["text"," "], ["paren.lparen","{"] ],[ "scss-start", ["text"," "], ["variable","$navbar-width"], ["text",": "], ["constant.numeric","800px"], ["text",";"] ],[ "scss-start", ["text"," "], ["variable","$items"], ["text",": "], ["constant.numeric","5"], ["text",";"] ],[ "scss-start", ["text"," "], ["variable","$navbar-color"], ["text",": "], ["constant.numeric","#ce4dd6"], ["text",";"] ],[ "scss-start" ],[ "scss-start", ["text"," "], ["support.type","width"], ["text",": "], ["variable","$navbar-width"], ["text",";"] ],[ "scss-start", ["text"," "], ["support.type","border-bottom"], ["text",": "], ["constant.numeric","2px"], ["text"," "], ["constant.language","solid"], ["text"," "], ["variable","$navbar-color"], ["text",";"] ],[ "scss-start" ],[ "scss-start", ["text"," "], ["variable.language","li"], ["text"," "], ["paren.lparen","{"] ],[ "scss-start", ["text"," "], ["support.type","float"], ["text",": "], ["support.type","left"], ["text",";"] ],[ "scss-start", ["text"," "], ["support.type","width"], ["text",": "], ["variable","$navbar-width"], ["text","/"], ["variable","$items"], ["text"," "], ["constant","-"], ["text"," "], ["constant.numeric","10px"], ["text",";"] ],[ "scss-start" ],[ "scss-start", ["text"," "], ["support.type","background-color"], ["text",": "], ["support.function","lighten"], ["paren.lparen","("], ["variable","$navbar-color"], ["text",", "], ["constant.numeric","20%"], ["paren.rparen",")"], ["text",";"] ],[ "scss-start" ],[ "scss-start", ["text"," &"], ["variable.language",":hover"], ["text"," "], ["paren.lparen","{"] ],[ "scss-start", ["text"," "], ["support.type","background-color"], ["text",": "], ["support.function","lighten"], ["paren.lparen","("], ["variable","$navbar-color"], ["text",", "], ["constant.numeric","10%"], ["paren.rparen",")"], ["text",";"] ],[ "scss-start", ["text"," "], ["paren.rparen","}"] ],[ "scss-start", ["text"," "], ["paren.rparen","}"] ],[ "scss-start", ["paren.rparen","}"] ],[ "scss-start" ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.style.tag-name.xml","style"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "jade-start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.template.tag-name.xml","template"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","lang"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"jade\""], ["meta.tag.punctuation.tag-close.template.xml",">"] ],[ "jade-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",")"] ],[ "jade-start", ["source.js.embedded.jade"," -"], ["storage.type","var"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"0\""], ["text",";"] ],[ "jade-start" ],[ "jade-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","]"] ],[ "jade-start", ["meta.tag.any.jade"," each"], ["text"," item in items"] ],[ "jade-start", ["meta.tag.any.jade"," li"], ["text","= item"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.template.tag-name.xml","template"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","template"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","v-"], ["entity.other.attribute-name.xml","slot"], ["entity.other.attribute-name.xml",":item"], ["entity.other.attribute-name.xml",".parentkey.subkey.subkey.subkey.subkey.subkey"], ["punctuation.separator.key-value.xml","="], ["string","\""], ["paren.lparen","{"], ["text"," "], ["identifier","value"], ["text"," "], ["paren.rparen","}"], ["string","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.tag-name.xml","template"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ]] ================================================ FILE: src/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: src/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","</"], ["meta.tag.tag-name.xml","Kinners"], ["meta.tag.punctuation.tag-close.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: src/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", ["meta.tag"," version"], ["keyword",":"], ["text"," 1.2.3.4"] ],[ "start" ],[ "start", ["meta.tag","bill-to"], ["keyword",":"], ["text"," "], ["constant.language","&id001"] ],[ ["mlStringPre",4], ["meta.tag"," street"], ["keyword",":"], ["text"," "], ["string","|"] ],[ ["mlString",11], ["indent"," "], ["string","123 Tornado Alley"] ],[ ["mlString",11], ["indent"," "], ["string","Suite 16"] ],[ "start", ["indent"," "], ["meta.tag","ref-id"], ["keyword",":"], ["text"," id123 "] ],[ "start", ["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" ],[ ["mlStringPre",0], ["meta.tag","specialDelivery"], ["keyword",":"], ["text"," "], ["string",">"] ],[ ["mlString",3], ["indent"," "], ["string","Follow the Yellow Brick"] ],[ ["mlString",3], ["indent"," "], ["string","Road to the Emerald City."] ],[ ["mlString",3], ["indent"," "], ["string","Pay no attention to the"] ],[ ["mlString",3], ["indent"," "], ["string","man behind the curtain."] ],[ ["mlString",3] ],[ ["mlStringPre",0], ["list.markup","? "], ["text"," "], ["string","|"] ],[ ["mlString",0], ["indent"," "], ["string","block key #1"] ],[ ["mlString",0], ["indent"," "], ["string","kkk"] ],[ ["mlStringPre",2], ["text",": - "], ["string","|"] ],[ ["mlString",2], ["indent"," "], ["string","one "] ],[ ["mlStringPre",2], ["indent"," "], ["text","- "], ["string","|"] ],[ ["mlString",2], ["indent"," "], ["string","tw #o "] ],[ ["mlStringPre",4], ["indent"," "], ["text","- ? "], ["string","|- "] ],[ ["mlStringPre",4] ],[ ["mlString",4], ["indent"," "], ["string","as #d"] ],[ ["mlString",4] ],[ ["mlString",4], ["indent"," "], ["string","q"] ],[ "start", ["indent"," "], ["text","b"] ],[ "start", ["list.markup"," - "] ],[ "start", ["meta.tag"," x"], ["keyword",":"], ["text"," xx"] ],[ "start", ["meta.tag"," r"], ["keyword",":"], ["text"," xx"] ],[ "start", ["meta.tag"," z"], ["keyword",":"], ["text"," sss"] ],[ "start", ["meta.tag"," zdd"], ["keyword",":"], ["text"," dddd"] ],[ "start", ["text"," "], ["string","\"block key 2\""], ["text"," : "] ],[ "start", ["list.markup"," - "], ["text","two "], ["comment","# block value"] ],[ ["mlStringPre",9], ["list.markup"," - "], ["text","? "], ["string","| "] ],[ ["mlString",9], ["indent"," "], ["string","as #d"] ],[ ["mlStringPre",9], ["indent"," "], ["text",": "], ["string","|"] ],[ ["mlString",9], ["indent"," "], ["string","asdadas #d"] ],[ ["mlString",9], ["indent"," "], ["string","asd"] ],[ "start", ["indent"," "], ["meta.tag","a"], ["keyword",":"], ["text"," "], ["constant.numeric","2"] ],[ ["mlStringPre",9], ["list.markup"," - "], ["text","? "], ["string","| "] ],[ ["mlString",9], ["indent"," "], ["string","asdas #d"] ],[ ["mlStringPre",9], ["indent"," "], ["text",": "], ["string","|"] ],[ ["mlString",9], ["indent"," "], ["string","xx"] ],[ ["mlString",12], ["indent"," "], ["meta.tag","s"], ["keyword",":"], ["text"," "], ["string","|4+ #comment"] ],[ ["mlString",12], ["indent"," "], ["string","7"] ],[ ["mlString",12] ],[ ["mlString",12], ["indent"," "], ["string","a "] ],[ "start", ["indent"," "], ["text","a"] ],[ "start" ]] ================================================ FILE: src/mode/_test/tokens_zeek.json ================================================ [[ "start", ["comment.line","# An example of the Zeek scripting language."] ],[ "start" ],[ "start", ["comment.line","##! A Zeekygen-style summmary comment."] ],[ "start" ],[ "start", ["comment.line","# TODO: just an example of a todo-indicator"] ],[ "start" ],[ "start", ["keyword.other","@load"], ["meta.preprocessor"," base/frameworks/notice"] ],[ "start" ],[ "start", ["keyword.other","@if"], ["text"," "], ["punctuation.section.parens.begin","("], ["text"," "], ["constant.language","F"], ["text"," "], ["punctuation.section.parens.end",")"] ],[ "start", ["keyword.other","@endif"] ],[ "start" ],[ "start", ["keyword.other","module"], ["meta.namespace"," "], ["entity.name.namespace","Example"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["keyword.other","export"], ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","type"], ["meta.enum"," "], ["entity.name.enum","SimpleEnum"], ["punctuation.separator",":"], ["meta.enum"," "], ["storage.type.enum","enum"], ["text"," "], ["punctuation.section.block.begin","{"], ["text"," ONE"], ["punctuation.separator",","], ["text"," TWO"], ["punctuation.separator",","], ["text"," THREE "], ["punctuation.section.block.end","}"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","redef"], ["meta.enum"," "], ["storage.type.enum","enum"], ["meta.enum"," "], ["entity.name.enum","SimpleEnum"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start" ],[ "start", ["text"," "], ["comment.line","## A Zeekygen-style comment."] ],[ "start", ["text"," FOUR"], ["punctuation.separator",","] ],[ "start", ["text"," FIVE"], ["punctuation.separator",","], ["text"," "], ["comment.line","##< A Zeekygen-style comment."] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","type"], ["meta.struct.record"," "], ["entity.name.struct.record","SimpleRecord"], ["punctuation.separator",":"], ["meta.struct.record"," "], ["storage.type.struct.record","record"], ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start", ["text"," field1"], ["punctuation.separator",":"], ["text"," "], ["storage.type","count"], ["punctuation.terminator",";"] ],[ "start", ["text"," field2"], ["punctuation.separator",":"], ["text"," "], ["storage.type","bool"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"], ["text"," "], ["storage.modifier.attribute","&redef"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","redef"], ["meta.struct.record"," "], ["storage.type.struct.record","record"], ["meta.struct.record"," "], ["entity.name.struct.record","SimpleRecord"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start" ],[ "start", ["text"," field3"], ["punctuation.separator",":"], ["text"," "], ["storage.type","string"], ["text"," "], ["storage.modifier.attribute","&optional"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," field4"], ["punctuation.separator",":"], ["text"," "], ["storage.type","string"], ["text"," "], ["storage.modifier.attribute","&default"], ["keyword.operator","="], ["string.double","\"blah\""], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","const"], ["text"," init_option"], ["punctuation.separator",":"], ["text"," "], ["storage.type","bool"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.language","T"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","option"], ["text"," runtime_option"], ["punctuation.separator",":"], ["text"," "], ["storage.type","bool"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.language","F"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","global"], ["text"," test_opaque"], ["punctuation.separator",":"], ["text"," "], ["storage.type","opaque"], ["text"," "], ["keyword.operator","of"], ["text"," "], ["storage.type","md5"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","global"], ["text"," test_vector"], ["punctuation.separator",":"], ["text"," "], ["storage.type","vector"], ["text"," "], ["keyword.operator","of"], ["text"," "], ["storage.type","count"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","global"], ["text"," myfunction"], ["punctuation.separator",":"], ["text"," "], ["storage.type","function"], ["punctuation.section.parens.begin","("], ["text","msg"], ["punctuation.separator",":"], ["text"," "], ["storage.type","string"], ["punctuation.separator",","], ["text"," c"], ["punctuation.separator",":"], ["text"," "], ["storage.type","count"], ["text"," "], ["storage.modifier.attribute","&default"], ["keyword.operator","="], ["constant.numeric.integer.decimal","0"], ["punctuation.section.parens.end",")"], ["punctuation.separator",":"], ["text"," "], ["storage.type","count"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","global"], ["text"," myhook"], ["punctuation.separator",":"], ["text"," "], ["storage.type","hook"], ["punctuation.section.parens.begin","("], ["text","tag"], ["punctuation.separator",":"], ["text"," "], ["storage.type","string"], ["punctuation.section.parens.end",")"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","global"], ["text"," myevent"], ["punctuation.separator",":"], ["text"," "], ["storage.type","event"], ["punctuation.section.parens.begin","("], ["text","tag"], ["punctuation.separator",":"], ["text"," "], ["storage.type","string"], ["punctuation.section.parens.end",")"], ["punctuation.terminator",";"] ],[ "start", ["punctuation.section.block.end","}"] ],[ "start" ],[ "start", ["storage.type","function"], ["text"," "], ["entity.name.function","myfunction"], ["punctuation.section.parens.begin","("], ["text","msg"], ["punctuation.separator",":"], ["text"," "], ["storage.type","string"], ["punctuation.separator",","], ["text"," c"], ["punctuation.separator",":"], ["text"," "], ["storage.type","count"], ["punctuation.section.parens.end",")"], ["punctuation.separator",":"], ["text"," "], ["storage.type","count"] ],[ "start", ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["string.double","\"in myfunction\""], ["punctuation.separator",","], ["text"," msg"], ["punctuation.separator",","], ["text"," c"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.control","return"], ["text"," "], ["constant.numeric.integer.decimal","0"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"] ],[ "start" ],[ "start", ["storage.type","event"], ["text"," "], ["entity.name.function.event","myevent"], ["punctuation.section.parens.begin","("], ["text","msg"], ["punctuation.separator",":"], ["text"," "], ["storage.type","string"], ["punctuation.section.parens.end",")"], ["text"," "], ["storage.modifier.attribute","&priority"], ["keyword.operator","="], ["constant.numeric.integer.decimal","1"] ],[ "start", ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["string.double","\"in myevent\""], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"] ],[ "start" ],[ "start", ["storage.type","hook"], ["text"," "], ["entity.name.function.hook","myhook"], ["punctuation.section.parens.begin","("], ["text","msg"], ["punctuation.separator",":"], ["text"," "], ["storage.type","string"], ["punctuation.section.parens.end",")"] ],[ "start", ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["string.double","\"in myevent\""], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"] ],[ "start" ],[ "start", ["storage.type","event"], ["text"," "], ["entity.name.function.event","zeek_init"], ["punctuation.section.parens.begin","("], ["punctuation.section.parens.end",")"] ],[ "start", ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start", ["text"," "], ["storage.modifier","local"], ["text"," b "], ["keyword.operator","="], ["text"," "], ["constant.language","T"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["storage.modifier","local"], ["text"," s "], ["keyword.operator","="], ["text"," "], ["string.double","\""], ["constant.character.escape","\\x"], ["string.double","ff"], ["constant.character.escape","\\x"], ["string.double","af"], ["constant.character.escape","\\\""], ["string.double","and more after the escaped quote\""], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["storage.modifier","local"], ["text"," p "], ["keyword.operator","="], ["text"," "], ["string.regexp","/foo|bar"], ["constant.character.escape","\\x"], ["string.regexp","be"], ["constant.character.escape","\\/"], ["string.regexp","and more after the escaped slash/"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["storage.modifier","local"], ["text"," c "], ["keyword.operator","="], ["text"," "], ["constant.numeric.integer.decimal","10"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","local"], ["text"," sr "], ["keyword.operator","="], ["text"," "], ["entity.name.function.call","SimpleRecord"], ["punctuation.section.parens.begin","("], ["punctuation.accessor","$"], ["text","field1 "], ["keyword.operator","="], ["text"," "], ["constant.numeric.integer.decimal","0"], ["punctuation.separator",","], ["text"," "], ["punctuation.accessor","$"], ["text","field2 "], ["keyword.operator","="], ["text"," "], ["constant.language","T"], ["punctuation.separator",","], ["text"," "], ["punctuation.accessor","$"], ["text","field3 "], ["keyword.operator","="], ["text"," "], ["string.double","\"hi\""], ["punctuation.section.parens.end",")"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," sr"], ["punctuation.accessor","?$"], ["text","field3"], ["punctuation.separator",","], ["text"," sr"], ["punctuation.accessor","$"], ["text","field1"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","local"], ["text"," myset"], ["punctuation.separator",":"], ["text"," "], ["storage.type","set"], ["punctuation.section.brackets.begin","["], ["storage.type","string"], ["punctuation.section.brackets.end","]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type","set"], ["punctuation.section.parens.begin","("], ["string.double","\"one\""], ["punctuation.separator",","], ["text"," "], ["string.double","\"two\""], ["punctuation.separator",","], ["text"," "], ["string.double","\"three\""], ["punctuation.section.parens.end",")"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","add"], ["text"," myset"], ["punctuation.section.brackets.begin","["], ["string.double","\"four\""], ["punctuation.section.brackets.end","]"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","delete"], ["text"," myset"], ["punctuation.section.brackets.begin","["], ["string.double","\"one\""], ["punctuation.section.brackets.end","]"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control","for"], ["text"," "], ["punctuation.section.parens.begin","("], ["text"," ms "], ["keyword.operator","in"], ["text"," myset "], ["punctuation.section.parens.end",")"] ],[ "start", ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," ms "], ["keyword.operator","is"], ["text"," "], ["storage.type","string"], ["punctuation.separator",","], ["text"," s "], ["keyword.operator","as"], ["text"," "], ["storage.type","string"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," s"], ["punctuation.section.brackets.begin","["], ["constant.numeric.integer.decimal","1"], ["punctuation.separator",":"], ["constant.numeric.integer.decimal","3"], ["punctuation.section.brackets.end","]"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.modifier","local"], ["text"," tern"], ["punctuation.separator",":"], ["text"," "], ["storage.type","count"], ["text"," "], ["keyword.operator","="], ["text"," s "], ["keyword.operator","=="], ["text"," "], ["string.double","\"two\""], ["text"," "], ["keyword.operator","?"], ["text"," "], ["constant.numeric.integer.decimal","2"], ["text"," "], ["punctuation.separator",":"], ["text"," "], ["constant.numeric.integer.decimal","0"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control.conditional","if"], ["text"," "], ["punctuation.section.parens.begin","("], ["text"," s "], ["keyword.operator","!in"], ["text"," myset "], ["punctuation.section.parens.end",")"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["entity.name.function.call","fmt"], ["punctuation.section.parens.begin","("], ["string.double","\"error "], ["constant.other.placeholder","%4.2f"], ["string.double",": "], ["constant.other.placeholder","%s"], ["string.double","\""], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal","3.14159"], ["punctuation.separator",","], ["text"," "], ["string.double","\"wtf?\""], ["punctuation.section.parens.end",")"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control","switch"], ["text"," "], ["punctuation.section.parens.begin","("], ["text"," c "], ["punctuation.section.parens.end",")"], ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start", ["text"," "], ["keyword.control","case"], ["text"," "], ["constant.numeric.integer.decimal","1"], ["punctuation.separator",":"] ],[ "start", ["text"," "], ["keyword.control","break"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.control","case"], ["text"," "], ["constant.numeric.integer.decimal","2"], ["punctuation.separator",":"] ],[ "start", ["text"," "], ["keyword.control","fallthrough"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.control","default"], ["punctuation.separator",":"] ],[ "start", ["text"," "], ["keyword.control","break"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control.conditional","if"], ["text"," "], ["punctuation.section.parens.begin","("], ["text"," "], ["keyword.operator","!"], ["text"," b "], ["punctuation.section.parens.end",")"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["string.double","\"here\""], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.control.conditional","else"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["string.double","\"there\""], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control","while"], ["text"," "], ["punctuation.section.parens.begin","("], ["text"," c "], ["keyword.operator","!="], ["text"," "], ["constant.numeric.integer.decimal","0"], ["text"," "], ["punctuation.section.parens.end",")"] ],[ "start", ["text"," "], ["punctuation.section.block.begin","{"] ],[ "start", ["text"," "], ["keyword.control.conditional","if"], ["text"," "], ["punctuation.section.parens.begin","("], ["text"," c "], ["keyword.operator",">="], ["text"," "], ["constant.numeric.integer.decimal","5"], ["text"," "], ["punctuation.section.parens.end",")"] ],[ "start", ["text"," c "], ["keyword.operator","+="], ["text"," "], ["constant.numeric.integer.decimal","0"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.control.conditional","else"], ["text"," "], ["keyword.control.conditional","if"], ["text"," "], ["punctuation.section.parens.begin","("], ["text"," c "], ["keyword.operator","=="], ["text"," "], ["constant.numeric.integer.decimal","8"], ["text"," "], ["punctuation.section.parens.end",")"] ],[ "start", ["text"," c "], ["keyword.operator","-="], ["text"," "], ["constant.numeric.integer.decimal","0"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," c "], ["keyword.operator","="], ["text"," c "], ["keyword.operator","/"], ["text"," "], ["constant.numeric.integer.decimal","1"], ["punctuation.terminator",";"] ],[ "start", ["text"," c "], ["keyword.operator","="], ["text"," c "], ["keyword.operator","/"], ["text"," "], ["constant.numeric.integer.decimal","1"], ["punctuation.terminator",";"] ],[ "start", ["text"," c "], ["keyword.operator","="], ["text"," c "], ["keyword.operator","-"], ["text"," "], ["constant.numeric.integer.decimal","1"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["keyword.operator","|"], ["text","myset"], ["keyword.operator","|"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["keyword.operator","~"], ["constant.numeric.integer.decimal","5"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.integer.decimal","1"], ["text"," "], ["keyword.operator","&"], ["text"," "], ["constant.numeric.integer.hexadecimal","0xff"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.integer.decimal","2"], ["text"," "], ["keyword.operator","^"], ["text"," "], ["constant.numeric.integer.decimal","5"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["entity.name.function.call","myfunction"], ["punctuation.section.parens.begin","("], ["string.double","\"hello function\""], ["punctuation.section.parens.end",")"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["storage.type","hook"], ["text"," "], ["entity.name.function.hook","myhook"], ["punctuation.section.parens.begin","("], ["string.double","\"hell hook\""], ["punctuation.section.parens.end",")"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["storage.type","event"], ["text"," "], ["entity.name.function.event","myevent"], ["punctuation.section.parens.begin","("], ["string.double","\"hello event\""], ["punctuation.section.parens.end",")"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.control","schedule"], ["text"," "], ["constant.numeric.float.decimal.interval","1sec"], ["text"," "], ["punctuation.section.block.begin","{"], ["text"," "], ["entity.name.function.call","myevent"], ["punctuation.section.parens.begin","("], ["string.double","\"hello scheduled event\""], ["punctuation.section.parens.end",")"], ["text"," "], ["punctuation.section.block.end","}"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.integer.decimal","0"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.integer.decimal","7"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.integer.hexadecimal","0xff"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.integer.hexadecimal","0xdeadbeef"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal","3.14159"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal","1234.0"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal","1234e0"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal",".003E-23"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal",".003E+23"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.port","123/udp"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.port","8000/tcp"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.port","13/icmp"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.port","42/unknown"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.hostname","google.com"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","192.168.50.1"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","255.255.255.255"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","0.0.0.0"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","10.0.0.0"], ["keyword.operator","/"], ["constant.numeric.integer.decimal","16"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[2001:0db8:85a3:0000:0000:8a2e:0370:7334]"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["comment.line","# test for case insensitivity"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[2001:0DB8:85A3:0000:0000:8A2E:0370:7334]"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["comment.line","# any case mixture is allowed"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[2001:0dB8:85a3:0000:0000:8A2E:0370:7334]"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["comment.line","# leading zeroes of a 16-bit group may be omitted"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[2001:db8:85a3:0:0:8a2e:370:7334]"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["comment.line","# a single occurrence of consecutive groups of zeroes may be replaced by ::"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[2001:db8:85a3::8a2e:370:7334]"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["comment.line","# all zeroes should work"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[0:0:0:0:0:0:0:0]"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["comment.line","# all zeroes condensed should work"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[::]"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["comment.line","# hybrid ipv6-ipv4 address should work"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[2001:db8:0:0:0:FFFF:192.168.0.5]"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["comment.line","# hybrid ipv6-ipv4 address with zero ommission should work"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[2001:db8::FFFF:192.168.0.5]"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.addr","[2001:0db8:85a3:0000:0000:8a2e:0370:7334]"], ["keyword.operator","/"], ["constant.numeric.integer.decimal","64"], ["punctuation.terminator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal.interval","1day"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1days"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0day"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0days"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal.interval","1hr"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1hrs"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0hr"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0hrs"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal.interval","1min"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1mins"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0min"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0mins"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal.interval","1sec"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1secs"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0sec"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0secs"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal.interval","1msec"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1msecs"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0msec"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0msecs"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["keyword.other","print"], ["text"," "], ["constant.numeric.float.decimal.interval","1usec"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1usecs"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0usec"], ["punctuation.separator",","], ["text"," "], ["constant.numeric.float.decimal.interval","1.0usecs"], ["punctuation.terminator",";"] ],[ "start", ["text"," "], ["punctuation.section.block.end","}"] ],[ "start" ]] ================================================ FILE: src/mode/abap.js ================================================ "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: src/mode/abap_highlight_rules.js ================================================ /* * based on * " Vim ABAP syntax file * " Language: SAP - ABAP/R4 * " Revision: 2.1 * " Maintainer: Marius Piedallu van Wyk <lailoken@gmail.com> * " Last Change: 2012 Oct 23 */ "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: src/mode/abc.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "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.$id = "ace/mode/abc"; this.snippetFileId = "ace/snippets/abc"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/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 ***********************************************************************************************/ "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: src/mode/actionscript.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "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"; this.snippetFileId = "ace/snippets/actionscript"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/actionscript_highlight_rules.js ================================================ /* 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 * ****************************************************************************************/ "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: src/mode/ada.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = AdaHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; 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; } // Indent when line ends with one of the following keywords if (state == "start") { var match = line.match(/^.*(begin|loop|then|is|do)\s*$/); if (match) { indent += tab; } } return indent; }; this.checkOutdent = function(state, line, input) { var complete_line = line + input; // Outdent when the current line contains begin or end, and nothing // else. This ensures that we'll send the signal only once. if (complete_line.match(/^\s*(begin|end)$/)) { return true; } return false; }; this.autoOutdent = function(state, session, row) { var line = session.getLine(row); var prevLine = session.getLine(row - 1); var prevIndent = this.$getIndent(prevLine).length; var indent = this.$getIndent(line).length; // Don't outdent if current line is at the same level as the last one, // it means that the user outdented himself if (indent <= prevIndent) { return; } session.outdentRows(new Range(row, 0, row + 2, 0)); }; this.$id = "ace/mode/ada"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/ada_highlight_rules.js ================================================ "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", // character 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: src/mode/ada_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var AdaMode = require("./ada").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new AdaMode(); }, "test: auto outdent after 'begin' and 'end'": function() { assert.ok(this.mode.checkOutdent("start", " begi", "n")); assert.ok(this.mode.checkOutdent("start", " en", "d")); }, "test: auto outdent" : function() { var session = new EditSession([ "procedure Pouet is", " begin" ]); this.mode.autoOutdent("start", session, 1); assert.equal("begin", session.getLine(1)); } }; require("../test/run")(module); ================================================ FILE: src/mode/alda.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var AldaHighlightRules = require("./alda_highlight_rules").AldaHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = AldaHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { // this.lineCommentStart = ""\\(comment\\b""; // this.blockComment = {start: ""/*"", end: ""*/""}; // Extra logic goes here. this.$id = "ace/mode/alda"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/alda_highlight_rules.js ================================================ /* This file was autogenerated from ../../src/alda.JSON-tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AldaHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { pitch: [{ token: "variable.parameter.operator.pitch.alda", regex: /(?:[+\-]+|\=)/ }, { token: "", regex: "", next: "timing" }], timing: [{ token: "string.quoted.operator.timing.alda", regex: /\d+(?:s|ms)?/ }, { token: "", regex: "", next: "start" }], start: [{ token: [ "constant.language.instrument.alda", "constant.language.instrument.alda", "meta.part.call.alda", "storage.type.nickname.alda", "meta.part.call.alda" ], regex: /^([a-zA-Z]{2}[\w\-+\'()]*)((?:\s*\/\s*[a-zA-Z]{2}[\w\-+\'()]*)*)(?:(\s*)(\"[a-zA-Z]{2}[\w\-+\'()]*\"))?(\s*:)/ }, { token: [ "text", "entity.other.inherited-class.voice.alda", "text" ], regex: /^(\s*)(V\d+)(:)/ }, { token: "comment.line.number-sign.alda", regex: /#.*$/ }, { token: "entity.name.function.pipe.measure.alda", regex: /\|/ }, { token: "comment.block.inline.alda", regex: /\(comment\b/, push: [{ token: "comment.block.inline.alda", regex: /\)/, next: "pop" }, { defaultToken: "comment.block.inline.alda" }] }, { token: "entity.name.function.marker.alda", regex: /%[a-zA-Z]{2}[\w\-+\'()]*/ }, { token: "entity.name.function.at-marker.alda", regex: /@[a-zA-Z]{2}[\w\-+\'()]*/ }, { token: "keyword.operator.octave-change.alda", regex: /\bo\d+\b/ }, { token: "keyword.operator.octave-shift.alda", regex: /[><]/ }, { token: "keyword.operator.repeat.alda", regex: /\*\s*\d+/ }, { token: "string.quoted.operator.timing.alda", regex: /[.]|r\d*(?:s|ms)?/ },{ token: "text", regex: /([cdefgab])/, next: "pitch" }, { token: "string.quoted.operator.timing.alda", regex: /~/, next: "timing" }, { token: "punctuation.section.embedded.cram.alda", regex: /\}/, next: "timing" }, { token: "constant.numeric.subchord.alda", regex: /\// }, { todo: { token: "punctuation.section.embedded.cram.alda", regex: /\{/, push: [{ token: "punctuation.section.embedded.cram.alda", regex: /\}/, next: "pop" }, { include: "$self" }] } }, { todo: { token: "keyword.control.sequence.alda", regex: /\[/, push: [{ token: "keyword.control.sequence.alda", regex: /\]/, next: "pop" }, { include: "$self" }] } }, { token: "meta.inline.clojure.alda", regex: /\(/, push: [{ token: "meta.inline.clojure.alda", regex: /\)/, next: "pop" }, { include: "source.clojure" }, { defaultToken: "meta.inline.clojure.alda" }] }] }; this.normalizeRules(); }; AldaHighlightRules.metaData = { scopeName: "source.alda", fileTypes: ["alda"], name: "Alda" }; oop.inherits(AldaHighlightRules, TextHighlightRules); exports.AldaHighlightRules = AldaHighlightRules; ================================================ FILE: src/mode/apache_conf.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "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: src/mode/apache_conf_highlight_rules.js ================================================ /* 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 * ****************************************************************************************/ "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: '(</)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(>)' }, { 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: src/mode/apex.js ================================================ /* caption: Apex; extensions: apex,cls,trigger,tgr */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("../mode/text").Mode; var ApexHighlightRules = require("./apex_highlight_rules").ApexHighlightRules; var FoldMode = require("../mode/folding/cstyle").FoldMode; function ApexMode() { TextMode.call(this); this.HighlightRules = ApexHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; } oop.inherits(ApexMode, TextMode); ApexMode.prototype.lineCommentStart = "//"; ApexMode.prototype.blockComment = { start: "/*", end: "*/" }; exports.Mode = ApexMode; ================================================ FILE: src/mode/apex_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("../mode/text_highlight_rules").TextHighlightRules; var DocCommentHighlightRules = require("../mode/doc_comment_highlight_rules").DocCommentHighlightRules; var ApexHighlightRules = function() { var mainKeywordMapper = this.createKeywordMapper({ "variable.language": "activate|any|autonomous|begin|bigdecimal|byte|cast|char|collect|const" + "|end|exit|export|float|goto|group|having|hint|import|inner|into|join|loop|number|object|of|outer" + "|parallel|pragma|retrieve|returning|search|short|stat|synchronized|then|this_month" + "|transaction|type|when", "keyword": "private|protected|public|native|synchronized|abstract|threadsafe|transient|static|final" + "|and|array|as|asc|break|bulk|by|catch|class|commit|continue|convertcurrency" + "|delete|desc|do|else|enum|extends|false|final|finally|for|from|future|global" + "|if|implements|in|insert|instanceof|interface|last_90_days|last_month" + "|last_n_days|last_week|like|limit|list|map|merge|new|next_90_days|next_month|next_n_days" + "|next_week|not|null|nulls|on|or|override|package|return" + "|rollback|savepoint|select|set|sort|super|testmethod|this|this_week|throw|today" + "|tolabel|tomorrow|trigger|true|try|undelete|update|upsert|using|virtual|webservice" + "|where|while|yesterday|switch|case|default", "storage.type": "def|boolean|byte|char|short|int|float|pblob|date|datetime|decimal|double|id|integer|long|string|time|void|blob|Object", "constant.language": "true|false|null|after|before|count|excludes|first|includes|last|order|sharing|with", "support.function": "system|apex|label|apexpages|userinfo|schema" }, "identifier", true); function keywordMapper(value) { if (value.slice(-3) == "__c") return "support.function"; return mainKeywordMapper(value); } function string(start, options) { return { regex: start + (options.multiline ? "" : "(?=.)"), token: "string.start", next: [{ regex: options.escape, token: "character.escape" }, { regex: options.error, token: "error.invalid" }, { regex: start + (options.multiline ? "" : "|$"), token: "string.end", next: options.next || "start" }, { defaultToken: "string" }] }; } function comments() { return [{ token : "comment", regex : "\\/\\/(?=.)", next : [ DocCommentHighlightRules.getTagRule(), {token : "comment", regex : "$|^", next : "start"}, {defaultToken : "comment", caseInsensitive: true} ] }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi line comment regex : /\/\*/, next : [ DocCommentHighlightRules.getTagRule(), {token : "comment", regex : "\\*\\/", next : "start"}, {defaultToken : "comment", caseInsensitive: true} ] } ]; } this.$rules = { start: [ string("'", { escape: /\\[nb'"\\]/, error: /\\./, multiline: false }), comments("c"), { type: "decoration", token: [ "meta.package.apex", "keyword.other.package.apex", "meta.package.apex", "storage.modifier.package.apex", "meta.package.apex", "punctuation.terminator.apex" ], regex: /^(\s*)(package)\b(?:(\s*)([^ ;$]+)(\s*)((?:;)?))?/ }, { regex: /@[a-zA-Z_$][a-zA-Z_$\d\u0080-\ufffe]*/, token: "constant.language" }, { regex: /[a-zA-Z_$][a-zA-Z_$\d\u0080-\ufffe]*/, token: keywordMapper }, { regex: "`#%", token: "error.invalid" }, { token : "constant.numeric", // float regex : /[+-]?\d+(?:(?:\.\d*)?(?:[LlDdEe][+-]?\d+)?)\b|\.\d+[LlDdEe]/ }, { token : "keyword.operator", regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/, next : "start" }, { token : "punctuation.operator", regex : /[?:,;.]/, next : "start" }, { token : "paren.lparen", regex : /[\[]/, next : "maybe_soql", merge : false }, { token : "paren.lparen", regex : /[\[({]/, next : "start", merge : false }, { token : "paren.rparen", regex : /[\])}]/, merge : false } ], maybe_soql: [{ regex: /\s+/, token: "text" }, { regex: /(SELECT|FIND)\b/, token: "keyword", caseInsensitive: true, next: "soql" }, { regex: "", token: "none", next: "start" }], soql: [{ regex: "(:?ASC|BY|CATEGORY|CUBE|DATA|DESC|END|FIND|FIRST|FOR|FROM|GROUP|HAVING|IN|LAST" + "|LIMIT|NETWORK|NULLS|OFFSET|ORDER|REFERENCE|RETURNING|ROLLUP|SCOPE|SELECT" + "|SNIPPET|TRACKING|TYPEOF|UPDATE|USING|VIEW|VIEWSTAT|WHERE|WITH|AND|OR)\\b", token: "keyword", caseInsensitive: true }, { regex: "(:?target_length|toLabel|convertCurrency|count|Contact|Account|User|FIELDS)\\b", token: "support.function", caseInsensitive: true }, { token : "paren.rparen", regex : /[\]]/, next : "start", merge : false }, string("'", { escape: /\\[nb'"\\]/, error: /\\./, multiline: false, next: "soql" }), string('"', { escape: /\\[nb'"\\]/, error: /\\./, multiline: false, next: "soql" }), { regex: /\\./, token: "character.escape" }, { regex : /[\?\&\|\!\{\}\[\]\(\)\^\~\*\:\"\'\+\-\,\.=\\\/]/, token : "keyword.operator" }], "log-start" : [ { token : "timestamp.invisible", regex : /^[\d:.() ]+\|/, next: "log-header" }, { token : "timestamp.invisible", regex : /^ (Number of|Maximum)[^:]*:/, next: "log-comment" }, { token : "invisible", regex : /^Execute Anonymous:/, next: "log-comment" }, { defaultToken: "text" }], "log-comment": [{ token : "log-comment", regex : /.*$/, next: "log-start" }], "log-header": [{ token : "timestamp.invisible", regex : /((USER_DEBUG|\[\d+\]|DEBUG)\|)+/ }, { token : "keyword", regex: "(?:EXECUTION_FINISHED|EXECUTION_STARTED|CODE_UNIT_STARTED" + "|CUMULATIVE_LIMIT_USAGE|LIMIT_USAGE_FOR_NS" + "|CUMULATIVE_LIMIT_USAGE_END|CODE_UNIT_FINISHED)" }, { regex: "", next: "log-start" }] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.normalizeRules(); }; oop.inherits(ApexHighlightRules, TextHighlightRules); exports.ApexHighlightRules = ApexHighlightRules; ================================================ FILE: src/mode/applescript.js ================================================ "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: src/mode/applescript_highlight_rules.js ================================================ "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: src/mode/aql.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var AqlHighlightRules = require("./aql_highlight_rules").AqlHighlightRules; var Mode = function() { this.HighlightRules = AqlHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/aql"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/aql_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AqlHighlightRules = function() { var keywords = ( "for|return|filter|search|sort|limit|let|collect|asc|desc|in|into|insert|update|remove|replace|upsert|options|with|and|or|not|distinct|graph|shortest_path|outbound|inbound|any|all|none|at least|aggregate|like|k_shortest_paths|k_paths|all_shortest_paths|prune|window" ); var builtinConstants = ( "true|false" ); var builtinFunctions = ( "to_bool|to_number|to_string|to_array|to_list|is_null|is_bool|is_number|is_string|is_array|is_list|is_object|is_document|is_datestring|" + "typename|json_stringify|json_parse|concat|concat_separator|char_length|lower|upper|substring|left|right|trim|reverse|contains|" + "log|log2|log10|exp|exp2|sin|cos|tan|asin|acos|atan|atan2|radians|degrees|pi|regex_test|regex_replace|" + "like|floor|ceil|round|abs|rand|sqrt|pow|length|count|min|max|average|avg|sum|product|median|variance_population|variance_sample|variance|percentile|" + "bit_and|bit_or|bit_xor|bit_negate|bit_test|bit_popcount|bit_shift_left|bit_shift_right|bit_construct|bit_deconstruct|bit_to_string|bit_from_string|" + "first|last|unique|outersection|interleave|in_range|jaccard|matches|merge|merge_recursive|has|attributes|keys|values|unset|unset_recursive|keep|keep_recursive|" + "near|within|within_rectangle|is_in_polygon|distance|fulltext|stddev_sample|stddev_population|stddev|" + "slice|nth|position|contains_array|translate|zip|call|apply|push|append|pop|shift|unshift|remove_value|remove_values|" + "remove_nth|replace_nth|date_now|date_timestamp|date_iso8601|date_dayofweek|date_year|date_month|date_day|date_hour|" + "date_minute|date_second|date_millisecond|date_dayofyear|date_isoweek|date_isoweekyear|date_leapyear|date_quarter|date_days_in_month|date_trunc|date_round|" + "date_add|date_subtract|date_diff|date_compare|date_format|date_utctolocal|date_localtoutc|date_timezone|date_timezones|" + "fail|passthru|v8|sleep|schema_get|schema_validate|shard_id|call_greenspun|version|noopt|noeval|not_null|" + "first_list|first_document|parse_identifier|current_user|current_database|collection_count|pregel_result|" + "collections|document|decode_rev|range|union|union_distinct|minus|intersection|flatten|is_same_collection|check_document|" + "ltrim|rtrim|find_first|find_last|split|substitute|ipv4_to_number|ipv4_from_number|is_ipv4|md5|sha1|sha512|crc32|fnv64|hash|random_token|to_base64|" + "to_hex|encode_uri_component|soundex|assert|warn|is_key|sorted|sorted_unique|count_distinct|count_unique|" + "levenshtein_distance|levenshtein_match|regex_matches|regex_split|ngram_match|ngram_similarity|ngram_positional_similarity|uuid|" + "tokens|exists|starts_with|phrase|min_match|bm25|tfidf|boost|analyzer|" + "cosine_similarity|decay_exp|decay_gauss|decay_linear|l1_distance|l2_distance|minhash|minhash_count|minhash_error|minhash_match|" + "geo_point|geo_multipoint|geo_polygon|geo_multipolygon|geo_linestring|geo_multilinestring|geo_contains|geo_intersects|" + "geo_equals|geo_distance|geo_area|geo_in_range" ); 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+" } ] }; this.normalizeRules(); }; oop.inherits(AqlHighlightRules, TextHighlightRules); exports.AqlHighlightRules = AqlHighlightRules; ================================================ FILE: src/mode/asciidoc.js ================================================ "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: src/mode/asciidoc_highlight_rules.js ================================================ "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: src/mode/asl.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ASLHighlightRules = require("./asl_highlight_rules").ASLHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { this.HighlightRules = ASLHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function () { this.$id = "ace/mode/asl"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/asl_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ASLHighlightRules = function() { var keywords = ( "Default|DefinitionBlock|Device|Method|Else|ElseIf|For|Function|If|Include|Method|Return|" + "Scope|Switch|Case|While|Break|BreakPoint|Continue|NoOp|Wait|True|False|" + "AccessAs|Acquire|Alias|BankField|Buffer|Concatenate|ConcatenateResTemplate|" + "CondRefOf|Connection|CopyObject|CreateBitField|CreateByteField|CreateDWordField|" + "CreateField|CreateQWordField|CreateWordField|DataTableRegion|Debug|" + "DMA|DWordIO|DWordMemory|DWordSpace|EisaId|EISAID|EndDependentFn|Event|ExtendedIO|" + "ExtendedMemory|ExtendedSpace|External|Fatal|Field|FindSetLeftBit|FindSetRightBit|" + "FixedDMA|FixedIO|Fprintf|FromBCD|GpioInt|GpioIo|I2CSerialBusV2|IndexField|" + "Interrupt|IO|IRQ|IRQNoFlags|Load|LoadTable|Match|Memory32|Memory32Fixed|" + "Mid|Mutex|Name|Notify|Offset|ObjectType|OperationRegion|Package|PowerResource|Printf|" + "QWordIO|QWordMemory|QWordSpace|RawDataBuffer|Register|Release|Reset|ResourceTemplate|" + "Signal|SizeOf|Sleep|SPISerialBusV2|Stall|StartDependentFn|StartDependentFnNoPri|" + "Store|ThermalZone|Timer|ToBCD|ToBuffer|ToDecimalString|ToInteger|ToPLD|ToString|" + "ToUUID|UARTSerialBusV2|Unicode|Unload|VendorLong|VendorShort|WordBusNumber|WordIO|" + "WordSpace" ); var keywordOperators = ( "Add|And|Decrement|Divide|Increment|Index|LAnd|LEqual|LGreater|LGreaterEqual|" + "LLess|LLessEqual|LNot|LNotEqual|LOr|Mod|Multiply|NAnd|NOr|Not|Or|RefOf|Revision|" + "ShiftLeft|ShiftRight|Subtract|XOr|DerefOf" ); var flags = ( "AttribQuick|AttribSendReceive|AttribByte|AttribBytes|AttribRawBytes|" + "AttribRawProcessBytes|AttribWord|AttribBlock|AttribProcessCall|AttribBlockProcessCall|" + "AnyAcc|ByteAcc|WordAcc|DWordAcc|QWordAcc|BufferAcc|" + "AddressRangeMemory|AddressRangeReserved|AddressRangeNVS|AddressRangeACPI|" + "RegionSpaceKeyword|FFixedHW|PCC|" + "AddressingMode7Bit|AddressingMode10Bit|" + "DataBitsFive|DataBitsSix|DataBitsSeven|DataBitsEight|DataBitsNine|" + "BusMaster|NotBusMaster|" + "ClockPhaseFirst|ClockPhaseSecond|ClockPolarityLow|ClockPolarityHigh|" + "SubDecode|PosDecode|" + "BigEndianing|LittleEndian|" + "FlowControlNone|FlowControlXon|FlowControlHardware|" + "Edge|Level|ActiveHigh|ActiveLow|ActiveBoth|Decode16|Decode10|" + "IoRestrictionNone|IoRestrictionInputOnly|IoRestrictionOutputOnly|" + "IoRestrictionNoneAndPreserve|Lock|NoLock|MTR|MEQ|MLE|MLT|MGE|MGT|" + "MaxFixed|MaxNotFixed|Cacheable|WriteCombining|Prefetchable|NonCacheable|" + "MinFixed|MinNotFixed|" + "ParityTypeNone|ParityTypeSpace|ParityTypeMark|ParityTypeOdd|ParityTypeEven|" + "PullDefault|PullUp|PullDown|PullNone|PolarityHigh|PolarityLow|" + "ISAOnlyRanges|NonISAOnlyRanges|EntireRange|ReadWrite|ReadOnly|" + "UserDefRegionSpace|SystemIO|SystemMemory|PCI_Config|EmbeddedControl|" + "SMBus|SystemCMOS|PciBarTarget|IPMI|GeneralPurposeIO|GenericSerialBus|" + "ResourceConsumer|ResourceProducer|Serialized|NotSerialized|" + "Shared|Exclusive|SharedAndWake|ExclusiveAndWake|ControllerInitiated|DeviceInitiated|" + "StopBitsZero|StopBitsOne|StopBitsOnePlusHalf|StopBitsTwo|" + "Width8Bit|Width16Bit|Width32Bit|Width64Bit|Width128Bit|Width256Bit|" + "SparseTranslation|DenseTranslation|TypeTranslation|TypeStatic|" + "Preserve|WriteAsOnes|WriteAsZeros|Transfer8|Transfer16|Transfer8_16|" + "ThreeWireMode|FourWireMode" ); var storageTypes = ( "UnknownObj|IntObj|StrObj|BuffObj|PkgObj|FieldUnitObj|DeviceObj|" + "EventObj|MethodObj|MutexObj|OpRegionObj|PowerResObj|ProcessorObj|" + "ThermalZoneObj|BuffFieldObj|DDBHandleObj" ); var builtinConstants = ( "__FILE__|__PATH__|__LINE__|__DATE__|__IASL__" ); var strNumbers = ( "One|Ones|Zero" ); var deprecated = ( "Memory24|Processor" ); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "constant.numeric": strNumbers, "keyword.operator": keywordOperators, "constant.language": builtinConstants, "storage.type": storageTypes, "constant.library": flags, "invalid.deprecated": deprecated }, "identifier"); this.$rules = { "start" : [ { token : "comment", regex : "\\/\\/.*$" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi line comment regex : "\\/\\*", next : "comment" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // ignored fields / comments regex : "\\\[", next : "ignoredfield" }, { token : "variable", regex : "\\Local[0-7]|\\Arg[0-6]" }, { token : "keyword", // pre-compiler directives regex : "#\\s*(?:define|elif|else|endif|error|if|ifdef|ifndef|include|includebuffer|line|pragma|undef|warning)\\b", next : "directive" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "constant.character", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "constant.numeric", // hex regex : /0[xX][0-9a-fA-F]+\b/ }, { token : "constant.numeric", regex : /[0-9]+\b/ }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : /[!\~\*\/%+-<>\^|=&]/ }, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "ignoredfield" : [ { token : "comment", // closing ignored fields / comments regex : "\\\]", next : "start" }, { defaultToken : "comment" } ], "directive" : [ { token : "constant.other.multiline", regex : /\\/ }, { token : "constant.other.multiline", regex : /.*\\/ }, { token : "constant.other", regex : "\\s*<.+?>*s", next : "start" }, { token : "constant.other", // single line regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]*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") ]); }; oop.inherits(ASLHighlightRules, TextHighlightRules); exports.ASLHighlightRules = ASLHighlightRules; ================================================ FILE: src/mode/assembly_arm32.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var AssemblyARM32HighlightRules = require("./assembly_arm32_highlight_rules").AssemblyARM32HighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = AssemblyARM32HighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = [";"]; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/assembly_arm32"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/assembly_arm32_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AssemblyARM32HighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'keyword.control.assembly', // should cover every instruction listed in https://pages.cs.wisc.edu/~markhill/restricted/arm_isa_quick_reference.pdf regex: '\\b(?:cpsid|cpsie|cps|setend|(?:srs|rfe)(?:ia|ib|da|db|fd|ed|fa|ea)|bkpt|nop|pld|cdp2|mrc2|mrrc2|mcr2|mcrr2|ldc2|stc2|(?:add|adc|sub|sbc|rsb|rsc|mul|mla|umull|umlal|smull|smlal|mvn|and|eor|orr|bic)(?:eq|ne|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al)?s?|(?:(?:q|qd)?(?:add|sub)|umaal|smul(?:b|t)(?:b|t)|smulw(?:b|t)|smla(?:b|t)(?:b|t)|smlaw(?:b|t)|smlal(?:b|t)(?:b|t)|smuadx?|smladx?|smlaldx?|smusdx?|smlsdx?|smlsldx?|smmulr?|smmlar?|smmlsr?|mia|miaph|mia(?:b|t)(?:b|t)|clz|(?:s|q|sh|u|uq|uh)(?:add16|sub16|add8|sub8|addsubx|subaddx)|usad8|usada8|mrs|msr|mra|mar|cpy|tst|teq|cmp|cmn|ssat|ssat16|usat|usat16|pkhbt|pkhtb|sxth|sxtb16|sxtb|uxth|uxtb16|uxtb|sxtah|sxtab16|sxtab|uxtah|uxtab16|uxtab|rev|rev16|revsh|sel|b|bl|bx|blx|bxj|swi|svc|ldrex|strex|cdp|mrc|mrrc|mcr|mcrr|ldc|stc)(?:eq|ne|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al)?|ldr(?:eq|ne|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al)?(?:t|b|bt|sb|h|sh|d)?|str(?:eq|ne|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al)?(?:t|b|bt|h|d)?|(?:ldm|stm)(?:eq|ne|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al)?(?:ia|ib|da|db|fd|ed|fa|ea)|swp(?:eq|ne|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al)?b?|mov(?:t|w)?)\\b', caseInsensitive: true }, { token: 'variable.parameter.register.assembly', // first half are actual registers until spsr, where it changes to fields and flexible operands regex: '\\b(?:r0|r1|r2|r3|r4|r5|r6|r7|r8|r9|r10|r11|r12|r13|r14|r15|fp|ip|sp|lr|pc|cpsr|spsr|c|f|s|x|lsl|lsr|asr|ror|rrx)\\b', caseInsensitive: true }, { token: 'constant.character.hexadecimal.assembly', regex: '#0x[A-F0-9]+', caseInsensitive: true }, { token: 'constant.character.decimal.assembly', regex: '#[0-9]+' }, { token: 'string.assembly', regex: /'([^\\']|\\.)*'/ }, { token: 'string.assembly', regex: /"([^\\"]|\\.)*"/ }, { token: 'support.function.directive.assembly', regex: '(?:\.section|\.global|\.text|\.asciz|\.asciiz|\.ascii|\.align|\.byte|\.end|\.data|\.equ|\.extern|\.include)' }, { 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: '\\/\\*', next: 'comment' }, { token: 'comment.assembly', regex: '(?:;|//|@).*$' } ], comment:[ { token: 'comment.assembly', regex: '\\*\\/', next:'start' }, { defaultToken:'comment' } ] }; this.normalizeRules(); }; AssemblyARM32HighlightRules.metaData = { fileTypes: [ 's' ], name: 'Assembly ARM32', scopeName: 'source.assembly' }; oop.inherits(AssemblyARM32HighlightRules, TextHighlightRules); exports.AssemblyARM32HighlightRules = AssemblyARM32HighlightRules; ================================================ FILE: src/mode/assembly_x86.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "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: src/mode/assembly_x86_highlight_rules.js ================================================ /* 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 * ****************************************************************************************/ "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: src/mode/astro.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var AstroHighlightRules = require("./astro_highlight_rules").AstroHighlightRules; var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; var Mode = function() { HtmlMode.call(this); this.HighlightRules = AstroHighlightRules; this.$behaviour = new HtmlBehaviour(); }; oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/astro"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/astro_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var JavascriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var AstroHighlightRules = function () { HtmlHighlightRules.call(this); var astro = { token: "paren.quasi.start", regex: /{/, next: function (state, stack) { if (state !== "start") { if (state.indexOf("attribute-equals") !== -1) { stack.splice(0); stack.unshift("tag_stuff"); } else { stack.unshift(state); } } return "inline-js-start"; } }; for (var key in this.$rules) { if ( key.startsWith("js") || key.startsWith("css") || key.startsWith("comment") ) continue; this.$rules[key].unshift(astro); } this.$rules.start.unshift({ token: "comment", regex: /^---$/, onMatch: function (value, state, stack) { stack.splice(0); return this.token; }, next: "javascript-start" }); this.embedRules(JavascriptHighlightRules, "javascript-", [ { regex: /^---$/, token: "comment", next: "start", onMatch: function (value, state, stack) { stack.splice(0); return this.token; } } ]); this.embedRules(JavascriptHighlightRules, "inline-js-"); var astroRules = [ { regex: /}/, token: "paren.quasi.end", onMatch: function (value, state, stack) { if (stack[0] === "inline-js-start") { stack.shift(); this.next = stack.shift(); if (this.next.indexOf("string") !== -1) return "paren.quasi.end"; return "paren.rparen"; } else { this.next = stack.shift() || "start"; return this.token; } } }, { regex: /{/, token: "paren.lparen", push: "inline-js-start" } ]; this.$rules["inline-js-start"].unshift(astroRules); this.$rules["inline-js-no_regex"].unshift(astroRules); function overwriteJSXendRule(prefix) { for (var index in this.$rules[prefix + "jsxAttributes"]) { if ( this.$rules[prefix + "jsxAttributes"][index].token === "meta.tag.punctuation.tag-close.xml" ) { this.$rules[prefix + "jsxAttributes"][index].onMatch = function ( value, currentState, stack ) { if (currentState == stack[0]) stack.shift(); if (value.length == 2) { if (stack[0] == this.nextState) stack[1]--; if (!stack[1] || stack[1] < 0) { stack.splice(0, 2); } } this.next = stack[0] || prefix + "start"; return [{ type: this.token, value: value }]; }; break; } } } overwriteJSXendRule.call(this, "javascript-"); overwriteJSXendRule.call(this, "inline-js-"); this.normalizeRules(); }; oop.inherits(AstroHighlightRules, HtmlHighlightRules); exports.AstroHighlightRules = AstroHighlightRules; ================================================ FILE: src/mode/autohotkey.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "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: src/mode/autohotkey_highlight_rules.js ================================================ /* 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 * ****************************************************************************************/ "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: 'paren', 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: src/mode/basic.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var BasicHighlightRules = require("./basic_highlight_rules").BasicHighlightRules; var FoldMode = require("./folding/basic").FoldMode; var Mode = function() { this.HighlightRules = BasicHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ["REM"]; this.getMatching = function(session, row, column, tokenRange) { if (row == undefined) { var pos = session.selection.lead; column = pos.column; row = pos.row; } if (tokenRange == undefined) tokenRange = true; var startToken = session.getTokenAt(row, column); if (startToken) { var val = startToken.value.toLowerCase(); if (val in this.indentKeywords) return this.foldingRules.basicBlock(session, row, column, tokenRange); } }; this.$id = "ace/mode/basic"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/basic_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var BasicHighlightRules = function () { var keywordMapper = this.createKeywordMapper({ "keyword.control": "FOR|TO|NEXT|GOSUB|RETURN|IF|THEN|ELSE|GOTO|ON|WHILE|WEND|TRON|TROFF", "entity.name": "Auto|Call|Chain|Clear|Close|Common|Cont|Data|MERGE|ALL|Delete|DIM|EDIT|END|ERASE|ERROR|FIELD|" + "GET|INPUT|KILL|LET|LIST|LLIST|LOAD|LSET|RSET|MERGE|NEW|NULL|OPEN|OUT|POKE|PRINT|PUT|RANDOMIZE|READ|" + "RENUM|RESTORE|RESUME|RUN|SAVE|STOP|SWAP|WAIT|WIDTH", "keyword.operator": "Mod|And|Not|Or|Xor|Eqv|Imp", "support.function": "ABS|ASC|ATN|CDBL|CINT|COS|CSNG|CVI|CVS|CVD|EOF|EXP|FIX|FRE|INP|INSTR|INT|LEN|LOC|LOG|LPOS|" + "PEEK|POS|RND|SGN|SIN|SPC|SQR|TAB|TAN|USR|VAL|VARPTR" }, "identifier", true); this.$rules = { "start": [ { token: "string", regex: /"(?:\\.|[^"\\])*"/ }, { token: "support.function", regex: /(HEX|CHR|INPUT|LEFT|MID|MKI|MKS|MKD|OCT|RIGHT|SPACE|STR|STRING)\$/ }, { token: "entity.name", regex: /(?:DEF\s(?:SEG|USR|FN[a-zA-Z]+)|LINE\sINPUT|L?PRINT#?(?:\sUSING)?|MID\$|ON\sERROR\sGOTO|OPTION\sBASE|WRITE#?|DATE\$|INKEY\$|TIME\$)/ }, { token: "variable", regex: /[a-zA-Z][a-zA-Z0-9_]{0,38}[$%!#]?(?=\s*=)/ }, { token: "keyword.operator", regex: /\\|=|\^|\*|\/|\+|\-|<|>|-/ }, { token: "paren.lparen", regex: /[([]/ }, { token: "paren.rparen", regex: /[\)\]]/ }, { token: "constant.numeric", regex: /[+-]?\d+(\.\d+)?([ED][+-]?\d+)?(?:[!#])?/ }, { token: "constant.numeric", //hexal, octal regex: /&[HO]?[0-9A-F]+/ }, { token: "comment", regex: /REM\s+.*$/ }, { regex: "\\w+", token: keywordMapper },{ token: "punctiation", regex: /[,;]/ } ] }; this.normalizeRules(); }; oop.inherits(BasicHighlightRules, TextHighlightRules); exports.BasicHighlightRules = BasicHighlightRules; ================================================ FILE: src/mode/batchfile.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "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: src/mode/batchfile_highlight_rules.js ================================================ /* 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 * ****************************************************************************************/ "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: src/mode/behaviour/behaviour_test.js ================================================ if (typeof process !== "undefined") { require("../../test/mockdom"); } "use strict"; require("../../multi_select"); var assert = require("../../test/assertions"); var Range = require("../../range").Range; var Editor = require("../../editor").Editor; var UndoManager = require("../../undomanager").UndoManager; 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 HTMLMode = require("../html").Mode; var CSSMode = require("../css").Mode; var MarkdownMode = require("../markdown").Mode; var PythonMode = require("../python").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"'); editor.setValue(""); exec("insertstring", 1, '`'); assert.equal(editor.getValue(), '``'); exec("insertstring", 1, 'n'); assert.equal(editor.getValue(), '`n`'); exec("backspace", 2); assert.equal(editor.getValue(), ''); // multiline string interpolation test case editor.setValue(""); exec("insertstring", 1, "var x="); exec("insertstring", 1, "`"); assert.equal(editor.getValue(), "var x=``"); exec("insertstring", 1, "$"); exec("insertstring", 1, "{"); assert.equal(editor.getValue(), "var x=`${}`"); // Testing for the auto-pairing of curly braces inside a JSX element attribute editor.setValue(""); exec("insertstring", 1, "var x=<a href="); exec("insertstring", 1, "{"); assert.equal(editor.getValue(), "var x=<a href={}"); // Testing of excluded token types auto-pairing editor.setValue(""); exec("insertstring", 1, "var x=<div>"); exec("gotoleft", 1); exec("insertstring", 1, "{"); assert.equal(editor.getValue(), "var x=<div{>"); // Testing for the auto-pairing of curly braces inside a JSX element editor.setValue(""); exec("insertstring", 1, "var x=<div>\\n "); exec("insertstring", 1, "{"); assert.equal(editor.getValue(), "var x=<div>\\n {}"); }, "test: xml": function() { editor = new Editor(new MockRenderer()); editor.session.setUndoManager(new UndoManager()); editor.setValue(["<OuterTag>", " <SelfClosingTag />" ].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(["<OuterTag", " <xyzrt" ].join("\n")); exec("golinedown", 1); exec("gotolineend", 1); exec("selectleft", 3); exec("insertstring", 1, '>'); assert.equal(editor.session.getLine(1), " <xy></xy>"); editor.setValue(["<a x='11'", "<b a='", " ", "' >" ].join("\n")); editor.selection.moveTo(0, 100); exec("insertstring", 1, '>'); editor.selection.moveTo(1, 100); exec("insertstring", 1, '>'); editor.selection.moveTo(2, 1); exec("insertstring", 1, '>'); editor.selection.moveTo(3, 1); exec("insertstring", 1, '>'); assert.equal(editor.getValue(), [ "<a x='11'></a>", "<b a='>", " > ", "'> >" ].join("\n")); editor.setValue(""); "<div x='1'>".split("").forEach(function(ch) { exec("insertstring", 1, ch); }); assert.equal(editor.getValue(), "<div x='1'></div>"); exec("insertstring", 1, ">"); assert.equal(editor.getValue(), "<div x='1'>></div>"); editor.setValue("<div '", 1); exec("selectleft", 1); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), "<div \""); exec("selectleft", 1); exec("insertstring", 1, "'"); assert.equal(editor.getValue(), "<div '"); exec("selectleft", 1); exec("insertstring", 1, "a"); exec("selectleft", 1); exec("insertstring", 1, "'"); assert.equal(editor.getValue(), "<div 'a'"); }, "test: html": function() { editor.session.setMode(new HTMLMode); editor.setWrapBehavioursEnabled(false); editor.setValue("<div a", 1); exec("selectleft", 1); exec("insertstring", 1, "'"); assert.equal(editor.getValue(), "<div '"); editor.setWrapBehavioursEnabled(true); editor.setValue("<div a", 1); exec("selectleft", 1); exec("insertstring", 1, "'"); assert.equal(editor.getValue(), "<div 'a'"); editor.setValue("<div a=></div>", 1); exec("gotoleft", 7); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), "<div a=\"\"></div>"); exec("insertstring", 1, '"'); exec("gotoright", 1); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "<div a=\"\">\n \n</div>"); exec("undo", 1); assert.equal(editor.getValue(), "<div a=\"\"></div>"); exec("gotoleft", 1); exec("backspace", 1); assert.equal(editor.getValue(), "<div a=\"></div>"); exec("undo", 1); exec("gotoleft", 1); exec("backspace", 1); assert.equal(editor.getValue(), "<div a=></div>"); exec("backspace", 1); assert.equal(editor.getValue(), "<div a></div>"); editor.setValue(" <div><div>", 1); editor.selection.moveTo(0, 9); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), " <div>\n <div>"); editor.setValue(" <div></div>", 1); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), " <div></div>\n "); editor.setValue(" <br><br>", 1); editor.selection.moveTo(0, 8); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), " <br>\n <br>"); editor.setValue("<div a='x", 1); exec("gotoleft", 1); exec("insertstring", 1, ">"); assert.equal(editor.getValue(), "<div a='>x"); editor.setValue(""); "<!DOCTYPE html></div><link><a>".split("").forEach(function(ch) { exec("insertstring", 1, ch); }); assert.equal(editor.getValue(), "<!DOCTYPE html></div><link><a></a>"); }, "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`"); editor.setValue(""); exec("insertstring", 1, 'a'); exec("insertstring", 1, "'"); assert.equal(editor.getValue(), "a'"); editor.setValue(""); exec("insertstring", 1, 'b'); exec("insertstring", 1, "`"); assert.equal(editor.getValue(), "b``"); }, "test: css": function() { editor.session.setMode(new CSSMode()); editor.setWrapBehavioursEnabled(true); editor.setValue("a {padding", 1); exec("insertstring", 1, ":"); assert.equal(editor.getValue(), "a {padding:;"); editor.setValue("a {padding:", 1); exec("gotoleft", 1); exec("insertstring", 1, ":"); assert.equal(editor.getValue(), "a {padding:"); editor.setValue("a {padding ", 1); exec("insertstring", 1, ":"); assert.equal(editor.getValue(), "a {padding :;"); editor.setValue("a", 1); exec("insertstring", 1, ":"); assert.equal(editor.getValue(), "a:"); editor.setValue("a {padding", 1); exec("insertstring", 1, ":"); exec("backspace", 1); assert.equal(editor.getValue(), "a {padding"); exec("backspace", 2); exec("insertstring", 1, ":;"); exec("gotoleft", 1); exec("backspace", 1); assert.equal(editor.getValue(), "a {paddi;"); editor.setValue("a {padding :", 1); exec("backspace", 1); assert.equal(editor.getValue(), "a {padding "); editor.setValue("a {padding:", 1); exec("insertstring", 1, ";"); assert.equal(editor.getValue(), "a {padding:;"); editor.setValue(";", 1); exec("gotoleft", 1); exec("insertstring", 1, "a {padding"); exec("insertstring", 1, ":"); assert.equal(editor.getValue(), "a {padding:;"); editor.setValue(";", 1); exec("selectleft", 1); exec("insertstring", 1, ";"); assert.equal(editor.getValue(), ";"); editor.setValue("a {padding:;", 1); exec("gotoleft", 1); exec("insertstring", 1, ";"); assert.equal(editor.getValue(), "a {padding:;"); editor.setValue("a {padding:10px", 1); exec("insertstring", 1, "!"); assert.equal(editor.getValue(), "a {padding:10px!important"); exec("removewordleft", 2); exec("insertstring", 1, "}"); exec("gotoleft", 1); exec("insertstring", 1, "!"); assert.equal(editor.getValue(), "a {padding:10px!important}"); exec("removewordleft", 2); exec("insertstring", 1, ";"); exec("gotoleft", 1); exec("insertstring", 1, "!"); assert.equal(editor.getValue(), "a {padding:10px!important;}"); editor.selection.moveTo(0, 3); exec("insertstring", 1, "!"); assert.equal(editor.getValue(), "a {!padding:10px!important;}"); }, "test: markdown": function() { editor.session.setMode(new MarkdownMode()); editor.setValue("```html", 1); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "```html\n"); editor.setValue("", 1); exec("insertstring", 1, "`"); assert.equal(editor.getValue(), "``"); exec("insertstring", 1, "x"); exec("insertstring", 1, "`"); assert.equal(editor.getValue(), "`x`"); editor.setValue("", 1); exec("insertstring", 1, "`"); exec("insertstring", 1, "`"); exec("insertstring", 1, "`"); exec("insertstring", 1, "x"); exec("insertstring", 1, "`"); exec("insertstring", 1, "`"); exec("insertstring", 1, "`"); assert.equal(editor.getValue(), "```x```"); editor.setValue("", 1); exec("insertstring", 1, "`"); exec("insertstring", 1, "`"); exec("insertstring", 1, "x"); exec("insertstring", 1, "`"); exec("insertstring", 1, "`"); assert.equal(editor.getValue(), "``x``"); editor.setValue("", 1); exec("insertstring", 1, "`"); exec("insertstring", 1, "`"); exec("insertstring", 1, "-"); exec("insertstring", 1, "`"); exec("insertstring", 1, "`"); assert.equal(editor.getValue(), "``-``"); }, "test: python": function() { editor.session.setMode(new PythonMode()); editor.setValue("f", 1); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), 'f""'); // there is no such prefix for python editor.setValue("p", 1); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), 'p"'); }, "test: doc comment auto-closing": function() { editor.session.setMode(new JavaScriptMode()); editor.setWrapBehavioursEnabled(true); // Test case 1: Starting a new doc comment editor.setValue("/**", 1); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "/**\n * \n */"); // Test case 2: Continuing an existing doc comment with asterisk on a new line editor.setValue("/**\n * Test", 1); editor.gotoLine(1, 5); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "/**\n * \n * Test"); // Test case 3: Starting a new doc comment with 4-space indentation editor.setValue(" /**", 1); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), " /**\n * \n */"); // Test case 4: Cursor between closing */ and opening /** on the same line editor.setValue("/**\n * Some comment\n *//**", 1); editor.gotoLine(3, 3); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "/**\n * Some comment\n */\n /**"); // Test case 5: Cursor at start of the line with doc comment editor.setValue("/**\n * Some comment\n */", 1); editor.gotoLine(1, 0); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "\n/**\n * Some comment\n */"); // Test case 6: Cursor at the end of the first comment editor.setValue("/** comment */identifier/**", 1); editor.gotoLine(1, 14); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "/** comment */\nidentifier/**"); // Test case 7: Cursor at the start of the second comment editor.setValue("/** comment */identifier/**", 1); editor.gotoLine(1, 24); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "/** comment */identifier\n/**"); // Test case 8: Cursor between '/' and '*' in a comment editor.setValue("/** comment */", 1); editor.gotoLine(1, 1); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "/\n** comment */"); }, "test: fragment auto-closing": function () { editor.setWrapBehavioursEnabled(true); editor.session.setMode(new JavaScriptMode()); editor.setValue(""); exec("insertstring", 1, '<'); exec("insertstring", 1, '>'); assert.equal(editor.getValue(), '<></>'); } }; require("../../test/run")(module); ================================================ FILE: src/mode/behaviour/css.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Behaviour = require("../behaviour").Behaviour; var CstyleBehaviour = require("./cstyle").CstyleBehaviour; var TokenIterator = require("../../token_iterator").TokenIterator; /**@type {(new() => Partial<import("../../../ace-internal").Ace.Behaviour>)}*/ var CssBehaviour = function () { this.inherit(CstyleBehaviour); this.add("colon", "insertion", function (state, action, editor, session, text) { if (text === ':' && editor.selection.isEmpty()) { 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 (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) { 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 === ';' && editor.selection.isEmpty()) { 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] }; } } }); this.add("!important", "insertion", function (state, action, editor, session, text) { if (text === '!' && editor.selection.isEmpty()) { var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) { return { text: '!important', selection: [10, 10] }; } } }); }; oop.inherits(CssBehaviour, CstyleBehaviour); exports.CssBehaviour = CssBehaviour; ================================================ FILE: src/mode/behaviour/cstyle.js ================================================ "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", "rparen", "paren", "punctuation.operator"]; var SAFE_INSERT_BEFORE_TOKENS = ["text", "paren.rparen", "rparen", "paren", "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) ] }; }; /** * Creates a new Cstyle behaviour object with the specified options. * @param {Object} [options] - The options for the Cstyle behaviour object. * @param {boolean} [options.braces] - Whether to force braces auto-pairing. * @param {boolean} [options.closeDocComment] - enables automatic insertion of closing tags for documentation comments. */ var CstyleBehaviour; CstyleBehaviour = function(options) { options = 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); var token = session.getTokenAt(cursor.row, cursor.column); if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { return getWrapped(selection, selected, '{', '}'); } else if (token && /(?:string)\.quasi|\.xml/.test(token.type)) { let excludeTokens = [ /tag\-(?:open|name)/, /attribute\-name/ ]; if (excludeTokens.some((el) => el.test(token.type)) || /(string)\.quasi/.test(token.type) && token.value[cursor.column - token.start - 1] !== '$') return; CstyleBehaviour.recordAutoInsert(editor, session, "}"); return { text: '{}', selection: [1, 1] }; } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode || 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(rightChar); var pairQuotesAfter = session.$mode.$pairQuotesAfter; var shouldPairQuotes = pairQuotesAfter && pairQuotesAfter[quote] && pairQuotesAfter[quote].test(leftChar); if ((!shouldPairQuotes && isWordBefore) || isWordAfter) return null; // before or after alphanumeric if (rightChar && !/[\s;,.})\]\\]/.test(rightChar)) return null; // there is rightChar and it isn't closing var charBefore = line[cursor.column - 2]; if (leftChar == quote && (charBefore == quote || wordRe.test(charBefore))) return null; pair = true; } return { text: pair ? quote + quote : "", selection: [1,1] }; } } }); this.add("string_dquotes", "deletion", function(state, action, editor, session, range) { var quotes = session.$mode.$quotes || defaultQuotes; var selected = session.doc.getTextRange(range); if (!range.isMultiLine() && quotes.hasOwnProperty(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; } } }); if (options.closeDocComment !== false) { this.add("doc comment end", "insertion", function (state, action, editor, session, text) { if (state === "doc-start" && (text === "\n" || text === "\r\n") && editor.selection.isEmpty()) { var cursor = editor.getCursorPosition(); if (cursor.column === 0) { return; } var line = session.doc.getLine(cursor.row); var nextLine = session.doc.getLine(cursor.row + 1); var tokens = session.getTokens(cursor.row); var index = 0; for (var i = 0; i < tokens.length; i++) { index += tokens[i].value.length; var currentToken = tokens[i]; if (index >= cursor.column) { if (index === cursor.column) { if (!/\.doc/.test(currentToken.type)) { return; } if (/\*\//.test(currentToken.value)) { var nextToken = tokens[i + 1]; if (!nextToken || !/\.doc/.test(nextToken.type)) { return; } } } var cursorPosInToken = cursor.column - (index - currentToken.value.length); // Check for the pattern `*/` followed by `/**` within the token var closeDocPos = currentToken.value.indexOf("*/"); var openDocPos = currentToken.value.indexOf("/**", closeDocPos > - 1 ? closeDocPos + 2 : 0); if (openDocPos !== -1 && cursorPosInToken > openDocPos && cursorPosInToken < openDocPos + 3) { return; } if (closeDocPos !== -1 && openDocPos !== -1 && cursorPosInToken >= closeDocPos && cursorPosInToken <= openDocPos || !/\.doc/.test(currentToken.type)) { return; } break; } } var indent = this.$getIndent(line); if (/\s*\*/.test(nextLine)) { if (/^\s*\*/.test(line)) { return { text: text + indent + "* ", selection: [1, 2 + indent.length, 1, 2 + indent.length] }; } else { return { text: text + indent + " * ", selection: [1, 3 + indent.length, 1, 3 + indent.length] }; } } if (/\/\*\*/.test(line.substring(0, cursor.column))) { return { text: text + indent + " * " + text + " " + indent + "*/", selection: [1, 4 + indent.length, 1, 4 + indent.length] }; } } }); } }; /** * @this {CstyleBehaviour} */ // @ts-ignore 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)) { if (/[)}\]]/.test(editor.session.getLine(cursor.row)[cursor.column])) return true; // 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: src/mode/behaviour/html.js ================================================ "use strict"; var oop = require("../../lib/oop"); var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; /**@type {(new() => Partial<import("../../../ace-internal").Ace.Behaviour>)}*/ var HtmlBehaviour = function () { XmlBehaviour.call(this); }; oop.inherits(HtmlBehaviour, XmlBehaviour); exports.HtmlBehaviour = HtmlBehaviour; ================================================ FILE: src/mode/behaviour/javascript.js ================================================ "use strict"; var oop = require("../../lib/oop"); const {TokenIterator} = require("../../token_iterator"); var CstyleBehaviour = require("../behaviour/cstyle").CstyleBehaviour; var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; var JavaScriptBehaviour = function () { var xmlBehaviours = new XmlBehaviour({closeCurlyBraces: true}).getBehaviours(); this.addBehaviours(xmlBehaviours); this.inherit(CstyleBehaviour); this.add("autoclosing-fragment", "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(); if (!token) return; if (token.value == '<') { return { text: "></>", selection: [1, 1] }; } } }); }; oop.inherits(JavaScriptBehaviour, CstyleBehaviour); exports.JavaScriptBehaviour = JavaScriptBehaviour; ================================================ FILE: src/mode/behaviour/liquid.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Behaviour = require("../behaviour").Behaviour; var XmlBehaviour = require("./xml").XmlBehaviour; var TokenIterator = require("../../token_iterator").TokenIterator; var lang = require("../../lib/lang"); function is(token, type) { return token && token.type.lastIndexOf(type + ".xml") > -1; } /**@type {(new() => Partial<import("../../../ace-internal").Ace.Behaviour>)}*/ var LiquidBehaviour = function () { XmlBehaviour.call(this); this.add("autoBraceTagClosing","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 || !( token.value.trim() === '%' || 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 tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length; if (position.column < tokenEndColumn) return; if (position.column == tokenEndColumn) { var nextToken = iterator.stepForward(); // TODO also handle non-closed string at the end of the line if (nextToken && is(nextToken, "attribute-value")) return; iterator.stepBackward(); } } // exit if the tag is empty if (/{%\s*%/.test(session.getLine(position.row))) return; if (/^\s*}/.test(session.getLine(position.row).slice(position.column))) return; // find tag name while (!token.type != 'meta.tag.punctuation.tag-open') { token = iterator.stepBackward(); if (token.value == '{%') { while(true) { token = iterator.stepForward(); if (token.type === 'meta.tag.punctuation.tag-open') { break; } else if (token.value.trim() == '%') { token = null; break; } } break; } } if (!token ) return ; 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: "}" + "{% end" + element + " %}", selection: [1, 1] }; } }); }; oop.inherits(LiquidBehaviour, Behaviour); exports.LiquidBehaviour = LiquidBehaviour; ================================================ FILE: src/mode/behaviour/xml.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Behaviour = require("../behaviour").Behaviour; var TokenIterator = require("../../token_iterator").TokenIterator; function is(token, type) { return token && token.type.lastIndexOf(type + ".xml") > -1; } /**@type {(new() => Partial<import("../../../ace-internal").Ace.Behaviour>)}*/ 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 tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length; if (position.column < tokenEndColumn) return; if (position.column == tokenEndColumn) { var nextToken = iterator.stepForward(); // TODO also handle non-closed string at the end of the line if (nextToken && is(nextToken, "attribute-value")) return; iterator.stepBackward(); } } if (/^\s*>/.test(session.getLine(position.row).slice(position.column))) 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 && this.voidElements.hasOwnProperty(element.toLowerCase())) return; return { text: ">" + "</" + element + ">", 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 (is(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] || !this.voidElements) { 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 === "</") { return { text: "\n" + indent + "\n" + nextIndent, selection: [1, indent.length, 1, indent.length] }; } else { return { text: "\n" + indent }; } } } } }); }; oop.inherits(XmlBehaviour, Behaviour); exports.XmlBehaviour = XmlBehaviour; ================================================ FILE: src/mode/behaviour/xquery.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Behaviour = require('../behaviour').Behaviour; var CstyleBehaviour = require('./cstyle').CstyleBehaviour; var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; var TokenIterator = require("../../token_iterator").TokenIterator; function hasType(token, type) { var hasType = true; var typeList = token.type.split('.'); var needleList = type.split('.'); needleList.forEach(function(needle){ if (typeList.indexOf(needle) == -1) { hasType = false; return false; } }); return hasType; } /**@type {(new() => Partial<import("../../../ace-internal").Ace.Behaviour>)}*/ var XQueryBehaviour = function () { this.inherit(CstyleBehaviour, ["braces", "parens", "string_dquotes"]); // Get string behaviour this.inherit(XmlBehaviour); // Get xml behaviour this.add("autoclosing", "insertion", function (state, action, editor, session, text) { if (text == '>') { 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: '>' + '</' + tag + '>', selection: [1, 1] }; } }); }; oop.inherits(XQueryBehaviour, Behaviour); exports.XQueryBehaviour = XQueryBehaviour; ================================================ FILE: src/mode/behaviour.js ================================================ "use strict"; var Behaviour; Behaviour = function() { this.$behaviours = {}; }; (function () { /** * @this {Behaviour & this} */ 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 {Behaviour & this} */ this.addBehaviours = function (behaviours) { for (var key in behaviours) { for (var action in behaviours[key]) { this.add(key, action, behaviours[key][action]); } } }; /** * @this {Behaviour & this} */ this.remove = function (name) { if (this.$behaviours && this.$behaviours[name]) { delete this.$behaviours[name]; } }; /** * @this {Behaviour & this} */ this.inherit = function (mode, filter) { if (typeof mode === "function") { var behaviours = new mode().getBehaviours(filter); } else { var behaviours = mode.getBehaviours(filter); } this.addBehaviours(behaviours); }; /** * * @param [filter] * @returns {{}|*} * @this {Behaviour & this} */ 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: src/mode/bibtex.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var BibTeXHighlightRules = require("./bibtex_highlight_rules").BibTeXHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = BibTeXHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/bibtex"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/bibtex_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var BibTeXHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: "comment", regex: /@Comment\{/, stateName: "bibtexComment", push: [ { token: "comment", regex: /}/, next: "pop" }, { token: "comment", regex: /\{/, push: "bibtexComment" }, { defaultToken: "comment" } ] }, { token: [ "keyword", "text", "paren.lparen", "text", "variable", "text", "keyword.operator" ], regex: /(@String)(\s*)(\{)(\s*)([a-zA-Z]*)(\s*)(=)/, push: [ { token: "paren.rparen", regex: /\}/, next: "pop" }, { include: "#misc" }, { defaultToken: "text" } ] }, { token: [ "keyword", "text", "paren.lparen", "text", "variable", "text", "keyword.operator" ], regex: /(@String)(\s*)(\()(\s*)([a-zA-Z]*)(\s*)(=)/, push: [ { token: "paren.rparen", regex: /\)/, next: "pop" }, { include: "#misc" }, { defaultToken: "text" } ] }, { token: [ "keyword", "text", "paren.lparen" ], regex: /(@preamble)(\s*)(\()/, push: [ { token: "paren.rparen", regex: /\)/, next: "pop" }, { include: "#misc" }, { defaultToken: "text" } ] }, { token: [ "keyword", "text", "paren.lparen" ], regex: /(@preamble)(\s*)(\{)/, push: [ { token: "paren.rparen", regex: /\}/, next: "pop" }, { include: "#misc" }, { defaultToken: "text" } ] }, { token: [ "keyword", "text", "paren.lparen", "text", "support.class" ], regex: /(@[a-zA-Z]+)(\s*)(\{)(\s*)([\w-]+)/, push: [ { token: "paren.rparen", regex: /\}/, next: "pop" }, { token: [ "variable", "text", "keyword.operator" ], regex: /([a-zA-Z0-9\!\$\&\*\+\-\.\/\:\;\<\>\?\[\]\^\_\`\|]+)(\s*)(=)/, push: [ { token: "text", regex: /(?=[,}])/, next: "pop" }, { include: "#misc" }, { include: "#integer" }, { defaultToken: "text" } ] }, { token: "punctuation", regex: /,/ }, { defaultToken: "text" } ] }, { defaultToken: "comment" } ], "#integer": [ { token: "constant.numeric.bibtex", regex: /\d+/ } ], "#misc": [ { token: "string", regex: /"/, push: "#string_quotes" }, { token: "paren.lparen", regex: /\{/, push: "#string_braces" }, { token: "keyword.operator", regex: /#/ } ], "#string_braces": [ { token: "paren.rparen", regex: /\}/, next: "pop" }, { token: "invalid.illegal", regex: /@/ }, { include: "#misc" }, { defaultToken: "string" } ], "#string_quotes": [ { token: "string", regex: /"/, next: "pop" }, { include: "#misc" }, { defaultToken: "string" } ] }; this.normalizeRules(); }; oop.inherits(BibTeXHighlightRules, TextHighlightRules); exports.BibTeXHighlightRules = BibTeXHighlightRules; ================================================ FILE: src/mode/c9search.js ================================================ "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: src/mode/c9search_highlight_rules.js ================================================ "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: src/mode/c_cpp.js ================================================ "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 CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = c_cppHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; 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"; this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/c_cpp_highlight_rules.js ================================================ "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 = "hypot|hypotf|hypotl|sscanf|system|snprintf|scanf|scalbn|scalbnf|scalbnl|scalbln|scalblnf|scalblnl|sin|sinh|sinhf|sinhl|sinf|sinl|signal|signbit|strstr|strspn|strncpy|strncat|strncmp|strcspn|strchr|strcoll|strcpy|strcat|strcmp|strtoimax|strtod|strtoul|strtoull|strtoumax|strtok|strtof|strtol|strtold|strtoll|strerror|strpbrk|strftime|strlen|strrchr|strxfrm|sprintf|setjmp|setvbuf|setlocale|setbuf|sqrt|sqrtf|sqrtl|swscanf|swprintf|srand|nearbyint|nearbyintf|nearbyintl|nexttoward|nexttowardf|nexttowardl|nextafter|nextafterf|nextafterl|nan|nanf|nanl|csin|csinh|csinhf|csinhl|csinf|csinl|csqrt|csqrtf|csqrtl|ccos|ccosh|ccoshf|ccosf|ccosl|cimag|cimagf|cimagl|ctime|ctan|ctanh|ctanhf|ctanhl|ctanf|ctanl|cos|cosh|coshf|coshl|cosf|cosl|conj|conjf|conjl|copysign|copysignf|copysignl|cpow|cpowf|cpowl|cproj|cprojf|cprojl|ceil|ceilf|ceill|cexp|cexpf|cexpl|clock|clog|clogf|clogl|clearerr|casin|casinh|casinhf|casinhl|casinf|casinl|cacos|cacosh|cacoshf|cacoshl|cacosf|cacosl|catan|catanh|catanhf|catanhl|catanf|catanl|calloc|carg|cargf|cargl|cabs|cabsf|cabsl|creal|crealf|creall|cbrt|cbrtf|cbrtl|time|toupper|tolower|tan|tanh|tanhf|tanhl|tanf|tanl|trunc|truncf|truncl|tgamma|tgammaf|tgammal|tmpnam|tmpfile|isspace|isnormal|isnan|iscntrl|isinf|isdigit|isunordered|isupper|ispunct|isprint|isfinite|iswspace|iswcntrl|iswctype|iswdigit|iswupper|iswpunct|iswprint|iswlower|iswalnum|iswalpha|iswgraph|iswxdigit|iswblank|islower|isless|islessequal|islessgreater|isalnum|isalpha|isgreater|isgreaterequal|isgraph|isxdigit|isblank|ilogb|ilogbf|ilogbl|imaxdiv|imaxabs|div|difftime|_Exit|ungetc|ungetwc|pow|powf|powl|puts|putc|putchar|putwc|putwchar|perror|printf|erf|erfc|erfcf|erfcl|erff|erfl|exit|exp|exp2|exp2f|exp2l|expf|expl|expm1|expm1f|expm1l|vsscanf|vsnprintf|vscanf|vsprintf|vswscanf|vswprintf|vprintf|vfscanf|vfprintf|vfwscanf|vfwprintf|vwscanf|vwprintf|va_start|va_copy|va_end|va_arg|qsort|fscanf|fsetpos|fseek|fclose|ftell|fopen|fdim|fdimf|fdiml|fpclassify|fputs|fputc|fputws|fputwc|fprintf|feholdexcept|fesetenv|fesetexceptflag|fesetround|feclearexcept|fetestexcept|feof|feupdateenv|feraiseexcept|ferror|fegetenv|fegetexceptflag|fegetround|fflush|fwscanf|fwide|fwprintf|fwrite|floor|floorf|floorl|fabs|fabsf|fabsl|fgets|fgetc|fgetpos|fgetws|fgetwc|freopen|free|fread|frexp|frexpf|frexpl|fmin|fminf|fminl|fmod|fmodf|fmodl|fma|fmaf|fmal|fmax|fmaxf|fmaxl|ldiv|ldexp|ldexpf|ldexpl|longjmp|localtime|localeconv|log|log1p|log1pf|log1pl|log10|log10f|log10l|log2|log2f|log2l|logf|logl|logb|logbf|logbl|labs|lldiv|llabs|llrint|llrintf|llrintl|llround|llroundf|llroundl|lrint|lrintf|lrintl|lround|lroundf|lroundl|lgamma|lgammaf|lgammal|wscanf|wcsstr|wcsspn|wcsncpy|wcsncat|wcsncmp|wcscspn|wcschr|wcscoll|wcscpy|wcscat|wcscmp|wcstoimax|wcstod|wcstoul|wcstoull|wcstoumax|wcstok|wcstof|wcstol|wcstold|wcstoll|wcstombs|wcspbrk|wcsftime|wcslen|wcsrchr|wcsrtombs|wcsxfrm|wctob|wctomb|wcrtomb|wprintf|wmemset|wmemchr|wmemcpy|wmemcmp|wmemmove|assert|asctime|asin|asinh|asinhf|asinhl|asinf|asinl|acos|acosh|acoshf|acoshl|acosf|acosl|atoi|atof|atol|atoll|atexit|atan|atanh|atanhf|atanhl|atan2|atan2f|atan2l|atanf|atanl|abs|abort|gets|getc|getchar|getenv|getwc|getwchar|gmtime|rint|rintf|rintl|round|roundf|roundl|rename|realloc|rewind|remove|remquo|remquof|remquol|remainder|remainderf|remainderl|rand|raise|bsearch|btowc|modf|modff|modfl|memset|memchr|memcpy|memcmp|memmove|mktime|malloc|mbsinit|mbstowcs|mbsrtowcs|mbtowc|mblen|mbrtowc|mbrlen"; var c_cppHighlightRules = function(extraKeywords) { 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|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|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(Object.assign({ "keyword.control" : keywordControls, "storage.type" : storageType, "storage.modifier" : storageModifiers, "keyword.operator" : keywordOperators, "variable.language": "this", "constant.language": builtinConstants, "support.function.C99.c": cFunctions }, extraKeywords), "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 : 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: src/mode/cirru.js ================================================ "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: src/mode/cirru_highlight_rules.js ================================================ "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: src/mode/clojure.js ================================================ "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"; this.snippetFileId = "ace/snippets/clojure"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/clojure_highlight_rules.js ================================================ "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 : "string.regexp", //Regular Expressions regex : '#"', next: "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]+/ } ], "string" : [ { token : "constant.language.escape", regex : "\\\\.|\\\\$" }, { token : "string", regex : '"', next : "start" }, { defaultToken: "string" } ], "regex": [ { // escapes token: "regexp.keyword.operator", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" }, { // flag token: "string.regexp", regex: '"', next: "start" }, { // operators token : "constant.language.escape", regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ }, { token : "constant.language.delimiter", regex: /\|/ }, { token: "constant.language.escape", regex: /\[\^?/, next: "regex_character_class" }, { defaultToken: "string.regexp" } ], "regex_character_class": [ { token: "regexp.charclass.keyword.operator", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" }, { token: "constant.language.escape", regex: "]", next: "regex" }, { token: "constant.language.escape", regex: "-" }, { defaultToken: "string.regexp.charachterclass" } ] }; }; oop.inherits(ClojureHighlightRules, TextHighlightRules); exports.ClojureHighlightRules = ClojureHighlightRules; ================================================ FILE: src/mode/clue.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 */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ClueHighlightRules = require("./clue_highlight_rules").ClueHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { this.HighlightRules = ClueHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function () { this.lineCommentStart = "//"; this.blockComment = { start: "/*", end: "*/" }; this.$quotes = { '"': '"', "'": "'", "`": "`" }; this.$pairQuotesAfter = { "`": /\w/ }; this.$id = "ace/mode/clue"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/clue_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 clue.json (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ClueHighlightRules = function () { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ token: [ "keyword.control.directive.clue", "text", "text" ], regex: /(@version)( )(.+?(?=\n))/ }, { token: ["keyword.control.macro.clue", "text", "text"], regex: /(@macro)( )([A-Za-z_][0-9A-Za-z_]*)/ }, { token: [ "keyword.control.import.clue", "text", "string" ], regex: /(@import)( )(".*")/ }, { token: "meta.preprocessor.macro.invocation.clue", regex: /\$[A-Za-z_][0-9A-Za-z_]*!/ }, { token: "keyword.control.directive.clue", regex: /@(?:(?:else_)?(?:ifos|iflua|ifdef|ifndef|ifcmp|ifos|iflua|ifdef|ifcmp|if)|else|define|macro|error|print)/ }, { token: "constant.numeric.integer.hexadecimal.clue", regex: /\b0[xX][0-9A-Fa-f]+(?![pPeE.0-9])\b/ }, { token: "constant.numeric.float.hexadecimal.clue", regex: /\b0[xX][0-9A-Fa-f]+(?:\.[0-9A-Fa-f]+)?(?:[eE]-?\d*)?(?:[pP][-+]\d+)?\b/ }, { token: "constant.numeric.integer.clue", regex: /\b\d+(?![pPeE.0-9])/ }, { token: "constant.numeric.float.clue", regex: /\b\d+(?:\.\d+)?(?:[eE]-?\d*)?/ }, { token: "punctuation.definition.string.multilined.begin.clue", regex: /'/, push: [{ token: "punctuation.definition.string.multilined.end.clue", regex: /'/, next: "pop" }, { include: "#escaped_char" }, { defaultToken: "string.quoted.single.clue" }] }, { token: "punctuation.definition.string.multilined.begin.clue", regex: /"/, push: [{ token: "punctuation.definition.string.multilined.end.clue", regex: /"/, next: "pop" }, { include: "#escaped_char" }, { defaultToken: "string.quoted.double.clue" }] }, { token: "punctuation.definition.string.multilined.begin.clue", regex: /`/, push: [{ token: "punctuation.definition.string.multilined.end.clue", regex: /`/, next: "pop" }, { include: "#escaped_char" }, { defaultToken: "string.multiline.clue" }] }, { token: "comment.line.double-dash.clue", regex: /\/\/.*/ }, { token: "punctuation.definition.comment.begin.clue", regex: /\/\*/, push: [{ token: "punctuation.definition.comment.end.clue", regex: /\*\//, next: "pop" }, { include: "#escaped_char" }, { defaultToken: "comment.block.clue" }] }, { token: "keyword.control.clue", regex: /\b(?:if|elseif|else|for|of|in|with|while|meta|until|fn|method|return|loop|enum|goto|continue|break|try|catch|match|default|macro)\b/ }, { token: "keyword.scope.clue", regex: /\b(?:local|global|static)\b/ }, { token: "constant.language.clue", regex: /\b(?:false|nil|true|_G|_VERSION|math\.(?:pi|huge))\b/ }, { token: "constant.language.ellipsis.clue", regex: /\.{3}(?!\.)/ }, { token: "keyword.operator.property.clue", regex: /\.|::/, next: "property_identifier" }, { token: "keyword.operator.clue", regex: /\/_|\&|\||\!|\~|\?|\$|@|\+|-|%|#|\*|\/|\^|==?|<=?|>=?|\.{2}|\?\?=?|(?:&&|\|\|)=?/ }, { token: "variable.language.self.clue", regex: /\bself\b/ }, { token: "support.function.any-method.clue", regex: /\b[a-zA-Z_][a-zA-Z0-9_]*\b(?=\(\s*)/ }, { token: "variable.other.clue", regex: /[A-Za-z_][0-9A-Za-z_]*/ }], "#escaped_char": [{ token: "constant.character.escape.clue", regex: /\\[abfnrtvz\\"'$]/ }, { token: "constant.character.escape.byte.clue", regex: /\\\d{1,3}/ }, { token: "constant.character.escape.byte.clue", regex: /\\x[0-9A-Fa-f][0-9A-Fa-f]/ }, { token: "constant.character.escape.unicode.clue", regex: /\\u\{[0-9A-Fa-f]+\}/ }, { token: "invalid.illegal.character.escape.clue", regex: /\\./ }], property_identifier: [{ token: "variable.other.property.clue", regex: /[A-Za-z_][0-9A-Za-z_]*/, next: "start" }, { token: "", regex: "", next: "start" }], }; this.normalizeRules(); }; ClueHighlightRules.metaData = { name: "Clue", scopeName: "source.clue" }; oop.inherits(ClueHighlightRules, TextHighlightRules); exports.ClueHighlightRules = ClueHighlightRules; ================================================ FILE: src/mode/cobol.js ================================================ "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: src/mode/cobol_highlight_rules.js ================================================ "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: src/mode/coffee.js ================================================ "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"; this.snippetFileId = "ace/snippets/coffee"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/coffee_highlight_rules.js ================================================ "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|yield|export|import|default" ); var langConstant = ( "true|false|null|undefined|NaN|Infinity" ); var illegal = ( "case|const|function|var|void|with|enum|implements|" + "interface|let|package|private|protected|public|static" ); 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: src/mode/coldfusion.js ================================================ "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: src/mode/coldfusion_highlight_rules.js ================================================ "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.start", push: "cfmlComment"}, { regex: "--->", token: "comment.end", next: "pop"}, { defaultToken: "comment"} ] }, "", [ { regex: "<!---", token: "comment.start", push: "cfmlComment"} ], [ "comment", "start", "tag_whitespace", "cdata" ].concat(jsAndCss)); this.$rules.cfTag = [ {include : "attributes"}, {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "pop"} ]; var cfTag = { token : function(start, tag) { return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml", "keyword.tag-name.xml"]; }, regex : "(</?)(cf[-_a-zA-Z0-9:.]+)", push: "cfTag" }; jsAndCss.forEach(function(s) { this.$rules[s].unshift(cfTag); }, this); this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "cfjs-", "cfscript"); this.normalizeRules(); }; oop.inherits(ColdfusionHighlightRules, HtmlHighlightRules); exports.ColdfusionHighlightRules = ColdfusionHighlightRules; ================================================ FILE: src/mode/coldfusion_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var Range = require("../range").Range; var ColdfusionMode = require("./coldfusion").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new ColdfusionMode(); }, "test: toggle comment lines" : function() { var session = new EditSession([" abc", " cde", "fg"]); var range = new Range(0, 3, 1, 1); var comment = this.mode.toggleCommentLines("start", session, 0, 1); assert.equal([" <!--abc-->", " <!--cde-->", "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")); } }; require("../test/run")(module); ================================================ FILE: src/mode/crystal.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CrystalHighlightRules = require("./crystal_highlight_rules").CrystalHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = CrystalHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; 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*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); var startingConditional = line.match(/^\s*(if|else|when)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } } return indent; }; this.checkOutdent = function(state, line, input) { return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { var line = session.getLine(row); if (/}/.test(line)) return this.$outdent.autoOutdent(session, row); var indent = this.$getIndent(line); var prevLine = session.getLine(row - 1); var prevIndent = this.$getIndent(prevLine); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) session.remove(new Range(row, indent.length-tab.length, row, indent.length)); } }; this.$id = "ace/mode/crystal"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/crystal_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CrystalHighlightRules = function () { var builtinFunctions = ( "puts|initialize|previous_def|typeof|as|pointerof|sizeof|instance_sizeof" ); var keywords = ( "if|end|else|elsif|unless|case|when|break|while|next|until|def|return|class|new|getter|setter|property|lib" + "|fun|do|struct|private|protected|public|module|super|abstract|include|extend|begin|enum|raise|yield|with" + "|alias|rescue|ensure|macro|uninitialized|union|type|require" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|__LINE__|__END_LINE__|__FILE__|__DIR__" ); var builtinVariables = ( "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" + "root_url|flash|session|cookies|params|request|response|logger|self" ); var keywordMapper = this.$keywords = this.createKeywordMapper({ "keyword": keywords, "constant.language": buildinConstants, "variable.language": builtinVariables, "support.function": builtinFunctions }, "identifier"); var hexNumber = "(?:0[xX][\\dA-Fa-f]+)"; var decNumber = "(?:[0-9][\\d_]*)"; var octNumber = "(?:0o[0-7][0-7]*)"; var binNumber = "(?:0[bB][01]+)"; var intNumber = "(?:[+-]?)(?:" + hexNumber + "|" + decNumber + "|" + octNumber + "|" + binNumber + ")(?:_?[iIuU](?:8|16|32|64))?\\b"; var escapeExpression = /\\(?:[nsrtvfbae'"\\]|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u{[\da-fA-F]{1,6}})/; var extEscapeExspresssion = /\\(?:[nsrtvfbae'"\\]|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u{[\da-fA-F]{1,6}}|u{(:?[\da-fA-F]{2}\s)*[\da-fA-F]{2}})/; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start": [ { token: "comment", regex: "#.*$" }, { token: "string.regexp", regex: "[/]", push: [{ token: "constant.language.escape", regex: extEscapeExspresssion }, { token: "string.regexp", regex: "[/][imx]*(?=[).,;\\s]|$)", next: "pop" }, { defaultToken: "string.regexp" }] }, [{ regex: "[{}]", onMatch: function (val, state, stack) { this.next = val == "{" ? this.nextState : ""; if (val == "{" && stack.length) { stack.unshift("start", state); return "paren.lparen"; } if (val == "}" && stack.length) { stack.shift(); this.next = stack.shift(); if (this.next.indexOf("string") != -1) return "paren.end"; } return val == "{" ? "paren.lparen" : "paren.rparen"; }, nextState: "start" }, { token: "string.start", regex: /"/, push: [{ token: "constant.language.escape", regex: extEscapeExspresssion }, { token: "string", regex: /\\#{/ }, { token: "paren.start", regex: /#{/, push: "start" }, { token: "string.end", regex: /"/, next: "pop" }, { defaultToken: "string" }] }, { token: "string.start", regex: /`/, push: [{ token: "constant.language.escape", regex: extEscapeExspresssion }, { token: "string", regex: /\\#{/ }, { token: "paren.start", regex: /#{/, push: "start" }, { token: "string.end", regex: /`/, next: "pop" }, { defaultToken: "string" }] }, { stateName: "rpstring", token: "string.start", regex: /%[Qx]?\(/, push: [{ token: "constant.language.escape", regex: extEscapeExspresssion }, { token: "string.start", regex: /\(/, push: "rpstring" }, { token: "string.end", regex: /\)/, next: "pop" }, { token: "paren.start", regex: /#{/, push: "start" }, { defaultToken: "string" }] }, { stateName: "spstring", token: "string.start", regex: /%[Qx]?\[/, push: [{ token: "constant.language.escape", regex: extEscapeExspresssion }, { token: "string.start", regex: /\[/, push: "spstring" }, { token: "string.end", regex: /]/, next: "pop" }, { token: "paren.start", regex: /#{/, push: "start" }, { defaultToken: "string" }] }, { stateName: "fpstring", token: "string.start", regex: /%[Qx]?{/, push: [{ token: "constant.language.escape", regex: extEscapeExspresssion }, { token: "string.start", regex: /{/, push: "fpstring" }, { token: "string.end", regex: /}/, next: "pop" }, { token: "paren.start", regex: /#{/, push: "start" }, { defaultToken: "string" }] }, { stateName: "tpstring", token: "string.start", regex: /%[Qx]?</, push: [{ token: "constant.language.escape", regex: extEscapeExspresssion }, { token: "string.start", regex: /</, push: "tpstring" }, { token: "string.end", regex: />/, next: "pop" }, { token: "paren.start", regex: /#{/, push: "start" }, { defaultToken: "string" }] }, { stateName: "ppstring", token: "string.start", regex: /%[Qx]?\|/, push: [{ token: "constant.language.escape", regex: extEscapeExspresssion }, { token: "string.end", regex: /\|/, next: "pop" }, { token: "paren.start", regex: /#{/, push: "start" }, { defaultToken: "string" }] }, { stateName: "rpqstring", token: "string.start", regex: /%[qwir]\(/, push: [{ token: "string.start", regex: /\(/, push: "rpqstring" }, { token: "string.end", regex: /\)/, next: "pop" }, { defaultToken: "string" }] }, { stateName: "spqstring", token: "string.start", regex: /%[qwir]\[/, push: [{ token: "string.start", regex: /\[/, push: "spqstring" }, { token: "string.end", regex: /]/, next: "pop" }, { defaultToken: "string" }] }, { stateName: "fpqstring", token: "string.start", regex: /%[qwir]{/, push: [{ token: "string.start", regex: /{/, push: "fpqstring" }, { token: "string.end", regex: /}/, next: "pop" }, { defaultToken: "string" }] }, { stateName: "tpqstring", token: "string.start", regex: /%[qwir]</, push: [{ token: "string.start", regex: /</, push: "tpqstring" }, { token: "string.end", regex: />/, next: "pop" }, { defaultToken: "string" }] }, { stateName: "ppqstring", token: "string.start", regex: /%[qwir]\|/, push: [{ token: "string.end", regex: /\|/, next: "pop" }, { defaultToken: "string" }] }, { token: "string.start", regex: /'/, push: [{ token: "constant.language.escape", regex: escapeExpression }, { token: "string.end", regex: /'|$/, next: "pop" }, { defaultToken: "string" }] }], { token: "text", // namespaces aren't symbols regex: "::" }, { token: "variable.instance", // instance variable regex: "@{1,2}[a-zA-Z_\\d]+" }, { token: "variable.fresh", // fresh variable regex: "%[a-zA-Z_\\d]+" }, { token: "support.class", // class name regex: "[A-Z][a-zA-Z_\\d]+" }, { token: "constant.other.symbol", // symbol regex: "[:](?:(?:===|<=>|\\[]\\?|\\[]=|\\[]|>>|\\*\\*|<<|==|!=|>=|<=|!~|=~|<|\\+|-|\\*|\\/|%|&|\\||\\^|>|!|~)|(?:(?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?))" }, { token: "constant.numeric", // float regex: "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?(?:_?[fF](?:32|64))?\\b" }, { token: "constant.numeric", regex: intNumber }, { token: "constant.other.symbol", regex: ':"', push: [{ token: "constant.language.escape", regex: extEscapeExspresssion }, { token: "constant.other.symbol", regex: '"', next: "pop" }, { defaultToken: "constant.other.symbol" }] }, { token: "constant.language.boolean", regex: "(?:true|false)\\b" }, { token: "support.function", regex: "(?:is_a\\?|nil\\?|responds_to\\?|as\\?)" }, { token: keywordMapper, regex: "[a-zA-Z_$][a-zA-Z0-9_$!?]*\\b" }, { token: "variable.system", regex: "\\$\\!|\\$\\?" }, { token: "punctuation.separator.key-value", regex: "=>" }, { stateName: "heredoc", onMatch: function (value, currentState, stack) { var next = "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ {type: "constant", value: tokens[1]}, {type: "string", value: tokens[2]}, {type: "support.class", value: tokens[3]}, {type: "string", value: tokens[4]} ]; }, regex: "(<<-)([']?)([\\w]+)([']?)", rules: { heredoc: [{ token: "string", regex: "^ +" }, { onMatch: function (value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); this.next = stack[0] || "start"; return "support.class"; } this.next = ""; return "string"; }, regex: ".*$", next: "start" }] } }, { regex: "$", token: "empty", next: function (currentState, stack) { if (stack[0] === "heredoc") return stack[0]; return currentState; } }, { token: "punctuation.operator", regex: /[.]\s*(?![.])/, push: [{ token : "punctuation.operator", regex : /[.]\s*(?![.])/ }, { token : "support.function", regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { regex: "", token: "empty", next: "pop" }] }, { token: "keyword.operator", regex: "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|\\?|\\:|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\^|\\|" }, { token: "punctuation.operator", regex: /[?:,;.]/ }, { token: "paren.lparen", regex: "[[({]" }, { token: "paren.rparen", regex: "[\\])}]" }, { token: "text", regex: "\\s+" } ] }; this.normalizeRules(); }; oop.inherits(CrystalHighlightRules, TextHighlightRules); exports.CrystalHighlightRules = CrystalHighlightRules; ================================================ FILE: src/mode/csharp.js ================================================ "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 CStyleFoldMode = require("./folding/csharp").FoldMode; var Mode = function() { this.HighlightRules = CSharpHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; 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: src/mode/csharp_highlight_rules.js ================================================ "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|async|await|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: src/mode/csound_document.js ================================================ "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); (function() { this.$id = "ace/mode/csound_document"; this.snippetFileId = "ace/snippets/csound_document"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/csound_document_highlight_rules.js ================================================ "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() { var orchestraHighlightRules = new CsoundOrchestraHighlightRules("csound-"); var scoreHighlightRules = new CsoundScoreHighlightRules("csound-score-"); 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 : "(</)(CsoundSynthesi[sz]er)(>)", 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 : orchestraHighlightRules.embeddedRulePrefix + "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 : scoreHighlightRules.embeddedRulePrefix + "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(orchestraHighlightRules.getRules(), orchestraHighlightRules.embeddedRulePrefix, [{ token : ["meta.tag.punctuation.end-tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : "(</)(CsInstruments)(>)", next : "synthesizer" }]); this.embedRules(scoreHighlightRules.getRules(), scoreHighlightRules.embeddedRulePrefix, [{ token : ["meta.tag.punctuation.end-tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : "(</)(CsScore)(>)", 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 : "(</)([Hh][Tt][Mm][Ll])(>)", next : "synthesizer" }]); this.normalizeRules(); }; oop.inherits(CsoundDocumentHighlightRules, TextHighlightRules); exports.CsoundDocumentHighlightRules = CsoundDocumentHighlightRules; ================================================ FILE: src/mode/csound_orchestra.js ================================================ "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: "*/"}; this.$id = "ace/mode/csound_orchestra"; this.snippetFileId = "ace/snippets/csound_orchestra"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/csound_orchestra_highlight_rules.js ================================================ "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(embeddedRulePrefix) { CsoundPreprocessorHighlightRules.call(this, embeddedRulePrefix); // To update the opcodes and deprecatedOpcodes arrays, run /* curl --remote-name --show-error --silent https://raw.githubusercontent.com/pygments/pygments/master/pygments/lexers/_csound_builtins.py python -c "import json; from _csound_builtins import OPCODES, DEPRECATED_OPCODES, REMOVED_OPCODES; print('var opcodes = {};'.format(json.dumps(sorted(list(OPCODES)), indent=4))); print('var deprecatedOpcodes = {};'.format(json.dumps(sorted(list(DEPRECATED_OPCODES.union(REMOVED_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", "OSCbundle", "OSCcount", "OSCinit", "OSCinitM", "OSClisten", "OSCraw", "OSCsend", "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", "allpole", "alpass", "alwayson", "ampdb", "ampdbfs", "ampmidi", "ampmidicurve", "ampmidid", "apoleparams", "arduinoRead", "arduinoReadF", "arduinoStart", "arduinoStop", "areson", "aresonk", "atone", "atonek", "atonex", "autocorr", "babo", "balance", "balance2", "bamboo", "barmodel", "bbcutm", "bbcuts", "betarand", "bexprnd", "bformdec1", "bformdec2", "bformenc1", "binit", "biquad", "biquada", "birnd", "bob", "bpf", "bpfcos", "bqrez", "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", "chngeta", "chngeti", "chngetk", "chngetks", "chngets", "chnmix", "chnparams", "chnset", "chnseta", "chnseti", "chnsetk", "chnsetks", "chnsets", "chuap", "clear", "clfilt", "clip", "clockoff", "clockon", "cmp", "cmplxprod", "cntCreate", "cntCycles", "cntDelete", "cntDelete_i", "cntRead", "cntReset", "cntState", "comb", "combinv", "compilecsd", "compileorc", "compilestr", "compress", "compress2", "connect", "control", "convle", "convolve", "copya2ftab", "copyf2array", "cos", "cosh", "cosinv", "cosseg", "cossegb", "cossegr", "count", "count_i", "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", "ctrlpreset", "ctrlprint", "ctrlprintpresets", "ctrlsave", "ctrlselect", "cuserrnd", "dam", "date", "dates", "db", "dbamp", "dbfsamp", "dcblock", "dcblock2", "dconv", "dct", "dctinv", "deinterleave", "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", "elapsedcycles", "elapsedtime", "envlpx", "envlpxr", "ephasor", "eqfil", "evalstr", "event", "event_i", "eventcycles", "eventtime", "exciter", "exitnow", "exp", "expcurve", "expon", "exprand", "exprandi", "expseg", "expsega", "expsegb", "expsegba", "expsegr", "fareylen", "fareyleni", "faustaudio", "faustcompile", "faustctl", "faustdsp", "faustgen", "faustplay", "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", "fluidInfo", "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", "ftaudio", "ftchnls", "ftconv", "ftcps", "ftexists", "ftfree", "ftgen", "ftgenonce", "ftgentmp", "ftlen", "ftload", "ftloadk", "ftlptim", "ftmorf", "ftom", "ftprint", "ftresize", "ftresizei", "ftsamplebank", "ftsave", "ftsavek", "ftset", "ftslice", "ftslicei", "ftsr", "gain", "gainslider", "gauss", "gaussi", "gausstrig", "gbuzz", "genarray", "genarray_i", "gendy", "gendyc", "gendyx", "getcfg", "getcol", "getftargs", "getrow", "getseed", "gogobel", "grain", "grain2", "grain3", "granule", "gtadsr", "gtf", "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", "interleave", "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", "lag", "lagud", "lastcycle", "lenarray", "lfo", "lfsr", "limit", "limit1", "lincos", "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", "loscil3phs", "loscilphs", "loscilx", "lowpass2", "lowres", "lowresx", "lpcanal", "lpcfilter", "lpf18", "lpform", "lpfreson", "lphasor", "lpinterp", "lposcil", "lposcil3", "lposcila", "lposcilsa", "lposcilsa2", "lpread", "lpreson", "lpshold", "lpsholdp", "lpslot", "lufs", "mac", "maca", "madsr", "mags", "mandel", "mandol", "maparray", "maparray_i", "marimba", "massign", "max", "max_k", "maxabs", "maxabsaccum", "maxaccum", "maxalloc", "maxarray", "mclock", "mdelay", "median", "mediank", "metro", "metro2", "metrobpm", "mfb", "midglobal", "midiarp", "midic14", "midic21", "midic7", "midichannelaftertouch", "midichn", "midicontrolchange", "midictrl", "mididefault", "midifilestatus", "midiin", "midinoteoff", "midinoteoncps", "midinoteonkey", "midinoteonoct", "midinoteonpch", "midion", "midion2", "midiout", "midiout_i", "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", "mp3out", "mp3scal", "mp3sr", "mpulse", "mrtmsg", "ms2st", "mtof", "mton", "multitap", "mute", "mvchpf", "mvclpf1", "mvclpf2", "mvclpf3", "mvclpf4", "mvmfilter", "mxadsr", "nchnls_hw", "nestedap", "nlalp", "nlfilt", "nlfilt2", "noise", "noteoff", "noteon", "noteondur", "noteondur2", "notnum", "nreverb", "nrpn", "nsamp", "nstance", "nstrnum", "nstrstr", "ntof", "ntom", "ntrpol", "nxtpow2", "octave", "octcps", "octmidi", "octmidib", "octmidinn", "octpch", "olabuffer", "oscbnk", "oscil", "oscil1", "oscil1i", "oscil3", "oscili", "oscilikt", "osciliktp", "oscilikts", "osciln", "oscils", "oscilx", "out", "out32", "outall", "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", "printarray", "printf", "printf_i", "printk", "printk2", "printks", "printks2", "println", "prints", "printsk", "product", "pset", "ptablew", "ptrack", "puts", "pvadd", "pvbufread", "pvcross", "pvinterp", "pvoc", "pvread", "pvs2array", "pvs2tab", "pvsadsyn", "pvsanal", "pvsarp", "pvsbandp", "pvsbandr", "pvsbandwidth", "pvsbin", "pvsblur", "pvsbuffer", "pvsbufread", "pvsbufread2", "pvscale", "pvscent", "pvsceps", "pvscfs", "pvscross", "pvsdemix", "pvsdiskin", "pvsdisp", "pvsenvftw", "pvsfilter", "pvsfread", "pvsfreeze", "pvsfromarray", "pvsftr", "pvsftw", "pvsfwrite", "pvsgain", "pvsgendy", "pvshift", "pvsifd", "pvsin", "pvsinfo", "pvsinit", "pvslock", "pvslpc", "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", "randc", "randh", "randi", "random", "randomh", "randomi", "rbjeq", "readclock", "readf", "readfi", "readk", "readk2", "readk3", "readk4", "readks", "readscore", "readscratch", "rect2pol", "release", "remoteport", "remove", "repluck", "reshapearray", "reson", "resonbnk", "resonk", "resonr", "resonx", "resonxk", "resony", "resonz", "resyn", "reverb", "reverb2", "reverbsc", "rewindscore", "rezzy", "rfft", "rifft", "rms", "rnd", "rnd31", "rndseed", "round", "rspline", "rtclock", "s16b14", "s32b14", "samphold", "sandpaper", "sc_lag", "sc_lagud", "sc_phasor", "sc_trig", "scale", "scale2", "scalearray", "scanhammer", "scanmap", "scans", "scansmap", "scantable", "scanu", "scanu2", "schedkwhen", "schedkwhennamed", "schedule", "schedulek", "schedwhen", "scoreline", "scoreline_i", "seed", "sekere", "select", "semitone", "sense", "sensekey", "seqtime", "seqtime2", "sequ", "sequstate", "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", "signum", "sin", "sinh", "sininv", "sinsyn", "skf", "sleighbells", "slicearray", "slicearray_i", "slider16", "slider16f", "slider16table", "slider16tablef", "slider32", "slider32f", "slider32table", "slider32tablef", "slider64", "slider64f", "slider64table", "slider64tablef", "slider8", "slider8f", "slider8table", "slider8tablef", "sliderKawai", "sndloop", "sndwarp", "sndwarpst", "sockrecv", "sockrecvs", "socksend", "socksends", "sorta", "sortd", "soundin", "space", "spat3d", "spat3di", "spat3dt", "spdist", "spf", "splitrig", "sprintf", "sprintfk", "spsend", "sqrt", "squinewave", "st2ms", "statevar", "sterrain", "stix", "strcat", "strcatk", "strchar", "strchark", "strcmp", "strcmpk", "strcpy", "strcpyk", "strecv", "streson", "strfromurl", "strget", "strindex", "strindexk", "string2array", "strlen", "strlenk", "strlower", "strlowerk", "strrindex", "strrindexk", "strset", "strstrip", "strsub", "strsubk", "strtod", "strtodk", "strtol", "strtolk", "strupper", "strupperk", "stsend", "subinstr", "subinstrinit", "sum", "sumarray", "svfilter", "svn", "syncgrain", "syncloop", "syncphasor", "system", "system_i", "tab", "tab2array", "tab2pvs", "tab_i", "tabifd", "table", "table3", "table3kt", "tablecopy", "tablefilter", "tablefilteri", "tablegpw", "tablei", "tableicopy", "tableigpw", "tableikt", "tableimix", "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", "tbvcf", "tempest", "tempo", "temposcal", "tempoval", "timedseq", "timeinstk", "timeinsts", "timek", "times", "tival", "tlineto", "tone", "tonek", "tonex", "tradsyn", "trandom", "transeg", "transegb", "transegr", "trcross", "trfilter", "trhighest", "trigExpseg", "trigLinseg", "trigexpseg", "trigger", "trighold", "triglinseg", "trigphasor", "trigseq", "trim", "trim_i", "trirand", "trlowest", "trmix", "trscale", "trshift", "trsplit", "turnoff", "turnoff2", "turnoff2_i", "turnoff3", "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", "vclpf", "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", "vps", "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", "wterrain2", "xadsr", "xin", "xout", "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 = [ "OSCsendA", "array", "beadsynt", "beosc", "bformdec", "bformenc", "buchla", "copy2ftab", "copy2ttab", "getrowlin", "hrtfer", "ktableseg", "lentab", "lua_exec", "lua_iaopcall", "lua_iaopcall_off", "lua_ikopcall", "lua_ikopcall_off", "lua_iopcall", "lua_iopcall_off", "lua_opdef", "maxtab", "mintab", "mp3scal_check", "mp3scal_load", "mp3scal_load2", "mp3scal_play", "mp3scal_play2", "pop", "pop_f", "ptable", "ptable3", "ptablei", "ptableiw", "push", "push_f", "pvsgendy", "scalet", "signalflowgraph", "sndload", "socksend_k", "soundout", "soundouts", "specaddm", "specdiff", "specdisp", "specfilt", "spechist", "specptrk", "specscal", "specsum", "spectrum", "stack", "sumTableFilter", "sumtab", "systime", "tabgen", "tableiw", "tabmap", "tabmap_i", "tabrowlin", "tabslice", "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", "vbap16", "vbap1move", "vbap4", "vbap4move", "vbap8", "vbap8move", "xscanmap", "xscans", "xscansmap", "xscanu", "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" }); var scoreHighlightRules = new CsoundScoreHighlightRules("csound-score-"); 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 : scoreHighlightRules.embeddedRulePrefix + "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(scoreHighlightRules.getRules(), scoreHighlightRules.embeddedRulePrefix, rules); this.embedRules(PythonHighlightRules, "python-", rules); this.embedRules(LuaHighlightRules, "lua-", rules); this.normalizeRules(); }; oop.inherits(CsoundOrchestraHighlightRules, CsoundPreprocessorHighlightRules); exports.CsoundOrchestraHighlightRules = CsoundOrchestraHighlightRules; ================================================ FILE: src/mode/csound_preprocessor_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CsoundPreprocessorHighlightRules = function(embeddedRulePrefix) { this.embeddedRulePrefix = embeddedRulePrefix === undefined ? "" : embeddedRulePrefix; 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.com/docs/manual/fprintks.html // fprints https://csound.com/docs/manual/fprints.html // printf/printf_i https://csound.com/docs/manual/printf.html // printks https://csound.com/docs/manual/printks.html // prints https://csound.com/docs/manual/prints.html // sprintf https://csound.com/docs/manual/sprintf.html // sprintfk https://csound.com/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 : /#includestr/, 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) { if (Array.isArray(params.next)) { for (var i = 0; i < params.next.length; i++) { params.next[i] = this.embeddedRulePrefix + params.next[i]; } } 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; }, get next() { return Array.isArray(params.next) ? params.next[params.next.length - 1] : params.next; }, set next(next) { if (!Array.isArray(params.next)) { params.next = next; } }, get token() { return params.token; } }; }; this.popRule = function(params) { if (params.next) { params.next = this.embeddedRulePrefix + params.next; } 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: src/mode/csound_score.js ================================================ "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: "*/"}; this.$id = "ace/mode/csound_score"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/csound_score_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var CsoundPreprocessorHighlightRules = require("./csound_preprocessor_highlight_rules").CsoundPreprocessorHighlightRules; var CsoundScoreHighlightRules = function(embeddedRulePrefix) { CsoundPreprocessorHighlightRules.call(this, embeddedRulePrefix); this.quotedStringContents.push({ token : "invalid.illegal.csound-score", regex : /[^"]*$/ }); var start = this.$rules.start; start.push( { token : "keyword.control.csound-score", regex : /[aBbCdefiqstvxy]/ }, { // 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: src/mode/csp.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var TextMode = require("./text").Mode; var CspHighlightRules = require("./csp_highlight_rules").CspHighlightRules; var oop = require("../lib/oop"); var Mode = function() { this.HighlightRules = CspHighlightRules; }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/csp"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/csp_highlight_rules.js ================================================ /* EXPLANATION This highlight rules were created to help developer spot typos when working with Content-Security-Policy (CSP). See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/ */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CspHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "constant.language": "child-src|connect-src|default-src|font-src|frame-src|img-src|manifest-src|media-src|object-src" + "|script-src|style-src|worker-src|base-uri|plugin-types|sandbox|disown-opener|form-action|frame-ancestors|report-uri" + "|report-to|upgrade-insecure-requests|block-all-mixed-content|require-sri-for|reflected-xss|referrer|policy-uri", "variable": "'none'|'self'|'unsafe-inline'|'unsafe-eval'|'strict-dynamic'|'unsafe-hashed-attributes'" }, "identifier", true); this.$rules = { start: [{ token: "string.link", regex: /https?:[^;\s]*/ }, { token: "operator.punctuation", regex: /;/ }, { token: keywordMapper, regex: /[^\s;]+/ }] }; }; oop.inherits(CspHighlightRules, TextHighlightRules); exports.CspHighlightRules = CspHighlightRules; ================================================ FILE: src/mode/css.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var WorkerClient = require("../worker/worker_client").WorkerClient; var CssCompletions = require("./css_completions").CssCompletions; var CssBehaviour = require("./behaviour/css").CssBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = CssHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CssBehaviour(); this.$completer = new CssCompletions(); this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.foldingRules = "cStyle"; this.blockComment = {start: "/*", end: "*/"}; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); // ignore braces in comments var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } 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.getCompletions = function(state, session, pos, prefix) { return this.$completer.getCompletions(state, session, pos, prefix); }; this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/css_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/css"; this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/css_completions.js ================================================ "use strict"; var propertyMap = { "background": {"#$0": 1}, "background-color": {"#$0": 1, "transparent": 1, "fixed": 1}, "background-image": {"url('/$0')": 1}, "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1}, "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2}, "background-attachment": {"scroll": 1, "fixed": 1}, "background-size": {"cover": 1, "contain": 1}, "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1}, "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1}, "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1}, "border-color": {"#$0": 1}, "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2}, "border-collapse": {"collapse": 1, "separate": 1}, "bottom": {"px": 1, "em": 1, "%": 1}, "clear": {"left": 1, "right": 1, "both": 1, "none": 1}, "color": {"#$0": 1, "rgb(#$00,0,0)": 1}, "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1}, "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1}, "empty-cells": {"show": 1, "hide": 1}, "float": {"left": 1, "right": 1, "none": 1}, "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1}, "font-size": {"px": 1, "em": 1, "%": 1}, "font-weight": {"bold": 1, "normal": 1}, "font-style": {"italic": 1, "normal": 1}, "font-variant": {"normal": 1, "small-caps": 1}, "height": {"px": 1, "em": 1, "%": 1}, "left": {"px": 1, "em": 1, "%": 1}, "letter-spacing": {"normal": 1}, "line-height": {"normal": 1}, "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1}, "margin": {"px": 1, "em": 1, "%": 1}, "margin-right": {"px": 1, "em": 1, "%": 1}, "margin-left": {"px": 1, "em": 1, "%": 1}, "margin-top": {"px": 1, "em": 1, "%": 1}, "margin-bottom": {"px": 1, "em": 1, "%": 1}, "max-height": {"px": 1, "em": 1, "%": 1}, "max-width": {"px": 1, "em": 1, "%": 1}, "min-height": {"px": 1, "em": 1, "%": 1}, "min-width": {"px": 1, "em": 1, "%": 1}, "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, "padding": {"px": 1, "em": 1, "%": 1}, "padding-top": {"px": 1, "em": 1, "%": 1}, "padding-right": {"px": 1, "em": 1, "%": 1}, "padding-bottom": {"px": 1, "em": 1, "%": 1}, "padding-left": {"px": 1, "em": 1, "%": 1}, "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1}, "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1}, "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1}, "right": {"px": 1, "em": 1, "%": 1}, "table-layout": {"fixed": 1, "auto": 1}, "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1}, "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1}, "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1}, "top": {"px": 1, "em": 1, "%": 1}, "vertical-align": {"top": 1, "bottom": 1}, "visibility": {"hidden": 1, "visible": 1}, "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1}, "width": {"px": 1, "em": 1, "%": 1}, "word-spacing": {"normal": 1}, // opacity "filter": {"alpha(opacity=$0100)": 1}, "text-shadow": {"$02px 2px 2px #777": 1}, "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1}, // border radius "-moz-border-radius": 1, "-moz-border-radius-topright": 1, "-moz-border-radius-bottomright": 1, "-moz-border-radius-topleft": 1, "-moz-border-radius-bottomleft": 1, "-webkit-border-radius": 1, "-webkit-border-top-right-radius": 1, "-webkit-border-top-left-radius": 1, "-webkit-border-bottom-right-radius": 1, "-webkit-border-bottom-left-radius": 1, // dropshadows "-moz-box-shadow": 1, "-webkit-box-shadow": 1, // transformations "transform": {"rotate($00deg)": 1, "skew($00deg)": 1}, "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1}, "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 } }; var CssCompletions = function() { }; (function() { this.completionsDefined = false; this.defineCompletions = function() { //fill in missing properties if (document) { var style = document.createElement('c').style; for (var i in style) { if (typeof style[i] !== 'string') continue; var name = i.replace(/[A-Z]/g, function(x) { return '-' + x.toLowerCase(); }); if (!propertyMap.hasOwnProperty(name)) propertyMap[name] = 1; } } this.completionsDefined = true; }; this.getCompletions = function(state, session, pos, prefix) { if (!this.completionsDefined) { this.defineCompletions(); } if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") { //css attribute value var line = session.getLine(pos.row).substr(0, pos.column); var inParens = /\([^)]*$/.test(line); if (inParens) { line = line.substr(line.lastIndexOf('(') + 1); } if (/:[^;]+$/.test(line)) { /([\w\-]+):[^:]*$/.test(line); return this.getPropertyValueCompletions(state, session, pos, prefix); } else { return this.getPropertyCompletions(state, session, pos, prefix, inParens); } } return []; }; this.getPropertyCompletions = function(state, session, pos, prefix, skipSemicolon) { skipSemicolon = skipSemicolon || false; var properties = Object.keys(propertyMap); return properties.map(function(property){ return { caption: property, snippet: property + ': $0' + (skipSemicolon ? '' : ';'), meta: "property", score: 1000000 }; }); }; this.getPropertyValueCompletions = function(state, session, pos, prefix) { var line = session.getLine(pos.row).substr(0, pos.column); var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1]; if (!property) return []; var values = []; if (property in propertyMap && typeof propertyMap[property] === "object") { values = Object.keys(propertyMap[property]); } return values.map(function(value){ return { caption: value, snippet: value, meta: "property value", score: 1000000 }; }); }; }).call(CssCompletions.prototype); exports.CssCompletions = CssCompletions; ================================================ FILE: src/mode/css_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; /* Exports are for Stylus and Less highlighters */ var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index"; var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|flex-end|flex-start|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom"; var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen"; var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))"; var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b"; var CssHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "support.function": supportFunction, "support.constant": supportConstant, "support.type": supportType, "support.constant.color": supportConstantColor, "support.constant.fonts": supportConstantFonts }, "text", true); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [{ include : ["strings", "url", "comments"] }, { token: "paren.lparen", regex: "\\{", next: "ruleset" }, { token: "paren.rparen", regex: "\\}" }, { token: "string", regex: "@(?!viewport)", next: "media" }, { token: "keyword", regex: "#[a-z0-9-_]+" }, { token: "keyword", regex: "%" }, { token: "variable", regex: "\\.[a-z0-9-_]+" }, { token: "string", regex: ":[a-z0-9-_]+" }, { token : "constant.numeric", regex : numRe }, { token: "constant", regex: "[a-z0-9-_]+" }, { caseInsensitive: true }], "media": [{ include : ["strings", "url", "comments"] }, { token: "paren.lparen", regex: "\\{", next: "start" }, { token: "paren.rparen", regex: "\\}", next: "start" }, { token: "string", regex: ";", next: "start" }, { token: "keyword", regex: "(?:media|supports|document|charset|import|namespace|media|supports|document" + "|page|font|keyframes|viewport|counter-style|font-feature-values" + "|swash|ornaments|annotation|stylistic|styleset|character-variant)" }], "comments" : [{ token: "comment", // multi line comment regex: "\\/\\*", push: [{ token : "comment", regex : "\\*\\/", next : "pop" }, { defaultToken : "comment" }] }], "ruleset" : [{ regex : "-(webkit|ms|moz|o)-", token : "text" }, { token : "punctuation.operator", regex : "[:;]" }, { token : "paren.rparen", regex : "\\}", next : "start" }, { include : ["strings", "url", "comments"] }, { token : ["constant.numeric", "keyword"], regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)" }, { token : "constant.numeric", regex : numRe }, { token : "constant.numeric", // hex6 color regex : "#[a-f0-9]{6}" }, { token : "constant.numeric", // hex3 color regex : "#[a-f0-9]{3}" }, { token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"], regex : pseudoElements }, { token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"], regex : pseudoClasses }, { include: "url" }, { token : keywordMapper, regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" }, { token: "paren.lparen", regex: "\\{" }, { caseInsensitive: true }], url: [{ token : "support.function", regex : "(?:url(:?-prefix)?|domain|regexp)\\(", push: [{ token : "support.function", regex : "\\)", next : "pop" }, { defaultToken: "string" }] }], strings: [{ token : "string.start", regex : "'", push : [{ token : "string.end", regex : "'|$", next: "pop" }, { include : "escapes" }, { token : "constant.language.escape", regex : /\\$/, consumeLineEnd: true }, { defaultToken: "string" }] }, { token : "string.start", regex : '"', push : [{ token : "string.end", regex : '"|$', next: "pop" }, { include : "escapes" }, { token : "constant.language.escape", regex : /\\$/, consumeLineEnd: true }, { defaultToken: "string" }] }], escapes: [{ token : "constant.language.escape", regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/ }] }; this.normalizeRules(); }; oop.inherits(CssHighlightRules, TextHighlightRules); exports.CssHighlightRules = CssHighlightRules; ================================================ FILE: src/mode/css_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var CssMode = require("./css").Mode; var assert = require("../test/assertions"); module.exports = { name: "CSS", setUp : function() { this.mode = new CssMode(); }, "test: toggle comment lines" : function() { var session = new EditSession([" abc", "cde", "fg"].join("\n")); var comment = this.mode.toggleCommentLines("start", session, 0, 1); assert.equal(["/* abc*/", "/*cde*/", "fg"].join("\n"), session.toString()); }, "test: lines should keep indentation" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", " abc", " ")); assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc", " ")); }, "test: new line after { should increase indent" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", " abc{", " ")); assert.equal("\t ", this.mode.getNextLineIndent("start", "\tabc { ", " ")); }, "test: no indent increase after { in a comment" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", " /*{", " ")); assert.equal(" ", this.mode.getNextLineIndent("start", " /*{ ", " ")); } }; require("../test/run")(module); ================================================ FILE: src/mode/csv.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var escapeRegExp = require("../lib/lang").escapeRegExp; var CsvHighlightRules = require("./csv_highlight_rules").CsvHighlightRules; var Mode = function(options) { this.HighlightRules = CsvHighlightRules; if (!options) options = {}; var separatorRegex = [options.splitter || ",", options.quote || '"'] .map(escapeRegExp).join("|"); this.$tokenizer = { getLineTokens: function(line, state, row) { return tokenizeCsv(line, state, this.options); }, options: { quotes: options.quote || '"', separatorRegex: new RegExp("(" + separatorRegex + ")"), spliter: options.splitter || "," }, states: {}, }; this.$highlightRules = new this.HighlightRules(); }; oop.inherits(Mode, TextMode); (function() { this.getTokenizer = function() { return this.$tokenizer; }; this.$id = "ace/mode/csv"; }).call(Mode.prototype); exports.Mode = Mode; var classNames = ["keyword", "text", "string", "string.regex", "variable", "constant.numeric"]; function tokenizeCsv(line, state, options) { var result = []; var parts = line.split(options.separatorRegex); var spliter = options.spliter; var quote = options.quote || '"'; var stateParts = (state||"start").split("-"); var column = parseInt(stateParts[1]) || 0; var inString = stateParts[0] == 'string'; var atColumnStart = !inString; for (var i = 0; i < parts.length; i++) { var value = parts[i]; if (value) { var isSeparator = false; if (value == spliter && !inString) { column++; atColumnStart = true; isSeparator = true; } else if (value == quote) { if (atColumnStart) { inString = true; atColumnStart = false; } else if (inString) { if (parts[i + 1] == '' && parts[i + 2] == quote) { value = quote + quote; i += 2; } else { inString = false; } } } else { atColumnStart = false; } result.push( { value: value, type: classNames[column % classNames.length] + ".csv_" + column + (isSeparator ? ".csv_separator" : "") } ); } } return { tokens: result, state: inString ? "string-" + column : "start" }; } ================================================ FILE: src/mode/csv_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CsvHighlightRules = function() { TextHighlightRules.call(this); }; oop.inherits(CsvHighlightRules, TextHighlightRules); exports.CsvHighlightRules = CsvHighlightRules; ================================================ FILE: src/mode/curly.js ================================================ "use strict"; var oop = require("../lib/oop"); // defines the parent mode var HtmlMode = require("./html").Mode; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var HtmlFoldMode = require("./folding/html").FoldMode; // defines the language specific highlighters and folding rules var CurlyHighlightRules = require("./curly_highlight_rules").CurlyHighlightRules; var Mode = function() { HtmlMode.call(this); this.HighlightRules = CurlyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new HtmlFoldMode(); }; oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/curly"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/curly_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var CurlyHighlightRules = function() { HtmlHighlightRules.call(this); this.$rules["start"].unshift({ token: "variable", regex: "{{", push: "curly-start" }); this.$rules["curly-start"] = [{ token: "variable", regex: "}}", next: "pop" }]; this.normalizeRules(); }; oop.inherits(CurlyHighlightRules, HtmlHighlightRules); exports.CurlyHighlightRules = CurlyHighlightRules; ================================================ FILE: src/mode/cuttlefish.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CuttlefishHighlightRules = require("./cuttlefish_highlight_rules").CuttlefishHighlightRules; var Mode = function() { this.HighlightRules = CuttlefishHighlightRules; this.foldingRules = null; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.blockComment = null; this.$id = "ace/mode/cuttlefish"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/cuttlefish_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CuttlefishHighlightRules = function () { this.$rules = { start: [{ token: ['text', 'comment'], regex: /^([ \t]*)(#.*)$/ }, { token: ['text', 'keyword', 'text', 'string', 'text', 'comment'], regex: /^([ \t]*)(include)([ \t]*)([A-Za-z0-9-\_\.\*\/]+)([ \t]*)(#.*)?$/ }, { token: ['text', 'keyword', 'text', 'operator', 'text', 'string', 'text', 'comment'], regex: /^([ \t]*)([A-Za-z0-9-_]+(?:\.[A-Za-z0-9-_]+)*)([ \t]*)(=)([ \t]*)([^ \t#][^#]*?)([ \t]*)(#.*)?$/ }, { defaultToken: 'invalid' }] }; this.normalizeRules(); }; CuttlefishHighlightRules.metaData = { fileTypes: ['conf'], keyEquivalent: '^~C', name: 'Cuttlefish', scopeName: 'source.conf' }; oop.inherits(CuttlefishHighlightRules, TextHighlightRules); exports.CuttlefishHighlightRules = CuttlefishHighlightRules; ================================================ FILE: src/mode/d.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var DHighlightRules = require("./d_highlight_rules").DHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = DHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/d"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/d_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var DHighlightRules = function() { var keywords = ( "this|super|import|module|body|mixin|__traits|invariant|alias|asm|delete|"+ "typeof|typeid|sizeof|cast|new|in|is|typedef|__vector|__parameters" ); var keywordControls = ( "break|case|continue|default|do|else|for|foreach|foreach_reverse|goto|if|" + "return|switch|while|catch|try|throw|finally|version|assert|unittest|with" ); var types = ( "auto|bool|char|dchar|wchar|byte|ubyte|float|double|real|" + "cfloat|creal|cdouble|cent|ifloat|ireal|idouble|" + "int|long|short|void|uint|ulong|ushort|ucent|" + "function|delegate|string|wstring|dstring|size_t|ptrdiff_t|hash_t|Object" ); var modifiers = ( "abstract|align|debug|deprecated|export|extern|const|final|in|inout|out|" + "ref|immutable|lazy|nothrow|override|package|pragma|private|protected|" + "public|pure|scope|shared|__gshared|synchronized|static|volatile" ); var storages = ( "class|struct|union|template|interface|enum|macro" ); var stringEscapesSeq = { token: "constant.language.escape", regex: "\\\\(?:(?:x[0-9A-F]{2})|(?:[0-7]{1,3})|(?:['\"\\?0abfnrtv\\\\])|" + "(?:u[0-9a-fA-F]{4})|(?:U[0-9a-fA-F]{8}))" }; var builtinConstants = ( "null|true|false|"+ "__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__|"+ "__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__" ); var operators = ( "/|/\\=|&|&\\=|&&|\\|\\|\\=|\\|\\||\\-|\\-\\=|\\-\\-|\\+|" + "\\+\\=|\\+\\+|\\<|\\<\\=|\\<\\<|\\<\\<\\=|\\<\\>|\\<\\>\\=|\\>|\\>\\=|\\>\\>\\=|" + "\\>\\>\\>\\=|\\>\\>|\\>\\>\\>|\\!|\\!\\=|\\!\\<\\>|\\!\\<\\>\\=|\\!\\<|\\!\\<\\=|" + "\\!\\>|\\!\\>\\=|\\?|\\$|\\=|\\=\\=|\\*|\\*\\=|%|%\\=|" + "\\^|\\^\\=|\\^\\^|\\^\\^\\=|~|~\\=|\\=\\>|#" ); var keywordMapper = this.$keywords = this.createKeywordMapper({ "keyword.modifier" : modifiers, "keyword.control" : keywordControls, "keyword.type" : types, "keyword": keywords, "keyword.storage": storages, "punctation": "\\.|\\,|;|\\.\\.|\\.\\.\\.", "keyword.operator" : operators, "constant.language": builtinConstants }, "identifier"); var identifierRe = "[a-zA-Z_\u00a1-\uffff][a-zA-Z\\d_\u00a1-\uffff]*\\b"; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { //-------------------------------------------------------- COMMENTS token : "comment", regex : "\\/\\/.*$" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi line comment regex : "\\/\\*", next : "star-comment" }, { token: "comment.shebang", regex: "^\\s*#!.*" }, { token : "comment", regex : "\\/\\+", next: "plus-comment" }, { //-------------------------------------------------------- STRINGS onMatch: function(value, currentState, state) { state.unshift(this.next, value.substr(2)); return "string"; }, regex: 'q"(?:[\\[\\(\\{\\<]+)', next: 'operator-heredoc-string' }, { onMatch: function(value, currentState, state) { state.unshift(this.next, value.substr(2)); return "string"; }, regex: 'q"(?:[a-zA-Z_]+)$', next: 'identifier-heredoc-string' }, { token : "string", // multi line string start regex : '[xr]?"', next : "quote-string" }, { token : "string", // multi line string start regex : '[xr]?`', next : "backtick-string" }, { token : "string", // single line regex : "[xr]?['](?:(?:\\\\.)|(?:[^'\\\\]))*?['][cdw]?" }, { //-------------------------------------------------------- RULES token: ["keyword", "text", "paren.lparen"], regex: /(asm)(\s*)({)/, next: "d-asm" }, { token: ["keyword", "text", "paren.lparen", "constant.language"], regex: "(__traits)(\\s*)(\\()("+identifierRe+")" }, { // import|module abc token: ["keyword", "text", "variable.module"], regex: "(import|module)(\\s+)((?:"+identifierRe+"\\.?)*)" }, { // storage Name token: ["keyword.storage", "text", "entity.name.type"], regex: "("+storages+")(\\s*)("+identifierRe+")" }, { // alias|typedef foo bar; token: ["keyword", "text", "variable.storage", "text"], regex: "(alias|typedef)(\\s*)("+identifierRe+")(\\s*)" }, { //-------------------------------------------------------- OTHERS token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F_]+(l|ul|u|f|F|L|U|UL)?\\b" }, { token : "constant.numeric", // float regex : "[+-]?\\d[\\d_]*(?:(?:\\.[\\d_]*)?(?:[eE][+-]?[\\d_]+)?)?(l|ul|u|f|F|L|U|UL)?\\b" }, { token: "entity.other.attribute-name", regex: "@"+identifierRe }, { token : keywordMapper, regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b" }, { token : "keyword.operator", regex : operators }, { token : "punctuation.operator", regex : "\\?|\\:|\\,|\\;|\\.|\\:" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "star-comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken: 'comment' } ], "plus-comment" : [ { token : "comment", // closing comment regex : "\\+\\/", next : "start" }, { defaultToken: 'comment' } ], "quote-string" : [ stringEscapesSeq, { token : "string", regex : '"[cdw]?', next : "start" }, { defaultToken: 'string' } ], "backtick-string" : [ stringEscapesSeq, { token : "string", regex : '`[cdw]?', next : "start" }, { defaultToken: 'string' } ], "operator-heredoc-string": [ { onMatch: function(value, currentState, state) { value = value.substring(value.length-2, value.length-1); var map = {'>':'<',']':'[',')':'(','}':'{'}; if(Object.keys(map).indexOf(value) != -1) value = map[value]; if(value != state[1]) return "string"; state.shift(); state.shift(); return "string"; }, regex: '(?:[\\]\\)}>]+)"', next: 'start' }, { token: 'string', regex: '[^\\]\\)}>]+' } ], "identifier-heredoc-string": [ { onMatch: function(value, currentState, state) { value = value.substring(0, value.length-1); if(value != state[1]) return "string"; state.shift(); state.shift(); return "string"; }, regex: '^(?:[A-Za-z_][a-zA-Z0-9]+)"', next: 'start' }, { token: 'string', regex: '[^\\]\\)}>]+' } ], "d-asm": [ { token: "paren.rparen", regex: "\\}", next: "start" }, { token: 'keyword.instruction', regex: '[a-zA-Z]+', next: 'd-asm-instruction' }, { token: "text", regex: "\\s+" } ], // minimal asm support 'd-asm-instruction': [ { token: 'constant.language', regex: /AL|AH|AX|EAX|BL|BH|BX|EBX|CL|CH|CX|ECX|DL|DH|DX|EDX|BP|EBP|SP|ESP|DI|EDI|SI|ESI/i }, { token: 'identifier', regex: '[a-zA-Z]+' }, { token: 'string', regex: '"[^"]*"' }, { token: 'comment', regex: '//.*$' }, { token: 'constant.numeric', regex: '[0-9.xA-F]+' }, { token: 'punctuation.operator', regex: '\\,' }, { token: 'punctuation.operator', regex: ';', next: 'd-asm' }, { token: 'text', regex: '\\s+' } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; DHighlightRules.metaData = { comment: 'D language', fileTypes: [ 'd', 'di' ], firstLineMatch: '^#!.*\\b[glr]?dmd\\b.', foldingStartMarker: '(?x)/\\*\\*(?!\\*)|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))', foldingStopMarker: '(?<!\\*)\\*\\*/|^\\s*\\}', keyEquivalent: '^~D', name: 'D', scopeName: 'source.d' }; oop.inherits(DHighlightRules, TextHighlightRules); exports.DHighlightRules = DHighlightRules; ================================================ FILE: src/mode/dart.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var CMode = require("./c_cpp").Mode; var DartHighlightRules = require("./dart_highlight_rules").DartHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { CMode.call(this); this.HighlightRules = DartHighlightRules; this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, CMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/dart"; this.snippetFileId = "ace/snippets/dart"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/dart_highlight_rules.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 958518BC-799F-477A-99F9-5B28EBF230F6) */ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var DartHighlightRules = function() { var constantLanguage = "true|false|null"; var variableLanguage = "this|super"; var keywordControl = "try|catch|finally|throw|rethrow|assert|break|case|continue|default|do|else|for|if|in|return|switch|while|new|deferred|async|await"; var keywordDeclaration = "abstract|class|extends|external|factory|implements|get|native|operator|set|typedef|with|enum"; var storageModifier = "static|final|const"; var storageType = "void|bool|num|int|double|dynamic|var|String"; var keywordMapper = this.createKeywordMapper({ "constant.language.dart": constantLanguage, "variable.language.dart": variableLanguage, "keyword.control.dart": keywordControl, "keyword.declaration.dart": keywordDeclaration, "storage.modifier.dart": storageModifier, "storage.type.primitive.dart": storageType }, "identifier"); var stringfill = [{ token : "constant.language.escape", regex : /\\./ }, { token : "text", regex : /\$(?:\w+|{[^"'}]+})?/ }, { defaultToken : "string" }]; // 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: ["meta.preprocessor.script.dart"], regex: "^(#!.*)$" }, { token: "keyword.other.import.dart", regex: "(?:\\b)(?:library|import|export|part|of|show|hide)(?:\\b)" }, { token : ["keyword.other.import.dart", "text"], regex : "(?:\\b)(prefix)(\\s*:)" }, { regex: "\\bas\\b", token: "keyword.cast.dart" }, { regex: "\\?|:", token: "keyword.control.ternary.dart" }, { regex: "(?:\\b)(is\\!?)(?:\\b)", token: ["keyword.operator.dart"] }, { regex: "(<<|>>>?|~|\\^|\\||&)", token: ["keyword.operator.bitwise.dart"] }, { regex: "((?:&|\\^|\\||<<|>>>?)=)", token: ["keyword.operator.assignment.bitwise.dart"] }, { regex: "(===?|!==?|<=?|>=?)", token: ["keyword.operator.comparison.dart"] }, { regex: "((?:[+*/%-]|\\~)=)", token: ["keyword.operator.assignment.arithmetic.dart"] }, { regex: "=", token: "keyword.operator.assignment.dart" }, { token : "string", regex : "'''", next : "qdoc" }, { token : "string", regex : '"""', next : "qqdoc" }, { token : "string", regex : "'", next : "qstring" }, { token : "string", regex : '"', next : "qqstring" }, { regex: "(\\-\\-|\\+\\+)", token: ["keyword.operator.increment-decrement.dart"] }, { regex: "(\\-|\\+|\\*|\\/|\\~\\/|%)", token: ["keyword.operator.arithmetic.dart"] }, { regex: "(!|&&|\\|\\|)", token: ["keyword.operator.logical.dart"] }, { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F]+\\b" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "qdoc" : [ { token : "string", regex : "'''", next : "start" } ].concat(stringfill), "qqdoc" : [ { token : "string", regex : '"""', next : "start" } ].concat(stringfill), "qstring" : [ { token : "string", regex : "'|$", next : "start" } ].concat(stringfill), "qqstring" : [ { token : "string", regex : '"|$', next : "start" } ].concat(stringfill) // TODO add support for interpolation and raw strings }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; oop.inherits(DartHighlightRules, TextHighlightRules); exports.DartHighlightRules = DartHighlightRules; ================================================ FILE: src/mode/diff.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules; var FoldMode = require("./folding/diff").FoldMode; var Mode = function() { this.HighlightRules = HighlightRules; this.foldingRules = new FoldMode(["diff", "@@|\\*{5}"], "i"); }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/diff"; this.snippetFileId = "ace/snippets/diff"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/diff_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var DiffHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [{ regex: "^(?:\\*{15}|={67}|-{3}|\\+{3})$", token: "punctuation.definition.separator.diff", "name": "keyword" }, { //diff.range.unified regex: "^(@@)(\\s*.+?\\s*)(@@)(.*)$", token: [ "constant", "constant.numeric", "constant", "comment.doc.tag" ] }, { //diff.range.normal regex: "^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$", token: [ "constant.numeric", "punctuation.definition.range.diff", "constant.function", "constant.numeric", "punctuation.definition.range.diff", "invalid" ], "name": "meta." }, { regex: "^(\\-{3}|\\+{3}|\\*{3})( .+)$", token: [ "constant.numeric", "meta.tag" ] }, { // added regex: "^([!+>])(.*?)(\\s*)$", token: [ "support.constant", "text", "invalid" ] }, { // removed regex: "^([<\\-])(.*?)(\\s*)$", token: [ "support.function", "string", "invalid" ] }, { regex: "^(diff)(\\s+--\\w+)?(.+?)( .+)?$", token: ["variable", "variable", "keyword", "variable"] }, { regex: "^Index.+$", token: "variable" }, { regex: "^\\s+$", token: "text" }, { regex: "\\s*$", token: "invalid" }, { defaultToken: "invisible", caseInsensitive: true } ] }; }; oop.inherits(DiffHighlightRules, TextHighlightRules); exports.DiffHighlightRules = DiffHighlightRules; ================================================ FILE: src/mode/django.js ================================================ var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var DjangoHighlightRules = function(){ this.$rules = { 'start': [{ token: "string", regex: '".*?"' }, { token: "string", regex: "'.*?'" }, { token: "constant", regex: '[0-9]+' }, { token: "variable", regex: "[-_a-zA-Z0-9:]+" }], 'tag': [{ token: "entity.name.function", regex: "[a-zA-Z][_a-zA-Z0-9]*", next: "start" }] }; }; oop.inherits(DjangoHighlightRules, TextHighlightRules); var DjangoHtmlHighlightRules = function() { HtmlHighlightRules.call(this); var startRules = [ { token: "comment.line", regex: "\\{#.*?#\\}" }, { token: "comment.block", regex: "\\{\\%\\s*comment\\s*\\%\\}", push: [{ token: "comment.block", regex: "\\{\\%\\s*endcomment\\s*\\%\\}", next: "pop" }, { defaultToken: "comment.block" }] }, { token: "constant.language", regex: "\\{\\{", push: "django-start" }, { token: "constant.language", regex: "\\{\\%", push: "django-tag" } ]; var endRules = [ { token: "constant.language", regex: "\\%\\}", next: "pop" }, { token: "constant.language", regex: "\\}\\}", next: "pop" } ]; for (var key in this.$rules) this.$rules[key].unshift.apply(this.$rules[key], startRules); this.embedRules(DjangoHighlightRules, "django-", endRules, ["start"]); this.normalizeRules(); }; oop.inherits(DjangoHtmlHighlightRules, HtmlHighlightRules); var Mode = function() { HtmlMode.call(this); this.HighlightRules = DjangoHtmlHighlightRules; }; oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/django"; this.snippetFileId = "ace/snippets/django"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/doc_comment_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var DocCommentHighlightRules = function () { this.$rules = { "start": [ { token: "comment.doc.tag", regex: "@\\w+(?=\\s|$)" }, DocCommentHighlightRules.getTagRule(), { defaultToken: "comment.doc.body", caseInsensitive: true } ] }; }; oop.inherits(DocCommentHighlightRules, TextHighlightRules); DocCommentHighlightRules.getTagRule = function(start) { return { token : "comment.doc.tag.storage.type", regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" }; }; DocCommentHighlightRules.getStartRule = function(start) { return { token : "comment.doc", // doc comment regex: /\/\*\*(?!\/)/, next : start }; }; DocCommentHighlightRules.getEndRule = function (start) { return { token : "comment.doc", // closing comment regex : "\\*\\/", next : start }; }; exports.DocCommentHighlightRules = DocCommentHighlightRules; ================================================ FILE: src/mode/dockerfile.js ================================================ "use strict"; var oop = require("../lib/oop"); var ShMode = require("./sh").Mode; var DockerfileHighlightRules = require("./dockerfile_highlight_rules").DockerfileHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { ShMode.call(this); this.HighlightRules = DockerfileHighlightRules; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, ShMode); (function() { this.$id = "ace/mode/dockerfile"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/dockerfile_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules; var DockerfileHighlightRules = function() { ShHighlightRules.call(this); var startRules = this.$rules.start; for (var i = 0; i < startRules.length; i++) { if (startRules[i].token == "variable.language") { startRules.splice(i, 0, { token: "constant.language", regex: "(?:^(?:FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|COPY|LABEL)\\b)", caseInsensitive: true }); break; } } }; oop.inherits(DockerfileHighlightRules, ShHighlightRules); exports.DockerfileHighlightRules = DockerfileHighlightRules; ================================================ FILE: src/mode/dot.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules; var DotFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = DotHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new DotFoldMode(); this.$behaviour = this.$defaultBehaviour; }; 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(/^.*(?:\bcase\b.*:|[\{\(\[])\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.$id = "ace/mode/dot"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/dot_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DotHighlightRules = function() { var keywords = lang.arrayToMap( ("strict|node|edge|graph|digraph|subgraph").split("|") ); var attributes = lang.arrayToMap( ("damping|k|url|area|arrowhead|arrowsize|arrowtail|aspect|bb|bgcolor|center|charset|clusterrank|color|colorscheme|comment|compound|concentrate|constraint|decorate|defaultdist|dim|dimen|dir|diredgeconstraints|distortion|dpi|edgeurl|edgehref|edgetarget|edgetooltip|epsilon|esep|fillcolor|fixedsize|fontcolor|fontname|fontnames|fontpath|fontsize|forcelabels|gradientangle|group|headurl|head_lp|headclip|headhref|headlabel|headport|headtarget|headtooltip|height|href|id|image|imagepath|imagescale|label|labelurl|label_scheme|labelangle|labeldistance|labelfloat|labelfontcolor|labelfontname|labelfontsize|labelhref|labeljust|labelloc|labeltarget|labeltooltip|landscape|layer|layerlistsep|layers|layerselect|layersep|layout|len|levels|levelsgap|lhead|lheight|lp|ltail|lwidth|margin|maxiter|mclimit|mindist|minlen|mode|model|mosek|nodesep|nojustify|normalize|nslimit|nslimit1|ordering|orientation|outputorder|overlap|overlap_scaling|pack|packmode|pad|page|pagedir|pencolor|penwidth|peripheries|pin|pos|quadtree|quantum|rank|rankdir|ranksep|ratio|rects|regular|remincross|repulsiveforce|resolution|root|rotate|rotation|samehead|sametail|samplepoints|scale|searchsize|sep|shape|shapefile|showboxes|sides|size|skew|smoothing|sortv|splines|start|style|stylesheet|tailurl|tail_lp|tailclip|tailhref|taillabel|tailport|tailtarget|tailtooltip|target|tooltip|truecolor|vertices|viewport|voro_margin|weight|width|xlabel|xlp|z").split("|") ); this.$rules = { "start" : [ { token : "comment", regex : /\/\/.*$/ }, { token : "comment", regex : /#.*$/ }, { token : "comment", // multi line comment merge : true, regex : /\/\*/, next : "comment" }, { token : "string", regex : "'(?=.)", next : "qstring" }, { token : "string", regex : '"(?=.)', next : "qqstring" }, { token : "constant.numeric", regex : /[+\-]?\d+(?:(?:\.\d*)?(?:[eE][+\-]?\d+)?)?\b/ }, { token : "keyword.operator", regex : /\+|=|\->/ }, { token : "punctuation.operator", regex : /,|;/ }, { token : "paren.lparen", regex : /[\[{]/ }, { token : "paren.rparen", regex : /[\]}]/ }, { token: "comment", regex: /^#!.*$/ }, { token: function(value) { if (keywords.hasOwnProperty(value.toLowerCase())) { return "keyword"; } else if (attributes.hasOwnProperty(value.toLowerCase())) { return "variable"; } else { return "text"; } }, regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "qqstring" : [ { token : "string", regex : '[^"\\\\]+', merge : true }, { token : "string", regex : "\\\\$", next : "qqstring", merge : true }, { token : "string", regex : '"|$', next : "start", merge : true } ], "qstring" : [ { token : "string", regex : "[^'\\\\]+", merge : true }, { token : "string", regex : "\\\\$", next : "qstring", merge : true }, { token : "string", regex : "'|$", next : "start", merge : true } ] }; }; oop.inherits(DotHighlightRules, TextHighlightRules); exports.DotHighlightRules = DotHighlightRules; ================================================ FILE: src/mode/drools.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var DroolsHighlightRules = require("./drools_highlight_rules").DroolsHighlightRules; var DroolsFoldMode = require("./folding/drools").FoldMode; var Mode = function() { this.HighlightRules = DroolsHighlightRules; this.foldingRules = new DroolsFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/drools"; this.snippetFileId = "ace/snippets/drools"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/drools_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"; var packageIdentifierRe = "[a-zA-Z\\$_\u00a1-\uffff][\\.a-zA-Z\\d\\$_\u00a1-\uffff]*"; var DroolsHighlightRules = function() { var keywords = ("date|effective|expires|lock|on|active|no|loop|auto|focus" + "|activation|group|agenda|ruleflow|duration|timer|calendars|refract|direct" + "|dialect|salience|enabled|attributes|extends|template" + "|function|contains|matches|eval|excludes|soundslike" + "|memberof|not|in|or|and|exists|forall|over|from|entry|point|accumulate|acc|collect" + "|action|reverse|result|end|init|instanceof|extends|super|boolean|char|byte|short" + "|int|long|float|double|this|void|class|new|case|final|if|else|for|while|do" + "|default|try|catch|finally|switch|synchronized|return|throw|break|continue|assert" + "|modify|static|public|protected|private|abstract|native|transient|volatile" + "|strictfp|throws|interface|enum|implements|type|window|trait|no-loop|str" ); var langClasses = ( "AbstractMethodError|AssertionError|ClassCircularityError|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ExceptionInInitializerError|IllegalAccessError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+ "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+ "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+ "SuppressWarnings|TypeNotPresentException|UnknownError|"+ "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+ "InstantiationException|IndexOutOfBoundsException|"+ "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+ "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+ "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+ "InterruptedException|NoSuchMethodException|IllegalAccessException|"+ "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+ "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+ "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+ "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+ "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+ "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+ "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+ "ArrayStoreException|ClassCastException|LinkageError|"+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ "Cloneable|Class|CharSequence|Comparable|String|Object" ); var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": keywords, "constant.language": "null", "support.class" : langClasses, "support.function" : "retract|update|modify|insert" }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var stringRules = function() { return [{ token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }]; }; var basicPreRules = function(blockCommentRules) { return [{ token : "comment", regex : "\\/\\/.*$" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi line comment regex : "\\/\\*", next : blockCommentRules }, { 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" }]; }; var blockCommentRules = function(returnRule) { return [ { token : "comment.block", // closing comment regex : "\\*\\/", next : returnRule }, { defaultToken : "comment.block" } ]; }; var basicPostRules = function() { return [{ token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" }]; }; this.$rules = { "start" : [].concat(basicPreRules("block.comment"), [ { token : "entity.name.type", regex : "@[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { // package com.example token : ["keyword","text","entity.name.type"], regex : "(package)(\\s+)(" + packageIdentifierRe +")" }, { // import function com.Util.staticMethod token : ["keyword","text","keyword","text","entity.name.type"], regex : "(import)(\\s+)(function)(\\s+)(" + packageIdentifierRe +")" }, { // import function com.Util.staticMethod token : ["keyword","text","entity.name.type"], regex : "(import)(\\s+)(" + packageIdentifierRe +")" }, { // global com.example.Type identifier token : ["keyword","text","entity.name.type","text","variable"], regex : "(global)(\\s+)(" + packageIdentifierRe +")(\\s+)(" + identifierRe +")" }, { // declare trait DeclaredType token : ["keyword","text","keyword","text","entity.name.type"], regex : "(declare)(\\s+)(trait)(\\s+)(" + identifierRe +")" }, { // declare trait DeclaredType token : ["keyword","text","entity.name.type"], regex : "(declare)(\\s+)(" + identifierRe +")" }, { // declare trait DeclaredType token : ["keyword","text","entity.name.type"], regex : "(extends)(\\s+)(" + packageIdentifierRe +")" }, { // rule ... token : ["keyword","text"], regex : "(rule)(\\s+)", next : "asset.name" }], stringRules(), [{ // variable : token : ["variable.other","text","text"], regex : "(" + identifierRe + ")(\\s*)(:)" }, { // query ... token : ["keyword","text"], regex : "(query)(\\s+)", next : "asset.name" }, { // when ... token : ["keyword","text"], regex : "(when)(\\s*)" }, { // then <java/mvel code> end token : ["keyword","text"], regex : "(then)(\\s*)", next : "java-start" }, { token : "paren.lparen", regex : /[\[({]/ }, { token : "paren.rparen", regex : /[\])}]/ }], basicPostRules()), "block.comment" : blockCommentRules("start"), "asset.name" : [ { token : "entity.name", regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "entity.name", regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "entity.name", regex : identifierRe }, { regex: "", token: "empty", next: "start" }] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.embedRules(JavaHighlightRules, "java-", [ { token : "support.function", regex: "\\b(insert|modify|retract|update)\\b" }, { token : "keyword", regex: "\\bend\\b", next : "start" }]); }; oop.inherits(DroolsHighlightRules, TextHighlightRules); exports.DroolsHighlightRules = DroolsHighlightRules; ================================================ FILE: src/mode/edifact.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var EdifactHighlightRules = require("./edifact_highlight_rules").EdifactHighlightRules; var Mode = function() { this.HighlightRules = EdifactHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/edifact"; this.snippetFileId = "ace/snippets/edifact"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/edifact_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var EdifactHighlightRules = function() { var header = ( "UNH" ); var segment = ( "ADR|AGR|AJT|ALC|ALI|APP|APR|ARD|ARR|ASI|ATT|AUT|"+ "BAS|BGM|BII|BUS|"+ "CAV|CCD|CCI|CDI|CDS|CDV|CED|CIN|CLA|CLI|CMP|CNI|CNT|COD|COM|COT|CPI|CPS|CPT|CST|CTA|CUX|"+ "DAM|DFN|DGS|DII|DIM|DLI|DLM|DMS|DOC|DRD|DSG|DSI|DTM|"+ "EDT|EFI|ELM|ELU|ELV|EMP|EQA|EQD|EQN|ERC|ERP|EVE|FCA|FII|FNS|FNT|FOR|FSQ|FTX|"+ "GDS|GEI|GID|GIN|GIR|GOR|GPO|GRU|HAN|HYN|ICD|IDE|IFD|IHC|IMD|IND|INP|INV|IRQ|"+ "LAN|LIN|LOC|MEA|MEM|MKS|MOA|MSG|MTD|NAD|NAT|"+ "PAC|PAI|PAS|PCC|PCD|PCI|PDI|PER|PGI|PIA|PNA|POC|PRC|PRI|PRV|PSD|PTY|PYT|"+ "QRS|QTY|QUA|QVR|"+ "RCS|REL|RFF|RJL|RNG|ROD|RSL|RTE|"+ "SAL|SCC|SCD|SEG|SEL|SEQ|SFI|SGP|SGU|SPR|SPS|STA|STC|STG|STS|"+ "TAX|TCC|TDT|TEM|TMD|TMP|TOD|TPL|TRU|TSR|"+ "UNB|UNZ|UNT|UGH|UGT|UNS|"+ "VLI" ); var header = ( "UNH" ); var buildinConstants = ("null|Infinity|NaN|undefined"); var langClasses = ( "" ); var keywords = ( "BY|SE|ON|INV|JP|UNOA" ); var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": keywords, "entity.name.segment":segment, "entity.name.header":header, "constant.language": buildinConstants, "support.function": langClasses }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "punctuation.operator", regex : "\\+.\\+" }, { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "\\+" }, { token : "punctuation.operator", regex : "\\:|'" },{ token : "identifier", regex : "\\:D\\:" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; EdifactHighlightRules.metaData = { fileTypes: [ 'edi' ], keyEquivalent: '^~E', name: 'Edifact', scopeName: 'source.edifact' }; oop.inherits(EdifactHighlightRules, TextHighlightRules); exports.EdifactHighlightRules = EdifactHighlightRules; ================================================ FILE: src/mode/eiffel.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var EiffelHighlightRules = require("./eiffel_highlight_rules").EiffelHighlightRules; var Mode = function() { this.HighlightRules = EiffelHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.$id = "ace/mode/eiffel"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/eiffel_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var EiffelHighlightRules = function() { var keywords = "across|agent|alias|all|attached|as|assign|attribute|check|" + "class|convert|create|debug|deferred|detachable|do|else|elseif|end|" + "ensure|expanded|export|external|feature|from|frozen|if|inherit|" + "inspect|invariant|like|local|loop|not|note|obsolete|old|once|" + "Precursor|redefine|rename|require|rescue|retry|select|separate|" + "some|then|undefine|until|variant|when"; var operatorKeywords = "and|implies|or|xor"; var languageConstants = "Void"; var booleanConstants = "True|False"; var languageVariables = "Current|Result"; var keywordMapper = this.createKeywordMapper({ "constant.language": languageConstants, "constant.language.boolean": booleanConstants, "variable.language": languageVariables, "keyword.operator": operatorKeywords, "keyword": keywords }, "identifier", true); var simpleString = /(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)+?/; this.$rules = { "start": [{ token : "string.quoted.other", // Aligned-verbatim-strings (verbatim option not supported) regex : /"\[/, next: "aligned_verbatim_string" }, { token : "string.quoted.other", // Non-aligned-verbatim-strings (verbatim option not supported) regex : /"\{/, next: "non-aligned_verbatim_string" }, { token : "string.quoted.double", regex : /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/ }, { token : "comment.line.double-dash", regex : /--.*/ }, { token : "constant.character", regex : /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/ }, { token : "constant.numeric", // hexa | octal | bin regex : /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/ }, { token : "constant.numeric", regex : /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/ }, { token : "paren.lparen", regex : /[\[({]|<<|\|\(/ }, { token : "paren.rparen", regex : /[\])}]|>>|\|\)/ }, { token : "keyword.operator", // punctuation regex : /:=|->|\.(?=\w)|[;,:?]/ }, { token : "keyword.operator", regex : /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/ }, { token : function (v) { var result = keywordMapper(v); if (result === "identifier" && v === v.toUpperCase()) { result = "entity.name.type"; } return result; }, regex : /[a-zA-Z][a-zA-Z\d_]*\b/ }, { token : "text", regex : /\s+/ } ], "aligned_verbatim_string" : [{ token : "string", regex : /]"/, next : "start" }, { token : "string", regex : simpleString } ], "non-aligned_verbatim_string" : [{ token : "string.quoted.other", regex : /}"/, next : "start" }, { token : "string.quoted.other", regex : simpleString } ]}; }; oop.inherits(EiffelHighlightRules, TextHighlightRules); exports.EiffelHighlightRules = EiffelHighlightRules; ================================================ FILE: src/mode/ejs.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var EjsHighlightRules = function(start, end) { HtmlHighlightRules.call(this); if (!start) start = "(?:<%|<\\?|{{)"; if (!end) end = "(?:%>|\\?>|}})"; for (var i in this.$rules) { this.$rules[i].unshift({ token : "markup.list.meta.tag", regex : start + "(?![>}])[-=]?", push : "ejs-start" }); } this.embedRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "ejs-", [{ token : "markup.list.meta.tag", regex : "-?" + end, next : "pop" }, { token: "comment", regex: "//.*?" + end, next: "pop" }]); this.normalizeRules(); }; oop.inherits(EjsHighlightRules, HtmlHighlightRules); exports.EjsHighlightRules = EjsHighlightRules; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var JavaScriptMode = require("./javascript").Mode; var CssMode = require("./css").Mode; var RubyMode = require("./ruby").Mode; var Mode = function() { HtmlMode.call(this); this.HighlightRules = EjsHighlightRules; this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode, "ejs-": JavaScriptMode }); }; oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/ejs"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/elixir.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ElixirHighlightRules = require("./elixir_highlight_rules").ElixirHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = ElixirHighlightRules; 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/elixir"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/elixir_highlight_rules.js ================================================ /* This file was autogenerated from https://raw.githubusercontent.com/elixir-lang/elixir-tmbundle/master/Syntaxes/Elixir.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ElixirHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: [ 'meta.module.elixir', 'keyword.control.module.elixir', 'meta.module.elixir', 'entity.name.type.module.elixir' ], regex: '^(\\s*)(defmodule)(\\s+)((?:[A-Z]\\w*\\s*\\.\\s*)*[A-Z]\\w*)' }, { token: 'comment.documentation.heredoc', regex: '@(?:module|type)?doc (?:~[a-z])?"""', push: [ { token: 'comment.documentation.heredoc', regex: '\\s*"""', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'comment.documentation.heredoc' } ], comment: '@doc with heredocs is treated as documentation' }, { token: 'comment.documentation.heredoc', regex: '@(?:module|type)?doc ~[A-Z]"""', push: [ { token: 'comment.documentation.heredoc', regex: '\\s*"""', next: 'pop' }, { defaultToken: 'comment.documentation.heredoc' } ], comment: '@doc with heredocs is treated as documentation' }, { token: 'comment.documentation.heredoc', regex: '@(?:module|type)?doc (?:~[a-z])?\'\'\'', push: [ { token: 'comment.documentation.heredoc', regex: '\\s*\'\'\'', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'comment.documentation.heredoc' } ], comment: '@doc with heredocs is treated as documentation' }, { token: 'comment.documentation.heredoc', regex: '@(?:module|type)?doc ~[A-Z]\'\'\'', push: [ { token: 'comment.documentation.heredoc', regex: '\\s*\'\'\'', next: 'pop' }, { defaultToken: 'comment.documentation.heredoc' } ], comment: '@doc with heredocs is treated as documentation' }, { token: 'comment.documentation.false', regex: '@(?:module|type)?doc false', comment: '@doc false is treated as documentation' }, { token: 'comment.documentation.string', regex: '@(?:module|type)?doc "', push: [ { token: 'comment.documentation.string', regex: '"', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'comment.documentation.string' } ], comment: '@doc with string is treated as documentation' }, { token: 'keyword.control.elixir', regex: '\\b(?:do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|require|alias|use|quote|unquote|super)\\b(?![?!])', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?<!\\.)\\b(do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|require|alias|use|quote|unquote|super)\\b(?![?!])' }, { token: 'keyword.operator.elixir', regex: '\\b(?:and|not|or|when|xor|in|inlist|inbits)\\b', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?<!\\.)\\b(and|not|or|when|xor|in|inlist|inbits)\\b', comment: ' as above, just doesn\'t need a \'end\' and does a logic operation' }, { token: 'constant.language.elixir', regex: '\\b(?:nil|true|false)\\b(?![?!])' }, { token: 'variable.language.elixir', regex: '\\b__(?:CALLER|ENV|MODULE|DIR)__\\b(?![?!])' }, { token: [ 'punctuation.definition.variable.elixir', 'variable.other.readwrite.module.elixir' ], regex: '(@)([a-zA-Z_]\\w*)' }, { token: [ 'punctuation.definition.variable.elixir', 'variable.other.anonymous.elixir' ], regex: '(&)(\\d*)' }, { token: 'variable.other.constant.elixir', regex: '\\b[A-Z]\\w*\\b' }, { token: 'constant.numeric.elixir', regex: '\\b(?:0x[\\da-fA-F](?:_?[\\da-fA-F])*|\\d(?:_?\\d)*(?:\\.(?![^[:space:][:digit:]])(?:_?\\d)*)?(?:[eE][-+]?\\d(?:_?\\d)*)?|0b[01]+|0o[0-7]+)\\b', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '\\b(0x\\h(?>_?\\h)*|\\d(?>_?\\d)*(\\.(?![^[:space:][:digit:]])(?>_?\\d)*)?([eE][-+]?\\d(?>_?\\d)*)?|0b[01]+|0o[0-7]+)\\b' }, { token: 'punctuation.definition.constant.elixir', regex: ':\'', push: [ { token: 'punctuation.definition.constant.elixir', regex: '\'', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'constant.other.symbol.single-quoted.elixir' } ] }, { token: 'punctuation.definition.constant.elixir', regex: ':"', push: [ { token: 'punctuation.definition.constant.elixir', regex: '"', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'constant.other.symbol.double-quoted.elixir' } ] }, { token: 'punctuation.definition.string.begin.elixir', regex: '(?:\'\'\')', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?>\'\'\')', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '^\\s*\'\'\'', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'support.function.variable.quoted.single.heredoc.elixir' } ], comment: 'Single-quoted heredocs' }, { token: 'punctuation.definition.string.begin.elixir', regex: '\'', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '\'', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'support.function.variable.quoted.single.elixir' } ], comment: 'single quoted string (allows for interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '(?:""")', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?>""")', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '^\\s*"""', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'string.quoted.double.heredoc.elixir' } ], comment: 'Double-quoted heredocs' }, { token: 'punctuation.definition.string.begin.elixir', regex: '"', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '"', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'string.quoted.double.elixir' } ], comment: 'double quoted string (allows for interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[a-z](?:""")', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '~[a-z](?>""")', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '^\\s*"""', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'string.quoted.double.heredoc.elixir' } ], comment: 'Double-quoted heredocs sigils' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[a-z]\\{', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '\\}[a-z]*', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'string.interpolated.elixir' } ], comment: 'sigil (allow for interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[a-z]\\[', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '\\][a-z]*', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'string.interpolated.elixir' } ], comment: 'sigil (allow for interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[a-z]\\<', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '\\>[a-z]*', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'string.interpolated.elixir' } ], comment: 'sigil (allow for interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[a-z]\\(', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '\\)[a-z]*', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { defaultToken: 'string.interpolated.elixir' } ], comment: 'sigil (allow for interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[a-z][^\\w]', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '[^\\w][a-z]*', next: 'pop' }, { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { include: '#escaped_char' }, { defaultToken: 'string.interpolated.elixir' } ], comment: 'sigil (allow for interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[A-Z](?:""")', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '~[A-Z](?>""")', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '^\\s*"""', next: 'pop' }, { defaultToken: 'string.quoted.other.literal.upper.elixir' } ], comment: 'Double-quoted heredocs sigils' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[A-Z]\\{', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '\\}[a-z]*', next: 'pop' }, { defaultToken: 'string.quoted.other.literal.upper.elixir' } ], comment: 'sigil (without interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[A-Z]\\[', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '\\][a-z]*', next: 'pop' }, { defaultToken: 'string.quoted.other.literal.upper.elixir' } ], comment: 'sigil (without interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[A-Z]\\<', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '\\>[a-z]*', next: 'pop' }, { defaultToken: 'string.quoted.other.literal.upper.elixir' } ], comment: 'sigil (without interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[A-Z]\\(', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '\\)[a-z]*', next: 'pop' }, { defaultToken: 'string.quoted.other.literal.upper.elixir' } ], comment: 'sigil (without interpolation)' }, { token: 'punctuation.definition.string.begin.elixir', regex: '~[A-Z][^\\w]', push: [ { token: 'punctuation.definition.string.end.elixir', regex: '[^\\w][a-z]*', next: 'pop' }, { defaultToken: 'string.quoted.other.literal.upper.elixir' } ], comment: 'sigil (without interpolation)' }, { token: ['punctuation.definition.constant.elixir', 'constant.other.symbol.elixir'], regex: '(:)([a-zA-Z_][\\w@]*(?:[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(?:\\^\\^)?)', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?<!:)(:)(?>[a-zA-Z_][\\w@]*(?>[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(\\^\\^)?)', comment: 'symbols' }, { token: 'punctuation.definition.constant.elixir', regex: '(?:[a-zA-Z_][\\w@]*(?:[?!])?):(?!:)', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?>[a-zA-Z_][\\w@]*(?>[?!])?)(:)(?!:)', comment: 'symbols' }, { token: [ 'punctuation.definition.comment.elixir', 'comment.line.number-sign.elixir' ], regex: '(#)(.*)' }, { token: 'constant.numeric.elixir', regex: '\\?(?:\\\\(?:x[\\da-fA-F]{1,2}(?![\\da-fA-F])\\b|[^xMC])|[^\\s\\\\])', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?<!\\w)\\?(\\\\(x\\h{1,2}(?!\\h)\\b|[^xMC])|[^\\s\\\\])', comment: '\n\t\t\tmatches questionmark-letters.\n\n\t\t\texamples (1st alternation = hex):\n\t\t\t?\\x1 ?\\x61\n\n\t\t\texamples (2rd alternation = escaped):\n\t\t\t?\\n ?\\b\n\n\t\t\texamples (3rd alternation = normal):\n\t\t\t?a ?A ?0 \n\t\t\t?* ?" ?( \n\t\t\t?. ?#\n\t\t\t\n\t\t\tthe negative lookbehind prevents against matching\n\t\t\tp(42.tainted?)\n\t\t\t' }, /* { token: 'punctuation.separator.variable.elixir', regex: '(?<=\\{|do|\\{\\s|do\\s)\\|', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?<=\\{|do|\\{\\s|do\\s)(\\|)', push: [ { token: 'punctuation.separator.variable.elixir', regex: '\\|', next: 'pop' }, { token: 'variable.other.block.elixir', regex: '[_a-zA-Z][_a-zA-Z0-9]*' }, { token: 'punctuation.separator.variable.elixir', regex: ',' } ] },*/ { token: 'keyword.operator.assignment.augmented.elixir', regex: '\\+=|\\-=|\\|\\|=|~=|&&=' }, { token: 'keyword.operator.comparison.elixir', regex: '===?|!==?|<=?|>=?' }, { token: 'keyword.operator.bitwise.elixir', regex: '\\|{3}|&{3}|\\^{3}|<{3}|>{3}|~{3}' }, { token: 'keyword.operator.logical.elixir', regex: '!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b', originalRegex: '(?<=[ \\t])!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b' }, { token: 'keyword.operator.arithmetic.elixir', regex: '\\*|\\+|\\-|/' }, { token: 'keyword.operator.other.elixir', regex: '\\||\\+\\+|\\-\\-|\\*\\*|\\\\\\\\|\\<\\-|\\<\\>|\\<\\<|\\>\\>|\\:\\:|\\.\\.|\\|>|~|=>' }, { token: 'keyword.operator.assignment.elixir', regex: '=' }, { token: 'punctuation.separator.other.elixir', regex: ':' }, { token: 'punctuation.separator.statement.elixir', regex: '\\;' }, { token: 'punctuation.separator.object.elixir', regex: ',' }, { token: 'punctuation.separator.method.elixir', regex: '\\.' }, { token: 'punctuation.section.scope.elixir', regex: '\\{|\\}' }, { token: 'punctuation.section.array.elixir', regex: '\\[|\\]' }, { token: 'punctuation.section.function.elixir', regex: '\\(|\\)' } ], '#escaped_char': [ { token: 'constant.character.escape.elixir', regex: '\\\\(?:x[\\da-fA-F]{1,2}|.)' } ], '#interpolated_elixir': [ { token: [ 'source.elixir.embedded.source', 'source.elixir.embedded.source.empty' ], regex: '(#\\{)(\\})' }, { todo: { token: 'punctuation.section.embedded.elixir', regex: '#\\{', push: [ { token: 'punctuation.section.embedded.elixir', regex: '\\}', next: 'pop' }, { include: '#nest_curly_and_self' }, { include: '$self' }, { defaultToken: 'source.elixir.embedded.source' } ] } } ], '#nest_curly_and_self': [ { token: 'punctuation.section.scope.elixir', regex: '\\{', push: [ { token: 'punctuation.section.scope.elixir', regex: '\\}', next: 'pop' }, { include: '#nest_curly_and_self' } ] }, { include: '$self' } ], '#regex_sub': [ { include: '#interpolated_elixir' }, { include: '#escaped_char' }, { token: [ 'punctuation.definition.arbitrary-repitition.elixir', 'string.regexp.arbitrary-repitition.elixir', 'string.regexp.arbitrary-repitition.elixir', 'punctuation.definition.arbitrary-repitition.elixir' ], regex: '(\\{)(\\d+)((?:,\\d+)?)(\\})' }, { token: 'punctuation.definition.character-class.elixir', regex: '\\[(?:\\^?\\])?', push: [ { token: 'punctuation.definition.character-class.elixir', regex: '\\]', next: 'pop' }, { include: '#escaped_char' }, { defaultToken: 'string.regexp.character-class.elixir' } ] }, { token: 'punctuation.definition.group.elixir', regex: '\\(', push: [ { token: 'punctuation.definition.group.elixir', regex: '\\)', next: 'pop' }, { include: '#regex_sub' }, { defaultToken: 'string.regexp.group.elixir' } ] }, { token: [ 'punctuation.definition.comment.elixir', 'comment.line.number-sign.elixir' ], regex: '(?:^|\\s)(#)(\\s[[a-zA-Z0-9,. \\t?!-][^\\x00-\\x7F]]*$)', originalRegex: '(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$', comment: 'We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.' } ] }; this.normalizeRules(); }; ElixirHighlightRules.metaData = { comment: 'Textmate bundle for Elixir Programming Language.', fileTypes: [ 'ex', 'exs' ], firstLineMatch: '^#!/.*\\belixir', foldingStartMarker: '(after|else|catch|rescue|\\-\\>|\\{|\\[|do)\\s*$', foldingStopMarker: '^\\s*((\\}|\\]|after|else|catch|rescue)\\s*$|end\\b)', keyEquivalent: '^~E', name: 'Elixir', scopeName: 'source.elixir' }; oop.inherits(ElixirHighlightRules, TextHighlightRules); exports.ElixirHighlightRules = ElixirHighlightRules; ================================================ FILE: src/mode/elm.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HighlightRules = require("./elm_highlight_rules").ElmHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = HighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "{-", end: "-}", nestable: true}; // Extra logic goes here. this.$id = "ace/mode/elm"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/elm_highlight_rules.js ================================================ // TODO check with https://github.com/deadfoxygrandpa/Elm.tmLanguage "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ElmHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "keyword": "as|case|class|data|default|deriving|do|else|export|foreign|" + "hiding|jsevent|if|import|in|infix|infixl|infixr|instance|let|" + "module|newtype|of|open|then|type|where|_|port|\u03BB" }, "identifier"); var escapeRe = /\\(\d+|['"\\&trnbvf])/; var smallRe = /[a-z_]/.source; var largeRe = /[A-Z]/.source; var idRe = /[a-z_A-Z0-9']/.source; this.$rules = { start: [{ token: "string.start", regex: '"', next: "string" }, { token: "string.character", regex: "'(?:" + escapeRe.source + "|.)'?" }, { regex: /0(?:[xX][0-9A-Fa-f]+|[oO][0-7]+)|\d+(\.\d+)?([eE][-+]?\d*)?/, token: "constant.numeric" }, { token: "comment", regex: "--.*" }, { token : "keyword", regex : /\.\.|\||:|=|\\|"|->|<-|\u2192/ }, { token : "keyword.operator", regex : /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]+/ }, { token : "operator.punctuation", regex : /[,;`]/ }, { regex : largeRe + idRe + "+\\.?", token : function(value) { if (value[value.length - 1] == ".") return "entity.name.function"; return "constant.language"; } }, { regex : "^" + smallRe + idRe + "+", token : function(value) { return "constant.language"; } }, { token : keywordMapper, regex : "[\\w\\xff-\\u218e\\u2455-\\uffff]+\\b" }, { regex: "{-#?", token: "comment.start", onMatch: function(value, currentState, stack) { this.next = value.length == 2 ? "blockComment" : "docComment"; return this.token; } }, { token: "variable.language", regex: /\[markdown\|/, next: "markdown" }, { token: "paren.lparen", regex: /[\[({]/ }, { token: "paren.rparen", regex: /[\])}]/ } ], markdown: [{ regex: /\|\]/, next: "start" }, { defaultToken : "string" }], blockComment: [{ regex: "{-", token: "comment.start", push: "blockComment" }, { regex: "-}", token: "comment.end", next: "pop" }, { defaultToken: "comment" }], docComment: [{ regex: "{-", token: "comment.start", push: "docComment" }, { regex: "-}", token: "comment.end", next: "pop" }, { defaultToken: "doc.comment" }], string: [{ token: "constant.language.escape", regex: escapeRe }, { token: "text", regex: /\\(\s|$)/, next: "stringGap" }, { token: "string.end", regex: '"', next: "start" }, { defaultToken: "string" }], stringGap: [{ token: "text", regex: /\\/, next: "string" }, { token: "error", regex: "", next: "start" }] }; this.normalizeRules(); }; oop.inherits(ElmHighlightRules, TextHighlightRules); exports.ElmHighlightRules = ElmHighlightRules; ================================================ FILE: src/mode/erlang.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ErlangHighlightRules = require("./erlang_highlight_rules").ErlangHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = ErlangHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "%"; this.blockComment = null; this.$id = "ace/mode/erlang"; this.snippetFileId = "ace/snippets/erlang"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/erlang_highlight_rules.js ================================================ /* This file was autogenerated from tm bundles\erlang.tmbundle\Syntaxes\Erlang.plist (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ErlangHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { include: '#module-directive' }, { include: '#import-export-directive' }, { include: '#behaviour-directive' }, { include: '#record-directive' }, { include: '#define-directive' }, { include: '#macro-directive' }, { include: '#directive' }, { include: '#function' }, { include: '#everything-else' } ], '#atom': [ { token: 'punctuation.definition.symbol.begin.erlang', regex: '\'', push: [ { token: 'punctuation.definition.symbol.end.erlang', regex: '\'', next: 'pop' }, { token: [ 'punctuation.definition.escape.erlang', 'constant.other.symbol.escape.erlang', 'punctuation.definition.escape.erlang', 'constant.other.symbol.escape.erlang', 'constant.other.symbol.escape.erlang' ], regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' }, { token: 'invalid.illegal.atom.erlang', regex: '\\\\\\^?.?' }, { defaultToken: 'constant.other.symbol.quoted.single.erlang' } ] }, { token: 'constant.other.symbol.unquoted.erlang', regex: '[a-z][a-zA-Z\\d@_]*' } ], '#behaviour-directive': [ { token: [ 'meta.directive.behaviour.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.behaviour.erlang', 'keyword.control.directive.behaviour.erlang', 'meta.directive.behaviour.erlang', 'punctuation.definition.parameters.begin.erlang', 'meta.directive.behaviour.erlang', 'entity.name.type.class.behaviour.definition.erlang', 'meta.directive.behaviour.erlang', 'punctuation.definition.parameters.end.erlang', 'meta.directive.behaviour.erlang', 'punctuation.section.directive.end.erlang' ], regex: '^(\\s*)(-)(\\s*)(behaviour)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ], '#binary': [ { token: 'punctuation.definition.binary.begin.erlang', regex: '<<', push: [ { token: 'punctuation.definition.binary.end.erlang', regex: '>>', next: 'pop' }, { token: [ 'punctuation.separator.binary.erlang', 'punctuation.separator.value-size.erlang' ], regex: '(,)|(:)' }, { include: '#internal-type-specifiers' }, { include: '#everything-else' }, { defaultToken: 'meta.structure.binary.erlang' } ] } ], '#character': [ { token: [ 'punctuation.definition.character.erlang', 'punctuation.definition.escape.erlang', 'constant.character.escape.erlang', 'punctuation.definition.escape.erlang', 'constant.character.escape.erlang', 'constant.character.escape.erlang' ], regex: '(\\$)(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' }, { token: 'invalid.illegal.character.erlang', regex: '\\$\\\\\\^?.?' }, { token: [ 'punctuation.definition.character.erlang', 'constant.character.erlang' ], regex: '(\\$)(\\S)' }, { token: 'invalid.illegal.character.erlang', regex: '\\$.?' } ], '#comment': [ { token: 'punctuation.definition.comment.erlang', regex: '%.*$', push_: [ { token: 'comment.line.percentage.erlang', regex: '$', next: 'pop' }, { defaultToken: 'comment.line.percentage.erlang' } ] } ], '#define-directive': [ { token: [ 'meta.directive.define.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.define.erlang', 'keyword.control.directive.define.erlang', 'meta.directive.define.erlang', 'punctuation.definition.parameters.begin.erlang', 'meta.directive.define.erlang', 'entity.name.function.macro.definition.erlang', 'meta.directive.define.erlang', 'punctuation.separator.parameters.erlang' ], regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(,)', push: [ { token: [ 'punctuation.definition.parameters.end.erlang', 'meta.directive.define.erlang', 'punctuation.section.directive.end.erlang' ], regex: '(\\))(\\s*)(\\.)', next: 'pop' }, { include: '#everything-else' }, { defaultToken: 'meta.directive.define.erlang' } ] }, { token: 'meta.directive.define.erlang', regex: '(?=^\\s*-\\s*define\\s*\\(\\s*[a-zA-Z\\d@_]+\\s*\\()', push: [ { token: [ 'punctuation.definition.parameters.end.erlang', 'meta.directive.define.erlang', 'punctuation.section.directive.end.erlang' ], regex: '(\\))(\\s*)(\\.)', next: 'pop' }, { token: [ 'text', 'punctuation.section.directive.begin.erlang', 'text', 'keyword.control.directive.define.erlang', 'text', 'punctuation.definition.parameters.begin.erlang', 'text', 'entity.name.function.macro.definition.erlang', 'text', 'punctuation.definition.parameters.begin.erlang' ], regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\()', push: [ { token: [ 'punctuation.definition.parameters.end.erlang', 'text', 'punctuation.separator.parameters.erlang' ], regex: '(\\))(\\s*)(,)', next: 'pop' }, { token: 'punctuation.separator.parameters.erlang', regex: ',' }, { include: '#everything-else' } ] }, { token: 'punctuation.separator.define.erlang', regex: '\\|\\||\\||:|;|,|\\.|->' }, { include: '#everything-else' }, { defaultToken: 'meta.directive.define.erlang' } ] } ], '#directive': [ { token: [ 'meta.directive.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.erlang', 'keyword.control.directive.erlang', 'meta.directive.erlang', 'punctuation.definition.parameters.begin.erlang' ], regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\(?)', push: [ { token: [ 'punctuation.definition.parameters.end.erlang', 'meta.directive.erlang', 'punctuation.section.directive.end.erlang' ], regex: '(\\)?)(\\s*)(\\.)', next: 'pop' }, { include: '#everything-else' }, { defaultToken: 'meta.directive.erlang' } ] }, { token: [ 'meta.directive.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.erlang', 'keyword.control.directive.erlang', 'meta.directive.erlang', 'punctuation.section.directive.end.erlang' ], regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\.)' } ], '#everything-else': [ { include: '#comment' }, { include: '#record-usage' }, { include: '#macro-usage' }, { include: '#expression' }, { include: '#keyword' }, { include: '#textual-operator' }, { include: '#function-call' }, { include: '#tuple' }, { include: '#list' }, { include: '#binary' }, { include: '#parenthesized-expression' }, { include: '#character' }, { include: '#number' }, { include: '#atom' }, { include: '#string' }, { include: '#symbolic-operator' }, { include: '#variable' } ], '#expression': [ { token: 'keyword.control.if.erlang', regex: '\\bif\\b', push: [ { token: 'keyword.control.end.erlang', regex: '\\bend\\b', next: 'pop' }, { include: '#internal-expression-punctuation' }, { include: '#everything-else' }, { defaultToken: 'meta.expression.if.erlang' } ] }, { token: 'keyword.control.case.erlang', regex: '\\bcase\\b', push: [ { token: 'keyword.control.end.erlang', regex: '\\bend\\b', next: 'pop' }, { include: '#internal-expression-punctuation' }, { include: '#everything-else' }, { defaultToken: 'meta.expression.case.erlang' } ] }, { token: 'keyword.control.receive.erlang', regex: '\\breceive\\b', push: [ { token: 'keyword.control.end.erlang', regex: '\\bend\\b', next: 'pop' }, { include: '#internal-expression-punctuation' }, { include: '#everything-else' }, { defaultToken: 'meta.expression.receive.erlang' } ] }, { token: [ 'keyword.control.fun.erlang', 'text', 'entity.name.type.class.module.erlang', 'text', 'punctuation.separator.module-function.erlang', 'text', 'entity.name.function.erlang', 'text', 'punctuation.separator.function-arity.erlang' ], regex: '\\b(fun)(\\s*)(?:([a-z][a-zA-Z\\d@_]*)(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*)(\\s*)(/)' }, { token: 'keyword.control.fun.erlang', regex: '\\bfun\\b', push: [ { token: 'keyword.control.end.erlang', regex: '\\bend\\b', next: 'pop' }, { token: 'text', regex: '(?=\\()', push: [ { token: 'punctuation.separator.clauses.erlang', regex: ';|(?=\\bend\\b)', next: 'pop' }, { include: '#internal-function-parts' } ] }, { include: '#everything-else' }, { defaultToken: 'meta.expression.fun.erlang' } ] }, { token: 'keyword.control.try.erlang', regex: '\\btry\\b', push: [ { token: 'keyword.control.end.erlang', regex: '\\bend\\b', next: 'pop' }, { include: '#internal-expression-punctuation' }, { include: '#everything-else' }, { defaultToken: 'meta.expression.try.erlang' } ] }, { token: 'keyword.control.begin.erlang', regex: '\\bbegin\\b', push: [ { token: 'keyword.control.end.erlang', regex: '\\bend\\b', next: 'pop' }, { include: '#internal-expression-punctuation' }, { include: '#everything-else' }, { defaultToken: 'meta.expression.begin.erlang' } ] }, { token: 'keyword.control.query.erlang', regex: '\\bquery\\b', push: [ { token: 'keyword.control.end.erlang', regex: '\\bend\\b', next: 'pop' }, { include: '#everything-else' }, { defaultToken: 'meta.expression.query.erlang' } ] } ], '#function': [ { token: [ 'meta.function.erlang', 'entity.name.function.definition.erlang', 'meta.function.erlang' ], regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()', push: [ { token: 'punctuation.terminator.function.erlang', regex: '\\.', next: 'pop' }, { token: [ 'text', 'entity.name.function.erlang', 'text' ], regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()' }, { token: 'text', regex: '(?=\\()', push: [ { token: 'punctuation.separator.clauses.erlang', regex: ';|(?=\\.)', next: 'pop' }, { include: '#parenthesized-expression' }, { include: '#internal-function-parts' } ] }, { include: '#everything-else' }, { defaultToken: 'meta.function.erlang' } ] } ], '#function-call': [ { token: 'meta.function-call.erlang', regex: '(?=(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*(?:\\(|:\\s*(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*\\())', push: [ { token: 'punctuation.definition.parameters.end.erlang', regex: '\\)', next: 'pop' }, { token: [ 'entity.name.type.class.module.erlang', 'text', 'punctuation.separator.module-function.erlang', 'text', 'entity.name.function.guard.erlang', 'text', 'punctuation.definition.parameters.begin.erlang' ], regex: '(?:(erlang)(\\s*)(:)(\\s*))?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)(\\s*)(\\()', push: [ { token: 'text', regex: '(?=\\))', next: 'pop' }, { token: 'punctuation.separator.parameters.erlang', regex: ',' }, { include: '#everything-else' } ] }, { token: [ 'entity.name.type.class.module.erlang', 'text', 'punctuation.separator.module-function.erlang', 'text', 'entity.name.function.erlang', 'text', 'punctuation.definition.parameters.begin.erlang' ], regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\()', push: [ { token: 'text', regex: '(?=\\))', next: 'pop' }, { token: 'punctuation.separator.parameters.erlang', regex: ',' }, { include: '#everything-else' } ] }, { defaultToken: 'meta.function-call.erlang' } ] } ], '#import-export-directive': [ { token: [ 'meta.directive.import.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.import.erlang', 'keyword.control.directive.import.erlang', 'meta.directive.import.erlang', 'punctuation.definition.parameters.begin.erlang', 'meta.directive.import.erlang', 'entity.name.type.class.module.erlang', 'meta.directive.import.erlang', 'punctuation.separator.parameters.erlang' ], regex: '^(\\s*)(-)(\\s*)(import)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)', push: [ { token: [ 'punctuation.definition.parameters.end.erlang', 'meta.directive.import.erlang', 'punctuation.section.directive.end.erlang' ], regex: '(\\))(\\s*)(\\.)', next: 'pop' }, { include: '#internal-function-list' }, { defaultToken: 'meta.directive.import.erlang' } ] }, { token: [ 'meta.directive.export.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.export.erlang', 'keyword.control.directive.export.erlang', 'meta.directive.export.erlang', 'punctuation.definition.parameters.begin.erlang' ], regex: '^(\\s*)(-)(\\s*)(export)(\\s*)(\\()', push: [ { token: [ 'punctuation.definition.parameters.end.erlang', 'meta.directive.export.erlang', 'punctuation.section.directive.end.erlang' ], regex: '(\\))(\\s*)(\\.)', next: 'pop' }, { include: '#internal-function-list' }, { defaultToken: 'meta.directive.export.erlang' } ] } ], '#internal-expression-punctuation': [ { token: [ 'punctuation.separator.clause-head-body.erlang', 'punctuation.separator.clauses.erlang', 'punctuation.separator.expressions.erlang' ], regex: '(->)|(;)|(,)' } ], '#internal-function-list': [ { token: 'punctuation.definition.list.begin.erlang', regex: '\\[', push: [ { token: 'punctuation.definition.list.end.erlang', regex: '\\]', next: 'pop' }, { token: [ 'entity.name.function.erlang', 'text', 'punctuation.separator.function-arity.erlang' ], regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(/)', push: [ { token: 'punctuation.separator.list.erlang', regex: ',|(?=\\])', next: 'pop' }, { include: '#everything-else' } ] }, { include: '#everything-else' }, { defaultToken: 'meta.structure.list.function.erlang' } ] } ], '#internal-function-parts': [ { token: 'text', regex: '(?=\\()', push: [ { token: 'punctuation.separator.clause-head-body.erlang', regex: '->', next: 'pop' }, { token: 'punctuation.definition.parameters.begin.erlang', regex: '\\(', push: [ { token: 'punctuation.definition.parameters.end.erlang', regex: '\\)', next: 'pop' }, { token: 'punctuation.separator.parameters.erlang', regex: ',' }, { include: '#everything-else' } ] }, { token: 'punctuation.separator.guards.erlang', regex: ',|;' }, { include: '#everything-else' } ] }, { token: 'punctuation.separator.expressions.erlang', regex: ',' }, { include: '#everything-else' } ], '#internal-record-body': [ { token: 'punctuation.definition.class.record.begin.erlang', regex: '\\{', push: [ { token: 'meta.structure.record.erlang', regex: '(?=\\})', next: 'pop' }, { token: [ 'variable.other.field.erlang', 'variable.language.omitted.field.erlang', 'text', 'keyword.operator.assignment.erlang' ], regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')|(_))(\\s*)(=|::)', push: [ { token: 'punctuation.separator.class.record.erlang', regex: ',|(?=\\})', next: 'pop' }, { include: '#everything-else' } ] }, { token: [ 'variable.other.field.erlang', 'text', 'punctuation.separator.class.record.erlang' ], regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)((?:,)?)' }, { include: '#everything-else' }, { defaultToken: 'meta.structure.record.erlang' } ] } ], '#internal-type-specifiers': [ { token: 'punctuation.separator.value-type.erlang', regex: '/', push: [ { token: 'text', regex: '(?=,|:|>>)', next: 'pop' }, { token: [ 'storage.type.erlang', 'storage.modifier.signedness.erlang', 'storage.modifier.endianness.erlang', 'storage.modifier.unit.erlang', 'punctuation.separator.type-specifiers.erlang' ], regex: '(integer|float|binary|bytes|bitstring|bits)|(signed|unsigned)|(big|little|native)|(unit)|(-)' } ] } ], '#keyword': [ { token: 'keyword.control.erlang', regex: '\\b(?:after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\\b' } ], '#list': [ { token: 'punctuation.definition.list.begin.erlang', regex: '\\[', push: [ { token: 'punctuation.definition.list.end.erlang', regex: '\\]', next: 'pop' }, { token: 'punctuation.separator.list.erlang', regex: '\\||\\|\\||,' }, { include: '#everything-else' }, { defaultToken: 'meta.structure.list.erlang' } ] } ], '#macro-directive': [ { token: [ 'meta.directive.ifdef.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.ifdef.erlang', 'keyword.control.directive.ifdef.erlang', 'meta.directive.ifdef.erlang', 'punctuation.definition.parameters.begin.erlang', 'meta.directive.ifdef.erlang', 'entity.name.function.macro.erlang', 'meta.directive.ifdef.erlang', 'punctuation.definition.parameters.end.erlang', 'meta.directive.ifdef.erlang', 'punctuation.section.directive.end.erlang' ], regex: '^(\\s*)(-)(\\s*)(ifdef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' }, { token: [ 'meta.directive.ifndef.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.ifndef.erlang', 'keyword.control.directive.ifndef.erlang', 'meta.directive.ifndef.erlang', 'punctuation.definition.parameters.begin.erlang', 'meta.directive.ifndef.erlang', 'entity.name.function.macro.erlang', 'meta.directive.ifndef.erlang', 'punctuation.definition.parameters.end.erlang', 'meta.directive.ifndef.erlang', 'punctuation.section.directive.end.erlang' ], regex: '^(\\s*)(-)(\\s*)(ifndef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' }, { token: [ 'meta.directive.undef.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.undef.erlang', 'keyword.control.directive.undef.erlang', 'meta.directive.undef.erlang', 'punctuation.definition.parameters.begin.erlang', 'meta.directive.undef.erlang', 'entity.name.function.macro.erlang', 'meta.directive.undef.erlang', 'punctuation.definition.parameters.end.erlang', 'meta.directive.undef.erlang', 'punctuation.section.directive.end.erlang' ], regex: '^(\\s*)(-)(\\s*)(undef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' } ], '#macro-usage': [ { token: [ 'keyword.operator.macro.erlang', 'meta.macro-usage.erlang', 'entity.name.function.macro.erlang' ], regex: '(\\?\\??)(\\s*)([a-zA-Z\\d@_]+)' } ], '#module-directive': [ { token: [ 'meta.directive.module.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.module.erlang', 'keyword.control.directive.module.erlang', 'meta.directive.module.erlang', 'punctuation.definition.parameters.begin.erlang', 'meta.directive.module.erlang', 'entity.name.type.class.module.definition.erlang', 'meta.directive.module.erlang', 'punctuation.definition.parameters.end.erlang', 'meta.directive.module.erlang', 'punctuation.section.directive.end.erlang' ], regex: '^(\\s*)(-)(\\s*)(module)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ], '#number': [ { token: 'text', regex: '(?=\\d)', push: [ { token: 'text', regex: '(?!\\d)', next: 'pop' }, { token: [ 'constant.numeric.float.erlang', 'punctuation.separator.integer-float.erlang', 'constant.numeric.float.erlang', 'punctuation.separator.float-exponent.erlang' ], regex: '(\\d+)(\\.)(\\d+)((?:[eE][\\+\\-]?\\d+)?)' }, { token: [ 'constant.numeric.integer.binary.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.binary.erlang' ], regex: '(2)(#)([0-1]+)' }, { token: [ 'constant.numeric.integer.base-3.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-3.erlang' ], regex: '(3)(#)([0-2]+)' }, { token: [ 'constant.numeric.integer.base-4.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-4.erlang' ], regex: '(4)(#)([0-3]+)' }, { token: [ 'constant.numeric.integer.base-5.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-5.erlang' ], regex: '(5)(#)([0-4]+)' }, { token: [ 'constant.numeric.integer.base-6.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-6.erlang' ], regex: '(6)(#)([0-5]+)' }, { token: [ 'constant.numeric.integer.base-7.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-7.erlang' ], regex: '(7)(#)([0-6]+)' }, { token: [ 'constant.numeric.integer.octal.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.octal.erlang' ], regex: '(8)(#)([0-7]+)' }, { token: [ 'constant.numeric.integer.base-9.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-9.erlang' ], regex: '(9)(#)([0-8]+)' }, { token: [ 'constant.numeric.integer.decimal.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.decimal.erlang' ], regex: '(10)(#)(\\d+)' }, { token: [ 'constant.numeric.integer.base-11.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-11.erlang' ], regex: '(11)(#)([\\daA]+)' }, { token: [ 'constant.numeric.integer.base-12.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-12.erlang' ], regex: '(12)(#)([\\da-bA-B]+)' }, { token: [ 'constant.numeric.integer.base-13.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-13.erlang' ], regex: '(13)(#)([\\da-cA-C]+)' }, { token: [ 'constant.numeric.integer.base-14.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-14.erlang' ], regex: '(14)(#)([\\da-dA-D]+)' }, { token: [ 'constant.numeric.integer.base-15.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-15.erlang' ], regex: '(15)(#)([\\da-eA-E]+)' }, { token: [ 'constant.numeric.integer.hexadecimal.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.hexadecimal.erlang' ], regex: '(16)(#)([\\da-fA-F]+)' }, { token: [ 'constant.numeric.integer.base-17.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-17.erlang' ], regex: '(17)(#)([\\da-gA-G]+)' }, { token: [ 'constant.numeric.integer.base-18.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-18.erlang' ], regex: '(18)(#)([\\da-hA-H]+)' }, { token: [ 'constant.numeric.integer.base-19.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-19.erlang' ], regex: '(19)(#)([\\da-iA-I]+)' }, { token: [ 'constant.numeric.integer.base-20.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-20.erlang' ], regex: '(20)(#)([\\da-jA-J]+)' }, { token: [ 'constant.numeric.integer.base-21.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-21.erlang' ], regex: '(21)(#)([\\da-kA-K]+)' }, { token: [ 'constant.numeric.integer.base-22.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-22.erlang' ], regex: '(22)(#)([\\da-lA-L]+)' }, { token: [ 'constant.numeric.integer.base-23.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-23.erlang' ], regex: '(23)(#)([\\da-mA-M]+)' }, { token: [ 'constant.numeric.integer.base-24.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-24.erlang' ], regex: '(24)(#)([\\da-nA-N]+)' }, { token: [ 'constant.numeric.integer.base-25.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-25.erlang' ], regex: '(25)(#)([\\da-oA-O]+)' }, { token: [ 'constant.numeric.integer.base-26.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-26.erlang' ], regex: '(26)(#)([\\da-pA-P]+)' }, { token: [ 'constant.numeric.integer.base-27.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-27.erlang' ], regex: '(27)(#)([\\da-qA-Q]+)' }, { token: [ 'constant.numeric.integer.base-28.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-28.erlang' ], regex: '(28)(#)([\\da-rA-R]+)' }, { token: [ 'constant.numeric.integer.base-29.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-29.erlang' ], regex: '(29)(#)([\\da-sA-S]+)' }, { token: [ 'constant.numeric.integer.base-30.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-30.erlang' ], regex: '(30)(#)([\\da-tA-T]+)' }, { token: [ 'constant.numeric.integer.base-31.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-31.erlang' ], regex: '(31)(#)([\\da-uA-U]+)' }, { token: [ 'constant.numeric.integer.base-32.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-32.erlang' ], regex: '(32)(#)([\\da-vA-V]+)' }, { token: [ 'constant.numeric.integer.base-33.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-33.erlang' ], regex: '(33)(#)([\\da-wA-W]+)' }, { token: [ 'constant.numeric.integer.base-34.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-34.erlang' ], regex: '(34)(#)([\\da-xA-X]+)' }, { token: [ 'constant.numeric.integer.base-35.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-35.erlang' ], regex: '(35)(#)([\\da-yA-Y]+)' }, { token: [ 'constant.numeric.integer.base-36.erlang', 'punctuation.separator.base-integer.erlang', 'constant.numeric.integer.base-36.erlang' ], regex: '(36)(#)([\\da-zA-Z]+)' }, { token: 'invalid.illegal.integer.erlang', regex: '\\d+#[\\da-zA-Z]+' }, { token: 'constant.numeric.integer.decimal.erlang', regex: '\\d+' } ] } ], '#parenthesized-expression': [ { token: 'punctuation.section.expression.begin.erlang', regex: '\\(', push: [ { token: 'punctuation.section.expression.end.erlang', regex: '\\)', next: 'pop' }, { include: '#everything-else' }, { defaultToken: 'meta.expression.parenthesized' } ] } ], '#record-directive': [ { token: [ 'meta.directive.record.erlang', 'punctuation.section.directive.begin.erlang', 'meta.directive.record.erlang', 'keyword.control.directive.import.erlang', 'meta.directive.record.erlang', 'punctuation.definition.parameters.begin.erlang', 'meta.directive.record.erlang', 'entity.name.type.class.record.definition.erlang', 'meta.directive.record.erlang', 'punctuation.separator.parameters.erlang' ], regex: '^(\\s*)(-)(\\s*)(record)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)', push: [ { token: [ 'punctuation.definition.class.record.end.erlang', 'meta.directive.record.erlang', 'punctuation.definition.parameters.end.erlang', 'meta.directive.record.erlang', 'punctuation.section.directive.end.erlang' ], regex: '(\\})(\\s*)(\\))(\\s*)(\\.)', next: 'pop' }, { include: '#internal-record-body' }, { defaultToken: 'meta.directive.record.erlang' } ] } ], '#record-usage': [ { token: [ 'keyword.operator.record.erlang', 'meta.record-usage.erlang', 'entity.name.type.class.record.erlang', 'meta.record-usage.erlang', 'punctuation.separator.record-field.erlang', 'meta.record-usage.erlang', 'variable.other.field.erlang' ], regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\.)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')' }, { token: [ 'keyword.operator.record.erlang', 'meta.record-usage.erlang', 'entity.name.type.class.record.erlang' ], regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')', push: [ { token: 'punctuation.definition.class.record.end.erlang', regex: '\\}', next: 'pop' }, { include: '#internal-record-body' }, { defaultToken: 'meta.record-usage.erlang' } ] } ], '#string': [ { token: 'punctuation.definition.string.begin.erlang', regex: '"', push: [ { token: 'punctuation.definition.string.end.erlang', regex: '"', next: 'pop' }, { token: [ 'punctuation.definition.escape.erlang', 'constant.character.escape.erlang', 'punctuation.definition.escape.erlang', 'constant.character.escape.erlang', 'constant.character.escape.erlang' ], regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' }, { token: 'invalid.illegal.string.erlang', regex: '\\\\\\^?.?' }, { token: [ 'punctuation.definition.erlang', 'punctuation.separator.erlang', 'constant.other.erlang', 'punctuation.separator.erlang', 'punctuation.separator.erlang', 'constant.other.erlang', 'punctuation.separator.erlang', 'punctuation.separator.erlang', 'punctuation.separator.erlang', 'constant.other.erlang', 'constant.other.erlang' ], regex: '(~)(?:((?:\\-)?)(\\d+)|(\\*))?(?:(\\.)(?:(\\d+)|(\\*)))?(?:(\\.)(?:(\\*)|(.)))?([~cfegswpWPBX#bx\\+ni])' }, { token: [ 'punctuation.definition.erlang', 'punctuation.separator.erlang', 'constant.other.erlang', 'constant.other.erlang' ], regex: '(~)((?:\\*)?)((?:\\d+)?)([~du\\-#fsacl])' }, { token: 'invalid.illegal.string.erlang', regex: '~.?' }, { defaultToken: 'string.quoted.double.erlang' } ] } ], '#symbolic-operator': [ { token: 'keyword.operator.symbolic.erlang', regex: '\\+\\+|\\+|--|-|\\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|!|::' } ], '#textual-operator': [ { token: 'keyword.operator.textual.erlang', regex: '\\b(?:andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\\b' } ], '#tuple': [ { token: 'punctuation.definition.tuple.begin.erlang', regex: '\\{', push: [ { token: 'punctuation.definition.tuple.end.erlang', regex: '\\}', next: 'pop' }, { token: 'punctuation.separator.tuple.erlang', regex: ',' }, { include: '#everything-else' }, { defaultToken: 'meta.structure.tuple.erlang' } ] } ], '#variable': [ { token: [ 'variable.other.erlang', 'variable.language.omitted.erlang' ], regex: '(_[a-zA-Z\\d@_]+|[A-Z][a-zA-Z\\d@_]*)|(_)' } ] }; this.normalizeRules(); }; ErlangHighlightRules.metaData = { comment: 'The recognition of function definitions and compiler directives (such as module, record and macro definitions) requires that each of the aforementioned constructs must be the first string inside a line (except for whitespace). Also, the function/module/record/macro names must be given unquoted. -- desp', fileTypes: [ 'erl', 'hrl' ], keyEquivalent: '^~E', name: 'Erlang', scopeName: 'source.erlang' }; oop.inherits(ErlangHighlightRules, TextHighlightRules); exports.ErlangHighlightRules = ErlangHighlightRules; ================================================ FILE: src/mode/flix.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var FlixHighlightRules = require("./flix_highlight_rules").FlixHighlightRules; var Mode = function() { this.HighlightRules = FlixHighlightRules; }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/flix"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/flix_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var FlixHighlightRules = function() { var keywords = ( "use|checked_cast|checked_ecast|unchecked_cast|as|discard|from|into|inject|" + "project|solve|query|where|select|force|import|region|handler|instanceof|new|pquery|psolve|run|super" ); var controlKeywords = ( "choose|forA|forM|foreach|yield|if|else|case|match|ematch|try|catch|throw|spawn|par" ); var operators = "not|and|or|fix"; var declarations = "eff|def|redef|law|enum|case|type|alias|trait|instance|mod|struct|let"; var modifiers = "with|lazy|lawful|pub|override|sealed|static|mut|unsafe"; var primitives = "Unit|Bool|Char|Float32|Float64|Int8|Int16|Int32|Int64|BigInt|String"; var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "keyword.control": controlKeywords, "keyword.operator": operators, "storage.type": declarations, "storage.modifier": modifiers, "support.type": primitives }, "identifier"); this.$rules = { "start" : [ { token : "comment.line", regex : "\\/\\/.*$" }, { token : "comment.block", regex : "\\/\\*", next : "comment" }, { token : "string", regex : '"', next : "string" }, { token : "string.regexp", regex : 'regex"', next : "regex" }, { token : "constant.character", regex : "'", next : "char" }, { token : "constant.numeric", // hex regex : "0x[a-fA-F0-9](_*[a-fA-F0-9])*(i8|i16|i32|i64|ii)?\\b" }, { token : "constant.numeric", // float regex : "[0-9](_*[0-9])*\\.[0-9](_*[0-9])*(f32|f64)?\\b" }, { token : "constant.numeric", // integer regex : "[0-9](_*[0-9])*(i8|i16|i32|i64|ii)?\\b" }, { token : "constant.language.boolean", regex : "(true|false)\\b" }, { token : "constant.language", regex : "null\\b" }, { token : "keyword.operator", regex : "\\->|~>|<\\-|=>" }, { token : "storage.modifier", regex : "@(Deprecated|Experimental|Internal|ParallelWhenPure|Parallel|LazyWhenPure|Lazy|Skip|Test)\\b" }, { token : "keyword", // hole regex : "(\\?\\?\\?|\\?[a-zA-Z0-9]+)" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment.block", regex : "\\*\\/", next : "start" }, { defaultToken : "comment.block" } ], "string" : [ { token : "constant.character.escape", // unicode regex : "\\\\(u[0-9a-fA-F]{4})" }, { token : "constant.character.escape", regex : '\\\\.' }, { token : "string", regex : '"', next : "start" }, { token : "string", regex : '[^"\\\\]+' } ], "regex" : [ { token : "constant.character.escape", // unicode regex : "\\\\(u[0-9a-fA-F]{4})" }, { token : "constant.character.escape", regex : '\\\\.' }, { token : "string.regexp", regex : '"', next : "start" }, { token : "string.regexp", regex : '[^"\\\\]+' } ], "char" : [ { token : "constant.character.escape", // unicode regex : "\\\\(u[0-9a-fA-F]{4})" }, { token : "constant.character.escape", regex : '\\\\.' }, { token : "constant.character", regex : "'", next : "start" }, { token : "constant.character", regex : "[^'\\\\]+" } ] }; }; oop.inherits(FlixHighlightRules, TextHighlightRules); exports.FlixHighlightRules = FlixHighlightRules; ================================================ FILE: src/mode/folding/asciidoc.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { this.foldingStartMarker = /^(?:\|={10,}|[\.\/=\-~^+]{4,}\s*$|={1,5} )/; this.singleLineHeadingRe = /^={1,5}(?=\s+\S)/; this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); if (!this.foldingStartMarker.test(line)) return ""; if (line[0] == "=") { if (this.singleLineHeadingRe.test(line)) return "start"; if (session.getLine(row - 1).length != session.getLine(row).length) return ""; return "start"; } if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock") return "end"; return "start"; }; this.getFoldWidgetRange = function(session, foldStyle, row) { var line = session.getLine(row); var startColumn = line.length; var maxRow = session.getLength(); var startRow = row; var endRow = row; if (!line.match(this.foldingStartMarker)) return; var token; function getTokenType(row) { token = session.getTokens(row)[0]; return token && token.type; } var levels = ["=","-","~","^","+"]; var heading = "markup.heading"; var singleLineHeadingRe = this.singleLineHeadingRe; function getLevel() { var match = token.value.match(singleLineHeadingRe); if (match) return match[0].length; var level = levels.indexOf(token.value[0]) + 1; if (level == 1) { if (session.getLine(row - 1).length != session.getLine(row).length) return Infinity; } return level; } if (getTokenType(row) == heading) { var startHeadingLevel = getLevel(); while (++row < maxRow) { if (getTokenType(row) != heading) continue; var level = getLevel(); if (level <= startHeadingLevel) break; } var isSingleLineHeading = token && token.value.match(this.singleLineHeadingRe); endRow = isSingleLineHeading ? row - 1 : row - 2; if (endRow > startRow) { while (endRow > startRow && (!getTokenType(endRow) || token.value[0] == "[")) endRow--; } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } } else { var state = session.bgTokenizer.getState(row); if (state == "dissallowDelimitedBlock") { while (row -- > 0) { if (session.bgTokenizer.getState(row).lastIndexOf("Block") == -1) break; } endRow = row + 1; if (endRow < startRow) { var endColumn = session.getLine(row).length; return new Range(endRow, 5, startRow, startColumn - 5); } } else { while (++row < maxRow) { if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock") break; } endRow = row; if (endRow > startRow) { var endColumn = session.getLine(row).length; return new Range(startRow, 5, endRow, endColumn - 5); } } } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/basic.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var TokenIterator = require("../../token_iterator").TokenIterator; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { this.indentKeywords = { "tron": 1, "while": 1, "for": 1, "troff": -1, "wend": -1, "next": -1 }; this.foldingStartMarker = /(?:\s|^)(tron|while|for)\b/i; this.foldingStopMarker = /(?:\b)(troff|next|wend)\b/i; this.getFoldWidgetRange = function (session, foldStyle, row) { var line = session.getLine(row); var isStart = this.foldingStartMarker.test(line); var isEnd = this.foldingStopMarker.test(line); if (isStart || isEnd) { var match = (isEnd) ? this.foldingStopMarker.exec(line) : this.foldingStartMarker.exec(line); var keyword = match && match[1].toLowerCase(); if (keyword) { var type = session.getTokenAt(row, match.index + 2).type; if (type === "keyword.control") return this.basicBlock(session, row, match.index + 2); } } }; this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); var isStart = this.foldingStartMarker.test(line); var isEnd = this.foldingStopMarker.test(line); if (isStart && !isEnd) { var match = this.foldingStartMarker.exec(line); var keyword = match && match[1].toLowerCase(); if (keyword) { var type = session.getTokenAt(row, match.index + 2).type; if (type == "keyword.control") { return "start"; } } } if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) return ""; var match = line.match(this.foldingStopMarker); var keyword = match && match[1].toLowerCase(); if (this.indentKeywords[keyword]) { if (session.getTokenAt(row, match.index + 2).type === "keyword.control") return "end"; } return ""; }; this.basicBlock = function(session, row, column, tokenRange) { var stream = new TokenIterator(session, row, column); var token = stream.getCurrentToken(); if (!token || token.type != "keyword.control") return; var val = token.value.toLowerCase(); var stack = [val]; var dir = this.indentKeywords[val]; if (!dir) return; var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length; var startRow = row; stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; while(token = stream.step()) { val = token.value.toLowerCase(); if (token.type !== "keyword.control" || !this.indentKeywords[val]) continue; var level = dir * this.indentKeywords[val]; if (level > 0) { stack.unshift(val); } else if (level <= 0) { stack.shift(); } if (stack.length === 0) { break; } } if (!token) return null; if (tokenRange) return stream.getCurrentTokenRange(); var row = stream.getCurrentTokenRow(); if (dir === -1) return new Range(row, session.getLine(row).length, startRow, startColumn); else return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn()); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/basic_test.js ================================================ "use strict"; var BasicMode = require("../basic").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { setUp: function() { this.mode = new BasicMode(); }, "test: ms-basic mode folding with markbeginend": function() { var session = new EditSession([ '10 INPUT"HOW MANY DIGITS";N', '20 T=TIME', '30 L=INT(10*N/3)+1:DIM A(L)', '40 Z$="000000":T$="999999"', '50 FOR I=1TOL:A(I)=2:NEXT', '60 M=0:P=0', '70 FOR J=1TON:Q=0:K=2*L+1', '80 FOR I=L TO 1 STEP -1', 'WHILE FLIPS', 'FLIPS=0', 'FOR I=1 TO J-1', 'IF A$(I)>A$(I+1) THEN', 'SWAP A$(I),', 'A$(I+1):FLIPS=1', 'NEXT I', 'WEND', '90 K=K-2:X=10*A(I)+Q*I', '100 Q=INT(X/K):A(I)=X-Q*K', '110 NEXT', '120 Y=INT(Q/10):A(1)=Q-10*Y:Q=Y', '130 IF Q=9 THEN M=M+1:GOTO170', '140 IF Q>9 THEN PRINT CHR$(49+P);LEFT$(Z$,M);:GOTO170', '150 PRINT CHR$(48+P);LEFT$(T$,M);', '160 P=Q:M=0', '170 NEXT', '180 PRINT CHR$(48+P):PRINT (TIME-T)/59.98' ]); session.setFoldStyle("markbeginend"); session.setMode(this.mode); // Assert fold widgets at the start of foldable regions assert.equal(session.getFoldWidget(6), "start"); // Line 6: FOR J=1TON assert.equal(session.getFoldWidget(7), "start"); // Line 7: FOR I=L TO 1 STEP -1 assert.equal(session.getFoldWidget(8), "start"); // Line 8: WHILE FLIPS assert.equal(session.getFoldWidget(10), "start"); // Line10: FOR I=1 TO J-1 // Assert fold widgets at the end of foldable regions assert.equal(session.getFoldWidget(14), "end"); // Line14: NEXT I assert.equal(session.getFoldWidget(15), "end"); // Line15: WEND assert.equal(session.getFoldWidget(18), "end"); // Line18: 110 NEXT assert.equal(session.getFoldWidget(24), "end"); // Line24: 170 NEXT // Lines without fold widgets for (var i = 0; i < session.getLength(); i++) { if ([0, 1, 2, 3, 4, 6, 7, 8, 10, 14, 15, 18, 24].indexOf(i) === -1) { assert.equal(session.getFoldWidget(i), ""); } } // Check folding ranges from start lines var range; range = session.getFoldWidgetRange(6); assert.range(range, 6, 25, 24, 4); range = session.getFoldWidgetRange(7); assert.range(range, 7, 23, 18, 4); range = session.getFoldWidgetRange(8); assert.range(range, 8, 11, 15, 0); range = session.getFoldWidgetRange(10); assert.range(range, 10, 14, 14, 0); // Check folding ranges from end lines range = session.getFoldWidgetRange(14); assert.range(range, 10, 14, 14, 0); range = session.getFoldWidgetRange(15); assert.range(range, 8, 11, 15, 0); range = session.getFoldWidgetRange(18); assert.range(range, 7, 23, 18, 4); range = session.getFoldWidgetRange(24); assert.range(range, 6, 25, 24, 4); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/c9search.js ================================================ "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() { this.foldingStartMarker = /^(\S.*:|Searching for.*)$/; this.foldingStopMarker = /^(\s+|Found.*)$/; this.getFoldWidgetRange = function(session, foldStyle, row) { var lines = session.doc.getAllLines(row); var line = lines[row]; var level1 = /^(Found.*|Searching for.*)$/; var level2 = /^(\S.*:|\s*)$/; var re = level1.test(line) ? level1 : level2; var startRow = row; var endRow = row; if (this.foldingStartMarker.test(line)) { for (var i = row + 1, l = session.getLength(); i < l; i++) { if (re.test(lines[i])) break; } endRow = i; } else if (this.foldingStopMarker.test(line)) { for (var i = row - 1; i >= 0; i--) { line = lines[i]; if (re.test(line)) break; } startRow = i; } if (startRow != endRow) { var col = line.length; if (re === level1) col = line.search(/\(Found[^)]+\)$|$/); return new Range(startRow, col, endRow, 0); } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/coffee.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { this.commentBlock = function(session, row) { var re = /\S/; var line = session.getLine(row); var startLevel = line.search(re); if (startLevel == -1 || line[startLevel] != "#") return; var startColumn = line.length; var maxRow = session.getLength(); var startRow = row; var endRow = row; while (++row < maxRow) { line = session.getLine(row); var level = line.search(re); if (level == -1) continue; if (line[level] != "#") break; endRow = row; } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } }; this.getFoldWidgetRange = function(session, foldStyle, row) { var range = this.indentationBlock(session, row); if (range) return range; range = this.commentBlock(session, row); if (range) return range; }; // must return "" if there's no fold, to enable caching this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); var indent = line.search(/\S/); var next = session.getLine(row + 1); var prev = session.getLine(row - 1); var prevIndent = prev.search(/\S/); var nextIndent = next.search(/\S/); if (indent == -1) { session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; return ""; } // documentation comments if (prevIndent == -1) { if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { session.foldWidgets[row - 1] = ""; session.foldWidgets[row + 1] = ""; return "start"; } } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { if (session.getLine(row - 2).search(/\S/) == -1) { session.foldWidgets[row - 1] = "start"; session.foldWidgets[row + 1] = ""; return ""; } } if (prevIndent!= -1 && prevIndent < indent) session.foldWidgets[row - 1] = "start"; else session.foldWidgets[row - 1] = ""; if (indent < nextIndent) return "start"; else return ""; }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/coffee_test.js ================================================ "use strict"; var CoffeeMode = require("../coffee").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); function testFoldWidgets(array) { var session = array.filter(function(_, i){return i % 2 == 1;}); session = new EditSession(session); var mode = new CoffeeMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); var widgets = array.filter(function(_, i){return i % 2 == 0;}); widgets.forEach(function(w, i){ session.foldWidgets[i] = session.getFoldWidget(i); }); widgets.forEach(function(w, i){ w = w.split(","); var type = w[0] == ">" ? "start" : w[0] == "<" ? "end" : ""; assert.equal(session.foldWidgets[i], type); if (!type) return; var range = session.getFoldWidgetRange(i); if (!w[1]) { assert.equal(range, null); return; } assert.equal(range.start.row, i); assert.equal(range.end.row - range.start.row, parseInt(w[1])); testColumn(w[2], range.start); testColumn(w[3], range.end); }); function testColumn(w, pos) { if (!w) return; if (w == "l") w = session.getLine(pos.row).length; else w = parseInt(w); assert.equal(pos.column, w); } } module.exports = { "test: coffee script indentation based folding": function() { testFoldWidgets([ '>,1,l,l', ' ## indented comment', '', ' # ', '', '', '>,1,l,l', ' # plain comment', '', ' # ', '>,2', ' function (x)=>', '', ' ', '', ' x++', '', ' ', '', ' ', '>,2', ' bar = ', '', ' foo: 1', '', ' baz: lighter' ]); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/csharp.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Range = require("../../range").Range; var CFoldMode = require("./cstyle").FoldMode; var FoldMode = exports.FoldMode = function(commentRegex) { if (commentRegex) { this.foldingStartMarker = new RegExp( this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) ); this.foldingStopMarker = new RegExp( this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) ); } }; oop.inherits(FoldMode, CFoldMode); (function() { this.usingRe = /^\s*using \S/; this.getFoldWidgetRangeBase = this.getFoldWidgetRange; this.getFoldWidgetBase = this.getFoldWidget; this.getFoldWidget = function(session, foldStyle, row) { var fw = this.getFoldWidgetBase(session, foldStyle, row); if (!fw) { var line = session.getLine(row); if (/^\s*#region\b/.test(line)) return "start"; var usingRe = this.usingRe; if (usingRe.test(line)) { var prev = session.getLine(row - 1); var next = session.getLine(row + 1); if (!usingRe.test(prev) && usingRe.test(next)) return "start"; } } return fw; }; this.getFoldWidgetRange = function(session, foldStyle, row) { var range = this.getFoldWidgetRangeBase(session, foldStyle, row); if (range) return range; var line = session.getLine(row); if (this.usingRe.test(line)) return this.getUsingStatementBlock(session, line, row); if (/^\s*#region\b/.test(line)) return this.getRegionBlock(session, line, row); }; this.getUsingStatementBlock = function(session, line, row) { var startColumn = line.match(this.usingRe)[0].length - 1; var maxRow = session.getLength(); var startRow = row; var endRow = row; while (++row < maxRow) { line = session.getLine(row); if (/^\s*$/.test(line)) continue; if (!this.usingRe.test(line)) break; endRow = row; } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } }; this.getRegionBlock = function(session, line, row) { var startColumn = line.search(/\s*$/); var maxRow = session.getLength(); var startRow = row; var re = /^\s*#(end)?region\b/; var depth = 1; while (++row < maxRow) { line = session.getLine(row); var m = re.exec(line); if (!m) continue; if (m[1]) depth--; else depth++; if (!depth) break; } var endRow = row; if (endRow > startRow) { return new Range(startRow, startColumn, endRow, line.length); } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/cstyle.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Range = require("../../range").Range; var BaseFoldMode = require("./fold_mode").FoldMode; var FoldMode = exports.FoldMode = function(commentRegex) { if (commentRegex) { this.foldingStartMarker = new RegExp( this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) ); this.foldingStopMarker = new RegExp( this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) ); } }; oop.inherits(FoldMode, BaseFoldMode); (function() { this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; //prevent naming conflict with any modes that inherit from cstyle and override this (like csharp) this._getFoldWidgetBase = this.getFoldWidget; /** * Gets fold widget with some non-standard extras: * * @example lineCommentRegionStart * //#region [optional description] * * @example blockCommentRegionStart * /*#region [optional description] *[/] * * @example tripleStarFoldingSection * /*** this folds even though 1 line because it has 3 stars ***[/] * * @note the pound symbol for region tags is optional */ this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); if (this.singleLineBlockCommentRe.test(line)) { // No widget for single line block comment unless region or triple star if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) return ""; } var fw = this._getFoldWidgetBase(session, foldStyle, row); if (!fw && this.startRegionRe.test(line)) return "start"; // lineCommentRegionStart return fw; }; this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { var line = session.getLine(row); if (this.startRegionRe.test(line)) return this.getCommentRegionBlock(session, line, 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, 1); if (range && !range.isMultiLine()) { if (forceMultiline) { range = this.getSectionRange(session, row); } else if (foldStyle != "all") range = null; } return range; } if (foldStyle === "markbegin") return; var match = line.match(this.foldingStopMarker); if (match) { var i = match.index + match[0].length; if (match[1]) return this.closingBracketBlock(session, match[1], row, i); return session.getCommentFoldRange(row, i, -1); } }; this.getSectionRange = function(session, row) { var line = session.getLine(row); var startIndent = line.search(/\S/); var startRow = row; var startColumn = line.length; row = row + 1; var endRow = row; var maxRow = session.getLength(); while (++row < maxRow) { line = session.getLine(row); var indent = line.search(/\S/); if (indent === -1) continue; if (startIndent > indent) break; var subRange = this.getFoldWidgetRange(session, "all", row); if (subRange) { if (subRange.start.row <= startRow) { break; } else if (subRange.isMultiLine()) { row = subRange.end.row; } else if (startIndent == indent) { break; } } endRow = row; } return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); }; /** * gets comment region block with end region assumed to be start of comment in any cstyle mode or SQL mode (--) which inherits from this. * There may optionally be a pound symbol before the region/endregion statement */ this.getCommentRegionBlock = function(session, line, row) { var startColumn = line.search(/\s*$/); var maxRow = session.getLength(); var startRow = row; var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; var depth = 1; while (++row < maxRow) { line = session.getLine(row); var m = re.exec(line); if (!m) continue; if (m[1]) depth--; else depth++; if (!depth) break; } var endRow = row; if (endRow > startRow) { return new Range(startRow, startColumn, endRow, line.length); } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/cstyle_test.js ================================================ "use strict"; var JavaScriptMode = require("../javascript").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { "test: fold comments": function() { var session = new EditSession([ '/*', 'stuff', '*/' ]); var mode = new JavaScriptMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), "end"); assert.range(session.getFoldWidgetRange(0), 0, 2, 2, 0); assert.range(session.getFoldWidgetRange(2), 0, 2, 2, 0); }, "test: fold doc style comments": function() { var session = new EditSession([ '/**', ' * stuff', ' * *** */' ]); var mode = new JavaScriptMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), "end"); assert.range(session.getFoldWidgetRange(0), 0, 3, 2, 7); assert.range(session.getFoldWidgetRange(2), 0, 3, 2, 7); }, "test: fold sections": function() { var session = new EditSession([ '/*** section0 ***/', '{', ' /*** section1 ***/', ' stuff', ' ', ' /*** section2 ***/', ' ', ' stuff', ' ', ' }', 'foo' ]); var mode = new JavaScriptMode(); session.setFoldStyle("markbegin"); session.setMode(mode); assert.range(session.getFoldWidgetRange(0, true), 0, 18, 10, 3); assert.range(session.getFoldWidgetRange(2, true), 2, 22, 3, 9); assert.range(session.getFoldWidgetRange(5, true), 5, 22, 7, 9); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/diff.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var FoldMode = exports.FoldMode = function(levels, flag) { this.regExpList = levels; this.flag = flag; this.foldingStartMarker = RegExp("^(" + levels.join("|") + ")", this.flag); }; oop.inherits(FoldMode, BaseFoldMode); (function() { this.getFoldWidgetRange = function(session, foldStyle, row) { var line = session.getLine(row); var start = {row: row, column: line.length}; var regList = this.regExpList; for (var i = 1; i <= regList.length; i++) { var re = RegExp("^(" + regList.slice(0, i).join("|") + ")", this.flag); if (re.test(line)) break; } for (var l = session.getLength(); ++row < l; ) { line = session.getLine(row); if (re.test(line)) break; } if (row == start.row + 1) return; return new Range(start.row, start.column, row - 1, line.length); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/drools.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Range = require("../../range").Range; var BaseFoldMode = require("./fold_mode").FoldMode; var TokenIterator = require("../../token_iterator").TokenIterator; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function () { // regular expressions that identify starting and stopping points this.foldingStartMarker = /\b(rule|declare|query|when|then)\b/; this.foldingStopMarker = /\bend\b/; this.importRegex = /^import /; this.globalRegex = /^global /; this.getBaseFoldWidget = this.getFoldWidget; this.getFoldWidget = function (session, foldStyle, row) { if (foldStyle === "markbegin") { var line = session.getLine(row); if (this.importRegex.test(line)) { if (row === 0 || !this.importRegex.test(session.getLine(row - 1))) return "start"; } if (this.globalRegex.test(line)) { if (row === 0 || !this.globalRegex.test(session.getLine(row - 1))) return "start"; } } return this.getBaseFoldWidget(session, foldStyle, row); }; this.getFoldWidgetRange = function (session, foldStyle, row) { var line = session.getLine(row); var match = line.match(this.foldingStartMarker); if (match) { if (match[1]) { var position = {row: row, column: line.length}; var iterator = new TokenIterator(session, position.row, position.column); var seek = "end"; var token = iterator.getCurrentToken(); if (token.value == "when") { seek = "then"; } while (token) { if (token.value == seek) { return Range.fromPoints(position ,{ row: iterator.getCurrentTokenRow(), column: iterator.getCurrentTokenColumn() }); } token = iterator.stepForward(); } } } match = line.match(this.importRegex); if (match) { return getMatchedFoldRange(session, this.importRegex, match, row); } match = line.match(this.globalRegex); if (match) { return getMatchedFoldRange(session, this.globalRegex, match, row); } // test each line, and return a range of segments to collapse }; }).call(FoldMode.prototype); function getMatchedFoldRange(session, regex, match, row) { let startColumn = match[0].length; let maxRow = session.getLength(); let startRow = row; let endRow = row; while (++row < maxRow) { let line = session.getLine(row); if (line.match(/^\s*$/)) continue; if (!line.match(regex)) break; endRow = row; } if (endRow > startRow) { let endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } } ================================================ FILE: src/mode/folding/drools_test.js ================================================ "use strict"; const DroolsMode = require("../drools").Mode; const EditSession = require("../../edit_session").EditSession; const assert = require("../../test/assertions"); module.exports = { "test: drools folds": function () { const session = new EditSession([ 'package com.example.ace', 'import java.math.BigDecimal', 'import function my.package.Foo.hello', '', 'global org.slf4j.Logger logger', 'global java.lang.Boolean checkFlag', '', 'declare trait GoldenCustomer', ' balance : long @Alias( "org.acme.foo.accountBalance" )', 'end', 'query isContainedIn( String x, String y )', ' Location( z, y; ) and isContainedIn( x, z;)', 'end', 'rule "go1"', ' String( this == "go1" )', ' isContainedIn("Office", "House"; )', 'then', ' System.out.println( "office is in the house" );', 'end' ]); const mode = new DroolsMode(); session.setMode(mode); session.setFoldStyle("markbegin"); assert.equal(session.getFoldWidget(0), ""); assert.equal(session.getFoldWidget(1), "start"); // import assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), ""); assert.equal(session.getFoldWidget(4), "start"); // global assert.equal(session.getFoldWidget(5), ""); assert.equal(session.getFoldWidget(6), ""); assert.equal(session.getFoldWidget(7), "start"); // declare assert.equal(session.getFoldWidget(8), ""); assert.equal(session.getFoldWidget(9), ""); assert.equal(session.getFoldWidget(10), "start"); // query assert.equal(session.getFoldWidget(11), ""); assert.equal(session.getFoldWidget(12), ""); assert.equal(session.getFoldWidget(13), "start"); // rule assert.equal(session.getFoldWidget(14), ""); assert.equal(session.getFoldWidget(15), ""); assert.equal(session.getFoldWidget(16), "start"); // then assert.equal(session.getFoldWidget(17), ""); assert.equal(session.getFoldWidget(18), ""); assert.range(session.getFoldWidgetRange(1), 1, 7, 2, 36); // import assert.range(session.getFoldWidgetRange(4), 4, 7, 5, 34); // global assert.range(session.getFoldWidgetRange(7), 7, 28, 9, 0); // declare assert.range(session.getFoldWidgetRange(10), 10, 41, 12, 0); // query assert.range(session.getFoldWidgetRange(13), 13, 10, 18, 0); // rule assert.range(session.getFoldWidgetRange(16), 16, 4, 18, 0); // then } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/fold_mode.js ================================================ "use strict"; var Range = require("../../range").Range; var FoldMode = exports.FoldMode = function() {}; (function() { this.foldingStartMarker = null; this.foldingStopMarker = null; // must return "" if there's no fold, to enable caching this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); if (this.foldingStartMarker.test(line)) return "start"; if (foldStyle == "markbeginend" && this.foldingStopMarker && this.foldingStopMarker.test(line)) return "end"; return ""; }; this.getFoldWidgetRange = function(session, foldStyle, row) { return null; }; this.indentationBlock = function(session, row, column) { var re = /\S/; var line = session.getLine(row); var startLevel = line.search(re); if (startLevel == -1) return; var startColumn = column || line.length; var maxRow = session.getLength(); var startRow = row; var endRow = row; while (++row < maxRow) { var level = session.getLine(row).search(re); if (level == -1) continue; if (level <= startLevel) { var token = session.getTokenAt(row, 0); if (!token || token.type !== "string") break; } endRow = row; } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } }; this.openingBracketBlock = function(session, bracket, row, column, typeRe) { var start = {row: row, column: column + 1}; var end = session.$findClosingBracket(bracket, start, typeRe); if (!end) return; var fw = session.foldWidgets[end.row]; if (fw == null) fw = session.getFoldWidget(end.row); if (fw == "start" && end.row > start.row) { end.row --; end.column = session.getLine(end.row).length; } return Range.fromPoints(start, end); }; this.closingBracketBlock = function(session, bracket, row, column, typeRe) { var end = {row: row, column: column}; var start = session.$findOpeningBracket(bracket, end); if (!start) return; start.column++; end.column--; return Range.fromPoints(start, end); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/fold_mode_test.js ================================================ "use strict"; var MarkdownMode = require("../markdown").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { "test: markdown folding": function() { var session = new EditSession([ "# heading 1", "## heading 2", "something", "### heading 3", "#### heading4", "other", "", "article 1", "======", "A Paragraph.", "level 2", "--------", "A Paragraph." ]); var expected = "[0/11][5/5],[1/12][5/5],,[3/13][5/5],[4/13][5/5],,,,[8/6][12/12],,,[11/8][12/12],"; var mode = new MarkdownMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); var ranges = session.doc.getAllLines().map(function(_, i) { return session.getFoldWidgetRange(i); }); assert.equal(ranges.toString().replace(/Range:|[\s]|->/g, ""), expected); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/haskell_cabal.js ================================================ /* * Folding mode for Cabal files (Haskell): allow folding each seaction, including * the initial general section. */ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { /** is the row a heading? */ this.isHeading = function (session,row) { var heading = "markup.heading"; var token = session.getTokens(row)[0]; return row==0 || (token && token.type.lastIndexOf(heading, 0) === 0); }; this.getFoldWidget = function(session, foldStyle, row) { if (this.isHeading(session,row)){ return "start"; } else if (foldStyle === "markbeginend" && !(/^\s*$/.test(session.getLine(row)))){ var maxRow = session.getLength(); while (++row < maxRow) { if (!(/^\s*$/.test(session.getLine(row)))){ break; } } if (row==maxRow || this.isHeading(session,row)){ return "end"; } } return ""; }; this.getFoldWidgetRange = function(session, foldStyle, row) { var line = session.getLine(row); var startColumn = line.length; var maxRow = session.getLength(); var startRow = row; var endRow = row; // go until next heading if (this.isHeading(session,row)) { while (++row < maxRow) { if (this.isHeading(session,row)){ row--; break; } } endRow = row; // remove empty lines at end if (endRow > startRow) { while (endRow > startRow && /^\s*$/.test(session.getLine(endRow))) endRow--; } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } // go back to heading } else if (this.getFoldWidget(session, foldStyle, row)==="end"){ var endRow = row; var endColumn = session.getLine(endRow).length; while (--row>=0){ if (this.isHeading(session,row)){ break; } } var line = session.getLine(row); var startColumn = line.length; return new Range(row, startColumn, endRow, endColumn); } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/html.js ================================================ "use strict"; var oop = require("../../lib/oop"); var MixedFoldMode = require("./mixed").FoldMode; var XmlFoldMode = require("./xml").FoldMode; var CStyleFoldMode = require("./cstyle").FoldMode; var FoldMode = exports.FoldMode = function(voidElements, optionalTags) { MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), { "js-": new CStyleFoldMode(), "css-": new CStyleFoldMode() }); }; oop.inherits(FoldMode, MixedFoldMode); ================================================ FILE: src/mode/folding/html_test.js ================================================ "use strict"; var HtmlMode = require("../html").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { "test: fold mixed html and javascript": function() { var session = new EditSession([ '<script type="text/javascript"> ', 'function() foo {', ' var bar = 1;', '}', '</script>' ]); var mode = new HtmlMode(); session.setMode(mode); session.setFoldStyle("markbeginend"); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), "start"); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), "end"); assert.equal(session.getFoldWidget(4), "end"); assert.range(session.getFoldWidgetRange(0), 0, 31, 4, 0); assert.range(session.getFoldWidgetRange(4), 0, 31, 4, 0); assert.range(session.getFoldWidgetRange(1), 1, 16, 3, 0); assert.range(session.getFoldWidgetRange(3), 1, 16, 3, 0); }, "test: fold mixed html and css": function() { var session = new EditSession([ '<style type="text/css">', ' .text-layer {', ' font-family: Monaco, "Courier New", monospace;', ' }', '</style>' ]); var mode = new HtmlMode(); session.setMode(mode); session.setFoldStyle("markbeginend"); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), "start"); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), "end"); assert.equal(session.getFoldWidget(4), "end"); assert.range(session.getFoldWidgetRange(0), 0, 23, 4, 0); assert.range(session.getFoldWidgetRange(4), 0, 23, 4, 0); assert.range(session.getFoldWidgetRange(1), 1, 17, 3, 4); assert.range(session.getFoldWidgetRange(3), 1, 17, 3, 4); }, "test: fold should skip self closing elements": function() { var session = new EditSession([ '<body>', '<br />', '</body>' ]); var mode = new HtmlMode(); session.setMode(mode); session.setFoldStyle("markbeginend"); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), "end"); assert.range(session.getFoldWidgetRange(0), 0, 6, 2, 0); assert.range(session.getFoldWidgetRange(2), 0, 6, 2, 0); }, "test: fold should skip void elements": function() { var session = new EditSession([ '<body>', '<br>', '</body>' ]); var mode = new HtmlMode(); session.setMode(mode); session.setFoldStyle("markbeginend"); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), "end"); assert.range(session.getFoldWidgetRange(0), 0, 6, 2, 0); assert.range(session.getFoldWidgetRange(2), 0, 6, 2, 0); }, "test: fold multiple unclosed elements": function() { var session = new EditSession([ '<div>', '<p>', 'juhu', '<p>', 'kinners', '</div>' ]); var mode = new HtmlMode(); session.setMode(mode); session.setFoldStyle("markbeginend"); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), "start"); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), "start"); assert.equal(session.getFoldWidget(4), ""); assert.equal(session.getFoldWidget(5), "end"); assert.range(session.getFoldWidgetRange(0), 0, 5, 5, 0); assert.range(session.getFoldWidgetRange(5), 0, 5, 5, 0); }, "test: fold multiple nested optional elements": function() { var session = new EditSession([ '<p>', '<li>', '<p>juhu', '<p>', 'kinners', '</li>' ]); var mode = new HtmlMode(); session.setMode(mode); session.setFoldStyle("markbeginend"); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), "start"); assert.equal(session.getFoldWidget(2), "start"); assert.equal(session.getFoldWidget(3), "start"); assert.equal(session.getFoldWidget(4), ""); assert.equal(session.getFoldWidget(5), "end"); assert.range(session.getFoldWidgetRange(1), 1, 4, 5, 0); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/ini.js ================================================ "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() { this.foldingStartMarker = /^\s*\[([^\])]*)]\s*(?:$|[;#])/; this.getFoldWidgetRange = function(session, foldStyle, row) { var re = this.foldingStartMarker; var line = session.getLine(row); var m = line.match(re); if (!m) return; var startName = m[1] + "."; var startColumn = line.length; var maxRow = session.getLength(); var startRow = row; var endRow = row; while (++row < maxRow) { line = session.getLine(row); if (/^\s*$/.test(line)) continue; m = line.match(re); if (m && m[1].lastIndexOf(startName, 0) !== 0) break; endRow = row; } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/java.js ================================================ "use strict"; var oop = require("../../lib/oop"); var CStyleFoldMode = require("./cstyle").FoldMode; var Range = require("../../range").Range; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, CStyleFoldMode); (function() { this.importRegex = /^import /; this.getCStyleFoldWidget = this.getFoldWidget; this.getFoldWidget = function(session, foldStyle, row) { if (foldStyle === "markbegin") { var line = session.getLine(row); if (this.importRegex.test(line)) { if (row == 0 || !this.importRegex.test(session.getLine(row - 1))) return "start"; } } return this.getCStyleFoldWidget(session, foldStyle, row); }; this.getCstyleFoldWidgetRange = this.getFoldWidgetRange; this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { var line = session.getLine(row); var match = line.match(this.importRegex); if (!match || foldStyle !== "markbegin") return this.getCstyleFoldWidgetRange(session, foldStyle, row, forceMultiline); var startColumn = match[0].length; var maxRow = session.getLength(); var startRow = row; var endRow = row; while (++row < maxRow) { var line = session.getLine(row); if (line.match(/^\s*$/)) continue; if (!line.match(this.importRegex)) break; endRow = row; } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/javascript.js ================================================ "use strict"; var oop = require("../../lib/oop"); var XmlFoldMode = require("./xml").FoldMode; var CFoldMode = require("./cstyle").FoldMode; var FoldMode = exports.FoldMode = function (commentRegex) { if (commentRegex) { this.foldingStartMarker = new RegExp( this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); } this.xmlFoldMode = new XmlFoldMode(); }; oop.inherits(FoldMode, CFoldMode); (function () { this.getFoldWidgetRangeBase = this.getFoldWidgetRange; this.getFoldWidgetBase = this.getFoldWidget; this.getFoldWidget = function (session, foldStyle, row) { var fw = this.getFoldWidgetBase(session, foldStyle, row); if (!fw) { return this.xmlFoldMode.getFoldWidget(session, foldStyle, row); } return fw; }; this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { var range = this.getFoldWidgetRangeBase(session, foldStyle, row, forceMultiline); if (range) return range; return this.xmlFoldMode.getFoldWidgetRange(session, foldStyle, row); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/javascript_test.js ================================================ "use strict"; var JavaScriptMode = require("../javascript").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { "test: fold jsdoc style comments": function() { var session = new EditSession([ '/**', ' *', ' * @param {string[]} items', ' * @param nada', '*/ ' ]); var mode = new JavaScriptMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), ""); assert.equal(session.getFoldWidget(4), "end"); assert.range(session.getFoldWidgetRange(0), 0, 3, 4, 0); assert.range(session.getFoldWidgetRange(4), 0, 3, 4, 0); }, "test: fold mixed js and jsx": function () { var session = new EditSession([ 'function Greeting(props) {', ' return (', ' <div>', ' {/* Comment inside JSX */}', ' <h1>Hello, {props.name}</h1>', ' <p>You are {props.age} years old.</p>', ' </div>', ' );', '}', '' ]); var mode = new JavaScriptMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), "start"); assert.equal(session.getFoldWidget(2), "start"); assert.equal(session.getFoldWidget(3), ""); assert.equal(session.getFoldWidget(4), ""); assert.equal(session.getFoldWidget(5), ""); assert.equal(session.getFoldWidget(6), "end"); assert.equal(session.getFoldWidget(7), "end"); assert.equal(session.getFoldWidget(8), "end"); assert.range(session.getFoldWidgetRange(0), 0, 26, 8, 0); assert.range(session.getFoldWidgetRange(1), 1, 12, 7, 4); assert.range(session.getFoldWidgetRange(2), 2, 13, 6, 8); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/latex.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var TokenIterator = require("../../token_iterator").TokenIterator; var keywordLevels = { "\\subparagraph": 1, "\\paragraph": 2, "\\subsubsubsection": 3, "\\subsubsection": 4, "\\subsection": 5, "\\section": 6, "\\chapter": 7, "\\part": 8, "\\begin": 9, "\\end": 10 }; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { this.foldingStartMarker = /^\s*\\(begin)|\s*\\(part|chapter|(?:sub)*(?:section|paragraph))\b|{\s*$/; this.foldingStopMarker = /^\s*\\(end)\b|^\s*}/; this.getFoldWidgetRange = function(session, foldStyle, row) { var line = session.doc.getLine(row); var match = this.foldingStartMarker.exec(line); if (match) { if (match[1]) return this.latexBlock(session, row, match[0].length - 1); if (match[2]) return this.latexSection(session, row, match[0].length - 1); return this.openingBracketBlock(session, "{", row, match.index); } var match = this.foldingStopMarker.exec(line); if (match) { if (match[1]) return this.latexBlock(session, row, match[0].length - 1); return this.closingBracketBlock(session, "}", row, match.index + match[0].length); } }; this.latexBlock = function(session, row, column, returnRange) { var keywords = { "\\begin": 1, "\\end": -1 }; var stream = new TokenIterator(session, row, column); var token = stream.getCurrentToken(); if (!token || !(token.type == "storage.type" || token.type == "constant.character.escape")) return; var val = token.value; var dir = keywords[val]; var getType = function() { var token = stream.stepForward(); var type = token && token.type == "lparen" ? stream.stepForward().value : ""; if (dir === -1) { stream.stepBackward(); if (type) stream.stepBackward(); } return type; }; var stack = [getType()]; var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length; var startRow = row; stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; while(token = stream.step()) { if (!token || !(token.type == "storage.type" || token.type == "constant.character.escape")) continue; var level = keywords[token.value]; if (!level) continue; var type = getType(); if (level === dir) stack.unshift(type); else if (stack.shift() !== type || !stack.length) break; } if (stack.length) return; if (dir == 1) { stream.stepBackward(); stream.stepBackward(); } if (returnRange) return stream.getCurrentTokenRange(); var row = stream.getCurrentTokenRow(); if (dir === -1) return new Range(row, session.getLine(row).length, startRow, startColumn); else return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn()); }; this.latexSection = function(session, row, column) { var stream = new TokenIterator(session, row, column); var token = stream.getCurrentToken(); if (!token || token.type != "storage.type") return; var startLevel = keywordLevels[token.value] || 0; var stackDepth = 0; var endRow = row; while(token = stream.stepForward()) { if (token.type !== "storage.type") continue; var level = keywordLevels[token.value] || 0; if (level >= 9) { if (!stackDepth) endRow = stream.getCurrentTokenRow() - 1; stackDepth += level == 9 ? 1 : - 1; if (stackDepth < 0) break; } else if (level >= startLevel) break; } if (!stackDepth) endRow = stream.getCurrentTokenRow() - 1; while (endRow > row && !/\S/.test(session.getLine(endRow))) endRow--; return new Range( row, session.getLine(row).length, endRow, session.getLine(endRow).length ); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/latex_test.js ================================================ "use strict"; var LatexMode = require("../latex").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { "test: latex block folding": function () { var session = new EditSession([ '\\usepackage{amsmath}', '\\title{\\LaTeX}', '\\date{}', '\\begin' ]); var mode = new LatexMode(); session.setFoldStyle("markbegin"); session.setMode(mode); assert.equal(session.getFoldWidget(0), ""); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), "start"); assert.equal(session.getFoldWidgetRange(3), null); session.setValue(session.getValue() + '{test}\nsome text here \n\\end{test}'); assert.range(session.getFoldWidgetRange(3), 3, 12, 5, 0); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/lua.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var TokenIterator = require("../../token_iterator").TokenIterator; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { this.foldingStartMarker = /\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/; this.foldingStopMarker = /\bend\b|^\s*}|\]=*\]/; this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); var isStart = this.foldingStartMarker.test(line); var isEnd = this.foldingStopMarker.test(line); if (isStart && !isEnd) { var match = line.match(this.foldingStartMarker); if (match[1] == "then" && /\belseif\b/.test(line)) return; if (match[1]) { if (session.getTokenAt(row, match.index + 1).type === "keyword") return "start"; } else if (match[2]) { var type = session.bgTokenizer.getState(row) || ""; if (type[0] == "bracketedComment" || type[0] == "bracketedString") return "start"; } else { return "start"; } } if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) return ""; var match = line.match(this.foldingStopMarker); if (match[0] === "end") { if (session.getTokenAt(row, match.index + 1).type === "keyword") return "end"; } else if (match[0][0] === "]") { var type = session.bgTokenizer.getState(row - 1) || ""; if (type[0] == "bracketedComment" || type[0] == "bracketedString") return "end"; } else return "end"; }; this.getFoldWidgetRange = function(session, foldStyle, row) { var line = session.doc.getLine(row); var match = this.foldingStartMarker.exec(line); if (match) { if (match[1]) return this.luaBlock(session, row, match.index + 1); if (match[2]) return session.getCommentFoldRange(row, match.index + 1); return this.openingBracketBlock(session, "{", row, match.index); } var match = this.foldingStopMarker.exec(line); if (match) { if (match[0] === "end") { if (session.getTokenAt(row, match.index + 1).type === "keyword") return this.luaBlock(session, row, match.index + 1); } if (match[0][0] === "]") return session.getCommentFoldRange(row, match.index + 1); return this.closingBracketBlock(session, "}", row, match.index + match[0].length); } }; this.luaBlock = function(session, row, column, tokenRange) { var stream = new TokenIterator(session, row, column); var indentKeywords = { "function": 1, "do": 1, "then": 1, "elseif": -1, "end": -1, "repeat": 1, "until": -1 }; var token = stream.getCurrentToken(); if (!token || token.type != "keyword") return; var val = token.value; var stack = [val]; var dir = indentKeywords[val]; if (!dir) return; var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length; var startRow = row; stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; while(token = stream.step()) { if (token.type !== "keyword") continue; var level = dir * indentKeywords[token.value]; if (level > 0) { stack.unshift(token.value); } else if (level <= 0) { stack.shift(); if (!stack.length && token.value != "elseif") break; if (level === 0) stack.unshift(token.value); } } if (!token) return null; if (tokenRange) return stream.getCurrentTokenRange(); var row = stream.getCurrentTokenRow(); if (dir === -1) return new Range(row, session.getLine(row).length, startRow, startColumn); else return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn()); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/lua_test.js ================================================ "use strict"; var LuaMode = require("../lua").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { "test: lua multi-line comment and string folding": function () { var session = new EditSession([ '--[[This is a multi-line comment in Lua', 'It can span multiple lines until it encounters', ']]--', '', 'local title = [[This is a multi-line string in Lua', 'It can also span multiple lines until it encounters ]]' ]); var luaMode = new LuaMode(); session.setFoldStyle("markbeginend"); session.setMode(luaMode); session.bgTokenizer.$worker(); assert.equal(session.getFoldWidget(0), "start"); // Comment starts assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), "end"); assert.equal(session.getFoldWidget(3), ""); assert.equal(session.getFoldWidget(4), "start"); // String starts assert.equal(session.getFoldWidget(5), "end"); assert.range(session.getFoldWidgetRange(0), 0, 4, 2, 0); assert.range(session.getFoldWidgetRange(2), 0, 4, 2, 0); assert.range(session.getFoldWidgetRange(4), 4, 16, 5, 52); assert.range(session.getFoldWidgetRange(5), 4, 16, 5, 52); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/markdown.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/; this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); if (!this.foldingStartMarker.test(line)) return ""; if (line[0] == "`") { if (session.bgTokenizer.getState(row) == "start") return "end"; return "start"; } return "start"; }; this.getFoldWidgetRange = function(session, foldStyle, row) { var line = session.getLine(row); var startColumn = line.length; var maxRow = session.getLength(); var startRow = row; var endRow = row; if (!line.match(this.foldingStartMarker)) return; if (line[0] == "`") { if (session.bgTokenizer.getState(row) !== "start") { while (++row < maxRow) { line = session.getLine(row); if (line[0] == "`" & line.substring(0, 3) == "```") break; } return new Range(startRow, startColumn, row, 0); } else { while (row -- > 0) { line = session.getLine(row); if (line[0] == "`" & line.substring(0, 3) == "```") break; } return new Range(row, line.length, startRow, 0); } } var token; function isHeading(row) { token = session.getTokens(row)[0]; return token && token.type.lastIndexOf(heading, 0) === 0; } var heading = "markup.heading"; function getLevel() { var ch = token.value[0]; if (ch == "=") return 6; if (ch == "-") return 5; return 7 - token.value.search(/[^#]|$/); } if (isHeading(row)) { var startHeadingLevel = getLevel(); while (++row < maxRow) { if (!isHeading(row)) continue; var level = getLevel(); if (level >= startHeadingLevel) break; } endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2); if (endRow > startRow) { while (endRow > startRow && /^\s*$/.test(session.getLine(endRow))) endRow--; } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/mixed.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var FoldMode = exports.FoldMode = function(defaultMode, subModes) { this.defaultMode = defaultMode; this.subModes = subModes; }; oop.inherits(FoldMode, BaseFoldMode); (function() { this.$getMode = function(state) { if (typeof state != "string") state = state[0]; for (var key in this.subModes) { if (state.indexOf(key) === 0) return this.subModes[key]; } return null; }; this.$tryMode = function(state, session, foldStyle, row) { var mode = this.$getMode(state); return (mode ? mode.getFoldWidget(session, foldStyle, row) : ""); }; this.getFoldWidget = function(session, foldStyle, row) { return ( this.$tryMode(session.getState(row-1), session, foldStyle, row) || this.$tryMode(session.getState(row), session, foldStyle, row) || this.defaultMode.getFoldWidget(session, foldStyle, row) ); }; this.getFoldWidgetRange = function(session, foldStyle, row) { var mode = this.$getMode(session.getState(row-1)); if (!mode || !mode.getFoldWidget(session, foldStyle, row)) mode = this.$getMode(session.getState(row)); if (!mode || !mode.getFoldWidget(session, foldStyle, row)) mode = this.defaultMode; return mode.getFoldWidgetRange(session, foldStyle, row); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/nunjucks.js ================================================ "use strict"; var oop = require("../../lib/oop"); const {FoldMode: MixedFoldMode} = require("./mixed"); var HtmlFoldMode = require("./html").FoldMode; var Range = require("../../range").Range; var TokenIterator = require("../../token_iterator").TokenIterator; var FoldMode = exports.FoldMode = function (voidElements, optionalTags) { HtmlFoldMode.call(this, voidElements, optionalTags); }; oop.inherits(FoldMode, HtmlFoldMode); (function () {//TODO: set|endset this.getFoldWidgetRangeBase = this.getFoldWidgetRange; this.getFoldWidgetBase = this.getFoldWidget; this.indentKeywords = { "block": 1, "if": 1, "for": 1, "asyncEach": 1, "asyncAll": 1, "macro": 1, "filter": 1, "call": 1, "else": 0, "elif": 0, "set": 1, "endblock": -1, "endif": -1, "endfor": -1, "endeach": -1, "endall": -1, "endmacro": -1, "endfilter": -1, "endcall": -1, "endset": -1 }; this.foldingStartMarkerNunjucks = /(?:\{%-?\s*)(?:(block|if|else|elif|for|asyncEach|asyncAll|macro|filter|call)\b.*)|(?:\bset(?:[^=]*))(?=%})/i; this.foldingStopMarkerNunjucks = /(?:\{%-?\s*)(endblock|endif|endfor|endeach|endall|endmacro|endfilter|endcall|endset)\b.*(?=%})/i; this.getFoldWidgetRange = function (session, foldStyle, row) { var line = session.doc.getLine(row); let offset = calculateOffset(this.foldingStartMarkerNunjucks, line); if (offset) { return this.nunjucksBlock(session, row, offset); } offset = calculateOffset(this.foldingStopMarkerNunjucks, line); if (offset) { return this.nunjucksBlock(session, row, offset); } return this.getFoldWidgetRangeBase(session, foldStyle, row); }; /** * * @param {RegExp} regExp * @param line * @return {*} */ function calculateOffset(regExp, line) { var match = regExp.exec(line); if (match) { var keyword = match[0].includes("set") ? "set" : match[1].toLowerCase(); if (keyword) { var offsetInMatch = match[0].toLowerCase().indexOf(keyword); return match.index + offsetInMatch + 1; } } } // must return "" if there's no fold, to enable caching this.getFoldWidget = function (session, foldStyle, row) { var line = session.getLine(row); var isStart = this.foldingStartMarkerNunjucks.test(line); var isEnd = this.foldingStopMarkerNunjucks.test(line); if (isStart && !isEnd) { var offset = calculateOffset(this.foldingStartMarkerNunjucks, line); if (offset) { var type = session.getTokenAt(row, offset).type; if (type === "keyword.control") { return "start"; } } } if (isEnd && !isStart && foldStyle === "markbeginend") { var offset = calculateOffset(this.foldingStopMarkerNunjucks, line); if (offset) { var type = session.getTokenAt(row, offset).type; if (type === "keyword.control") { return "end"; } } } return this.getFoldWidgetBase(session, foldStyle, row); }; /** * * @param {TokenIterator} stream */ function getTokenPosition(stream, findStart) { let token; const currentIndex = stream.$tokenIndex; const type = findStart ? "punctuation.begin" : "punctuation.end"; stream.step = findStart ? stream.stepBackward : stream.stepForward; while (token = stream.step()) { if (token.type !== type) continue; break; } if (!token) return; let pos = stream.getCurrentTokenPosition(); if (!findStart) { pos.column = pos.column + token.value.length; } stream.$tokenIndex = currentIndex; return pos; } this.nunjucksBlock = function (session, row, column) { var stream = new TokenIterator(session, row, column); var token = stream.getCurrentToken(); if (!token || token.type != "keyword.control") return; var val = token.value; var stack = [val]; var dir = this.indentKeywords[val]; if (val === "else" || val === "elif") { dir = 1; } if (!dir) return; var start = getTokenPosition(stream, dir === -1); if (!token) return; stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; while (token = stream.step()) { if (token.type !== "keyword.control") continue; var level = dir * this.indentKeywords[token.value]; if (token.value === "set") { var tokenPos = stream.getCurrentTokenPosition(); var line = session.getLine(tokenPos.row).substring(tokenPos.column); if (!/^[^=]*%}/.test(line)) { continue; } } if (level > 0) { stack.unshift(token.value); } else if (level <= 0) { stack.shift(); if (!stack.length) break; if (level === 0) stack.unshift(token.value); } } if (!token) return null; var end = getTokenPosition(stream, dir === 1); return dir === 1 ? Range.fromPoints(start, end) : Range.fromPoints(end, start); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/nunjucks_test.js ================================================ "use strict"; var NunjucksMode = require("../nunjucks").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { setUp : function() { this.mode = new NunjucksMode(); }, "test: nunjucks folding": function() { var session = new EditSession([ '{% block header %}', ' <section class="left">', ' {% block left %}{% endblock %}', ' {% set standardModal %}', ' {% include "standardModalData.html" %}', ' {% set cls = cycler("odd", "even") %}', ' {% endset %}', ' {% if hungry %}', ' I am hungry', ' {% elif tired %}', ' I am tired', ' {% else %}', ' I am good!', ' {% endif %}', ' </section>', '{% endblock %}' ]); session.setFoldStyle("markbeginend"); session.setMode(this.mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), "start"); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), "start"); assert.equal(session.getFoldWidget(4), ""); assert.equal(session.getFoldWidget(5), ""); // set with = assert.equal(session.getFoldWidget(6), "end"); assert.equal(session.getFoldWidget(7), "start"); assert.equal(session.getFoldWidget(8), ""); assert.equal(session.getFoldWidget(9), "start"); assert.equal(session.getFoldWidget(10), ""); assert.equal(session.getFoldWidget(11), "start"); assert.equal(session.getFoldWidget(12), ""); assert.equal(session.getFoldWidget(13), "end"); assert.equal(session.getFoldWidget(14), "end"); assert.equal(session.getFoldWidget(15), "end"); assert.range(session.getFoldWidgetRange(0), 0, 18, 15, 0); assert.range(session.getFoldWidgetRange(1), 1, 24, 14, 2); assert.range(session.getFoldWidgetRange(3), 3, 27, 6, 4); assert.range(session.getFoldWidgetRange(6), 3, 27, 6, 4); assert.range(session.getFoldWidgetRange(7), 7, 19, 9, 4); assert.range(session.getFoldWidgetRange(11), 11, 14, 13, 4); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/php.js ================================================ "use strict"; var oop = require("../../lib/oop"); var CstyleFoldMode = require("./cstyle").FoldMode; var Range = require("../../range").Range; var TokenIterator = require("../../token_iterator").TokenIterator; var FoldMode = exports.FoldMode = function () { }; oop.inherits(FoldMode, CstyleFoldMode); (function () { this.getFoldWidgetRangeBase = this.getFoldWidgetRange; this.getFoldWidgetBase = this.getFoldWidget; this.indentKeywords = { "if": 1, "while": 1, "for": 1, "foreach": 1, "switch": 1, "else": 0, "elseif": 0, "endif": -1, "endwhile": -1, "endfor": -1, "endforeach": -1, "endswitch": -1 }; this.foldingStartMarkerPhp = /(?:\s|^)(if|else|elseif|while|for|foreach|switch).*\:/i; this.foldingStopMarkerPhp = /(?:\s|^)(endif|endwhile|endfor|endforeach|endswitch)\;/i; this.getFoldWidgetRange = function (session, foldStyle, row) { var line = session.doc.getLine(row); var match = this.foldingStartMarkerPhp.exec(line); if (match) { return this.phpBlock(session, row, match.index + 2); } var match = this.foldingStopMarkerPhp.exec(line); if (match) { return this.phpBlock(session, row, match.index + 2); } return this.getFoldWidgetRangeBase(session, foldStyle, row); }; // must return "" if there's no fold, to enable caching this.getFoldWidget = function (session, foldStyle, row) { var line = session.getLine(row); var isStart = this.foldingStartMarkerPhp.test(line); var isEnd = this.foldingStopMarkerPhp.test(line); if (isStart && !isEnd) { var match = this.foldingStartMarkerPhp.exec(line); var keyword = match && match[1].toLowerCase(); if (keyword) { var type = session.getTokenAt(row, match.index + 2).type; if (type == "keyword") { return "start"; } } } if (isEnd && foldStyle === "markbeginend") { var match = this.foldingStopMarkerPhp.exec(line); var keyword = match && match[1].toLowerCase(); if (keyword) { var type = session.getTokenAt(row, match.index + 2).type; if (type == "keyword") { return "end"; } } } return this.getFoldWidgetBase(session, foldStyle, row); }; this.phpBlock = function (session, row, column, tokenRange) { var stream = new TokenIterator(session, row, column); var token = stream.getCurrentToken(); if (!token || token.type != "keyword") return; var val = token.value; var stack = [val]; var dir = this.indentKeywords[val]; if (val === "else" || val === "elseif") { dir = 1; } if (!dir) return; var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length; var startRow = row; stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; while (token = stream.step()) { if (token.type !== "keyword") continue; var level = dir * this.indentKeywords[token.value]; if (level > 0) { stack.unshift(token.value); } else if (level <= 0) { stack.shift(); if (!stack.length) break; if (level === 0) stack.unshift(token.value); } } if (!token) return null; if (tokenRange) return stream.getCurrentTokenRange(); var row = stream.getCurrentTokenRow(); if (dir === -1) return new Range( row, session.getLine(row).length, startRow, startColumn); else return new Range( startRow, startColumn, row, stream.getCurrentTokenColumn()); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/php_test.js ================================================ "use strict"; var PHPMode = require("../php").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { setUp: function () { this.mode = new PHPMode(); }, "test: php folding with alternative syntax": function () { var session = new EditSession([ '<?php', 'function checkNumber($number)', '{', ' switch ($number) {', ' case 0:', ' echo "Number is zero again";', ' if ($number == 0):', ' echo "Number is zero";', ' elseif ($number > 0):', ' echo "Number is positive";', ' else:', ' echo "Number is negative";', 'endif;', ' break;', ' default:', ' echo "Number is not zero";', ' }', 'foreach (array(1, 2, 3) as $num):', ' echo "Num: $num";', ' endforeach;', '}', '?>', '', '<script>', ' function test() {', ' ', ' }', '</script>', '<style>', ' div {', ' color: red;', ' }', '</style>' ]); session.setFoldStyle("markbeginend"); session.setMode(this.mode); session.bgTokenizer.$worker(); assert.equal(session.getFoldWidget(0), ""); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), "start"); assert.equal(session.getFoldWidget(3), "start"); assert.equal(session.getFoldWidget(4), ""); assert.equal(session.getFoldWidget(5), ""); assert.equal(session.getFoldWidget(6), "start"); assert.equal(session.getFoldWidget(7), ""); assert.equal(session.getFoldWidget(8), "start"); assert.equal(session.getFoldWidget(10), "start"); assert.equal(session.getFoldWidget(12), "end"); assert.equal(session.getFoldWidget(16), "end"); assert.equal(session.getFoldWidget(17), "start"); assert.equal(session.getFoldWidget(19), "end"); assert.equal(session.getFoldWidget(20), "end"); assert.equal(session.getFoldWidget(21), ""); assert.equal(session.getFoldWidget(22), ""); assert.equal(session.getFoldWidget(23), "start"); assert.equal(session.getFoldWidget(24), "start"); assert.equal(session.getFoldWidget(25), ""); assert.equal(session.getFoldWidget(26), "end"); assert.equal(session.getFoldWidget(27), "end"); assert.equal(session.getFoldWidget(28), "start"); assert.equal(session.getFoldWidget(29), "start"); assert.equal(session.getFoldWidget(30), ""); assert.equal(session.getFoldWidget(31), "end"); assert.equal(session.getFoldWidget(32), "end"); assert.range(session.getFoldWidgetRange(2), 2, 1, 20, 0); // Range for the function's foldable section assert.range(session.getFoldWidgetRange(3), 3, 21, 16, 7); // Range for the 'switch' statement assert.range(session.getFoldWidgetRange(6), 6, 29, 8, 11); // Range for the 'if' block assert.range(session.getFoldWidgetRange(8), 8, 32, 10, 11); // Range for the 'elseif' block assert.range(session.getFoldWidgetRange(10), 10, 16, 12, 0); // Range for the 'else' block assert.range(session.getFoldWidgetRange(12), 10, 16, 12, 0); // Range for the 'endif' line assert.range(session.getFoldWidgetRange(17), 17, 33, 19, 3); assert.range(session.getFoldWidgetRange(19), 17, 33, 19, 3); assert.range(session.getFoldWidgetRange(23), 23, 8, 27, 0); // Range for script tag assert.range(session.getFoldWidgetRange(24), 24, 21, 26, 4); // Range for cstyle { } block assert.range(session.getFoldWidgetRange(26), 24, 21, 26, 4); // Range for closing cstyle { } block assert.range(session.getFoldWidgetRange(27), 23, 8, 27, 0); // Range for closing script tag assert.range(session.getFoldWidgetRange(28), 28, 7, 32, 0); // Range for openning style tag assert.range(session.getFoldWidgetRange(29), 29, 9, 31, 4); // Range for cstyle { } block assert.range(session.getFoldWidgetRange(31), 29, 9, 31, 4); // Range for closing cstyle { } block assert.range(session.getFoldWidgetRange(32), 28, 7, 32, 0); // Range for closing style tag } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/pythonic.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var FoldMode = exports.FoldMode = function(markers) { this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$"); }; oop.inherits(FoldMode, BaseFoldMode); (function() { this.getFoldWidgetRange = function(session, foldStyle, row) { var line = session.getLine(row); var match = line.match(this.foldingStartMarker); if (match) { if (match[1]) return this.openingBracketBlock(session, match[1], row, match.index); if (match[2]) return this.indentationBlock(session, row, match.index + match[2].length); return this.indentationBlock(session, row); } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/pythonic_test.js ================================================ "use strict"; var PythonMode = require("../python").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { "test: bracket folding": function() { var session = new EditSession([ '[ ', 'stuff', ']', '[ ', '{ ', '[ #-' ]); var mode = new PythonMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), "start"); assert.equal(session.getFoldWidget(4), "start"); assert.equal(session.getFoldWidget(5), ""); assert.range(session.getFoldWidgetRange(0), 0, 1, 2, 0); assert.equal(session.getFoldWidgetRange(3), null); assert.equal(session.getFoldWidgetRange(5), null); }, "test: indentation folding": function() { var session = new EditSession([ 'def a: #', '', ' b:', ' c', ' ', ' c', '', ' ', '' ]); var mode = new PythonMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), "start"); assert.range(session.getFoldWidgetRange(0), 0, 6, 5, 3); assert.range(session.getFoldWidgetRange(2), 2, 3, 5, 3); }, "test: indentation folding with strings": function() { var session = new EditSession([ 'def a: #', ' print """', 'xx', '"""', '', ' c', '', '' ]); var mode = new PythonMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); assert.equal(session.getFoldWidget(0), "start"); session.bgTokenizer.$worker(); assert.range(session.getFoldWidgetRange(0), 0, 6, 5, 3); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/ruby.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var TokenIterator = require("../../token_iterator").TokenIterator; var FoldMode = exports.FoldMode = function () { }; oop.inherits(FoldMode, BaseFoldMode); (function () { this.indentKeywords = { "class": 1, "def": 1, "module": 1, "do": 1, "unless": 1, "if": 1, "while": 1, "for": 1, "until": 1, "begin": 1, "else": 0, "elsif": 0, "rescue": 0, "ensure": 0, "when": 0, "end": -1, "case": 1, "=begin": 1, "=end": -1 }; this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/; this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/; this.getFoldWidget = function (session, foldStyle, row) { var line = session.getLine(row); var isStart = this.foldingStartMarker.test(line); var isEnd = this.foldingStopMarker.test(line); if (isStart && !isEnd) { var match = line.match(this.foldingStartMarker); if (match[1]) { if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") { if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) { return; } if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) { return; } } if (match[1] == "when") { if (/\sthen\s/.test(line) === true) { return; } } if (session.getTokenAt(row, match.index + 2).type === "keyword") return "start"; } else if (match[3]) { if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") return "start"; } else { return "start"; } } if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) return ""; var match = line.match(this.foldingStopMarker); if (match[3] === "end") { if (session.getTokenAt(row, match.index + 1).type === "keyword") return "end"; } else if (match[1]) { if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") return "end"; } else return "end"; }; this.getFoldWidgetRange = function (session, foldStyle, row) { var line = session.doc.getLine(row); var match = this.foldingStartMarker.exec(line); if (match) { if (match[1] || match[3]) return this.rubyBlock(session, row, match.index + 2); return this.openingBracketBlock(session, "{", row, match.index); } var match = this.foldingStopMarker.exec(line); if (match) { if (match[3] === "end") { if (session.getTokenAt(row, match.index + 1).type === "keyword") return this.rubyBlock(session, row, match.index + 1); } if (match[1] === "=end") { if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") return this.rubyBlock(session, row, match.index + 1); } return this.closingBracketBlock(session, "}", row, match.index + match[0].length); } }; this.rubyBlock = function (session, row, column, tokenRange) { var stream = new TokenIterator(session, row, column); var token = stream.getCurrentToken(); if (!token || (token.type != "keyword" && token.type != "comment.multiline")) return; var val = token.value; var line = session.getLine(row); switch (token.value) { case "if": case "unless": case "while": case "until": var checkToken = new RegExp("^\\s*" + token.value); if (!checkToken.test(line)) { return; } var dir = this.indentKeywords[val]; break; case "when": if (/\sthen\s/.test(line)) { return; } case "elsif": case "rescue": case "ensure": var dir = 1; break; case "else": var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); if (!checkToken.test(line)) { return; } var dir = 1; break; default: var dir = this.indentKeywords[val]; break; } var stack = [val]; if (!dir) return; var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; var startRow = row; var ranges = []; ranges.push(stream.getCurrentTokenRange()); stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; if (token.type == "comment.multiline") { while (token = stream.step()) { if (token.type !== "comment.multiline") continue; if (dir == 1) { startColumn = 6; if (token.value == "=end") { break; } } else { if (token.value == "=begin") { break; } } } } else { while (token = stream.step()) { var ignore = false; if (token.type !== "keyword") continue; var level = dir * this.indentKeywords[token.value]; line = session.getLine(stream.getCurrentTokenRow()); switch (token.value) { case "do": for (var i = stream.$tokenIndex - 1; i >= 0; i--) { var prevToken = stream.$rowTokens[i]; if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) { level = 0; break; } } break; case "else": var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); if (!checkToken.test(line) || val == "case") { level = 0; ignore = true; } break; case "if": case "unless": case "while": case "until": var checkToken = new RegExp("^\\s*" + token.value); if (!checkToken.test(line)) { level = 0; ignore = true; } break; case "when": if (/\sthen\s/.test(line) || val == "case") { level = 0; ignore = true; } break; } if (level > 0) { stack.unshift(token.value); } else if (level <= 0 && ignore === false) { stack.shift(); if (!stack.length) { if ((val == "while" || val == "until" || val == "for") && token.value != "do") { break; } if (token.value == "do" && dir == -1 && level != 0) break; if (token.value != "do") break; } if (level === 0) { stack.unshift(token.value); } } } } if (!token) return null; if (tokenRange) { ranges.push(stream.getCurrentTokenRange()); return ranges; } var row = stream.getCurrentTokenRow(); if (dir === -1) { if (token.type === "comment.multiline") { var endColumn = 6; } else { var endColumn = session.getLine(row).length; } return new Range(row, endColumn, startRow - 1, startColumn); } else return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/ruby_test.js ================================================ "use strict"; var RubyMode = require("../ruby").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { setUp : function() { this.mode = new RubyMode(); }, "test: opening/ending tags matching/folding": function() { var session = new EditSession([ 'def Name(n)', ' if i == 0', ' ...', ' else', ' ...', ' end', 'end' ]); session.setFoldStyle("markbeginend"); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 0); assert.range(ranges[0], 0, 0, 0, 3); assert.range(ranges[1], 6, 0, 6, 3); ranges = this.mode.getMatching(session, 6, 1); assert.range(ranges[1], 0, 0, 0, 3); assert.range(ranges[0], 6, 0, 6, 3); ranges = this.mode.getMatching(session, 1, 4); assert.range(ranges[0], 1, 3, 1, 5); assert.range(ranges[1], 3, 3, 3, 7); ranges = this.mode.getMatching(session, 5, 4); assert.range(ranges[1], 3, 3, 3, 7); assert.range(ranges[0], 5, 3, 5, 6); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), "start"); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), "start"); assert.equal(session.getFoldWidget(4), ""); assert.equal(session.getFoldWidget(5), "end"); assert.equal(session.getFoldWidget(6), "end"); assert.range(session.getFoldWidgetRange(0), 0, 11, 5, 6); assert.equal(session.getFoldWidgetRange(2), null); assert.equal(session.getFoldWidgetRange(4), null); assert.range(session.getFoldWidgetRange(5), 3, 7, 4, 9); }, "test: if/unless/while/until used as modifier shouldn't have matching tag and start/end fold": function() { var session = new EditSession([ 'if i == 0', ' a += 1 if a.zero?', 'else', ' a += 1 unless a.zero?', 'end' ]); session.setMode(this.mode); }, "test: brackets folding": function() { var session = new EditSession([ 'def to_json(*a)', '{', '"json_class" => self.class.name, # = "Range"', '"data" => [ first, last, exclude_end? ]', '}.to_json(*a)', 'end' ]); session.setFoldStyle("markbeginend"); session.setMode(this.mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), "start"); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(4), "end"); assert.equal(session.getFoldWidget(5), "end"); assert.range(session.getFoldWidgetRange(1), 1, 1, 4, 0); assert.range(session.getFoldWidgetRange(4), 1, 1, 4, 0); }, "test: multiline comments matching and folding": function() { var session = new EditSession([ '=begin', 'text line 1', 'text line 2', 'text line 3', '=end' ]); session.setFoldStyle("markbeginend"); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 2); assert.range(ranges[0], 0, 0, 0, 6); assert.range(ranges[1], 4, 0, 4, 4); ranges = this.mode.getMatching(session, 4, 2); assert.range(ranges[1], 0, 0, 0, 6); assert.range(ranges[0], 4, 0, 4, 4); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(4), "end"); assert.range(session.getFoldWidgetRange(0), 0,6,3,11); assert.range(session.getFoldWidgetRange(4), 0,6,3,11); }, "test: `case` with multiline `when` expressions matchings and foldings": function() { var session = new EditSession([ 'case', 'when a == 1', ' puts "a is one"', 'when a == 2', ' puts "a is two"', 'else', ' puts "a is not one or two"', 'end' ]); session.setFoldStyle("markbeginend"); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 2); //`case` should always be closed with `end` assert.range(ranges[0], 0, 0, 0, 4); assert.range(ranges[1], 7, 0, 7, 3); assert.equal(session.getFoldWidget(0), "start"); assert.range(session.getFoldWidgetRange(0), 0,4,6,27); //`end` should close last block ranges = this.mode.getMatching(session, 7, 2); assert.range(ranges[0], 7, 0, 7, 3); assert.range(ranges[1], 5, 0, 5, 4); assert.equal(session.getFoldWidget(7), "end"); assert.range(session.getFoldWidgetRange(7), 5,4,6,27); //`else` should be closed with `end` ranges = this.mode.getMatching(session, 5, 2); assert.range(ranges[1], 7, 0, 7, 3); assert.range(ranges[0], 5, 0, 5, 4); assert.equal(session.getFoldWidget(5), "start"); assert.range(session.getFoldWidgetRange(5), 5,4,6,27); //first `when` should close by next `when` ranges = this.mode.getMatching(session, 1, 2); assert.range(ranges[0], 1, 0, 1, 4); assert.range(ranges[1], 3, 0, 3, 4); assert.equal(session.getFoldWidget(1), "start"); assert.range(session.getFoldWidgetRange(1), 1,11,2,16); }, "test: `case` with single line `when` expressions matchings and foldings": function() { var session = new EditSession([ 'kind = case year', ' when 1850..1889 then "Blues"', ' when 1890..1909 then "Ragtime"', ' when 1910..1929 then "New Orleans Jazz"', ' when 1930..1939 then "Swing"', ' when 1940..1950 then "Bebop"', ' else "Jazz"', ' end' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 9); //`case` should always be closed with `end` assert.range(ranges[0], 0, 7, 0, 11); assert.range(ranges[1], 7, 7, 7, 10); //`end` should close `case` ranges = this.mode.getMatching(session, 7, 9); assert.range(ranges[1], 0, 7, 0, 11); assert.range(ranges[0], 7, 7, 7, 10); //`when` shouldn't have any matchings in single line form ranges = this.mode.getMatching(session, 1, 8); assert.equal(ranges, undefined); assert.equal(session.getFoldWidget(1), undefined); assert.equal(session.getFoldWidgetRange(1), null); //`else` shouldn't have any matchings in single line form ranges = this.mode.getMatching(session, 6, 8); assert.equal(ranges, undefined); assert.equal(session.getFoldWidget(6), undefined); assert.equal(session.getFoldWidgetRange(6), null); }, "test: loops `while` and `until` including `do` keyword and `do` loops should properly highlight": function() { var session = new EditSession([ 'while a < 10 do', ' p a', ' a += 1', ' 0.upto 5 do |value|', ' selected << value if value==2...value==2', ' end', 'end' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 3); assert.range(ranges[0], 0, 0, 0, 5); assert.range(ranges[1], 6, 0, 6, 3); ranges = this.mode.getMatching(session, 6, 1); assert.range(ranges[1], 0, 0, 0, 5); assert.range(ranges[0], 6, 0, 6, 3); //for `do` keyword we also returns proper `end` from `while` loop ranges = this.mode.getMatching(session, 0, 14); assert.range(ranges[0], 0, 13, 0, 15); assert.range(ranges[1], 6, 0, 6, 3); ranges = this.mode.getMatching(session, 3, 13); assert.range(ranges[0], 3, 12, 3, 14); assert.range(ranges[1], 5, 3, 5, 6); ranges = this.mode.getMatching(session, 5, 4); assert.range(ranges[1], 3, 12, 3, 14); assert.range(ranges[0], 5, 3, 5, 6); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/sql.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./cstyle").FoldMode; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { /** * Inheriting cstyle folding because it handles the region comment folding * and special block comment folding appropriately. * * Cstyle's getCommentRegionBlock() contains the sql comment characters '--' for end region block. */ }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/sqlserver.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Range = require("../../range").Range; var BaseFoldMode = require("./cstyle").FoldMode; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { /** * Inheriting cstyle folding because it handles the region comment folding * and special block comment folding appropriately. * * Cstyle's getCommentRegionBlock() contains the sql comment characters '--' for end region block. */ this.foldingStartMarker = /(\bCASE\b|\bBEGIN\b)|^\s*(\/\*)/i; // this.foldingStopMarker = /(\bEND\b)|^[\s\*]*(\*\/)/i; this.startRegionRe = /^\s*(\/\*|--)#?region\b/; this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { var line = session.getLine(row); if (this.startRegionRe.test(line)) return this.getCommentRegionBlock(session, line, row); var match = line.match(this.foldingStartMarker); if (match) { var i = match.index; if (match[1]) return this.getBeginEndBlock(session, row, i, match[1]); var range = session.getCommentFoldRange(row, i + match[0].length, 1); if (range && !range.isMultiLine()) { if (forceMultiline) { range = this.getSectionRange(session, row); } else if (foldStyle != "all") range = null; } return range; } if (foldStyle === "markbegin") return; //TODO: add support for end folding markers return; }; /** * @returns {Range} folding block for sequence that starts with 'CASE' or 'BEGIN' and ends with 'END' * @param {string} matchSequence - the sequence of charaters that started the fold widget, which should remain visible when the fold widget is folded */ this.getBeginEndBlock = function(session, row, column, matchSequence) { var start = { row: row, column: column + matchSequence.length }; var maxRow = session.getLength(); var line; var depth = 1; var re = /(\bCASE\b|\bBEGIN\b)|(\bEND\b)/i; while (++row < maxRow) { line = session.getLine(row); var m = re.exec(line); if (!m) continue; if (m[1]) depth++; else depth--; if (!depth) break; } var endRow = row; if (endRow > start.row) { return new Range(start.row, start.column, endRow, line.length); } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/vbscript.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var TokenIterator = require("../../token_iterator").TokenIterator; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { this.indentKeywords = { "class": 1, "function": 1, "sub": 1, "if": 1, "select": 1, "do": 1, "for": 1, "while": 1, "with": 1, "property": 1, "else": 1, "elseif": 1, "end": -1, "loop": -1, "next": -1, "wend": -1, "exit": 0, "until": 0 }; this.foldingStartMarker = /(?:\s|^)(class|function|sub|if|select|do|for|while|with|property|else|elseif)\b/i; this.foldingStopMarker = /\b(end|loop|next|wend)\b/i; this.getFoldWidgetRange = function (session, foldStyle, row) { var line = session.getLine(row); var isStart = this.foldingStartMarker.test(line); var isEnd = this.foldingStopMarker.test(line); if (isStart || isEnd) { var match = (isEnd) ? this.foldingStopMarker.exec(line) : this.foldingStartMarker.exec(line); var keyword = match && match[1].toLowerCase(); if (keyword) { var type = session.getTokenAt(row, match.index + 2).type; if (type === "keyword.control.asp" || type === "storage.type.function.asp") return this.vbsBlock(session, row, match.index + 2); } } }; // must return "" if there's no fold, to enable caching this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); var isStart = this.foldingStartMarker.test(line); var isEnd = this.foldingStopMarker.test(line); if (/(?:\s*|^)Exit\s+(Do|For|Sub|Function|Property)\b/i.test(line)) return ""; if (isStart && !isEnd) { var match = this.foldingStartMarker.exec(line); var keyword = match && match[1].toLowerCase(); if (keyword) { var type = session.getTokenAt(row, match.index + 2).type; if (type == "keyword.control.asp" || type == "storage.type.function.asp") { if (keyword == "if" && !/then\s*('|$)/i.test(line)) return ""; return "start"; } } } return ""; }; this.vbsBlock = function(session, row, column, tokenRange) { var stream = new TokenIterator(session, row, column); var endOpenings = { "class": 1, "function": 1, "sub": 1, "if": 1, "select": 1, "with": 1, "property": 1, "else": 1, "elseif": 1 }; var token = stream.getCurrentToken(); if (!token || (token.type != "keyword.control.asp" && token.type != "storage.type.function.asp")) return; var startTokenValue = token.value.toLowerCase(); var val = token.value.toLowerCase(); var firstRange = stream.getCurrentTokenRange(); var doubleKeywordResult = this.$isDoubleKeyword(token, stream); if (doubleKeywordResult === "ignore") { return; } var doubleKeywordPosition = null; if (doubleKeywordResult) { firstRange = doubleKeywordResult.range; doubleKeywordPosition = doubleKeywordResult.position; if (doubleKeywordResult.position === "second") { val = doubleKeywordResult.keyword; startTokenValue = val; } } var stack = [val]; var dir = this.indentKeywords[val]; if (!dir) return; if (doubleKeywordPosition === "first" && dir === 1) { stream.stepForward(); stream.stepForward(); } else if (doubleKeywordPosition === "second" && dir === -1) { stream.stepBackward(); stream.stepBackward(); } switch (val) { case "property": case "sub": case "function": case "if": case "select": case "do": case "for": case "class": case "while": case "with": var line = session.getLine(row); var singleLineCondition = /^\s*If\s+.*\s+Then(?!')\s+(?!')\S/i.test(line); if (singleLineCondition) return; var checkToken = new RegExp("(?:^|\\s)" + val, "i"); var endTest = /^\s*End\s(If|Sub|Select|Function|Class|With|Property)\s*/i.test(line); if (!checkToken.test(line) && !endTest) { return; } if (endTest) { var tokenRange = stream.getCurrentTokenRange(); stream.step = stream.stepBackward; stream.step(); stream.step(); token = stream.getCurrentToken(); if (token) { val = token.value.toLowerCase(); if (val == "end") { firstRange = stream.getCurrentTokenRange(); firstRange = new Range(firstRange.start.row, firstRange.start.column, tokenRange.start.row, tokenRange.end.column); } } dir = -1; } break; case "end": var tokenPos = stream.getCurrentTokenPosition(); firstRange = stream.getCurrentTokenRange(); stream.step = stream.stepForward; stream.step(); stream.step(); token = stream.getCurrentToken(); if (token) { val = token.value.toLowerCase(); if (val in endOpenings) { startTokenValue = val; var nextTokenPos = stream.getCurrentTokenPosition(); var endColumn = nextTokenPos.column + val.length; firstRange = new Range(tokenPos.row, tokenPos.column, nextTokenPos.row, endColumn); } } stream.step = stream.stepBackward; stream.step(); stream.step(); break; } var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; var startRow = row; var ranges = []; ranges.push(firstRange); stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; while(token = stream.step()) { var outputRange = null; var ignore = false; if (token.type != "keyword.control.asp" && token.type != "storage.type.function.asp") continue; val = token.value.toLowerCase(); var level = dir * this.indentKeywords[val]; switch (val) { case "property": case "sub": case "function": case "if": case "select": case "do": case "for": case "class": case "while": case "with": case "until": case "exit": var line = session.getLine(stream.getCurrentTokenRow()); var singleLineCondition = /^\s*If\s+.*\s+Then(?!')\s+(?!')\S/i.test(line); if (singleLineCondition) { level = 0; ignore = true; } var checkToken = new RegExp("^\\s* end\\s+" + val, "i"); if (checkToken.test(line)) { level = 0; ignore = true; } var doubleKeyword = this.$isDoubleKeyword(token, stream); if (doubleKeyword === "ignore" || (doubleKeyword && doubleKeyword.position === "second")) { level = 0; ignore = true; } break; case "elseif": case "else": level = 0; if (startTokenValue != "elseif") { ignore = true; } break; } if (level > 0) { stack.unshift(val); } else if (level <= 0 && ignore === false) { stack.shift(); if (!stack.length) { switch (val) { case "end": var tokenPos = stream.getCurrentTokenPosition(); outputRange = stream.getCurrentTokenRange(); stream.step(); stream.step(); token = stream.getCurrentToken(); if (token) { val = token.value.toLowerCase(); if (val in endOpenings) { if ((startTokenValue == "else" || startTokenValue == "elseif")) { if (val !== "if") { ranges.shift(); } } else { if (val != startTokenValue) ranges.shift(); } var nextTokenPos = stream.getCurrentTokenPosition(); var endColumn = nextTokenPos.column + val.length; outputRange.setEnd(nextTokenPos.row, endColumn); } else { ranges.shift(); } } else { ranges.shift(); } stream.step = stream.stepBackward; stream.step(); stream.step(); token = stream.getCurrentToken(); val = token.value.toLowerCase(); break; case "select": case "sub": case "if": case "function": case "class": case "with": case "property": if (val != startTokenValue) ranges.shift(); break; case "do": if (startTokenValue != "loop") ranges.shift(); var doDouble = this.$isDoubleKeyword(token, stream); outputRange = (doDouble && doDouble.position === "first") ? doDouble.range : stream.getCurrentTokenRange(); break; case "loop": if (startTokenValue != "do") ranges.shift(); var loopDouble = this.$isDoubleKeyword(token, stream); outputRange = (loopDouble && loopDouble.position === "first") ? loopDouble.range : stream.getCurrentTokenRange(); break; case "for": if (startTokenValue != "next") ranges.shift(); break; case "next": if (startTokenValue != "for") ranges.shift(); break; case "while": if (startTokenValue != "wend") ranges.shift(); break; case "wend": if (startTokenValue != "while") ranges.shift(); break; } break; } if (level === 0){ stack.unshift(val); } } } if (!token) return null; if (tokenRange) { if (!outputRange) { ranges.push(stream.getCurrentTokenRange()); } else { ranges.push(outputRange); } return ranges; } var row = stream.getCurrentTokenRow(); if (dir === -1) { var endColumn = session.getLine(row).length; return new Range(row, endColumn, startRow - 1, startColumn); } else return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); }; /** * @param {Token} currentToken * @param {TokenIterator} stream * @return {false | "ignore" | { range: Range, position: "first" | "second", keyword: string }} */ this.$isDoubleKeyword = function (currentToken, stream) { var val = currentToken.value.toLowerCase(); var tokenIndex = stream.$tokenIndex; var rowTokens = stream.$rowTokens; var prevKeywordIndex = tokenIndex - 2; var prevKeyword = prevKeywordIndex >= 0 ? rowTokens[prevKeywordIndex] : null; if (prevKeyword) { var prevVal = prevKeyword.value.toLowerCase(); // Do While / Do Until if ((val === "while" || val === "until") && prevVal === "do") { return { range: this.$getDoubleKeywordRange(prevKeywordIndex, tokenIndex, stream), position: "second", keyword: "do" }; } // Loop While / Loop Until if ((val === "while" || val === "until") && prevVal === "loop") { return { range: this.$getDoubleKeywordRange(prevKeywordIndex, tokenIndex, stream), position: "second", keyword: "loop" }; } if (prevVal === "exit" && (val === "for" || val === "do" || val === "sub" || val === "function" || val === "property")) { return "ignore"; } } var nextKeywordIndex = tokenIndex + 2; var nextKeyword = nextKeywordIndex < rowTokens.length ? rowTokens[nextKeywordIndex] : null; if (nextKeyword) { var nextVal = nextKeyword.value.toLowerCase(); // Do While / Do Until if (val === "do" && (nextVal === "while" || nextVal === "until")) { return { range: this.$getDoubleKeywordRange(tokenIndex, nextKeywordIndex, stream), position: "first", keyword: "do" }; } // Loop While / Loop Until if (val === "loop" && (nextVal === "while" || nextVal === "until")) { return { range: this.$getDoubleKeywordRange(tokenIndex, nextKeywordIndex, stream), position: "first", keyword: "loop" }; } if (val === "exit" && (nextVal === "for" || nextVal === "do" || nextVal === "sub" || nextVal === "function" || nextVal === "property")) { return "ignore"; } } return false; }; /** * Calculate range spanning both tokens of a double keyword * @param {number} firstTokenIndex * @param {number} secondTokenIndex * @param {TokenIterator} stream * @return {Range} */ this.$getDoubleKeywordRange = function (firstTokenIndex, secondTokenIndex, stream) { var row = stream.$row; var rowTokens = stream.$rowTokens; var firstStart = 0; for (var i = 0; i < firstTokenIndex; i++) { firstStart += rowTokens[i].value.length; } var secondEnd = 0; for (var i = 0; i <= secondTokenIndex; i++) { secondEnd += rowTokens[i].value.length; } return new Range(row, firstStart, row, secondEnd); }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/vbscript_test.js ================================================ "use strict"; var VBScriptMode = require("../vbscript").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { setUp : function() { this.mode = new VBScriptMode(); }, "test: visual basic script indentation based folding": function() { var session = new EditSession([ 'Sub MakeHelloWorldFile (FileName)', ' \'Create a new file in C: drive or overwrite existing file', ' Set FSO = CreateObject("Scripting.FileSystemObject")', ' If FSO.FileExists(FileName) Then \'comment ', ' 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' ]); session.setFoldStyle("markbegin"); session.setMode(this.mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), "start"); assert.equal(session.getFoldWidget(4), ""); assert.equal(session.getFoldWidget(8), "start"); assert.equal(session.getFoldWidget(9), ""); assert.range(session.getFoldWidgetRange(0), 0, 33, 18, 46); assert.range(session.getFoldWidgetRange(3), 3, 45, 11, 37); assert.range(session.getFoldWidgetRange(12), 3, 45, 11, 37); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/velocity.js ================================================ "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); (function() { this.getFoldWidgetRange = function(session, foldStyle, row) { var range = this.indentationBlock(session, row); if (range) return range; var re = /\S/; var line = session.getLine(row); var startLevel = line.search(re); if (startLevel == -1 || line[startLevel] != "##") return; var startColumn = line.length; var maxRow = session.getLength(); var startRow = row; var endRow = row; while (++row < maxRow) { line = session.getLine(row); var level = line.search(re); if (level == -1) continue; if (line[level] != "##") break; endRow = row; } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } }; // must return "" if there's no fold, to enable caching this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); var indent = line.search(/\S/); var next = session.getLine(row + 1); var prev = session.getLine(row - 1); var prevIndent = prev.search(/\S/); var nextIndent = next.search(/\S/); if (indent == -1) { session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; return ""; } // documentation comments if (prevIndent == -1) { if (indent == nextIndent && line[indent] == "##" && next[indent] == "##") { session.foldWidgets[row - 1] = ""; session.foldWidgets[row + 1] = ""; return "start"; } } else if (prevIndent == indent && line[indent] == "##" && prev[indent] == "##") { if (session.getLine(row - 2).search(/\S/) == -1) { session.foldWidgets[row - 1] = "start"; session.foldWidgets[row + 1] = ""; return ""; } } if (prevIndent!= -1 && prevIndent < indent) session.foldWidgets[row - 1] = "start"; else session.foldWidgets[row - 1] = ""; if (indent < nextIndent) return "start"; else return ""; }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/xml.js ================================================ "use strict"; var oop = require("../../lib/oop"); var Range = require("../../range").Range; var BaseFoldMode = require("./fold_mode").FoldMode; var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) { BaseFoldMode.call(this); this.voidElements = voidElements || {}; this.optionalEndTags = oop.mixin({}, this.voidElements); if (optionalEndTags) oop.mixin(this.optionalEndTags, optionalEndTags); }; oop.inherits(FoldMode, BaseFoldMode); var Tag = function() { this.tagName = ""; this.closing = false; this.selfClosing = false; this.start = {row: 0, column: 0}; this.end = {row: 0, column: 0}; }; function is(token, type) { return token && token.type && token.type.lastIndexOf(type + ".xml") > -1; } (function() { this.getFoldWidget = function(session, foldStyle, row) { var tag = this._getFirstTagInLine(session, row); if (!tag) return this.getCommentFoldWidget(session, row); if (tag.closing || (!tag.tagName && tag.selfClosing)) return foldStyle === "markbeginend" ? "end" : ""; if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase())) return ""; if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column)) return ""; return "start"; }; this.getCommentFoldWidget = function(session, row) { if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row))) return "start"; return ""; }; /* * returns a first tag (or a fragment) in a line */ this._getFirstTagInLine = function(session, row) { var tokens = session.getTokens(row); var tag = new Tag(); for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; if (is(token, "tag-open")) { tag.end.column = tag.start.column + token.value.length; tag.closing = is(token, "end-tag-open"); token = tokens[++i]; if (!token) return null; tag.tagName = token.value; if (token.value === "") { //skip empty tag name token for fragment token = tokens[++i]; if (!token) return null; tag.tagName = token.value; } tag.end.column += token.value.length; for (i++; i < tokens.length; i++) { token = tokens[i]; tag.end.column += token.value.length; if (is(token, "tag-close")) { tag.selfClosing = token.value == '/>'; break; } } return tag; } else if (is(token, "tag-close")) { tag.selfClosing = token.value == '/>'; return tag; } tag.start.column += token.value.length; } return null; }; this._findEndTagInLine = function(session, row, tagName, startColumn) { var tokens = session.getTokens(row); var column = 0; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; column += token.value.length; if (column < startColumn - 1) continue; if (is(token, "end-tag-open")) { token = tokens[i + 1]; if (is(token, "tag-name") && token.value === "") { token = tokens[i + 2]; } if (token && token.value == tagName) return true; } } return false; }; this.getFoldWidgetRange = function(session, foldStyle, row) { var firstTag = this._getFirstTagInLine(session, row); if (!firstTag) { return this.getCommentFoldWidget(session, row) && session.getCommentFoldRange( row, session.getLine(row).length); } var tags = session.getMatchingTags({row: row, column: 0}); if (tags) { return new Range( tags.openTag.end.row, tags.openTag.end.column, tags.closeTag.start.row, tags.closeTag.start.column); } }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/xml_test.js ================================================ "use strict"; var XmlMode = require("../xml").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); module.exports = { "test: fold multi line self closing element": function() { var session = new EditSession([ '<person', ' firstname="fabian"', ' lastname="jakobs"/>' ]); var mode = new XmlMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), "end"); assert.range(session.getFoldWidgetRange(0), 0, 8, 2, 19); assert.range(session.getFoldWidgetRange(2), 0, 8, 2, 19); }, "test: fold should skip self closing elements": function() { var session = new EditSession([ '<person>', ' <attrib value="fabian"/>', '</person>' ]); var mode = new XmlMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), ""); assert.equal(session.getFoldWidget(2), "end"); assert.range(session.getFoldWidgetRange(0), 0, 8, 2, 0); assert.range(session.getFoldWidgetRange(2), 0, 8, 2, 0); }, "test: fold should skip multi line self closing elements": function() { var session = new EditSession([ '<person>', ' <attib', ' key="name"', ' value="fabian"/>', '</person>' ]); var mode = new XmlMode(); session.setMode(mode); session.setFoldStyle("markbeginend"); assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(1), "start"); assert.equal(session.getFoldWidget(2), ""); assert.equal(session.getFoldWidget(3), "end"); assert.equal(session.getFoldWidget(4), "end"); assert.range(session.getFoldWidgetRange(0), 0, 8, 4, 0); assert.range(session.getFoldWidgetRange(1), 1, 9, 3, 19); assert.range(session.getFoldWidgetRange(3), 1, 9, 3, 19); assert.range(session.getFoldWidgetRange(4), 0, 8, 4, 0); }, "test: fold should handle multi-line comments inside nested elements correctly": function () { var session = new EditSession([ '<parentElement>', ' <childElement>', ' text <!--', ' This is a multi-line comment', ' that spans multiple lines', ' -->', ' </childElement>', ' <anotherChildElement>', ' <!-- Another comment -->', ' </anotherChildElement>', '</parentElement>' ]); var mode = new XmlMode(); session.setMode(mode); session.setFoldStyle("markbeginend"); // Checks for the parentElement assert.equal(session.getFoldWidget(0), "start"); assert.equal(session.getFoldWidget(10), "end"); // Checks for multi-line comment folding assert.equal(session.getFoldWidget(2), "start"); // Checks for anotherChildElement folding (with single-line comment) assert.equal(session.getFoldWidget(7), "start"); assert.equal(session.getFoldWidget(8), ""); assert.equal(session.getFoldWidget(9), "end"); // Verifying fold ranges assert.range(session.getFoldWidgetRange(0), 0, 15, 10, 0); assert.range(session.getFoldWidgetRange(2), 2, 13, 5, 4); assert.equal(session.getFoldWidgetRange(8), ""); } }; require("../../test/run")(module); ================================================ FILE: src/mode/folding/yaml.js ================================================ "use strict"; var oop = require("../../lib/oop"); var CoffeeFoldMode = require("./coffee").FoldMode; var Range = require("../../range").Range; var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, CoffeeFoldMode); (function() { this.getFoldWidgetRange = function(session, foldStyle, row) { var re = /\S/; var line = session.getLine(row); var startLevel = line.search(re); var isCommentFold = line[startLevel] === "#"; var isDashFold = line[startLevel] === "-"; if (startLevel == -1) return; var startColumn = line.length; var maxRow = session.getLength(); var startRow = row; var endRow = row; // Comment folding if (isCommentFold) { var range = this.commentBlock(session, row); if (range) return range; // Indentation folding (used for indentations that start with a '-'). } else if (isDashFold) { var range = this.indentationBlock(session, row); if (range) return range; // List folding (used for indentations that don't start with a '-').. } else { while (++row < maxRow) { var line = session.getLine(row); var level = line.search(re); if (level == -1) continue; if (level <= startLevel && line[startLevel] !== '-') { var token = session.getTokenAt(row, 0); if (!token || token.type !== "string") break; } endRow = row; } } if (endRow > startRow) { var endColumn = session.getLine(endRow).length; return new Range(startRow, startColumn, endRow, endColumn); } }; // must return "" if there's no fold, to enable caching this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); var indent = line.search(/\S/); var next = session.getLine(row + 1); var prev = session.getLine(row - 1); var prevIndent = prev.search(/\S/); var nextIndent = next.search(/\S/); var lineStartsWithDash = line[indent] === '-'; if (indent == -1) { session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; return ""; } // documentation comments if (prevIndent == -1) { if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { session.foldWidgets[row - 1] = ""; session.foldWidgets[row + 1] = ""; return "start"; } } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { if (session.getLine(row - 2).search(/\S/) == -1) { session.foldWidgets[row - 1] = "start"; session.foldWidgets[row + 1] = ""; return ""; } } // Indentation fold if (prevIndent!= -1 && prevIndent < indent) { session.foldWidgets[row - 1] = "start"; // Fold non-indented list } else if (prevIndent!= -1 && (prevIndent == indent && lineStartsWithDash)) { session.foldWidgets[row - 1] = "start"; } else { session.foldWidgets[row - 1] = ""; } if (indent < nextIndent) return "start"; else return ""; }; }).call(FoldMode.prototype); ================================================ FILE: src/mode/folding/yaml_test.js ================================================ "use strict"; var YamlMode = require("../yaml").Mode; var EditSession = require("../../edit_session").EditSession; var assert = require("../../test/assertions"); function testFoldWidgets(array) { var session = array.filter(function(_, i){return i % 2 == 1;}); session = new EditSession(session); var mode = new YamlMode(); session.setFoldStyle("markbeginend"); session.setMode(mode); var widgets = array.filter(function(_, i){return i % 2 == 0;}); widgets.forEach(function(w, i){ session.foldWidgets[i] = session.getFoldWidget(i); }); widgets.forEach(function(w, i){ w = w.split(","); var type = w[0] == ">" ? "start" : w[0] == "<" ? "end" : ""; assert.equal(session.foldWidgets[i], type); if (!type) return; var range = session.getFoldWidgetRange(i); if (!w[1]) { assert.equal(range, null); return; } assert.equal(range.start.row, i); assert.equal(range.end.row - range.start.row, parseInt(w[1])); testColumn(w[2], range.start); testColumn(w[3], range.end); }); function testColumn(w, pos) { if (!w) return; if (w == "l") w = session.getLine(pos.row).length; else w = parseInt(w); assert.equal(pos.column, w); } } module.exports = { "test: yaml indentation based folding": function() { testFoldWidgets([ '>,1,l,l', ' ## indented comment', '', ' # ', '', '', '', ' ', '>,1', 'list: ', '', ' -item', '', ' ', '>,2', 'list: ', '>,1', ' -item1', '', ' item2', '', ' ', '>,4', 'list: ', '>,1', ' -item1', '', ' item2', '>,1', ' -item3', '', ' item4', '', ' ', '>,1', 'list: ', '', '-item', '', ' ', '>,2', 'list: ', '>,1', '-item1', '', ' item2', '', ' ', '>,4', 'list: ', '>,1', '-item1', '', ' item2', '>,1', '-item3', '', ' item4' ]); } }; require("../../test/run")(module); ================================================ FILE: src/mode/forth.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ForthHighlightRules = require("./forth_highlight_rules").ForthHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = ForthHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = null; this.$id = "ace/mode/forth"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/forth_highlight_rules.js ================================================ /* This file was autogenerated from https://raw.github.com/vze26m98/Forth.tmbundle/master/Syntaxes/Forth.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ForthHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { include: '#forth' } ], '#comment': [ { token: 'comment.line.double-dash.forth', regex: '(?:^|\\s)--\\s.*$', comment: 'line comments for iForth' }, { token: 'comment.line.backslash.forth', regex: '(?:^|\\s)\\\\[\\s\\S]*$', comment: 'ANSI line comment' }, { token: 'comment.line.backslash-g.forth', regex: '(?:^|\\s)\\\\[Gg] .*$', comment: 'gForth line comment' }, { token: 'comment.block.forth', regex: '(?:^|\\s)\\(\\*(?=\\s|$)', push: [ { token: 'comment.block.forth', regex: '(?:^|\\s)\\*\\)(?=\\s|$)', next: 'pop' }, { defaultToken: 'comment.block.forth' } ], comment: 'multiline comments for iForth' }, { token: 'comment.block.documentation.forth', regex: '\\bDOC\\b', caseInsensitive: true, push: [ { token: 'comment.block.documentation.forth', regex: '\\bENDDOC\\b', caseInsensitive: true, next: 'pop' }, { defaultToken: 'comment.block.documentation.forth' } ], comment: 'documentation comments for iForth' }, { token: 'comment.line.parentheses.forth', regex: '(?:^|\\s)\\.?\\( [^)]*\\)', comment: 'ANSI line comment' } ], '#constant': [ { token: 'constant.language.forth', regex: '(?:^|\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s|$)', caseInsensitive: true}, { token: 'constant.numeric.forth', regex: '(?:^|\\s)[$#%]?[-+]?[0-9]+(?:\\.[0-9]*e-?[0-9]+|\\.?[0-9a-fA-F]*)(?=\\s|$)'}, { token: 'constant.character.forth', regex: '(?:^|\\s)(?:[&^]\\S|(?:"|\')\\S(?:"|\'))(?=\\s|$)'}], '#forth': [ { include: '#constant' }, { include: '#comment' }, { include: '#string' }, { include: '#word' }, { include: '#variable' }, { include: '#storage' }, { include: '#word-def' } ], '#storage': [ { token: 'storage.type.forth', regex: '(?:^|\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\s|$)', caseInsensitive: true}], '#string': [ { token: 'string.quoted.double.forth', regex: '(ABORT" |BREAK" |\\." |C" |0"|S\\\\?" )([^"]+")', caseInsensitive: true}, { token: 'string.unquoted.forth', regex: '(?:INCLUDE|NEEDS|REQUIRE|USE)[ ]\\S+(?=\\s|$)', caseInsensitive: true}], '#variable': [ { token: 'variable.language.forth', regex: '\\b(?:I|J)\\b', caseInsensitive: true } ], '#word': [ { token: 'keyword.control.immediate.forth', regex: '(?:^|\\s)\\[(?:\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\](?=\\s|$)', caseInsensitive: true}, { token: 'keyword.other.immediate.forth', regex: '(?:^|\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|])(?=\\s|$)', caseInsensitive: true}, { token: 'keyword.control.compile-only.forth', regex: '(?:^|\\s)(?:-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE)(?=\\s|$)', caseInsensitive: true}, { token: 'keyword.other.compile-only.forth', regex: '(?:^|\\s)(?:\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\s|$)', caseInsensitive: true}, { token: 'keyword.other.non-immediate.forth', regex: '(?:^|\\s)(?:\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\s|$)', caseInsensitive: true}, { token: 'keyword.other.warning.forth', regex: '(?:^|\\s)(?:~~|BREAK:|BREAK"|DBG)(?=\\s|$)', caseInsensitive: true}], '#word-def': [ { token: [ 'keyword.other.compile-only.forth', 'keyword.other.compile-only.forth', 'meta.block.forth', 'entity.name.function.forth' ], regex: '(:NONAME)|(^:|\\s:)(\\s)(\\S+)(?=\\s|$)', caseInsensitive: true, push: [ { token: 'keyword.other.compile-only.forth', regex: ';(?:CODE)?', caseInsensitive: true, next: 'pop' }, { include: '#constant' }, { include: '#comment' }, { include: '#string' }, { include: '#word' }, { include: '#variable' }, { include: '#storage' }, { defaultToken: 'meta.block.forth' } ] } ] }; this.normalizeRules(); }; ForthHighlightRules.metaData = { fileTypes: [ 'frt', 'fs', 'ldr', 'fth', '4th' ], foldingStartMarker: '/\\*\\*|\\{\\s*$', foldingStopMarker: '\\*\\*/|^\\s*\\}', keyEquivalent: '^~F', name: 'Forth', scopeName: 'source.forth' }; oop.inherits(ForthHighlightRules, TextHighlightRules); exports.ForthHighlightRules = ForthHighlightRules; ================================================ FILE: src/mode/fortran.js ================================================ /* Derived from Python rules */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var FortranHighlightRules = require("./fortran_highlight_rules").FortranHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = FortranHighlightRules; this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "!"; 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; }; var outdents = { "return": 1, "break": 1, "continue": 1, "RETURN": 1, "BREAK": 1, "CONTINUE": 1 }; this.checkOutdent = function(state, line, input) { if (input !== "\r\n" && input !== "\r" && input !== "\n") return false; var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens) return false; do { var last = tokens.pop(); } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/)))); if (!last) return false; return (last.type == "keyword" && outdents[last.value]); }; this.autoOutdent = function(state, doc, row) { row += 1; var indent = this.$getIndent(doc.getLine(row)); var tab = doc.getTabString(); if (indent.slice(-tab.length) == tab) doc.remove(new Range(row, indent.length-tab.length, row, indent.length)); }; this.$id = "ace/mode/fortran"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/fortran_highlight_rules.js ================================================ /* Derived from Python highlighing rules */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var FortranHighlightRules = function() { var keywords = ( "call|case|contains|continue|cycle|do|else|elseif|end|enddo|endif|function|"+ "if|implicit|in|include|inout|intent|module|none|only|out|print|program|return|"+ "select|status|stop|subroutine|" + "return|then|use|while|write|"+ "CALL|CASE|CONTAINS|CONTINUE|CYCLE|DO|ELSE|ELSEIF|END|ENDDO|ENDIF|FUNCTION|"+ "IF|IMPLICIT|IN|INCLUDE|INOUT|INTENT|MODULE|NONE|ONLY|OUT|PRINT|PROGRAM|RETURN|"+ "SELECT|STATUS|STOP|SUBROUTINE|" + "RETURN|THEN|USE|WHILE|WRITE" ); var keywordOperators = ( "and|or|not|eq|ne|gt|ge|lt|le|" + "AND|OR|NOT|EQ|NE|GT|GE|LT|LE" ); var builtinConstants = ( "true|false|TRUE|FALSE" ); var builtinFunctions = ( "abs|achar|acos|acosh|adjustl|adjustr|aimag|aint|all|allocate|"+ "anint|any|asin|asinh|associated|atan|atan2|atanh|"+ "bessel_j0|bessel_j1|bessel_jn|bessel_y0|bessel_y1|bessel_yn|"+ "bge|bgt|bit_size|ble|blt|btest|ceiling|char|cmplx|conjg|cos|cosh|"+ "count|cpu_time|cshift|date_and_time|dble|deallocate|digits|dim|dot_product|dprod|"+ "dshiftl|dshiftr|dsqrt|eoshift|epsilon|erf|erfc|erfc_scaled|exp|float|floor|"+ "format|fraction|gamma|input|len|lge|lgt|lle|llt|log|log10|maskl|maskr|matmul|max|maxloc|maxval|"+ "merge|min|minloc|minval|mod|modulo|nint|not|norm2|null|nullify|pack|parity|popcnt|poppar|"+ "precision|present|product|radix|random_number|random_seed|range|repeat|reshape|round|"+ "rrspacing|same_type_as|scale|scan|selected_char_kind|selected_int_kind|selected_real_kind|"+ "set_exponent|shape|shifta|shiftl|shiftr|sign|sin|sinh|size|sngl|spacing|spread|"+ "sqrt|sum|system_clock|tan|tanh|tiny|trailz|transfer|transpose|trim|ubound|unpack|verify|" + "ABS|ACHAR|ACOS|ACOSH|ADJUSTL|ADJUSTR|AIMAG|AINT|ALL|ALLOCATE|"+ "ANINT|ANY|ASIN|ASINH|ASSOCIATED|ATAN|ATAN2|ATANH|"+ "BESSEL_J0|BESSEL_J1|BESSEL_JN|BESSEL_Y0|BESSEL_Y1|BESSEL_YN|"+ "BGE|BGT|BIT_SIZE|BLE|BLT|BTEST|CEILING|CHAR|CMPLX|CONJG|COS|COSH|"+ "COUNT|CPU_TIME|CSHIFT|DATE_AND_TIME|DBLE|DEALLOCATE|DIGITS|DIM|DOT_PRODUCT|DPROD|"+ "DSHIFTL|DSHIFTR|DSQRT|EOSHIFT|EPSILON|ERF|ERFC|ERFC_SCALED|EXP|FLOAT|FLOOR|"+ "FORMAT|FRACTION|GAMMA|INPUT|LEN|LGE|LGT|LLE|LLT|LOG|LOG10|MASKL|MASKR|MATMUL|MAX|MAXLOC|MAXVAL|"+ "MERGE|MIN|MINLOC|MINVAL|MOD|MODULO|NINT|NOT|NORM2|NULL|NULLIFY|PACK|PARITY|POPCNT|POPPAR|"+ "PRECISION|PRESENT|PRODUCT|RADIX|RANDOM_NUMBER|RANDOM_SEED|RANGE|REPEAT|RESHAPE|ROUND|"+ "RRSPACING|SAME_TYPE_AS|SCALE|SCAN|SELECTED_CHAR_KIND|SELECTED_INT_KIND|SELECTED_REAL_KIND|"+ "SET_EXPONENT|SHAPE|SHIFTA|SHIFTL|SHIFTR|SIGN|SIN|SINH|SIZE|SNGL|SPACING|SPREAD|"+ "SQRT|SUM|SYSTEM_CLOCK|TAN|TANH|TINY|TRAILZ|TRANSFER|TRANSPOSE|TRIM|UBOUND|UNPACK|VERIFY" ); var storageType = ( "logical|character|integer|real|type|" + "LOGICAL|CHARACTER|INTEGER|REAL|TYPE" ); var storageModifiers = ( "allocatable|dimension|intent|parameter|pointer|target|private|public|" + "ALLOCATABLE|DIMENSION|INTENT|PARAMETER|POINTER|TARGET|PRIVATE|PUBLIC" ); var keywordMapper = this.createKeywordMapper({ "invalid.deprecated": "debugger", "support.function": builtinFunctions, "constant.language": builtinConstants, "keyword": keywords, "keyword.operator": keywordOperators, "storage.type": storageType, "storage.modifier" : storageModifiers }, "identifier"); var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?"; var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; var octInteger = "(?:0[oO]?[0-7]+)"; var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; var binInteger = "(?:0[bB][01]+)"; var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")"; var exponent = "(?:[eE][+-]?\\d+)"; var fraction = "(?:\\.\\d+)"; var intPart = "(?:\\d+)"; var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")"; var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"; this.$rules = { "start" : [ { token : "comment", regex : "!.*$" }, { token : "string", // multi line """ string start regex : strPre + '"{3}', next : "qqstring3" }, { token : "string", // " string regex : strPre + '"(?=.)', next : "qqstring" }, { token : "string", // multi line ''' string start regex : strPre + "'{3}", next : "qstring3" }, { token : "string", // ' string regex : strPre + "'(?=.)", next : "qstring" }, { token : "constant.numeric", // imaginary regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b" }, { token : "constant.numeric", // float regex : floatNumber }, { token : "constant.numeric", // long integer regex : integer + "[lL]\\b" }, { token : "constant.numeric", // integer regex : integer + "\\b" }, { token : "keyword", // pre-compiler directives regex : "#\\s*(?:include|import|define|undef|INCLUDE|IMPORT|DEFINE|UNDEF)\\b" }, { token : "keyword", // special case pre-compiler directive regex : "#\\s*(?:endif|ifdef|else|elseif|ifndef|ENDIF|IFDEF|ELSE|ELSEIF|IFNDEF)\\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+" } ], "qqstring3" : [ { token : "constant.language.escape", regex : stringEscape }, { token : "string", // multi line """ string end regex : '"{3}', next : "start" }, { defaultToken : "string" } ], "qstring3" : [ { token : "constant.language.escape", regex : stringEscape }, { token : "string", // multi line """ string end regex : '"{3}', next : "start" }, { defaultToken : "string" } ], "qqstring" : [{ token : "constant.language.escape", regex : stringEscape }, { token : "string", regex : "\\\\$", next : "qqstring" }, { token : "string", regex : '"|$', next : "start" }, { defaultToken: "string" }], "qstring" : [{ token : "constant.language.escape", regex : stringEscape }, { token : "string", regex : "\\\\$", next : "qstring" }, { token : "string", regex : "'|$", next : "start" }, { defaultToken: "string" }] }; }; oop.inherits(FortranHighlightRules, TextHighlightRules); exports.FortranHighlightRules = FortranHighlightRules; ================================================ FILE: src/mode/fsharp.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var FSharpHighlightRules = require("./fsharp_highlight_rules").FSharpHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { TextMode.call(this); this.HighlightRules = FSharpHighlightRules; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function () { this.lineCommentStart = "//"; this.blockComment = {start: "(*", end: "*)", nestable: true}; this.$id = "ace/mode/fsharp"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/fsharp_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var FSharpHighlightRules = function () { var keywordMapper = this.createKeywordMapper({ "variable": "this", "keyword": 'abstract|assert|base|begin|class|default|delegate|done|downcast|downto|elif\ |else|exception|extern|false|finally|function|global|inherit|inline|interface|internal|lazy|match\ |member|module|mutable|namespace|open|or|override|private|public|rec|return|return!|select|static\ |struct|then|to|true|try|typeof|upcast|use|use!|val|void|when|while|with|yield|yield!|__SOURCE_DIRECTORY__\ |as|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue\ |eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall\ |trait|virtual|volatile|and|do|end|for|fun|if|in|let|let!|new|not|null|of|endif', "constant": "true|false" }, "identifier"); var floatNumber = "(?:(?:(?:(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.))|(?:\\d+))(?:[eE][+-]?\\d+))|(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.)))"; this.$rules = { "start": [ { token: "variable.classes", regex: '\\[\\<[.]*\\>\\]' }, { token: "comment", regex: '//.*$' }, { token: "comment.start", regex: /\(\*(?!\))/, push: "blockComment" }, { token: "string", regex: "'.'" }, { token: "string", regex: '"""', next : [{ token : "constant.language.escape", regex : /\\./, next : "qqstring" }, { token : "string", regex : '"""', next : "start" }, { defaultToken: "string" }] }, { token: "string", regex: '"', next : [{ token : "constant.language.escape", regex : /\\./, next : "qqstring" }, { token : "string", regex : '"', next : "start" }, { defaultToken: "string" }] }, { token: ["verbatim.string", "string"], regex: '(@?)(")', stateName : "qqstring", next : [{ token : "constant.language.escape", regex : '""' }, { token : "string", regex : '"', next : "start" }, { defaultToken: "string" }] }, { token: "constant.float", regex: "(?:" + floatNumber + "|\\d+)[jJ]\\b" }, { token: "constant.float", regex: floatNumber }, { token: "constant.integer", regex: "(?:(?:(?:[1-9]\\d*)|(?:0))|(?:0[oO]?[0-7]+)|(?:0[xX][\\dA-Fa-f]+)|(?:0[bB][01]+))\\b" }, { token: ["keyword.type", "variable"], regex: "(type\\s)([a-zA-Z0-9_$\-]*\\b)" }, { token: keywordMapper, regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token: "keyword.operator", regex: "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|=|\\(\\*\\)" }, { token: "paren.lparen", regex: "[[({]" }, { token: "paren.rparen", regex: "[\\])}]" } ], blockComment: [{ regex: /\(\*\)/, token: "comment" }, { regex: /\(\*(?!\))/, token: "comment.start", push: "blockComment" }, { regex: /\*\)/, token: "comment.end", next: "pop" }, { defaultToken: "comment" }] }; this.normalizeRules(); }; oop.inherits(FSharpHighlightRules, TextHighlightRules); exports.FSharpHighlightRules = FSharpHighlightRules; ================================================ FILE: src/mode/fsl.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var FSLHighlightRules = require("./fsl_highlight_rules").FSLHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = FSLHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; // Extra logic goes here. this.$id = "ace/mode/fsl"; this.snippetFileId = "ace/snippets/fsl"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/fsl_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var FSLHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ token: "punctuation.definition.comment.mn", regex: /\/\*/, push: [{ token: "punctuation.definition.comment.mn", regex: /\*\//, next: "pop" }, { defaultToken: "comment.block.fsl" }] }, { token: "comment.line.fsl", regex: /\/\//, push: [{ token: "comment.line.fsl", regex: /$/, next: "pop" }, { defaultToken: "comment.line.fsl" }] }, { token: "entity.name.function", regex: /\${/, push: [{ token: "entity.name.function", regex: /}/, next: "pop" }, { defaultToken: "keyword.other" }], comment: "js outcalls" }, { token: "constant.numeric", regex: /[0-9]*\.[0-9]*\.[0-9]*/, comment: "semver" }, { token: "constant.language.fslLanguage", regex: "(?:" + "graph_layout|machine_name|machine_author|machine_license|machine_comment|machine_language" + "|machine_version|machine_reference|npm_name|graph_layout|on_init|on_halt|on_end|on_terminate|on_finalize|on_transition" + "|on_action|on_stochastic_action|on_legal|on_main|on_forced|on_validation|on_validation_failure|on_transition_refused|on_forced_transition_refused" + "|on_action_refused|on_enter|on_exit|start_states|end_states|terminal_states|final_states|fsl_version" + ")\\s*:" }, { token: "keyword.control.transition.fslArrow", regex: /<->|<-|->|<=>|=>|<=|<~>|~>|<~|<-=>|<=->|<-~>|<~->|<=~>|<~=>/ }, { token: "constant.numeric.fslProbability", regex: /[0-9]+%/, comment: "edge probability annotation" }, { token: "constant.character.fslAction", regex: /\'[^']*\'/, comment: "action annotation" }, { token: "string.quoted.double.fslLabel.doublequoted", regex: /\"[^"]*\"/, comment: "fsl label annotation" }, { token: "entity.name.tag.fslLabel.atom", regex: /[a-zA-Z0-9_.+&()#@!?,]/, comment: "fsl label annotation" }] }; this.normalizeRules(); }; FSLHighlightRules.metaData = { fileTypes: ["fsl", "fsl_state"], name: "FSL", scopeName: "source.fsl" }; oop.inherits(FSLHighlightRules, TextHighlightRules); exports.FSLHighlightRules = FSLHighlightRules; ================================================ FILE: src/mode/ftl.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var FtlHighlightRules = require("./ftl_highlight_rules").FtlHighlightRules; var Mode = function() { this.HighlightRules = FtlHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/ftl"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/ftl_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var FtlLangHighlightRules = function () { var stringBuiltIns = "\\?|substring|cap_first|uncap_first|capitalize|chop_linebreak|date|time|datetime|" + "ends_with|html|groups|index_of|j_string|js_string|json_string|last_index_of|length|lower_case|" + "left_pad|right_pad|contains|matches|number|replace|rtf|url|split|starts_with|string|trim|" + "upper_case|word_list|xhtml|xml"; var numberBuiltIns = "c|round|floor|ceiling"; var dateBuiltIns = "iso_[a-z_]+"; var seqBuiltIns = "first|last|seq_contains|seq_index_of|seq_last_index_of|reverse|size|sort|sort_by|chunk"; var hashBuiltIns = "keys|values"; var xmlBuiltIns = "children|parent|root|ancestors|node_name|node_type|node_namespace"; var expertBuiltIns = "byte|double|float|int|long|short|number_to_date|number_to_time|number_to_datetime|" + "eval|has_content|interpret|is_[a-z_]+|namespacenew"; var allBuiltIns = stringBuiltIns + numberBuiltIns + dateBuiltIns + seqBuiltIns + hashBuiltIns + xmlBuiltIns + expertBuiltIns; var deprecatedBuiltIns = "default|exists|if_exists|web_safe"; var variables = "data_model|error|globals|lang|locale|locals|main|namespace|node|current_node|" + "now|output_encoding|template_name|url_escaping_charset|vars|version"; var operators = "gt|gte|lt|lte|as|in|using"; var reserved = "true|false"; var attributes = "encoding|parse|locale|number_format|date_format|time_format|datetime_format|time_zone|" + "url_escaping_charset|classic_compatible|strip_whitespace|strip_text|strict_syntax|ns_prefixes|" + "attributes"; this.$rules = { "start" : [{ token : "constant.character.entity", regex : /&[^;]+;/ }, { token : "support.function", regex : "\\?("+allBuiltIns+")" }, { token : "support.function.deprecated", regex : "\\?("+deprecatedBuiltIns+")" }, { token : "language.variable", regex : "\\.(?:"+variables+")" }, { token : "constant.language", regex : "\\b("+reserved+")\\b" }, { token : "keyword.operator", regex : "\\b(?:"+operators+")\\b" }, { token : "entity.other.attribute-name", regex : attributes }, { token : "string", // regex : /['"]/, next : "qstring" }, { // Deal with variable names that contains number // e.g. <#if var42 == 42 > token : function(value) { if (value.match("^[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?$")) { return "constant.numeric"; } else { return "variable"; } }, regex : /[\w.+\-]+/ }, { token : "keyword.operator", regex : "!|\\.|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" }], "qstring" : [{ token : "constant.character.escape", regex : '\\\\[nrtvef\\\\"$]' }, { token : "string", regex : /['"]/, next : "start" }, { defaultToken : "string" }] }; }; oop.inherits(FtlLangHighlightRules, TextHighlightRules); var FtlHighlightRules = function() { HtmlHighlightRules.call(this); var directives = "assign|attempt|break|case|compress|default|elseif|else|escape|fallback|function|flush|" + "ftl|global|if|import|include|list|local|lt|macro|nested|noescape|noparse|nt|recover|recurse|return|rt|" + "setting|stop|switch|t|visit"; var startRules = [ { token : "comment", regex : "<#--", next : "ftl-dcomment" }, { token : "string.interpolated", regex : "\\${", push : "ftl-start" }, { token : "keyword.function", regex : "</?#("+directives+")", push : "ftl-start" }, { token : "keyword.other", regex : "</?@[a-zA-Z\\.]+", push : "ftl-start" } ]; var endRules = [ { token : "keyword", regex : "/?>", next : "pop" }, { token : "string.interpolated", regex : "}", next : "pop" } ]; for (var key in this.$rules) this.$rules[key].unshift.apply(this.$rules[key], startRules); this.embedRules(FtlLangHighlightRules, "ftl-", endRules, ["start"]); this.addRules({ "ftl-dcomment" : [{ token : "comment", regex : "-->", next : "pop" }, { defaultToken : "comment" }] }); this.normalizeRules(); }; oop.inherits(FtlHighlightRules, HtmlHighlightRules); exports.FtlHighlightRules = FtlHighlightRules; ================================================ FILE: src/mode/gcode.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var GcodeHighlightRules = require("./gcode_highlight_rules").GcodeHighlightRules; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = GcodeHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/gcode"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/gcode_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var GcodeHighlightRules = function() { var keywords = ( "IF|DO|WHILE|ENDWHILE|CALL|ENDIF|SUB|ENDSUB|GOTO|REPEAT|ENDREPEAT|CALL" ); var builtinConstants = ( "PI" ); var builtinFunctions = ( "ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords, "constant.language": builtinConstants }, "identifier", true); this.$rules = { "start" : [ { token : "comment", regex : "\\(.*\\)" }, { token : "comment", // block number regex : "([N])([0-9]+)" }, { token : "string", // " string regex : "([G])([0-9]+\\.?[0-9]?)" }, { token : "string", // ' string regex : "([M])([0-9]+\\.?[0-9]?)" }, { token : "constant.numeric", // float regex : "([-+]?([0-9]*\\.?[0-9]+\\.?))|(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)" }, { token : keywordMapper, regex : "[A-Z]" }, { token : "keyword.operator", regex : "EQ|LT|GT|NE|GE|LE|OR|XOR" }, { token : "paren.lparen", regex : "[\\[]" }, { token : "paren.rparen", regex : "[\\]]" }, { token : "text", regex : "\\s+" } ] }; }; oop.inherits(GcodeHighlightRules, TextHighlightRules); exports.GcodeHighlightRules = GcodeHighlightRules; ================================================ FILE: src/mode/gherkin.js ================================================ var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var GherkinHighlightRules = require("./gherkin_highlight_rules").GherkinHighlightRules; var Mode = function() { this.HighlightRules = GherkinHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$id = "ace/mode/gherkin"; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); var space2 = " "; var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if(line.match("[ ]*\\|")) { indent += "| "; } if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } if (state == "start") { if (line.match("Scenario:|Feature:|Scenario Outline:|Background:")) { indent += space2; } else if(line.match("(Given|Then).+(:)$|Examples:")) { indent += space2; } else if(line.match("\\*.+")) { indent += "* "; } } return indent; }; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/gherkin_highlight_rules.js ================================================ var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"; var GherkinHighlightRules = function() { var languages = [{ name: "en", labels: "Feature|Background|Scenario(?: Outline)?|Examples", keywords: "Given|When|Then|And|But" } /* TODO find a way to enable this when first line in the file is # language: pl , { name: "pl", labels: "Właściwość|Funkcja|Aspekt|Potrzeba biznesowa|Założenia|Scenariusz|Szablon scenariusza|Przykłady", keywords: "Mając|Zakładając(?:, że)?|Jeżeli|Jeśli|Gdy|Kiedy|Wtedy|Oraz|I|Ale" } */]; var labels = languages.map(function(l) { return l.labels; }).join("|"); var keywords = languages.map(function(l) { return l.keywords; }).join("|"); // need to include constant ints this.$rules = { start : [{ token: "constant.numeric", regex: "(?:(?:[1-9]\\d*)|(?:0))" }, { token : "comment", regex : "#.*$" }, { token : "keyword", regex : "(?:" + labels + "):|(?:" + keywords + ")\\b" }, { token : "keyword", regex : "\\*" }, { token : "string", // multi line """ string start regex : '"{3}', next : "qqstring3" }, { token : "string", // " string regex : '"', next : "qqstring" }, { token : "text", regex : "^\\s*(?=@[\\w])", next : [{ token : "text", regex : "\\s+" }, { token : "variable.parameter", regex : "@[\\w]+" }, { token : "empty", regex : "", next : "start" }] }, { token : "comment", regex : "<[^>]+>" }, { token : "comment", regex : "\\|(?=.)", next : "table-item" }, { token : "comment", regex : "\\|$", next : "start" }], "qqstring3" : [ { token : "constant.language.escape", regex : stringEscape }, { token : "string", // multi line """ string end regex : '"{3}', next : "start" }, { defaultToken : "string" }], "qqstring" : [{ token : "constant.language.escape", regex : stringEscape }, { token : "string", regex : "\\\\$", next : "qqstring" }, { token : "string", regex : '"|$', next : "start" }, { defaultToken: "string" }], "table-item" : [{ token : "comment", regex : /$/, next : "start" }, { token : "comment", regex : /\|/ }, { token : "string", regex : /\\./ }, { defaultToken : "string" }] }; this.normalizeRules(); }; oop.inherits(GherkinHighlightRules, TextHighlightRules); exports.GherkinHighlightRules = GherkinHighlightRules; ================================================ FILE: src/mode/gitignore.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var GitignoreHighlightRules = require("./gitignore_highlight_rules").GitignoreHighlightRules; var Mode = function() { this.HighlightRules = GitignoreHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$id = "ace/mode/gitignore"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/gitignore_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var GitignoreHighlightRules = function() { this.$rules = { "start" : [ { token : "comment", regex : /^\s*#.*$/ }, { token : "keyword", // negated patterns regex : /^\s*!.*$/ } ] }; this.normalizeRules(); }; GitignoreHighlightRules.metaData = { fileTypes: ['gitignore'], name: 'Gitignore' }; oop.inherits(GitignoreHighlightRules, TextHighlightRules); exports.GitignoreHighlightRules = GitignoreHighlightRules; ================================================ FILE: src/mode/glsl.js ================================================ "use strict"; var oop = require("../lib/oop"); var CMode = require("./c_cpp").Mode; var glslHighlightRules = require("./glsl_highlight_rules").glslHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = glslHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, CMode); (function() { this.$id = "ace/mode/glsl"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/glsl_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; var glslHighlightRules = function() { var keywords = ( "attribute|const|uniform|varying|break|continue|do|for|while|" + "if|else|in|out|inout|float|int|void|bool|true|false|" + "lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" + "mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" + "samplerCube|struct" ); var buildinConstants = ( "radians|degrees|sin|cos|tan|asin|acos|atan|pow|" + "exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" + "min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" + "normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" + "lessThanEqual|greaterThan|greaterThanEqual|equal|notEqual|any|all|" + "not|dFdx|dFdy|fwidth|texture2D|texture2DProj|texture2DLod|" + "texture2DProjLod|textureCube|textureCubeLod|" + "gl_MaxVertexAttribs|gl_MaxVertexUniformVectors|gl_MaxVaryingVectors|" + "gl_MaxVertexTextureImageUnits|gl_MaxCombinedTextureImageUnits|" + "gl_MaxTextureImageUnits|gl_MaxFragmentUniformVectors|gl_MaxDrawBuffers|" + "gl_DepthRangeParameters|gl_DepthRange|" + // The following two are only for MIME x-shader/x-vertex. "gl_Position|gl_PointSize|" + // The following five are only for MIME x-shader/x-fragment. "gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData" ); var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": keywords, "constant.language": buildinConstants }, "identifier"); this.$rules = new c_cppHighlightRules().$rules; this.$rules.start.forEach(function(rule) { if (typeof rule.token == "function") rule.token = keywordMapper; }); }; oop.inherits(glslHighlightRules, c_cppHighlightRules); exports.glslHighlightRules = glslHighlightRules; ================================================ FILE: src/mode/gobstones.js ================================================ "use strict"; var oop = require("../lib/oop"); var JavaScriptMode = require("./javascript").Mode; var GobstonesHighlightRules = require("./gobstones_highlight_rules").GobstonesHighlightRules; var Mode = function() { JavaScriptMode.call(this); this.HighlightRules = GobstonesHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, JavaScriptMode); (function() { this.createWorker = function() { return null; }; this.$id = "ace/mode/gobstones"; this.snippetFileId = "ace/snippets/gobstones"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/gobstones_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var GobstonesHighlightRules = function() { var definitions = { standard: "program|procedure|function|interactive|return|let", type: "type|is|variant|record|field|case" }; var control = { commands: { repetitions: "repeat|while|foreach|in", alternatives: "if|elseif|else|switch" }, expressions: { alternatives: "choose|when|otherwise|matching|select|on" } }; var values = { colors: "Verde|Rojo|Azul|Negro", cardinals: "Norte|Sur|Este|Oeste", booleans: "True|False", numbers: /([-]?)([0-9]+)\b/, strings: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; var primitives = { commands: "Poner|Sacar|Mover|IrAlBorde|VaciarTablero|BOOM", expressions: "nroBolitas|hayBolitas|puedeMover|"+ "siguiente|previo|opuesto|"+ "minBool|maxBool|minDir|maxDir|minColor|maxColor|"+ "primero|sinElPrimero|esVacía|"+ "boom", keys: "K_A|K_B|K_C|K_D|K_E|K_F|K_G|K_G|K_H|K_I|K_J|K_K|K_L|K_M|K_N|K_Ñ|"+ "K_O|K_P|K_Q|K_R|K_S|K_T|K_U|K_V|K_W|K_X|K_Y|K_Z|"+ "K_0|K_1|K_2|K_3|K_4|K_5|K_6|K_7|K_8|K_9|"+ "K_F1|K_F2|K_F3|K_F4|K_F5|K_F6|K_F7|K_F8|K_F9|K_F10|K_F11|K_12|"+ "K_UP|K_DOWN|K_LEFT|K_RIGHT|K_RETURN|K_BACKSPACE|K_TAB|K_SPACE|K_ESCAPE"+ "K_CTRL_A|K_CTRL_B|K_CTRL_C|K_CTRL_D|K_CTRL_E|K_CTRL_F|K_CTRL_G|K_CTRL_G|"+ "K_CTRL_H|K_CTRL_I|K_CTRL_J|K_CTRL_K|K_CTRL_L|K_CTRL_M|K_CTRL_N|K_CTRL_Ñ|"+ "K_CTRL_O|K_CTRL_P|K_CTRL_Q|K_CTRL_R|K_CTRL_S|K_CTRL_T|K_CTRL_U|K_CTRL_V|"+ "K_CTRL_W|K_CTRL_X|K_CTRL_Y|K_CTRL_Z|"+ "K_CTRL_0|K_CTRL_1|K_CTRL_2|K_CTRL_3|K_CTRL_4|K_CTRL_5|K_CTRL_6|K_CTRL_7|K_CTRL_8|K_CTRL_9|"+ "K_CTRL_F1|K_CTRL_F2|K_CTRL_F3|K_CTRL_F4|K_CTRL_F5|K_CTRL_F6|K_CTRL_F7|"+ "K_CTRL_F8|K_CTRL_F9|K_CTRL_F10|K_CTRL_F11|K_CTRL_F12|"+ "K_CTRL_UP|K_CTRL_DOWN|K_CTRL_LEFT|K_CTRL_RIGHT|K_CTRL_RETURN|"+ "K_CTRL_BACKSPACE|K_CTRL_TAB|K_CTRL_SPACE|K_CTRL_ESCAPE"+ "K_ALT_A|K_ALT_B|K_ALT_C|K_ALT_D|K_ALT_E|K_ALT_F|K_ALT_G|K_ALT_G|K_ALT_H|"+ "K_ALT_I|K_ALT_J|K_ALT_K|K_ALT_L|K_ALT_M|K_ALT_N|K_ALT_Ñ|K_ALT_O|K_ALT_P|"+ "K_ALT_Q|K_ALT_R|K_ALT_S|K_ALT_T|K_ALT_U|K_ALT_V|K_ALT_W|K_ALT_X|K_ALT_Y|K_ALT_Z|"+ "K_ALT_0|K_ALT_1|K_ALT_2|K_ALT_3|K_ALT_4|K_ALT_5|K_ALT_6|K_ALT_7|K_ALT_8|K_ALT_9|"+ "K_ALT_F1|K_ALT_F2|K_ALT_F3|K_ALT_F4|K_ALT_F5|K_ALT_F6|K_ALT_F7|K_ALT_F8|"+ "K_ALT_F9|K_ALT_F10|K_ALT_F11|K_ALT_F12|"+ "K_ALT_UP|K_ALT_DOWN|K_ALT_LEFT|K_ALT_RIGHT|K_ALT_RETURN|K_ALT_BACKSPACE|"+ "K_ALT_TAB|K_ALT_SPACE|K_ALT_ESCAPE"+ "K_SHIFT_A|K_SHIFT_B|K_SHIFT_C|K_SHIFT_D|K_SHIFT_E|K_SHIFT_F|K_SHIFT_G|"+ "K_SHIFT_G|K_SHIFT_H|K_SHIFT_I|K_SHIFT_J|K_SHIFT_K|K_SHIFT_L|K_SHIFT_M|"+ "K_SHIFT_N|K_SHIFT_Ñ|K_SHIFT_O|K_SHIFT_P|K_SHIFT_Q|K_SHIFT_R|K_SHIFT_S|"+ "K_SHIFT_T|K_SHIFT_U|K_SHIFT_V|K_SHIFT_W|K_SHIFT_X|K_SHIFT_Y|K_SHIFT_Z|"+ "K_SHIFT_0|K_SHIFT_1|K_SHIFT_2|K_SHIFT_3|K_SHIFT_4|K_SHIFT_5|K_SHIFT_6|"+ "K_SHIFT_7|K_SHIFT_8|K_SHIFT_9|"+ "K_SHIFT_F1|K_SHIFT_F2|K_SHIFT_F3|K_SHIFT_F4|K_SHIFT_F5|K_SHIFT_F6|"+ "K_SHIFT_F7|K_SHIFT_F8|K_SHIFT_F9|K_SHIFT_F10|K_SHIFT_F11|K_SHIFT_F12|"+ "K_SHIFT_UP|K_SHIFT_DOWN|K_SHIFT_LEFT|K_SHIFT_RIGHT|K_SHIFT_RETURN|"+ "K_SHIFT_BACKSPACE|K_SHIFT_TAB|K_SHIFT_SPACE|K_SHIFT_ESCAPE"+ "K_CTRL_ALT_A|K_CTRL_ALT_B|K_CTRL_ALT_C|K_CTRL_ALT_D|K_CTRL_ALT_E|"+ "K_CTRL_ALT_F|K_CTRL_ALT_G|K_CTRL_ALT_G|K_CTRL_ALT_H|K_CTRL_ALT_I|"+ "K_CTRL_ALT_J|K_CTRL_ALT_K|K_CTRL_ALT_L|K_CTRL_ALT_M|K_CTRL_ALT_N|"+ "K_CTRL_ALT_Ñ|K_CTRL_ALT_O|K_CTRL_ALT_P|K_CTRL_ALT_Q|K_CTRL_ALT_R|"+ "K_CTRL_ALT_S|K_CTRL_ALT_T|K_CTRL_ALT_U|K_CTRL_ALT_V|K_CTRL_ALT_W|"+ "K_CTRL_ALT_X|K_CTRL_ALT_Y|K_CTRL_ALT_Z|"+ "K_CTRL_ALT_0|K_CTRL_ALT_1|K_CTRL_ALT_2|K_CTRL_ALT_3|K_CTRL_ALT_4|"+ "K_CTRL_ALT_5|K_CTRL_ALT_6|K_CTRL_ALT_7|K_CTRL_ALT_8|K_CTRL_ALT_9|"+ "K_CTRL_ALT_F1|K_CTRL_ALT_F2|K_CTRL_ALT_F3|K_CTRL_ALT_F4|K_CTRL_ALT_F5|"+ "K_CTRL_ALT_F6|K_CTRL_ALT_F7|K_CTRL_ALT_F8|K_CTRL_ALT_F9|K_CTRL_ALT_F10|"+ "K_CTRL_ALT_F11|K_CTRL_ALT_F12|"+ "K_CTRL_ALT_UP|K_CTRL_ALT_DOWN|K_CTRL_ALT_LEFT|K_CTRL_ALT_RIGHT|"+ "K_CTRL_ALT_RETURN|K_CTRL_ALT_BACKSPACE|K_CTRL_ALT_TAB|K_CTRL_ALT_SPACE|K_CTRL_ALT_ESCAPE"+ "K_CTRL_SHIFT_A|K_CTRL_SHIFT_B|K_CTRL_SHIFT_C|K_CTRL_SHIFT_D|K_CTRL_SHIFT_E|"+ "K_CTRL_SHIFT_F|K_CTRL_SHIFT_G|K_CTRL_SHIFT_G|K_CTRL_SHIFT_H|K_CTRL_SHIFT_I|"+ "K_CTRL_SHIFT_J|K_CTRL_SHIFT_K|K_CTRL_SHIFT_L|K_CTRL_SHIFT_M|K_CTRL_SHIFT_N|"+ "K_CTRL_SHIFT_Ñ|K_CTRL_SHIFT_O|K_CTRL_SHIFT_P|K_CTRL_SHIFT_Q|K_CTRL_SHIFT_R|"+ "K_CTRL_SHIFT_S|K_CTRL_SHIFT_T|K_CTRL_SHIFT_U|K_CTRL_SHIFT_V|K_CTRL_SHIFT_W|"+ "K_CTRL_SHIFT_X|K_CTRL_SHIFT_Y|K_CTRL_SHIFT_Z|"+ "K_CTRL_SHIFT_0|K_CTRL_SHIFT_1|K_CTRL_SHIFT_2|K_CTRL_SHIFT_3|K_CTRL_SHIFT_4|"+ "K_CTRL_SHIFT_5|K_CTRL_SHIFT_6|K_CTRL_SHIFT_7|K_CTRL_SHIFT_8|K_CTRL_SHIFT_9|"+ "K_CTRL_SHIFT_F1|K_CTRL_SHIFT_F2|K_CTRL_SHIFT_F3|K_CTRL_SHIFT_F4|"+ "K_CTRL_SHIFT_F5|K_CTRL_SHIFT_F6|K_CTRL_SHIFT_F7|K_CTRL_SHIFT_F8|"+ "K_CTRL_SHIFT_9|K_CTRL_SHIFT_10|K_CTRL_SHIFT_11|K_CTRL_SHIFT_12|"+ "K_CTRL_SHIFT_UP|K_CTRL_SHIFT_DOWN|K_CTRL_SHIFT_LEFT|K_CTRL_SHIFT_RIGHT|"+ "K_CTRL_SHIFT_RETURN|K_CTRL_SHIFT_BACKSPACE|K_CTRL_SHIFT_TAB|"+ "K_CTRL_SHIFT_SPACE|K_CTRL_SHIFT_ESCAPE"+ "K_ALT_SHIFT_A|K_ALT_SHIFT_B|K_ALT_SHIFT_C|K_ALT_SHIFT_D|K_ALT_SHIFT_E|"+ "K_ALT_SHIFT_F|K_ALT_SHIFT_G|K_ALT_SHIFT_G|K_ALT_SHIFT_H|K_ALT_SHIFT_I|"+ "K_ALT_SHIFT_J|K_ALT_SHIFT_K|K_ALT_SHIFT_L|K_ALT_SHIFT_M|K_ALT_SHIFT_N|"+ "K_ALT_SHIFT_Ñ|K_ALT_SHIFT_O|K_ALT_SHIFT_P|K_ALT_SHIFT_Q|K_ALT_SHIFT_R|"+ "K_ALT_SHIFT_S|K_ALT_SHIFT_T|K_ALT_SHIFT_U|K_ALT_SHIFT_V|K_ALT_SHIFT_W|"+ "K_ALT_SHIFT_X|K_ALT_SHIFT_Y|K_ALT_SHIFT_Z|"+ "K_ALT_SHIFT_0|K_ALT_SHIFT_1|K_ALT_SHIFT_2|K_ALT_SHIFT_3|K_ALT_SHIFT_4|"+ "K_ALT_SHIFT_5|K_ALT_SHIFT_6|K_ALT_SHIFT_7|K_ALT_SHIFT_8|K_ALT_SHIFT_9|"+ "K_ALT_SHIFT_F1|K_ALT_SHIFT_F2|K_ALT_SHIFT_F3|K_ALT_SHIFT_F4|"+ "K_ALT_SHIFT_F5|K_ALT_SHIFT_F6|K_ALT_SHIFT_F7|K_ALT_SHIFT_F8|"+ "K_ALT_SHIFT_9|K_ALT_SHIFT_10|K_ALT_SHIFT_11|K_ALT_SHIFT_12|"+ "K_ALT_SHIFT_UP|K_ALT_SHIFT_DOWN|K_ALT_SHIFT_LEFT|K_ALT_SHIFT_RIGHT|"+ "K_ALT_SHIFT_RETURN|K_ALT_SHIFT_BACKSPACE|K_ALT_SHIFT_TAB|K_ALT_SHIFT_SPACE|"+ "K_ALT_SHIFT_ESCAPE"+ "K_CTRL_ALT_SHIFT_A|K_CTRL_ALT_SHIFT_B|K_CTRL_ALT_SHIFT_C|K_CTRL_ALT_SHIFT_D|"+ "K_CTRL_ALT_SHIFT_E|K_CTRL_ALT_SHIFT_F|K_CTRL_ALT_SHIFT_G|K_CTRL_ALT_SHIFT_G|"+ "K_CTRL_ALT_SHIFT_H|K_CTRL_ALT_SHIFT_I|K_CTRL_ALT_SHIFT_J|K_CTRL_ALT_SHIFT_K|"+ "K_CTRL_ALT_SHIFT_L|K_CTRL_ALT_SHIFT_M|K_CTRL_ALT_SHIFT_N|K_CTRL_ALT_SHIFT_Ñ|"+ "K_CTRL_ALT_SHIFT_O|K_CTRL_ALT_SHIFT_P|K_CTRL_ALT_SHIFT_Q|K_CTRL_ALT_SHIFT_R|"+ "K_CTRL_ALT_SHIFT_S|K_CTRL_ALT_SHIFT_T|K_CTRL_ALT_SHIFT_U|K_CTRL_ALT_SHIFT_V|"+ "K_CTRL_ALT_SHIFT_W|K_CTRL_ALT_SHIFT_X|K_CTRL_ALT_SHIFT_Y|K_CTRL_ALT_SHIFT_Z|"+ "K_CTRL_ALT_SHIFT_0|K_CTRL_ALT_SHIFT_1|K_CTRL_ALT_SHIFT_2|K_CTRL_ALT_SHIFT_3|"+ "K_CTRL_ALT_SHIFT_4|K_CTRL_ALT_SHIFT_5|K_CTRL_ALT_SHIFT_6|K_CTRL_ALT_SHIFT_7|"+ "K_CTRL_ALT_SHIFT_8|K_CTRL_ALT_SHIFT_9|"+ "K_CTRL_ALT_SHIFT_F1|K_CTRL_ALT_SHIFT_F2|K_CTRL_ALT_SHIFT_F3|K_CTRL_ALT_SHIFT_F4|"+ "K_CTRL_ALT_SHIFT_F5|K_CTRL_ALT_SHIFT_F6|K_CTRL_ALT_SHIFT_F7|K_CTRL_ALT_SHIFT_F8|"+ "K_CTRL_ALT_SHIFT_F9|K_CTRL_ALT_SHIFT_F10|K_CTRL_ALT_SHIFT_F11|K_CTRL_ALT_SHIFT_F12|"+ "K_CTRL_ALT_SHIFT_UP|K_CTRL_ALT_SHIFT_DOWN|K_CTRL_ALT_SHIFT_LEFT|K_CTRL_ALT_SHIFT_RIGHT|"+ "K_CTRL_ALT_SHIFT_RETURN|K_CTRL_ALT_SHIFT_BACKSPACE|K_CTRL_ALT_SHIFT_TAB|"+ "K_CTRL_ALT_SHIFT_SPACE|K_CTRL_ALT_SHIFT_ESCAPE" }; var operations = { commands: ":=", expressions: { numeric: "\\+|\\-|\\*|\\^|div|mod", comparison: ">=|<=|==|\\/=|>|<", boolean: "\\|\\||&&|not", other: "\\+\\+|<\\-|\\[|\\]|\\_|\\->" } }; var comments = { line: { double_slash: "\\/\\/.*$", double_dash: "\\-\\-.*$", number_sign: "#.*$" }, block: { start: "\\/\\*", end: "\\*\\/" }, block_alt: { start: "\\{\\-", end: "\\-\\}" } }; this.$rules = { "start" : [ // comments { token : "comment.line.double-slash.gobstones", regex : comments.line.double_slash }, { token : "comment.line.double-dash.gobstones", regex : comments.line.double_dash }, { token : "comment.line.number-sign.gobstones", regex : comments.line.number_sign }, { token : "comment.block.dash-asterisc.gobstones", regex : comments.block.start, next : "block_comment_end" }, { token : "comment.block.brace-dash.gobstones", regex : comments.block_alt.start, next : "block_comment_alt_end" }, // numbers { token : "constant.numeric.gobstones", regex : values.numbers }, // strings { token : "string.quoted.double.gobstones", regex : values.strings }, // operations { token : "keyword.operator.other.gobstones", regex : operations.expressions.other }, { token : "keyword.operator.numeric.gobstones", regex : operations.expressions.numeric }, { token : "keyword.operator.compare.gobstones", regex : operations.expressions.comparison }, { token : "keyword.operator.boolean.gobstones", regex : operations.expressions.boolean }, // keywords { token : this.createKeywordMapper({ // basic constructs "storage.type.definitions.gobstones": definitions.standard, "storage.type.types.gobstones": definitions.type, "keyword.control.commands.repetitions.gobstones": control.commands.repetitions, "keyword.control.commands.alternatives.gobstones": control.commands.alternatives, "keyword.control.expressions.alternatives.gobstones": control.expressions.alternatives, // types "constant.language.colors.gobstones":values.colors, "constant.language.cardinals.gobstones": values.cardinals, "constant.language.boolean.gobstones": values.booleans, // primitives "support.function.gobstones": primitives.commands, "support.variable.gobstones": primitives.expressions, "variable.language.gobstones": primitives.keys }, "identifier.gobstones"), regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "comma.gobstones", regex : "," }, { token : "semicolon.gobstones", regex : ";" }, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "block_comment_end": [{ token : "comment.block.dash-asterisc.gobstones", regex : comments.block.end, next : "start" }, { defaultToken : "comment.block.dash-asterisc.gobstones" } ], "block_comment_alt_end": [{ token : "comment.block.brace-dash.gobstones", regex : comments.block_alt.end, next : "start" }, { defaultToken : "comment.block.brace-dash.gobstones" } ] }; }; oop.inherits(GobstonesHighlightRules, TextHighlightRules); exports.GobstonesHighlightRules = GobstonesHighlightRules; ================================================ FILE: src/mode/golang.js ================================================ var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = GolangHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; 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; } } return indent; };//end getNextLineIndent 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/golang"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/golang_highlight_rules.js ================================================ var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var GolangHighlightRules = function() { var keywords = ( "else|break|case|return|goto|if|const|select|" + "continue|struct|default|switch|for|range|" + "func|import|package|chan|defer|fallthrough|go|interface|map|range|" + "select|type|var" ); var builtinTypes = ( "string|uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|" + "float64|complex64|complex128|byte|rune|uint|int|uintptr|bool|error" ); var builtinFunctions = ( "new|close|cap|copy|panic|panicln|print|println|len|make|delete|real|recover|imag|append" ); var builtinConstants = ("nil|true|false|iota"); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "constant.language": builtinConstants, "support.function": builtinFunctions, "support.type": builtinTypes }, ""); var stringEscapeRe = "\\\\(?:[0-7]{3}|x\\h{2}|u{4}|U\\h{6}|[abfnrtv'\"\\\\])".replace(/\\h/g, "[a-fA-F\\d]"); this.$rules = { "start" : [ { token : "comment", regex : "\\/\\/.*$" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment.start", // multi line comment regex : "\\/\\*", next : "comment" }, { token : "string", // single line regex : /"(?:[^"\\]|\\.)*?"/ }, { token : "string", // raw regex : '`', next : "bqstring" }, { token : "constant.numeric", // rune regex : "'(?:[^\\'\uD800-\uDBFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|" + stringEscapeRe.replace('"', '') + ")'" }, { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F]+\\b" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : ["keyword", "text", "entity.name.function"], regex : "(func)(\\s+)([a-zA-Z_$][a-zA-Z0-9_$]*)\\b" }, { token : function(val) { if (val[val.length - 1] == "(") { return [{ type: keywordMapper(val.slice(0, -1)) || "support.function", value: val.slice(0, -1) }, { type: "paren.lparen", value: val.slice(-1) }]; } return keywordMapper(val) || "identifier"; }, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b\\(?" }, { token : "keyword.operator", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=" }, { token : "punctuation.operator", regex : "\\?|\\:|\\,|\\;|\\." }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment.end", regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "bqstring" : [ { token : "string", regex : '`', next : "start" }, { defaultToken : "string" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; oop.inherits(GolangHighlightRules, TextHighlightRules); exports.GolangHighlightRules = GolangHighlightRules; ================================================ FILE: src/mode/graphqlschema.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var GraphQLSchemaHighlightRules = require("./graphqlschema_highlight_rules").GraphQLSchemaHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = GraphQLSchemaHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$id = "ace/mode/graphqlschema"; this.snippetFileId = "ace/snippets/graphqlschema"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/graphqlschema_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var GraphQLSchemaHighlightRules = function() { var keywords = ( "type|interface|union|enum|schema|input|implements|extends|scalar" ); var dataTypes = ( "Int|Float|String|ID|Boolean" ); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "storage.type": dataTypes }, "identifier"); this.$rules = { "start" : [ { token : "comment", regex : "#.*$" }, { token : "paren.lparen", regex : /[\[({]/, next : "start" }, { token : "paren.rparen", regex : /[\])}]/ }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" } ] }; this.normalizeRules(); }; oop.inherits(GraphQLSchemaHighlightRules, TextHighlightRules); exports.GraphQLSchemaHighlightRules = GraphQLSchemaHighlightRules; ================================================ FILE: src/mode/groovy.js ================================================ "use strict"; var oop = require("../lib/oop"); var JavaScriptMode = require("./javascript").Mode; var GroovyHighlightRules = require("./groovy_highlight_rules").GroovyHighlightRules; var Mode = function() { JavaScriptMode.call(this); this.HighlightRules = GroovyHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, JavaScriptMode); (function() { this.createWorker = function(session) { return null; }; this.$id = "ace/mode/groovy"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/groovy_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var GroovyHighlightRules = function() { var keywords = ( "assert|with|abstract|continue|for|new|switch|" + "assert|default|goto|package|synchronized|" + "boolean|do|if|private|this|" + "break|double|implements|protected|throw|" + "byte|else|import|public|throws|" + "case|enum|instanceof|return|transient|" + "catch|extends|int|short|try|" + "char|final|interface|static|void|" + "class|finally|long|strictfp|volatile|" + "def|float|native|super|while" ); var buildinConstants = ( "null|Infinity|NaN|undefined" ); var langClasses = ( "AbstractMethodError|AssertionError|ClassCircularityError|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ExceptionInInitializerError|IllegalAccessError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+ "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+ "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+ "SuppressWarnings|TypeNotPresentException|UnknownError|"+ "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+ "InstantiationException|IndexOutOfBoundsException|"+ "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+ "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+ "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+ "InterruptedException|NoSuchMethodException|IllegalAccessException|"+ "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+ "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+ "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+ "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+ "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+ "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+ "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+ "ArrayStoreException|ClassCastException|LinkageError|"+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ "Cloneable|Class|CharSequence|Comparable|String|Object" ); // TODO var importClasses = ""; var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": keywords, "support.function": langClasses, "constant.language": buildinConstants }, "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.regexp", regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" }, { token : "string", regex : '"""', next : "qqstring" }, { token : "string", regex : "'''", next : "qstring" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single line 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, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "\\?:|\\?\\.|\\*\\.|<=>|=~|==~|\\.@|\\*\\.@|\\.&|as|in|is|!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "qqstring" : [ { token : "constant.language.escape", regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/ }, { token : "constant.language.escape", regex : /\$[\w\d]+/ }, { token : "constant.language.escape", regex : /\$\{[^"\}]+\}?/ }, { token : "string", regex : '"{3,5}', next : "start" }, { token : "string", regex : '.+?' } ], "qstring" : [ { token : "constant.language.escape", regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/ }, { token : "string", regex : "'{3,5}", next : "start" }, { token : "string", regex : ".+?" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; oop.inherits(GroovyHighlightRules, TextHighlightRules); exports.GroovyHighlightRules = GroovyHighlightRules; ================================================ FILE: src/mode/haml.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HamlHighlightRules = require("./haml_highlight_rules").HamlHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = HamlHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/haml"; this.snippetFileId = "ace/snippets/haml"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/haml_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var RubyExports = require("./ruby_highlight_rules"); var RubyHighlightRules = RubyExports.RubyHighlightRules; var HamlHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used HtmlHighlightRules.call(this); this.$rules = { "start": [ { token: "comment.block", // multiline HTML comment regex: /^\/$/, next: "comment" }, { token: "comment.block", // multiline HAML comment regex: /^\-#$/, next: "comment" }, { token: "comment.line", // HTML comment regex: /\/\s*.*/ }, { token: "comment.line", // HAML comment regex: /-#\s*.*/ }, { token: "keyword.other.doctype", regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?" }, RubyExports.qString, RubyExports.qqString, RubyExports.tString, { token: "meta.tag.haml", regex: /(%[\w:\-]+)/ }, { token: "keyword.attribute-name.class.haml", regex: /\.[\w-]+/ }, { token: "keyword.attribute-name.id.haml", regex: /#[\w-]+/, next: "element_class" }, RubyExports.constantNumericHex, RubyExports.constantNumericFloat, RubyExports.constantOtherSymbol, { token: "text", regex: /=|-|~/, next: "embedded_ruby" } ], "element_class": [ { token: "keyword.attribute-name.class.haml", regex: /\.[\w-]+/ }, { token: "punctuation.section", regex: /\{/, next: "element_attributes" }, RubyExports.constantOtherSymbol, { token: "empty", regex: "$|(?!\\.|#|\\{|\\[|=|-|~|\\/])", next: "start" } ], "element_attributes": [ RubyExports.constantOtherSymbol, RubyExports.qString, RubyExports.qqString, RubyExports.tString, RubyExports.constantNumericHex, RubyExports.constantNumericFloat, { token: "punctuation.section", regex: /$|\}/, next: "start" } ], "embedded_ruby": [ RubyExports.constantNumericHex, RubyExports.constantNumericFloat, RubyExports.instanceVariable, RubyExports.qString, RubyExports.qqString, RubyExports.tString, { token : "support.class", // class name regex : "[A-Z][a-zA-Z_\\d]+" }, { token : new RubyHighlightRules().getKeywords(), regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : ["keyword", "text", "text"], regex : "(?:do|\\{)(?: \\|[^|]+\\|)?$", next : "start" }, { token : ["text"], regex : "^$", next : "start" }, { token : ["text"], regex : "^(?!.*\\|\\s*$)", next : "start" } ], "comment": [ { token: "comment.block", regex: /^$/, next: "start" }, { token: "comment.block", // comment spanning the whole line regex: /\s+.*/ } ] }; this.normalizeRules(); }; oop.inherits(HamlHighlightRules, HtmlHighlightRules); exports.HamlHighlightRules = HamlHighlightRules; ================================================ FILE: src/mode/handlebars.js ================================================ /* global define */ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var HandlebarsHighlightRules = require("./handlebars_highlight_rules").HandlebarsHighlightRules; var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour; var HtmlFoldMode = require("./folding/html").FoldMode; var Mode = function() { HtmlMode.call(this); this.HighlightRules = HandlebarsHighlightRules; this.$behaviour = new HtmlBehaviour(); }; oop.inherits(Mode, HtmlMode); (function() { this.blockComment = {start: "{{!--", end: "--}}"}; this.$id = "ace/mode/handlebars"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/handlebars_highlight_rules.js ================================================ /* global define */ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; function pop2(currentState, stack) { stack.splice(0, 3); return stack.shift() || "start"; } var HandlebarsHighlightRules = function() { HtmlHighlightRules.call(this); var hbs = { regex : "(?={{)", push : "handlebars" }; for (var key in this.$rules) { this.$rules[key].unshift(hbs); } this.$rules.handlebars = [{ token : "comment.start", regex : "{{!--", push : [{ token : "comment.end", regex : "--}}", next : pop2 }, { defaultToken : "comment" }] }, { token : "comment.start", regex : "{{!", push : [{ token : "comment.end", regex : "}}", next : pop2 }, { defaultToken : "comment" }] }, { token : "support.function", // unescaped variable regex : "{{{", push : [{ token : "support.function", regex : "}}}", next : pop2 }, { token : "variable.parameter", regex : "[a-zA-Z_$][a-zA-Z0-9_$]*" }] }, { token : "storage.type.start", // begin section regex : "{{[#\\^/&]?", push : [{ token : "storage.type.end", regex : "}}", next : pop2 }, { token : "variable.parameter", regex : "[a-zA-Z_$][a-zA-Z0-9_$]*" }] }]; this.normalizeRules(); }; oop.inherits(HandlebarsHighlightRules, HtmlHighlightRules); exports.HandlebarsHighlightRules = HandlebarsHighlightRules; ================================================ FILE: src/mode/haskell.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HaskellHighlightRules = require("./haskell_highlight_rules").HaskellHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = HaskellHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = null; this.$id = "ace/mode/haskell"; this.snippetFileId = "ace/snippets/haskell"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/haskell_cabal.js ================================================ /** * Haskell Cabal files mode (https://www.haskell.org/cabal/users-guide/developing-packages.html) **/ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CabalHighlightRules = require("./haskell_cabal_highlight_rules").CabalHighlightRules; var FoldMode = require("./folding/haskell_cabal").FoldMode; var Mode = function() { this.HighlightRules = CabalHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = null; this.$id = "ace/mode/haskell_cabal"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/haskell_cabal_highlight_rules.js ================================================ /** * Haskell Cabal files highlighter (https://www.haskell.org/cabal/users-guide/developing-packages.html) **/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CabalHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : "^\\s*--.*$" }, { token: ["keyword"], regex: /^(\s*\w.*?)(:(?:\s+|$))/ }, { token : "constant.numeric", // float regex : /[\d_]+(?:(?:[\.\d_]*)?)/ }, { token : "constant.language.boolean", regex : "(?:true|false|TRUE|FALSE|True|False|yes|no)\\b" }, { token : "markup.heading", regex : /^(\w.*)$/ } ]}; }; oop.inherits(CabalHighlightRules, TextHighlightRules); exports.CabalHighlightRules = CabalHighlightRules; ================================================ FILE: src/mode/haskell_highlight_rules.js ================================================ /* This file was autogenerated from tm bundles\haskell.tmbundle\Syntaxes\Haskell.plist (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var HaskellHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: [ 'punctuation.definition.entity.haskell', 'keyword.operator.function.infix.haskell', 'punctuation.definition.entity.haskell' ], regex: '(`)([a-zA-Z_\']*?)(`)', comment: 'In case this regex seems unusual for an infix operator, note that Haskell allows any ordinary function application (elem 4 [1..10]) to be rewritten as an infix expression (4 `elem` [1..10]).' }, { token: 'constant.language.unit.haskell', regex: '\\(\\)' }, { token: 'constant.language.empty-list.haskell', regex: '\\[\\]' }, { token: 'keyword.other.haskell', regex: '\\b(module|signature)\\b', push: [ { token: 'keyword.other.haskell', regex: '\\bwhere\\b', next: 'pop' }, { include: '#module_name' }, { include: '#module_exports' }, { token: 'invalid', regex: '[a-z]+' }, { defaultToken: 'meta.declaration.module.haskell' } ] }, { token: 'keyword.other.haskell', regex: '\\bclass\\b', push: [ { token: 'keyword.other.haskell', regex: '\\bwhere\\b', next: 'pop' }, { token: 'support.class.prelude.haskell', regex: '\\b(?:Monad|Functor|Eq|Ord|Read|Show|Num|(?:Frac|Ra)tional|Enum|Bounded|Real(?:Frac|Float)?|Integral|Floating)\\b' }, { token: 'entity.other.inherited-class.haskell', regex: '[A-Z][A-Za-z_\']*' }, { token: 'variable.other.generic-type.haskell', regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' }, { defaultToken: 'meta.declaration.class.haskell' } ] }, { token: 'keyword.other.haskell', regex: '\\binstance\\b', push: [ { token: 'keyword.other.haskell', regex: '\\bwhere\\b|$', next: 'pop' }, { include: '#type_signature' }, { defaultToken: 'meta.declaration.instance.haskell' } ] }, { token: 'keyword.other.haskell', regex: 'import', push: [ { token: 'meta.import.haskell', regex: '$|;|^', next: 'pop' }, { token: 'keyword.other.haskell', regex: 'qualified|as|hiding' }, { include: '#module_name' }, { include: '#module_exports' }, { defaultToken: 'meta.import.haskell' } ] }, { token: [ 'keyword.other.haskell', 'meta.deriving.haskell' ], regex: '(deriving)(\\s*\\()', push: [ { token: 'meta.deriving.haskell', regex: '\\)', next: 'pop' }, { token: 'entity.other.inherited-class.haskell', regex: '\\b[A-Z][a-zA-Z_\']*' }, { defaultToken: 'meta.deriving.haskell' } ] }, { token: 'keyword.other.haskell', regex: '\\b(?:deriving|where|data|type|case|of|let|in|newtype|default)\\b' }, { token: 'keyword.operator.haskell', regex: '\\binfix[lr]?\\b' }, { token: 'keyword.control.haskell', regex: '\\b(?:do|if|then|else)\\b' }, { token: 'constant.numeric.float.haskell', regex: '\\b(?:[0-9]+\\.[0-9]+(?:[eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\\b', comment: 'Floats are always decimal' }, { token: 'constant.numeric.haskell', regex: '\\b(?:[0-9]+|0(?:[xX][0-9a-fA-F]+|[oO][0-7]+))\\b' }, { token: [ 'meta.preprocessor.c', 'punctuation.definition.preprocessor.c', 'meta.preprocessor.c' ], regex: '^(\\s*)(#)(\\s*\\w+)', comment: 'In addition to Haskell\'s "native" syntax, GHC permits the C preprocessor to be run on a source file.' }, { include: '#pragma' }, { token: 'punctuation.definition.string.begin.haskell', regex: '"', push: [ { token: 'punctuation.definition.string.end.haskell', regex: '"', next: 'pop' }, { token: 'constant.character.escape.haskell', regex: '\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&])' }, { token: 'constant.character.escape.octal.haskell', regex: '\\\\o[0-7]+|\\\\x[0-9A-Fa-f]+|\\\\[0-9]+' }, { token: 'constant.character.escape.control.haskell', regex: '\\^[A-Z@\\[\\]\\\\\\^_]' }, { defaultToken: 'string.quoted.double.haskell' } ] }, { token: [ 'punctuation.definition.string.begin.haskell', 'string.quoted.single.haskell', 'constant.character.escape.haskell', 'constant.character.escape.octal.haskell', 'constant.character.escape.hexadecimal.haskell', 'constant.character.escape.control.haskell', 'punctuation.definition.string.end.haskell' ], regex: '(\')(?:([\\ -\\[\\]-~])|(\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&]))|(\\\\o[0-7]+)|(\\\\x[0-9A-Fa-f]+)|(\\^[A-Z@\\[\\]\\\\\\^_]))(\')' }, { token: [ 'meta.function.type-declaration.haskell', 'entity.name.function.haskell', 'meta.function.type-declaration.haskell', 'keyword.other.double-colon.haskell' ], regex: '^(\\s*)([a-z_][a-zA-Z0-9_\']*|\\([|!%$+\\-.,=</>]+\\))(\\s*)(::)', push: [ { token: 'meta.function.type-declaration.haskell', regex: '$', next: 'pop' }, { include: '#type_signature' }, { defaultToken: 'meta.function.type-declaration.haskell' } ] }, { token: 'support.constant.haskell', regex: '\\b(?:Just|Nothing|Left|Right|True|False|LT|EQ|GT|\\(\\)|\\[\\])\\b' }, { token: 'constant.other.haskell', regex: '\\b[A-Z]\\w*\\b' }, { include: '#comments' }, { token: 'support.function.prelude.haskell', regex: '\\b(?:abs|acos|acosh|all|and|any|appendFile|applyM|asTypeOf|asin|asinh|atan|atan2|atanh|break|catch|ceiling|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|div|divMod|drop|dropWhile|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromEnum|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|head|id|init|interact|ioError|isDenormalized|isIEEE|isInfinite|isNaN|isNegativeZero|iterate|last|lcm|length|lex|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|odd|or|otherwise|pi|pred|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|read|readFile|readIO|readList|readLn|readParen|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showList|showParen|showString|shows|showsPrec|significand|signum|sin|sinh|snd|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|toEnum|toInteger|toRational|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\\b' }, { include: '#infix_op' }, { token: 'keyword.operator.haskell', regex: '[|!%$?~+:\\-.=</>\\\\]+', comment: 'In case this regex seems overly general, note that Haskell permits the definition of new operators which can be nearly any string of punctuation characters, such as $%^&*.' }, { token: 'punctuation.separator.comma.haskell', regex: ',' } ], '#block_comment': [ { token: 'punctuation.definition.comment.haskell', regex: '\\{-(?!#)', push: [ { include: '#block_comment' }, { token: 'punctuation.definition.comment.haskell', regex: '-\\}', next: 'pop' }, { defaultToken: 'comment.block.haskell' } ] } ], '#comments': [ { token: 'punctuation.definition.comment.haskell', regex: '--.*', push_: [ { token: 'comment.line.double-dash.haskell', regex: '$', next: 'pop' }, { defaultToken: 'comment.line.double-dash.haskell' } ] }, { include: '#block_comment' } ], '#infix_op': [ { token: 'entity.name.function.infix.haskell', regex: '\\([|!%$+:\\-.=</>]+\\)|\\(,+\\)' } ], '#module_exports': [ { token: 'meta.declaration.exports.haskell', regex: '\\(', push: [ { token: 'meta.declaration.exports.haskell.end', regex: '\\)', next: 'pop' }, { token: 'entity.name.function.haskell', regex: '\\b[a-z][a-zA-Z_\']*' }, { token: 'storage.type.haskell', regex: '\\b[A-Z][A-Za-z_\']*' }, { token: 'punctuation.separator.comma.haskell', regex: ',' }, { include: '#infix_op' }, { token: 'meta.other.unknown.haskell', regex: '\\(.*?\\)', comment: 'So named because I don\'t know what to call this.' }, { defaultToken: 'meta.declaration.exports.haskell.end' } ] } ], '#module_name': [ { token: 'support.other.module.haskell', regex: '[A-Z][A-Za-z._\']*' } ], '#pragma': [ { token: 'meta.preprocessor.haskell', regex: '\\{-#', push: [ { token: 'meta.preprocessor.haskell', regex: '#-\\}', next: 'pop' }, { token: 'keyword.other.preprocessor.haskell', regex: '\\b(?:LANGUAGE|UNPACK|INLINE)\\b' }, { defaultToken: 'meta.preprocessor.haskell' } ] } ], '#type_signature': [ { token: [ 'meta.class-constraint.haskell', 'entity.other.inherited-class.haskell', 'meta.class-constraint.haskell', 'variable.other.generic-type.haskell', 'meta.class-constraint.haskell', 'keyword.other.big-arrow.haskell' ], regex: '(\\(\\s*)([A-Z][A-Za-z]*)(\\s+)([a-z][A-Za-z_\']*)(\\)\\s*)(=>)' }, { include: '#pragma' }, { token: 'keyword.other.arrow.haskell', regex: '->' }, { token: 'keyword.other.big-arrow.haskell', regex: '=>' }, { token: 'support.type.prelude.haskell', regex: '\\b(?:Int(?:eger)?|Maybe|Either|Bool|Float|Double|Char|String|Ordering|ShowS|ReadS|FilePath|IO(?:Error)?)\\b' }, { token: 'variable.other.generic-type.haskell', regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' }, { token: 'storage.type.haskell', regex: '\\b[A-Z][a-zA-Z0-9_\']*\\b' }, { token: 'support.constant.unit.haskell', regex: '\\(\\)' }, { include: '#comments' } ] }; this.normalizeRules(); }; HaskellHighlightRules.metaData = { fileTypes: [ 'hs' ], keyEquivalent: '^~H', name: 'Haskell', scopeName: 'source.haskell' }; oop.inherits(HaskellHighlightRules, TextHighlightRules); exports.HaskellHighlightRules = HaskellHighlightRules; ================================================ FILE: src/mode/haxe.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HaxeHighlightRules = require("./haxe_highlight_rules").HaxeHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = HaxeHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; 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.$id = "ace/mode/haxe"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/haxe_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var HaxeHighlightRules = function() { var keywords = ( "break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std" ); var buildinConstants = ( "null|true|false" ); var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": keywords, "constant.language": buildinConstants }, "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.regexp", regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single line 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, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { 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") ]); }; oop.inherits(HaxeHighlightRules, TextHighlightRules); exports.HaxeHighlightRules = HaxeHighlightRules; ================================================ FILE: src/mode/hjson.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HjsonHighlightRules = require("./hjson_highlight_rules").HjsonHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = HjsonHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = { start: "/*", end: "*/" }; this.$id = "ace/mode/hjson"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/hjson_highlight_rules.js ================================================ /* This file was autogenerated from Hjson.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var HjsonHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ include: "#comments" }, { include: "#rootObject" }, { include: "#value" }], "#array": [{ token: "paren.lparen", regex: /\[/, push: [{ token: "paren.rparen", regex: /\]/, next: "pop" }, { include: "#value" }, { include: "#comments" }, { token: "text", regex: /,|$/ }, { token: "invalid.illegal", regex: /[^\s\]]/ }, { defaultToken: "array" }] }], "#comments": [{ token: [ "comment.punctuation", "comment.line" ], regex: /(#)(.*$)/ }, { token: "comment.punctuation", regex: /\/\*/, push: [{ token: "comment.punctuation", regex: /\*\//, next: "pop" }, { defaultToken: "comment.block" }] }, { token: [ "comment.punctuation", "comment.line" ], regex: /(\/\/)(.*$)/ }], "#constant": [{ token: "constant", regex: /\b(?:true|false|null)\b/ }], "#keyname": [{ token: "keyword", regex: /(?:[^,\{\[\}\]\s]+|"(?:[^"\\]|\\.)*")\s*(?=:)/ }], "#mstring": [{ token: "string", regex: /'''/, push: [{ token: "string", regex: /'''/, next: "pop" }, { defaultToken: "string" }] }], "#number": [{ token: "constant.numeric", regex: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/, comment: "handles integer and decimal numbers" }], "#object": [{ token: "paren.lparen", regex: /\{/, push: [{ token: "paren.rparen", regex: /\}/, next: "pop" }, { include: "#keyname" }, { include: "#value" }, { token: "text", regex: /:/ }, { token: "text", regex: /,/ }, { defaultToken: "paren" }] }], "#rootObject": [{ token: "paren", regex: /(?=\s*(?:[^,\{\[\}\]\s]+|"(?:[^"\\]|\\.)*")\s*:)/, push: [{ token: "paren.rparen", regex: /---none---/, next: "pop" }, { include: "#keyname" }, { include: "#value" }, { token: "text", regex: /:/ }, { token: "text", regex: /,/ }, { defaultToken: "paren" }] }], "#string": [{ token: "string", regex: /"/, push: [{ token: "string", regex: /"/, next: "pop" }, { token: "constant.language.escape", regex: /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/ }, { token: "invalid.illegal", regex: /\\./ }, { defaultToken: "string" }] }], "#ustring": [{ token: "string", regex: /\b[^:,0-9\-\{\[\}\]\s].*$/ }], "#value": [{ include: "#constant" }, { include: "#number" }, { include: "#string" }, { include: "#array" }, { include: "#object" }, { include: "#comments" }, { include: "#mstring" }, { include: "#ustring" }] }; this.normalizeRules(); }; HjsonHighlightRules.metaData = { fileTypes: ["hjson"], foldingStartMarker: "(?x: # turn on extended mode\n ^ # a line beginning with\n \\s* # some optional space\n [{\\[] # the start of an object or array\n (?! # but not followed by\n .* # whatever\n [}\\]] # and the close of an object or array\n ,? # an optional comma\n \\s* # some optional space\n $ # at the end of the line\n )\n | # ...or...\n [{\\[] # the start of an object or array\n \\s* # some optional space\n $ # at the end of the line\n )", foldingStopMarker: "(?x: # turn on extended mode\n ^ # a line beginning with\n \\s* # some optional space\n [}\\]] # and the close of an object or array\n )", keyEquivalent: "^~J", name: "Hjson", scopeName: "source.hjson" }; oop.inherits(HjsonHighlightRules, TextHighlightRules); exports.HjsonHighlightRules = HjsonHighlightRules; ================================================ FILE: src/mode/html.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextMode = require("./text").Mode; var JavaScriptMode = require("./javascript").Mode; var CssMode = require("./css").Mode; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; var HtmlFoldMode = require("./folding/html").FoldMode; var HtmlCompletions = require("./html_completions").HtmlCompletions; var WorkerClient = require("../worker/worker_client").WorkerClient; // http://www.w3.org/TR/html5/syntax.html#void-elements var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"]; var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"]; var Mode = function(options) { this.fragmentContext = options && options.fragmentContext; this.HighlightRules = HtmlHighlightRules; this.$behaviour = new XmlBehaviour(); this.$completer = new HtmlCompletions(); this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode }); this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags)); }; oop.inherits(Mode, TextMode); (function() { this.blockComment = {start: "<!--", end: "-->"}; this.voidElements = lang.arrayToMap(voidElements); this.getNextLineIndent = function(state, line, tab) { return this.$getIndent(line); }; this.checkOutdent = function(state, line, input) { return false; }; this.getCompletions = function(state, session, pos, prefix) { return this.$completer.getCompletions(state, session, pos, prefix); }; this.createWorker = function(session) { if (this.constructor != Mode) return; var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker"); worker.attachToDocument(session.getDocument()); if (this.fragmentContext) worker.call("setOptions", [{context: this.fragmentContext}]); worker.on("error", function(e) { session.setAnnotations(e.data); }); worker.on("terminate", function() { session.clearAnnotations(); }); return worker; }; this.$id = "ace/mode/html"; this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/html_completions.js ================================================ "use strict"; var TokenIterator = require("../token_iterator").TokenIterator; var commonAttributes = [ "accesskey", "class", "contenteditable", "contextmenu", "dir", "draggable", "dropzone", "hidden", "id", "inert", "itemid", "itemprop", "itemref", "itemscope", "itemtype", "lang", "spellcheck", "style", "tabindex", "title", "translate" ]; var eventAttributes = [ "onabort", "onblur", "oncancel", "oncanplay", "oncanplaythrough", "onchange", "onclick", "onclose", "oncontextmenu", "oncuechange", "ondblclick", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "ondurationchange", "onemptied", "onended", "onerror", "onfocus", "oninput", "oninvalid", "onkeydown", "onkeypress", "onkeyup", "onload", "onloadeddata", "onloadedmetadata", "onloadstart", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onmousewheel", "onpause", "onplay", "onplaying", "onprogress", "onratechange", "onreset", "onscroll", "onseeked", "onseeking", "onselect", "onshow", "onstalled", "onsubmit", "onsuspend", "ontimeupdate", "onvolumechange", "onwaiting" ]; var globalAttributes = commonAttributes.concat(eventAttributes); var attributeMap = { "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1}, "abbr": {}, "address": {}, "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1}, "article": {"pubdate": 1}, "aside": {}, "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }}, "b": {}, "base": {"href": 1, "target": 1}, "bdi": {}, "bdo": {}, "blockquote": {"cite": 1}, "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1}, "br": {}, "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}}, "canvas": {"width": 1, "height": 1}, "caption": {}, "cite": {}, "code": {}, "col": {"span": 1}, "colgroup": {"span": 1}, "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1}, "data": {}, "datalist": {}, "dd": {}, "del": {"cite": 1, "datetime": 1}, "details": {"open": 1}, "dfn": {}, "dialog": {"open": 1}, "div": {}, "dl": {}, "dt": {}, "em": {}, "embed": {"src": 1, "height": 1, "width": 1, "type": 1}, "fieldset": {"disabled": 1, "form": 1, "name": 1}, "figcaption": {}, "figure": {}, "footer": {}, "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}}, "h1": {}, "h2": {}, "h3": {}, "h4": {}, "h5": {}, "h6": {}, "head": {}, "header": {}, "hr": {}, "html": {"manifest": 1}, "i": {}, "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}}, "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1}, "input": { "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1}, "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1}, "ins": {"cite": 1, "datetime": 1}, "kbd": {}, "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1}, "label": {"form": 1, "for": 1}, "legend": {}, "li": {"value": 1}, "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1}, "main": {}, "map": {"name": 1}, "mark": {}, "math": {}, "menu": {"type": 1, "label": 1}, "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1}, "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1}, "nav": {}, "noscript": {"href": 1}, "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1}, "ol": {"start": 1, "reversed": 1}, "optgroup": {"disabled": 1, "label": 1}, "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1}, "output": {"for": 1, "form": 1, "name": 1}, "p": {}, "param": {"name": 1, "value": 1}, "pre": {}, "progress": {"value": 1, "max": 1}, "q": {"cite": 1}, "rp": {}, "rt": {}, "ruby": {}, "s": {}, "samp": {}, "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1}, "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}}, "small": {}, "source": {"src": 1, "type": 1, "media": 1}, "span": {}, "strong": {}, "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1}, "sub": {}, "sup": {}, "svg": {}, "table": {"summary": 1}, "tbody": {}, "td": {"headers": 1, "rowspan": 1, "colspan": 1}, "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}}, "tfoot": {}, "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1}, "thead": {}, "time": {"datetime": 1}, "title": {}, "tr": {}, "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1}, "section": {}, "summary": {}, "u": {}, "ul": {}, "var": {}, "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}}, "wbr": {} }; var elements = Object.keys(attributeMap); function is(token, type) { return token.type.lastIndexOf(type + ".xml") > -1; } function findTagName(session, pos) { var iterator = new TokenIterator(session, pos.row, pos.column); var token = iterator.getCurrentToken(); while (token && !is(token, "tag-name")){ token = iterator.stepBackward(); } if (token) return token.value; } function findAttributeName(session, pos) { var iterator = new TokenIterator(session, pos.row, pos.column); var token = iterator.getCurrentToken(); while (token && !is(token, "attribute-name")){ token = iterator.stepBackward(); } if (token) return token.value; } var HtmlCompletions = function() { }; (function() { this.getCompletions = function(state, session, pos, prefix) { var token = session.getTokenAt(pos.row, pos.column); if (!token) return []; // tag name if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open")) return this.getTagCompletions(state, session, pos, prefix); // tag attribute if (is(token, "tag-whitespace") || is(token, "attribute-name")) return this.getAttributeCompletions(state, session, pos, prefix); // tag attribute values if (is(token, "attribute-value")) return this.getAttributeValueCompletions(state, session, pos, prefix); // HTML entities var line = session.getLine(pos.row).substr(0, pos.column); if (/&[a-z]*$/i.test(line)) return this.getHTMLEntityCompletions(state, session, pos, prefix); return []; }; this.getTagCompletions = function(state, session, pos, prefix) { return elements.map(function(element){ return { value: element, meta: "tag", score: 1000000 }; }); }; this.getAttributeCompletions = function(state, session, pos, prefix) { var tagName = findTagName(session, pos); if (!tagName) return []; var attributes = globalAttributes; if (tagName in attributeMap) { attributes = attributes.concat(Object.keys(attributeMap[tagName])); } return attributes.map(function(attribute){ return { caption: attribute, snippet: attribute + '="$0"', meta: "attribute", score: 1000000 }; }); }; this.getAttributeValueCompletions = function(state, session, pos, prefix) { var tagName = findTagName(session, pos); var attributeName = findAttributeName(session, pos); if (!tagName) return []; var values = []; if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") { values = Object.keys(attributeMap[tagName][attributeName]); } return values.map(function(value){ return { caption: value, snippet: value, meta: "attribute value", score: 1000000 }; }); }; this.getHTMLEntityCompletions = function(state, session, pos, prefix) { var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;']; return values.map(function(value){ return { caption: value, snippet: value, meta: "html entity", score: 1000000 }; }); }; }).call(HtmlCompletions.prototype); exports.HtmlCompletions = HtmlCompletions; ================================================ FILE: src/mode/html_elixir.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlElixirHighlightRules = require("./html_elixir_highlight_rules").HtmlElixirHighlightRules; var HtmlMode = require("./html").Mode; var JavaScriptMode = require("./javascript").Mode; var CssMode = require("./css").Mode; var ElixirMode = require("./elixir").Mode; var Mode = function() { HtmlMode.call(this); this.HighlightRules = HtmlElixirHighlightRules; this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode, "elixir-": ElixirMode }); }; oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/html_elixir"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/html_elixir_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var ElixirHighlightRules = require("./elixir_highlight_rules").ElixirHighlightRules; var HtmlElixirHighlightRules = function() { HtmlHighlightRules.call(this); var startRules = [ { regex: "<%%|%%>", token: "constant.language.escape" }, { token : "comment.start.eex", regex : "<%#", push : [{ token : "comment.end.eex", regex: "%>", next: "pop", defaultToken:"comment" }] }, { token : "support.elixir_tag", regex : "<%+(?!>)[-=]?", push : "elixir-start" } ]; var endRules = [ { token : "support.elixir_tag", regex : "%>", next : "pop" }, { token: "comment", regex: "#(?:[^%]|%[^>])*" } ]; for (var key in this.$rules) this.$rules[key].unshift.apply(this.$rules[key], startRules); this.embedRules(ElixirHighlightRules, "elixir-", endRules, ["start"]); this.normalizeRules(); }; oop.inherits(HtmlElixirHighlightRules, HtmlHighlightRules); exports.HtmlElixirHighlightRules = HtmlElixirHighlightRules; ================================================ FILE: src/mode/html_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; var tagMap = lang.createMap({ a : 'anchor', button : 'form', form : 'form', img : 'image', input : 'form', label : 'form', option : 'form', script : 'script', select : 'form', textarea : 'form', style : 'style', table : 'table', tbody : 'table', td : 'table', tfoot : 'table', th : 'table', tr : 'table' }); var HtmlHighlightRules = function() { XmlHighlightRules.call(this); this.addRules({ attributes: [{ include : "tag_whitespace" }, { token : "entity.other.attribute-name.xml", regex : "[-_a-zA-Z0-9:.]+" }, { token : "keyword.operator.attribute-equals.xml", regex : "=", push : [{ include: "tag_whitespace" }, { token : "string.unquoted.attribute-value.html", regex : "[^<>='\"`\\s]+", next : "pop" }, { token : "empty", regex : "", next : "pop" }] }, { include : "attribute_value" }], tag: [{ token : function(start, tag) { var group = tagMap[tag]; return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml", "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"]; }, regex : "(</?)([-_a-zA-Z0-9:.]+)", next: "tag_stuff" }], tag_stuff: [ {include : "attributes"}, {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"} ] }); this.embedTagRules(CssHighlightRules, "css-", "style"); this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script"); if (this.constructor === HtmlHighlightRules) this.normalizeRules(); }; oop.inherits(HtmlHighlightRules, XmlHighlightRules); exports.HtmlHighlightRules = HtmlHighlightRules; ================================================ FILE: src/mode/html_ruby.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlRubyHighlightRules = require("./html_ruby_highlight_rules").HtmlRubyHighlightRules; var HtmlMode = require("./html").Mode; var JavaScriptMode = require("./javascript").Mode; var CssMode = require("./css").Mode; var RubyMode = require("./ruby").Mode; var Mode = function() { HtmlMode.call(this); this.HighlightRules = HtmlRubyHighlightRules; this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode, "ruby-": RubyMode }); }; oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/html_ruby"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/html_ruby_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; var HtmlRubyHighlightRules = function() { HtmlHighlightRules.call(this); var startRules = [ { regex: "<%%|%%>", token: "constant.language.escape" }, { token : "comment.start.erb", regex : "<%#", push : [{ token : "comment.end.erb", regex: "%>", next: "pop", defaultToken:"comment" }] }, { token : "support.ruby_tag", regex : "<%+(?!>)[-=]?", push : "ruby-start" } ]; var endRules = [ { token : "support.ruby_tag", regex : "%>", next : "pop" }, { token: "comment", regex: "#(?:[^%]|%[^>])*" } ]; for (var key in this.$rules) this.$rules[key].unshift.apply(this.$rules[key], startRules); this.embedRules(RubyHighlightRules, "ruby-", endRules, ["start"]); this.normalizeRules(); }; oop.inherits(HtmlRubyHighlightRules, HtmlHighlightRules); exports.HtmlRubyHighlightRules = HtmlRubyHighlightRules; ================================================ FILE: src/mode/html_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var Range = require("../range").Range; var HtmlMode = require("./html").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new HtmlMode(); }, "test: toggle comment lines" : function() { var session = new EditSession([" abc", "", "fg"]); var range = new Range(0, 3, 1, 1); var comment = this.mode.toggleCommentLines("start", session, 0, 1); assert.equal([" <!--abc-->", "", "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")); } }; require("../test/run")(module); ================================================ FILE: src/mode/ini.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/ini").FoldMode; var Mode = function() { this.HighlightRules = IniHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.blockComment = null; this.$id = "ace/mode/ini"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/ini_highlight_rules.js ================================================ /* This file was autogenerated from tool\tm bundles\ini.tmbundle\Syntaxes\Ini.plist (uuid: ) */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var escapeRe = "\\\\(?:[\\\\0abtrn;#=:]|x[a-fA-F\\d]{4})"; var IniHighlightRules = function() { this.$rules = { start: [{ token: 'punctuation.definition.comment.ini', regex: '#.*', push_: [{ token: 'comment.line.number-sign.ini', regex: '$|^', next: 'pop' }, { defaultToken: 'comment.line.number-sign.ini' }] }, { token: 'punctuation.definition.comment.ini', regex: ';.*', push_: [{ token: 'comment.line.semicolon.ini', regex: '$|^', next: 'pop' }, { defaultToken: 'comment.line.semicolon.ini' }] }, { token: ['keyword.other.definition.ini', 'text', 'punctuation.separator.key-value.ini'], regex: '\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)' }, { token: ['punctuation.definition.entity.ini', 'constant.section.group-title.ini', 'punctuation.definition.entity.ini'], regex: '^(\\[)(.*?)(\\])' }, { token: 'punctuation.definition.string.begin.ini', regex: "'", push: [{ token: 'punctuation.definition.string.end.ini', regex: "'", next: 'pop' }, { token: "constant.language.escape", regex: escapeRe }, { defaultToken: 'string.quoted.single.ini' }] }, { token: 'punctuation.definition.string.begin.ini', regex: '"', push: [{ token: "constant.language.escape", regex: escapeRe }, { token: 'punctuation.definition.string.end.ini', regex: '"', next: 'pop' }, { defaultToken: 'string.quoted.double.ini' }] }] }; this.normalizeRules(); }; IniHighlightRules.metaData = { fileTypes: ['ini', 'conf'], keyEquivalent: '^~I', name: 'Ini', scopeName: 'source.ini' }; oop.inherits(IniHighlightRules, TextHighlightRules); exports.IniHighlightRules = IniHighlightRules; ================================================ FILE: src/mode/io.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var IoHighlightRules = require("./io_highlight_rules").IoHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = IoHighlightRules; 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/io"; this.snippetFileId = "ace/snippets/io"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/io_highlight_rules.js ================================================ /* This file was autogenerated from tm bundles\io.tmbundle/Syntaxes/io.plist (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var IoHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'keyword.control.io', regex: '\\b(?:if|ifTrue|ifFalse|ifTrueIfFalse|for|loop|reverseForeach|foreach|map|continue|break|while|do|return)\\b' }, { token: 'punctuation.definition.comment.io', regex: '/\\*', push: [ { token: 'punctuation.definition.comment.io', regex: '\\*/', next: 'pop' }, { defaultToken: 'comment.block.io' } ] }, { token: 'punctuation.definition.comment.io', regex: '//', push: [ { token: 'comment.line.double-slash.io', regex: '$', next: 'pop' }, { defaultToken: 'comment.line.double-slash.io' } ] }, { token: 'punctuation.definition.comment.io', regex: '#', push: [ { token: 'comment.line.number-sign.io', regex: '$', next: 'pop' }, { defaultToken: 'comment.line.number-sign.io' } ] }, { token: 'variable.language.io', regex: '\\b(?:self|sender|target|proto|protos|parent)\\b', comment: 'I wonder if some of this isn\'t variable.other.language? --Allan; scoping this as variable.language to match Objective-C\'s handling of \'self\', which is inconsistent with C++\'s handling of \'this\' but perhaps intentionally so -- Rob' }, { token: 'keyword.operator.io', regex: '<=|>=|=|:=|\\*|\\||\\|\\||\\+|-|/|&|&&|>|<|\\?|@|@@|\\b(?:and|or)\\b' }, { token: 'constant.other.io', regex: '\\bGL[\\w_]+\\b' }, { token: 'support.class.io', regex: '\\b[A-Z](?:\\w+)?\\b' }, { token: 'support.function.io', regex: '\\b(?:clone|call|init|method|list|vector|block|\\w+(?=\\s*\\())\\b' }, { token: 'support.function.open-gl.io', regex: '\\bgl(?:u|ut)?[A-Z]\\w+\\b' }, { token: 'punctuation.definition.string.begin.io', regex: '"""', push: [ { token: 'punctuation.definition.string.end.io', regex: '"""', next: 'pop' }, { token: 'constant.character.escape.io', regex: '\\\\.' }, { defaultToken: 'string.quoted.triple.io' } ] }, { token: 'punctuation.definition.string.begin.io', regex: '"', push: [ { token: 'punctuation.definition.string.end.io', regex: '"', next: 'pop' }, { token: 'constant.character.escape.io', regex: '\\\\.' }, { defaultToken: 'string.quoted.double.io' } ] }, { token: 'constant.numeric.io', 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: 'variable.other.global.io', regex: 'Lobby\\b' }, { token: 'constant.language.io', regex: '\\b(?:TRUE|true|FALSE|false|NULL|null|Null|Nil|nil|YES|NO)\\b' } ] }; this.normalizeRules(); }; IoHighlightRules.metaData = { fileTypes: [ 'io' ], keyEquivalent: '^~I', name: 'Io', scopeName: 'source.io' }; oop.inherits(IoHighlightRules, TextHighlightRules); exports.IoHighlightRules = IoHighlightRules; ================================================ FILE: src/mode/ion.js ================================================ /* THIS FILE WAS GENERATED BY 'ligand' USING 'mode.js' */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HighlightRules = require("./ion_highlight_rules").IonHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { this.HighlightRules = HighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; 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); 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.$id = "ace/mode/ion"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/ion_highlight_rules.js ================================================ /* THIS FILE WAS GENERATED BY 'ligand' USING 'mode_highlight_rules.js' */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var IonHighlightRules = function() { // constant.language.bool.ion var k_keywords_bool = "TRUE|FALSE"; var k_bool = k_keywords_bool; // constant.language.null.ion var k_keywords_null = "NULL.NULL|NULL.BOOL|NULL.INT|NULL.FLOAT|NULL.DECIMAL|NULL.TIMESTAMP|NULL.STRING|NULL.SYMBOL|NULL.BLOB|NULL.CLOB|" +"NULL.STRUCT|NULL.LIST|NULL.SEXP|NULL"; var k_null = k_keywords_null; var keywordMapper = this.createKeywordMapper({ "constant.language.bool.ion": k_bool, "constant.language.null.ion": k_null }, "constant.other.symbol.identifier.ion", true); var keywordMapperRule = { token : keywordMapper, regex : "\\b\\w+(?:\\.\\w+)?\\b" }; this.$rules = { "start": [ { "include": "value" } ], "value": [ { "include": "whitespace" }, { "include": "comment" }, { "include": "annotation" }, { "include": "string" }, { "include": "number" }, { "include": "keywords" }, { "include": "symbol" }, { "include": "clob" }, { "include": "blob" }, { "include": "struct" }, { "include": "list" }, { "include": "sexp" } ], "sexp": [ { "token": "punctuation.definition.sexp.begin.ion", "regex": "\\(", "push": [ { "token": "punctuation.definition.sexp.end.ion", "regex": "\\)", "next": "pop" }, { "include": "comment" }, { "include": "value" }, { "token": "storage.type.symbol.operator.ion", "regex": "[\\!\\#\\%\\&\\*\\+\\-\\./\\;\\<\\=\\>\\?\\@\\^\\`\\|\\~]+" } ] } ], "comment": [ { "token": "comment.line.ion", "regex": "//[^\\n]*" }, { "token": "comment.block.ion", "regex": "/\\*", "push": [ { "token": "comment.block.ion", "regex": "[*]/", "next": "pop" }, { "token": "comment.block.ion", "regex": "[^*/]+" }, { "token": "comment.block.ion", "regex": "[*/]+" } ] } ], "list": [ { "token": "punctuation.definition.list.begin.ion", "regex": "\\[", "push": [ { "token": "punctuation.definition.list.end.ion", "regex": "\\]", "next": "pop" }, { "include": "comment" }, { "include": "value" }, { "token": "punctuation.definition.list.separator.ion", "regex": "," } ] } ], "struct": [ { "token": "punctuation.definition.struct.begin.ion", "regex": "\\{", "push": [ { "token": "punctuation.definition.struct.end.ion", "regex": "\\}", "next": "pop" }, { "include": "comment" }, { "include": "value" }, { "token": "punctuation.definition.struct.separator.ion", "regex": ",|:" } ] } ], "blob": [ { "token": [ "punctuation.definition.blob.begin.ion", "string.other.blob.ion", "punctuation.definition.blob.end.ion" ], "regex": "(\\{\\{)([^\"]*)(\\}\\})" } ], "clob": [ { "token": [ "punctuation.definition.clob.begin.ion", "string.other.clob.ion", "punctuation.definition.clob.end.ion" ], "regex": "(\\{\\{)(\"[^\"]*\")(\\}\\})" } ], "symbol": [ { "token": "storage.type.symbol.quoted.ion", "regex": "(['])((?:(?:\\\\')|(?:[^']))*?)(['])" }, { "token": "storage.type.symbol.identifier.ion", "regex": "[\\$_a-zA-Z][\\$_a-zA-Z0-9]*" } ], "number": [ { "token": "constant.numeric.timestamp.ion", "regex": "\\d{4}(?:-\\d{2})?(?:-\\d{2})?T(?:\\d{2}:\\d{2})(?::\\d{2})?(?:\\.\\d+)?(?:Z|[-+]\\d{2}:\\d{2})?" }, { "token": "constant.numeric.timestamp.ion", "regex": "\\d{4}-\\d{2}-\\d{2}T?" }, { "token": "constant.numeric.integer.binary.ion", "regex": "-?0[bB][01](?:_?[01])*" }, { "token": "constant.numeric.integer.hex.ion", "regex": "-?0[xX][0-9a-fA-F](?:_?[0-9a-fA-F])*" }, { "token": "constant.numeric.float.ion", "regex": "-?(?:0|[1-9](?:_?\\d)*)(?:\\.(?:\\d(?:_?\\d)*)?)?(?:[eE][+-]?\\d+)" }, { "token": "constant.numeric.float.ion", "regex": "(?:[-+]inf)|(?:nan)" }, { "token": "constant.numeric.decimal.ion", "regex": "-?(?:0|[1-9](?:_?\\d)*)(?:(?:(?:\\.(?:\\d(?:_?\\d)*)?)(?:[dD][+-]?\\d+)|\\.(?:\\d(?:_?\\d)*)?)|(?:[dD][+-]?\\d+))" }, { "token": "constant.numeric.integer.ion", "regex": "-?(?:0|[1-9](?:_?\\d)*)" } ], "string": [ { "token": [ "punctuation.definition.string.begin.ion", "string.quoted.double.ion", "punctuation.definition.string.end.ion" ], "regex": "([\"])((?:(?:\\\\\")|(?:[^\"]))*?)([\"])" }, { "token": "punctuation.definition.string.begin.ion", "regex": "'{3}", "push": [ { "token": "punctuation.definition.string.end.ion", "regex": "'{3}", "next": "pop" }, { "token": "string.quoted.triple.ion", "regex": "(?:\\\\'|[^'])+" }, { "token": "string.quoted.triple.ion", "regex": "'" } ] } ], "annotation": [ { "token": [ "variable.language.annotation.ion", "punctuation.definition.annotation.ion" ], "regex": /('(?:[^'\\]|\\.)*')\s*(::)/ }, { "token": [ "variable.language.annotation.ion", "punctuation.definition.annotation.ion" ], "regex": "([\\$_a-zA-Z][\\$_a-zA-Z0-9]*)\\s*(::)" } ], "whitespace": [ { "token": "text.ion", "regex": "\\s+" } ] } ; this.$rules["keywords"] = [keywordMapperRule]; this.normalizeRules(); }; oop.inherits(IonHighlightRules, TextHighlightRules); exports.IonHighlightRules = IonHighlightRules; ================================================ FILE: src/mode/jack.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HighlightRules = require("./jack_highlight_rules").JackHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = HighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); 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.$id = "ace/mode/jack"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/jack_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JackHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "string", regex : '"', next : "string2" }, { token : "string", regex : "'", next : "string1" }, { token : "constant.numeric", // hex regex: "-?0[xX][0-9a-fA-F]+\\b" }, { token : "constant.numeric", // float regex : "(?:0|[-+]?[1-9][0-9]*)\\b" }, { token : "constant.binary", regex : "<[0-9A-Fa-f][0-9A-Fa-f](\\s+[0-9A-Fa-f][0-9A-Fa-f])*>" }, { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { token : "constant.language.null", regex : "null\\b" }, { token : "storage.type", regex: "(?:Integer|Boolean|Null|String|Buffer|Tuple|List|Object|Function|Coroutine|Form)\\b" }, { token : "keyword", regex : "(?:return|abort|vars|for|delete|in|is|escape|exec|split|and|if|elif|else|while)\\b" }, { token : "language.builtin", regex : "(?:lines|source|parse|read-stream|interval|substr|parseint|write|print|range|rand|inspect|bind|i-values|i-pairs|i-map|i-filter|i-chunk|i-all\\?|i-any\\?|i-collect|i-zip|i-merge|i-each)\\b" }, { token : "comment", regex : "--.*$" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "storage.form", regex : "@[a-z]+" }, { token : "constant.other.symbol", regex : ':+[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?' }, { token : "variable", regex : '[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?' }, { token : "keyword.operator", regex : "\\|\\||\\^\\^|&&|!=|==|<=|<|>=|>|\\+|-|\\*|\\/|\\^|\\%|\\#|\\!" }, { token : "text", regex : "\\s+" } ], "string1" : [ { token : "constant.language.escape", regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/ }, { token : "string", regex : "[^'\\\\]+" }, { token : "string", regex : "'", next : "start" }, { token : "string", regex : "", next : "start" } ], "string2" : [ { token : "constant.language.escape", regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/ }, { token : "string", regex : '[^"\\\\]+' }, { token : "string", regex : '"', next : "start" }, { token : "string", regex : "", next : "start" } ] }; }; oop.inherits(JackHighlightRules, TextHighlightRules); exports.JackHighlightRules = JackHighlightRules; ================================================ FILE: src/mode/jade.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var JadeHighlightRules = require("./jade_highlight_rules").JadeHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = JadeHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/jade"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/jade_highlight_rules.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: C5B73B98-5F2A-42E3-9F0E-028A74A9FE4B) */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules; var SassHighlightRules = require("./scss_highlight_rules").ScssHighlightRules; var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules; var CoffeeHighlightRules = require("./coffee_highlight_rules").CoffeeHighlightRules; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; function mixin_embed(tag, prefix) { return { token : "entity.name.function.jade", regex : "^\\s*\\:" + tag, next : prefix + "start" }; } var JadeHighlightRules = function() { var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex "u[0-9a-fA-F]{4}|" + // unicode "[0-2][0-7]{0,2}|" + // oct "3[0-6][0-7]?|" + // oct "37[0-7]?|" + // oct "[4-7][0-7]?|" + //oct ".)"; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start": [ { token: "keyword.control.import.include.jade", regex: "\\s*\\binclude\\b" }, { token: "keyword.other.doctype.jade", regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?" }, { onMatch: function(value, currentState, stack) { stack.unshift(this.next, value.length - 2, currentState); return "comment"; }, regex: /^\s*\/\//, next: "comment_block" }, mixin_embed("markdown", "markdown-"), mixin_embed("sass", "sass-"), mixin_embed("less", "less-"), mixin_embed("coffee", "coffee-"), /* { token: { "2": { "name": "entity.name.function.jade" } }, regex: "^(\\s*)(\\:cdata)", next: "state_9" },*/ // match stuff like: mixin dialog-title-desc(title, desc) { token: [ "storage.type.function.jade", "entity.name.function.jade", "punctuation.definition.parameters.begin.jade", "variable.parameter.function.jade", "punctuation.definition.parameters.end.jade" ], regex: "^(\\s*mixin)( [\\w\\-]+)(\\s*\\()(.*?)(\\))" }, // match stuff like: mixin dialog-title-desc { token: [ "storage.type.function.jade", "entity.name.function.jade"], regex: "^(\\s*mixin)( [\\w\\-]+)" }, { token: "source.js.embedded.jade", regex: "^\\s*(?:-|=|!=)", next: "js-start" }, /*{ token: "entity.name.tag.script.jade", regex: "^\\s*script", next: "js_code_tag" },*/ { token: "string.interpolated.jade", regex: "[#!]\\{[^\\}]+\\}" }, // Match any tag, id or class. skip AST filters { token: "meta.tag.any.jade", regex: /^\s*(?!\w+:)(?:[\w-]+|(?=\.|#)])/, next: "tag_single" }, { token: "suport.type.attribute.id.jade", regex: "#\\w+" }, { token: "suport.type.attribute.class.jade", regex: "\\.\\w+" }, { token: "punctuation", regex: "\\s*(?:\\()", next: "tag_attributes" } ], "comment_block": [ {regex: /^\s*(?:\/\/)?/, onMatch: function(value, currentState, stack) { if (value.length <= stack[1]) { if (value.slice(-1) == "/") { stack[1] = value.length - 2; this.next = ""; return "comment"; } stack.shift(); stack.shift(); this.next = stack.shift(); return "text"; } else { this.next = ""; return "comment"; } }, next: "start"}, {defaultToken: "comment"} ], /* "state_9": [ { token: "TODO", regex: "^(?!\\1\\s+)", next: "start" }, { token: "TODO", regex: ".+", next: "state_9" } ],*/ /*"js_code": [ { token: "keyword.control.js", regex: "\\beach\\b" }, { token: "text", regex: "$", next: "start" } ],*/ /*"js_code_tag": [ { "include": "source.js" }, { token: "TODO", regex: "^((?=(\\1)([\\w#\\.]|$\\n?))|^$\\n?)", next: "start" } ],*/ "tag_single": [ { token: "entity.other.attribute-name.class.jade", regex: "\\.[\\w-]+" }, { token: "entity.other.attribute-name.id.jade", regex: "#[\\w-]+" }, { token: ["text", "punctuation"], regex: "($)|((?!\\.|#|=|-))", next: "start" } ], "tag_attributes": [ { token : "string", regex : "'(?=.)", next : "qstring" }, { token : "string", regex : '"(?=.)', next : "qqstring" }, { token: ["entity.other.attribute-name.jade", "punctuation"], regex: "([a-zA-Z:\\.-]+)(=)?", next: "attribute_strings" }, { token: "punctuation", regex: "\\)", next: "start" } ], "attribute_strings": [ { token : "string", regex : "'(?=.)", next : "qstring" }, { token : "string", regex : '"(?=.)', next : "qqstring" }, { token : "string", regex : '(?=\\S)', next : "tag_attributes" } ], "qqstring" : [ { token : "constant.language.escape", regex : escapedRe }, { token : "string", regex : '[^"\\\\]+' }, { token : "string", regex : "\\\\$", next : "qqstring" }, { token : "string", regex : '"|$', next : "tag_attributes" } ], "qstring" : [ { token : "constant.language.escape", regex : escapedRe }, { token : "string", regex : "[^'\\\\]+" }, { token : "string", regex : "\\\\$", next : "qstring" }, { token : "string", regex : "'|$", next : "tag_attributes" } ] }; this.embedRules(JavaScriptHighlightRules, "js-", [{ token: "text", regex: ".$", next: "start" }]); /* this.embedRules(MarkdownHighlightRules, "markdown-", [{ token : "support.function", regex : "^\\1\\s+", captures: "1", next : "start" }]); this.embedRules(SassHighlightRules, "sass-", [{ token : "support.function", regex : "^(?!\\1\\s+)", captures: "1", next : "start" }]); this.embedRules(LessHighlightRules, "less-", [{ token : "support.function", regex : "^(?!\\1\\s+)", captures: "1", next : "start" }]); this.embedRules(CoffeeHighlightRules, "coffee-", [{ token : "support.function", regex : "^(?!\\1\\s+)", captures: "1", next : "start" }]); this.embedRules(JavaScriptHighlightRules, "js-", [{ token : "support.function", regex : "$", captures: "1", next : "start" }]); */ }; oop.inherits(JadeHighlightRules, TextHighlightRules); exports.JadeHighlightRules = JadeHighlightRules; ================================================ FILE: src/mode/java.js ================================================ "use strict"; var oop = require("../lib/oop"); var JavaScriptMode = require("./javascript").Mode; var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules; var JavaFoldMode = require("./folding/java").FoldMode; var Mode = function() { JavaScriptMode.call(this); this.HighlightRules = JavaHighlightRules; this.foldingRules = new JavaFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, JavaScriptMode); (function() { this.createWorker = function(session) { return null; }; this.$id = "ace/mode/java"; this.snippetFileId = "ace/snippets/java"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/java_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JavaHighlightRules = function() { var identifierRe = "[a-zA-Z_$][a-zA-Z0-9_$]*"; // taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html var keywords = ( "abstract|continue|for|new|switch|" + "assert|default|goto|package|synchronized|" + "boolean|do|if|private|this|" + "break|double|implements|protected|throw|" + "byte|else|import|public|throws|" + "case|enum|instanceof|return|transient|" + "catch|extends|int|short|try|" + "char|final|interface|static|void|" + "class|finally|long|strictfp|volatile|" + "const|float|native|super|while|" + "yield|when|record|var|" + "permits|(?:non\\-)?sealed" ); var buildinConstants = ("null|Infinity|NaN|undefined"); var langClasses = ( "AbstractMethodError|AssertionError|ClassCircularityError|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ExceptionInInitializerError|IllegalAccessError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+ "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+ "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+ "SuppressWarnings|TypeNotPresentException|UnknownError|"+ "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+ "InstantiationException|IndexOutOfBoundsException|"+ "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+ "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+ "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+ "InterruptedException|NoSuchMethodException|IllegalAccessException|"+ "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+ "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+ "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+ "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+ "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+ "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+ "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+ "ArrayStoreException|ClassCastException|LinkageError|"+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ "Cloneable|Class|CharSequence|Comparable|String|Object" ); var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "constant.language": buildinConstants, "support.function": langClasses }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ {include: "comments"}, {include: "multiline-strings"}, {include: "strings"}, {include: "constants"}, { regex: "(open(?:\\s+))?module(?=\\s*\\w)", token: "keyword", next: [{ regex: "{", token: "paren.lparen", push: [ { regex: "}", token: "paren.rparen", next: "pop" }, {include: "comments"}, { // From Section 3.9 of http://cr.openjdk.java.net/~mr/jigsaw/spec/java-se-9-jls-diffs.pdf regex: "\\b(requires|transitive|exports|opens|to|uses|provides|with)\\b", token: "keyword" } ] }, { token : "text", regex : "\\s+" }, { token : "identifier", regex : "\\w+" }, { token : "punctuation.operator", regex : "." }, { token : "text", regex : "\\s+" }, { regex: "", // exit if there is anything else next: "start" }] }, {include: "statements"} ], "comments" : [ { token : "comment", regex : "\\/\\/.*$" }, { token : "comment.doc", // doc comment regex: /\/\*\*(?!\/)/, push : "doc-start" }, { token : "comment", // multi line comment regex : "\\/\\*", push : [ { token : "comment", // closing comment regex : "\\*\\/", next : "pop" }, { defaultToken : "comment" } ] }, ], "strings": [ { token: ["punctuation", "string"], regex: /(\.)(")/, push: [ { token: "lparen", regex: /\\\{/, push: [ { token: "text", regex: /$/, next: "start" }, { token: "rparen", regex: /}/, next: "pop" }, { include: "strings" }, { include: "constants" }, { include: "statements" } ] }, { token: "string", regex: /"/, next: "pop" }, { defaultToken: "string" } ] }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" } ], "multiline-strings": [ { token: ["punctuation", "string"], regex: /(\.)(""")/, push: [ { token: "string", regex: '"""', next: "pop" }, { token: "lparen", regex: /\\\{/, push: [ { token: "text", regex: /$/, next: "start" }, { token: "rparen", regex: /}/, next: "pop" }, { include: "multiline-strings" }, { include: "strings" }, { include: "constants" }, { include: "statements" } ] }, { token: "constant.language.escape", regex: /\\./ }, { defaultToken: "string" } ] }, { token: "string", regex: '"""', push: [ { token: "string", regex: '"""', next: "pop" }, { token : "constant.language.escape", regex : /\\./ }, { defaultToken: "string" } ] } ], "constants": [ { token: "constant.numeric", // hex regex: /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/ }, { token: "constant.numeric", // float regex: /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/ }, { token: "constant.language.boolean", regex: "(?:true|false)\\b" } ], "statements": [ { token: ["keyword", "text", "identifier"], regex: "(record)(\\s+)("+identifierRe+")\\b" }, { token: "keyword", regex: "(?:" + keywords + ")\\b" }, {//annotations token: "storage.type.annotation", regex: "@" + identifierRe + "\\b" }, { token: "entity.name.function", regex: identifierRe + "(?=\\()" }, { token: keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex: identifierRe + "\\b" }, { token: "keyword.operator", regex: "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token: "lparen", regex: "[[({]" }, { token: "rparen", regex: "[\\])}]" }, { token: "text", regex: "\\s+" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("pop") ]); this.normalizeRules(); }; oop.inherits(JavaHighlightRules, TextHighlightRules); exports.JavaHighlightRules = JavaHighlightRules; ================================================ FILE: src/mode/javascript.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var WorkerClient = require("../worker/worker_client").WorkerClient; var JavaScriptBehaviour = require("./behaviour/javascript").JavaScriptBehaviour; var JavaScriptFoldMode = require("./folding/javascript").FoldMode; var Mode = function() { this.HighlightRules = JavaScriptHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new JavaScriptBehaviour(); this.foldingRules = new JavaScriptFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$quotes = {'"': '"', "'": "'", "`": "`"}; this.$pairQuotesAfter = { "`": /\w/ }; 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" || state == "no_regex") { var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); if (match) { indent += tab; } } else if (state == "doc-start") { if (endState == "start" || endState == "no_regex") { return ""; } } 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/javascript_worker", "JavaScriptWorker"); worker.attachToDocument(session.getDocument()); worker.on("annotate", function(results) { session.setAnnotations(results.data); }); worker.on("terminate", function() { session.clearAnnotations(); }); return worker; }; this.$id = "ace/mode/javascript"; this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/javascript_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; // TODO: Unicode escape sequences var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"; var JavaScriptHighlightRules = function(options) { // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects var keywords = { "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|" + // Constructors "Namespace|QName|XML|XMLList|" + // E4X "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors "SyntaxError|TypeError|URIError|" + "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions "isNaN|parseFloat|parseInt|" + "JSON|Math|" + // Other "this|arguments|prototype|window|document" , // Pseudo "keyword": "const|yield|import|get|set|async|await|" + "break|case|catch|continue|default|delete|do|else|finally|for|" + "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + // invalid or reserved "__parent__|__count__|escape|unescape|with|__proto__|" + "class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor", "storage.type": "const|let|var|function", "constant.language": "null|Infinity|NaN|undefined", "support.function": "alert", "constant.language.boolean": "true|false" }; var keywordMapper = this.createKeywordMapper(keywords, "identifier"); // keywords which can be followed by regular expressions var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex "u[0-9a-fA-F]{4}|" + // unicode "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode "[0-2][0-7]{0,2}|" + // oct "3[0-7][0-7]?|" + // oct "[4-7][0-7]?|" + //oct ".)"; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var anonymousFunctionRe = "(function)(\\s*)(\\*?)"; var functionCallStartRule = { //just simple function call token: ["identifier", "text", "paren.lparen"], regex: "(\\b(?!" + Object.values(keywords).join("|") + "\\b)" + identifierRe + ")(\\s*)(\\()" }; this.$rules = { "no_regex" : [ DocCommentHighlightRules.getStartRule("doc-start"), comments("no_regex"), functionCallStartRule, { token : "string", regex : "'(?=.)", next : "qstring" }, { token : "string", regex : '"(?=.)', next : "qqstring" }, { include: "numeric_constants" }, { // play = function() { } token : [ "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "storage.type", "text", "paren.lparen" ], regex : "(" + identifierRe +")(\\s*)(=)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()", next: "function_arguments" }, { // function myFunc(arg) { } token : [ "storage.type", "text", "storage.type", "text", "text", "entity.name.function", "text", "paren.lparen" ], regex : "(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(" + identifierRe + ")(\\s*)(\\()", next: "function_arguments" }, { // foobar: function() { } token : [ "entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "storage.type", "text", "paren.lparen" ], regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()", next: "function_arguments" }, { // : function() { } (this is for issues with 'foo': function() { }) token : [ "text", "text", "storage.type", "text", "storage.type", "text", "paren.lparen" ], regex : "(:)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()", next: "function_arguments" }, { // from "module-path" (this is the only case where 'from' should be a keyword) token : "keyword", regex : "from(?=\\s*('|\"))" }, { token : "keyword", regex : "(?:" + kwBeforeRe + ")\\b", next : "start" }, { token : "support.constant", regex : /that\b/ }, { token : ["storage.type", "punctuation.operator", "support.function.firebug"], regex : /(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/ }, { token : keywordMapper, regex : identifierRe }, { token : "punctuation.operator", regex : /[.](?![.])/, next : "property" }, { token : "storage.type", regex : /=>/, next : "start" }, { token : "keyword.operator", regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, next : "start" }, { token : "punctuation.operator", regex : /[?:,;.]/, next : "start" }, { token : "paren.lparen", regex : /[\[({]/, next : "start" }, { token : "paren.rparen", regex : /[\])}]/ }, { token: "comment", regex: /^#!.*$/ } ], property: [{ token : "text", regex : "\\s+" }, { token: "keyword.operator", regex: /=/ }, { // Sound.play = function() { } token : [ "storage.type", "text", "storage.type", "text", "paren.lparen" ], regex : anonymousFunctionRe + "(\\s*)(\\()", next: "function_arguments" }, { // Sound.play = function play() { } token: [ "storage.type", "text", "storage.type", "text", "text", "entity.name.function", "text", "paren.lparen" ], regex: "(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(\\w+)(\\s*)(\\()", next: "function_arguments" }, { token : "punctuation.operator", regex : /[.](?![.])/ }, { token : "support.function", regex: "prototype" }, { token : "support.function", regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ }, { token : "support.function.dom", regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/ }, { token : "support.constant", regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/ }, { token : "identifier", regex : identifierRe }, { regex: "", token: "empty", next: "no_regex" } ], // regular expressions are only allowed after certain tokens. This // makes sure we don't mix up regexps with the divison operator "start": [ DocCommentHighlightRules.getStartRule("doc-start"), comments("start"), { token: "string.regexp", regex: "\\/", next: "regex" }, { token : "text", regex : "\\s+|^$", next : "start" }, { // immediately return to the start mode without matching // anything token: "empty", regex: "", next: "no_regex" } ], "regex": [ { // escapes token: "regexp.keyword.operator", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" }, { // flag token: "string.regexp", regex: "/[sxngimy]*", next: "no_regex" }, { // invalid operators token : "invalid", regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ }, { // operators token : "constant.language.escape", regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ }, { token : "constant.language.delimiter", regex: /\|/ }, { token: "constant.language.escape", regex: /\[\^?/, next: "regex_character_class" }, { token: "empty", regex: "$", next: "no_regex" }, { defaultToken: "string.regexp" } ], "regex_character_class": [ { token: "regexp.charclass.keyword.operator", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" }, { token: "constant.language.escape", regex: "]", next: "regex" }, { token: "constant.language.escape", regex: "-" }, { token: "empty", regex: "$", next: "no_regex" }, { defaultToken: "string.regexp.charachterclass" } ], "default_parameter": [ { token : "string", regex : "'(?=.)", push: [ { token: "string", regex: "'|$", next: "pop" }, { include: "qstring" } ] }, { token : "string", regex : '"(?=.)', push: [ { token: "string", regex: '"|$', next: "pop" }, { include: "qqstring" } ] }, { token : "constant.language", regex : "null|Infinity|NaN|undefined" }, { include: "numeric_constants" }, { token: "punctuation.operator", regex: ",", next: "function_arguments" }, { token: "text", regex: "\\s+" }, { token: "punctuation.operator", regex: "$" }, { token: "empty", regex: "", next: "no_regex" } ], "function_arguments": [ comments("function_arguments"), { token: "variable.parameter", regex: identifierRe }, { token: "punctuation.operator", regex: "," }, { token: "text", regex: "\\s+" }, { token: "punctuation.operator", regex: "$" }, { token: "empty", regex: "", next: "no_regex" } ], "qqstring" : [ { token : "constant.language.escape", regex : escapedRe }, { token : "string", regex : "\\\\$", consumeLineEnd : true }, { token : "string", regex : '"|$', next : "no_regex" }, { defaultToken: "string" } ], "qstring" : [ { token : "constant.language.escape", regex : escapedRe }, { token : "string", regex : "\\\\$", consumeLineEnd : true }, { token : "string", regex : "'|$", next : "no_regex" }, { defaultToken: "string" } ], "numeric_constants": [ { token : "constant.numeric", // hexadecimal, octal and binary regex : /0(?:[xX][0-9a-fA-F_]+|[oO][0-7_]+|[bB][01_]+)\b/ }, { token : "constant.numeric", // decimal integers and floats regex : /(?:\d[\d_]*(?:\.[\d_]*)?|\.\d[\d_]*)(?:[eE][+-]?\d+\b)?/ }, ] }; if (!options || !options.noES6) { this.$rules.no_regex.unshift({ regex: "[{}]", onMatch: function(val, state, stack) { this.next = val == "{" ? this.nextState : ""; if (val == "{" && stack.length) { stack.unshift("start", state); } else if (val == "}" && stack.length) { stack.shift(); this.next = stack.shift(); if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) return "paren.quasi.end"; } return val == "{" ? "paren.lparen" : "paren.rparen"; }, nextState: "start" }, { token : "string.quasi.start", regex : /`/, push : [{ token : "constant.language.escape", regex : escapedRe }, { token : "paren.quasi.start", regex : /\${/, push : "start" }, { token : "string.quasi.end", regex : /`/, next : "pop" }, { defaultToken: "string.quasi" }] }, { token: ["variable.parameter", "text"], regex: "(" + identifierRe + ")(\\s*)(?=\\=>)" }, { token: "paren.lparen", regex: "(\\()(?=[^\\(]+\\s*=>)", next: "function_arguments" }, { token: "variable.language", regex: "(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b" }); this.$rules["function_arguments"].unshift({ token: "keyword.operator", regex: "=", next: "default_parameter" }, { token: "keyword.operator", regex: "\\.{3}" }); this.$rules["property"].unshift({ token: "support.function", regex: "(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|" + "finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()" }, { token : "constant.language", regex : "(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b" }); if (!options || options.jsx != false) JSX.call(this); } this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("no_regex") ]); this.normalizeRules(); }; oop.inherits(JavaScriptHighlightRules, TextHighlightRules); function JSX() { var tagRegex = identifierRe.replace("\\d", "\\d\\-"); var jsxTag = { onMatch : function(val, state, stack) { var offset = val.charAt(1) == "/" ? 2 : 1; if (offset == 1) { if (state != this.nextState) stack.unshift(this.next, this.nextState, 0); else stack.unshift(this.next); stack[2]++; } else if (offset == 2) { if (state == this.nextState) { stack[1]--; if (!stack[1] || stack[1] < 0) { stack.shift(); stack.shift(); } } } return [{ type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", value: val.slice(0, offset) }, { type: "meta.tag.tag-name.xml", value: val.substr(offset) }]; }, regex : "</?(?:" + tagRegex + "|(?=>))", next: "jsxAttributes", nextState: "jsx" }; this.$rules.start.unshift(jsxTag); var jsxJsRule = { regex: "{", token: "paren.quasi.start", push: "start" }; this.$rules.jsx = [ jsxJsRule, jsxTag, {include : "reference"}, {defaultToken: "string.xml"} ]; this.$rules.jsxAttributes = [{ token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", onMatch : function(value, currentState, stack) { if (currentState == stack[0]) stack.shift(); if (value.length == 2) { if (stack[0] == this.nextState) stack[1]--; if (!stack[1] || stack[1] < 0) { stack.splice(0, 2); } } this.next = stack[0] || "start"; return [{type: this.token, value: value}]; }, nextState: "jsx" }, jsxJsRule, comments("jsxAttributes"), { token : "entity.other.attribute-name.xml", regex : tagRegex }, { token : "keyword.operator.attribute-equals.xml", regex : "=" }, { token : "text.tag-whitespace.xml", regex : "\\s+" }, { token : "string.attribute-value.xml", regex : "'", stateName : "jsx_attr_q", push : [ {token : "string.attribute-value.xml", regex: "'", next: "pop"}, {include : "reference"}, {defaultToken : "string.attribute-value.xml"} ] }, { token : "string.attribute-value.xml", regex : '"', stateName : "jsx_attr_qq", push : [ {token : "string.attribute-value.xml", regex: '"', next: "pop"}, {include : "reference"}, {defaultToken : "string.attribute-value.xml"} ] }, jsxTag ]; this.$rules.reference = [{ token : "constant.language.escape.reference.xml", regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }]; } function comments(next) { return [ { token : "comment", // multi line comment regex : /\/\*/, next: [ DocCommentHighlightRules.getTagRule(), {token : "comment", regex : "\\*\\/", next : next || "pop"}, {defaultToken : "comment", caseInsensitive: true} ] }, { token : "comment", regex : "\\/\\/", next: [ DocCommentHighlightRules.getTagRule(), {token : "comment", regex : "$|^", next : next || "pop"}, {defaultToken : "comment", caseInsensitive: true} ] } ]; } exports.JavaScriptHighlightRules = JavaScriptHighlightRules; ================================================ FILE: src/mode/javascript_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var Tokenizer = require("../tokenizer").Tokenizer; var JavaScriptMode = require("./javascript").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new JavaScriptMode(); }, "test: getTokenizer() (smoke test)" : function() { var tokenizer = this.mode.getTokenizer(); assert.ok(tokenizer instanceof Tokenizer); var tokens = tokenizer.getLineTokens("'juhu'", "start").tokens; assert.equal("string", tokens[0].type); }, "test: toggle comment lines should prepend '//' to each line" : function() { var session = new EditSession([" abc", "cde", "fg"]); session.setTabSize(1); this.mode.toggleCommentLines("start", session, 0, 1); assert.equal(["// abc", "// cde", "fg"].join("\n"), session.toString()); }, "test: toggle comment on commented lines should remove leading '//' chars" : function() { var session = new EditSession(["// abc", "//cde", "fg"]); session.setTabSize(1); this.mode.toggleCommentLines("start", session, 0, 1); assert.equal([" abc", "cde", "fg"].join("\n"), session.toString()); }, "test: toggle comment on all empty lines" : function() { var session = new EditSession([" ", " ", " "]); session.setTabSize(1); this.mode.toggleCommentLines("start", session, 0, 1); assert.equal([" // ", " // ", " "].join("\n"), session.toString()); }, "test: toggle comment with empty lines" : function() { var session = new EditSession([ " abc", "", " cde", " fg"]); var initial = session.toString(); this.mode.toggleCommentLines("start", session, 0, 3); assert.equal([ " // abc", "", " // cde", " // fg"].join("\n"), session.toString() ); this.mode.toggleCommentLines("start", session, 0, 3); assert.equal(initial, session.toString()); }, "test: toggle comment lines twice should return the original text" : function() { var session = new EditSession([" abc", "cde", "fg"]); this.mode.toggleCommentLines("start", session, 0, 2); this.mode.toggleCommentLines("start", session, 0, 2); assert.equal([" abc", "cde", "fg"].join("\n"), session.toString()); }, "test: toggle comment on multiple lines with one commented line prepend '//' to each line" : function() { var session = new EditSession([" // abc", " //cde", " fg"]); session.setTabSize(1); this.mode.toggleCommentLines("start", session, 0, 2); assert.equal([" // // abc", " // //cde", " // fg"].join("\n"), session.toString()); }, "test: toggle comment on a comment line with leading white space": function() { var session = new EditSession(["//cde", " //fg"]); this.mode.toggleCommentLines("start", session, 0, 1); assert.equal(["cde", " fg"].join("\n"), session.toString()); }, "test: toggle comment lines should take tabsize into account" : function() { var session = new EditSession([" // abc", " // cde", "// fg"]); session.setTabSize(2); this.mode.toggleCommentLines("start", session, 0, 2); assert.equal([" abc", " cde", " fg"].join("\n"), session.toString()); session.setTabSize(4); this.mode.toggleCommentLines("start", session, 0, 2); assert.equal(["// abc", "// cde", "// fg"].join("\n"), session.toString()); this.mode.toggleCommentLines("start", session, 0, 2); assert.equal([" abc", " cde", " fg"].join("\n"), session.toString()); session.insert({row: 0, column: 0}, " "); this.mode.toggleCommentLines("start", session, 0, 2); assert.equal(["// abc", "// cde", "// fg"].join("\n"), session.toString()); }, //there doesn't seem to be any way to make this work "!test: togglecomment on line with one space" : function() { var session = new EditSession([" abc", " // cde", "// fg"]); var initialValue = session + ""; session.setTabSize(4); this.mode.toggleCommentLines("start", session, 0, 0); this.mode.toggleCommentLines("start", session, 0, 0); assert.equal(initialValue, session.toString()); }, "test: auto indent after opening brace" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", "if () {", " ")); }, "test: auto indent after case" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", "case 'juhu':", " ")); }, "test: no auto indent in object literal" : function() { assert.equal("", this.mode.getNextLineIndent("start", "{ 'juhu':", " ")); }, "test: no auto indent after opening brace in multi line comment" : function() { assert.equal("", this.mode.getNextLineIndent("start", "/*if () {", " ")); assert.equal(" ", this.mode.getNextLineIndent("comment", " abcd", " ")); }, "test: no auto indent after opening brace in single line comment" : function() { assert.equal("", this.mode.getNextLineIndent("start", "//if () {", " ")); assert.equal(" ", this.mode.getNextLineIndent("start", " //if () {", " ")); }, "test: no auto indent should add to existing indent" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", " if () {", " ")); assert.equal(" ", this.mode.getNextLineIndent("start", " cde", " ")); assert.equal(" ", this.mode.getNextLineIndent("start", "function foo(items) {", " ")); }, "test: no indent after doc comments" : function() { assert.equal("", this.mode.getNextLineIndent("doc-start", " */", " ")); }, "test: trigger outdent if line is space and new text starts with closing brace" : function() { assert.ok(this.mode.checkOutdent("start", " ", " }")); assert.ok(!this.mode.checkOutdent("start", " a ", " }")); assert.ok(!this.mode.checkOutdent("start", "", "}")); assert.ok(!this.mode.checkOutdent("start", " ", "a }")); assert.ok(!this.mode.checkOutdent("start", " }", "}")); }, "test: auto outdent should indent the line with the same indent as the line with the matching opening brace" : function() { var session = new EditSession([" function foo() {", " bla", " }"], new JavaScriptMode()); this.mode.autoOutdent("start", session, 2); assert.equal(" }", session.getLine(2)); }, "test: no auto outdent if no matching brace is found" : function() { var session = new EditSession([" function foo()", " bla", " }"]); this.mode.autoOutdent("start", session, 2); assert.equal(" }", session.getLine(2)); } }; require("../test/run")(module); ================================================ FILE: src/mode/jexl.js ================================================ "use strict"; var oop = require("../lib/oop"); var JexlHighlightRules = require("./jexl_highlight_rules").JexlHighlightRules; var TextMode = require("./text").Mode; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { this.HighlightRules = JexlHighlightRules; this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function () { this.lineCommentStart = ["//", "##"]; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/jexl"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/jexl_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JexlHighlightRules = function () { var keywords = "return|var|function|and|or|not|if|for|while|do|continue|break"; var buildinConstants = "null"; var supportFunc = "empty|size|new"; var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "constant.language": buildinConstants, "support.function": supportFunc }, "identifier"); var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex "u[0-9a-fA-F]{4}|" + // unicode "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode "|.)"; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start": [ { token: "comment", regex: "\\/\\/.*$" }, { token: "comment", regex: "##.*$" }, { token: "comment", // multi line comment regex: "\\/\\*", next: "comment" }, { token: ["comment", "text"], regex: "(#pragma)(\\s.*$)" }, { token: "string", // single line regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token: "string", // single line regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token: "string", // multi line string regex: "`", push: [ { token: "constant.language.escape", regex: escapedRe }, { token: "string", regex: "`", next: "pop" }, { token: "lparen", //interpolation regex: "\\${", push: [ { token: "rparen", regex: "}", next: "pop" }, { include: "start" } ] }, { defaultToken: "string" } ] }, { token: "constant.numeric", // hex regex: /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/ }, { token: "constant.numeric", // float regex: /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/ }, { token: "constant.language.boolean", regex: "(?:true|false)\\b" }, { token: "string.regexp", regex: "~/", push: [ { token: "constant.language.escape", regex: "\\\\/" }, { token: "string.regexp", regex: "$|/", next: "pop" }, { defaultToken: "string.regexp" } ] }, { token: keywordMapper, regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token: "keyword.operator", regex: "&&|\\|\\||!|&|\\||\\^|~|\\?|:|\\?\\?|==|!=|<|<=|>|>=|=~|!~|=\\^|=\\$|!\\$|\\+|\\-|\\*|%|\\/|=" }, { token: "lparen", regex: "[[({]" }, { token: "rparen", regex: "[\\])}]" }, { token: "text", regex: "\\s+" }, { token: "punctuation", regex: "[,.]" }, { token: "storage.type.annotation", regex: "@[a-zA-Z_$][a-zA-Z0-9_$]*\\b" } ], "comment": [ { token: "comment", regex: "\\*\\/", next: "start" }, { defaultToken: "comment" } ] }; this.normalizeRules(); }; oop.inherits(JexlHighlightRules, TextHighlightRules); exports.JexlHighlightRules = JexlHighlightRules; ================================================ FILE: src/mode/js_regex_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var escape = "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"; var quantifier = "({\\d+\\b,?\\d*}|[+*?])(\\??)"; var JsRegexHighlightRules = function() { this.$rules = { "start": [{ // operators token : "keyword", regex: "\\\\[bB]", next: "no_quantifier" }, { token: "regexp.keyword.operator", regex: escape }, { // flag token: "string.regexp", regex: "/\\w*", next: "start" }, { token : ["string", "string.regex"], regex: quantifier, next: "no_quantifier" }, { // operators token : "keyword", regex: "[$^]|\\\\[bB]", next: "no_quantifier" }, { // operators token : "constant.language.escape", regex: /\(\?[:=!]|\)|[()$^+*?]/, next: "no_quantifier" }, { token : "constant.language.delimiter", regex: /\|/, next: "no_quantifier" }, { token: "constant.language.escape", regex: /\[\^?/, next: "character_class" }, { token: "empty", regex: "$", next: "start" } ], "character_class": [{ regex: /\\[dDwWsS]/ },{ token: "markup.list", regex: "(?:" + escape + "|.)-(?:[^\\]\\\\]|" + escape + ")" }, { token: "keyword", regex: escape }, { token: "constant.language.escape", regex: "]", next: "start" }, { token: "constant.language.escape", regex: "-" }, { token: "empty", regex: "$", next: "start" }, { defaultToken: "string.regexp.charachterclass" } ], "no_quantifier":[{ token: "invalid", regex: quantifier }, { token: "invalid", regex: "", next: "start" } ] }; }; oop.inherits(JsRegexHighlightRules, TextHighlightRules); exports.JsRegexHighlightRules = JsRegexHighlightRules; ================================================ FILE: src/mode/jsdoc_comment_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JsDocCommentHighlightRules = function() { this.$rules = { "start": [ { token: ["comment.doc.tag", "comment.doc.text", "lparen.doc"], regex: "(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)", push: [ { token: "lparen.doc", regex: "{", push: [ { include: "doc-syntax" }, { token: "rparen.doc", regex: "}|(?=$)", next: "pop" } ] }, { token: ["rparen.doc", "text.doc", "variable.parameter.doc", "lparen.doc", "variable.parameter.doc", "rparen.doc"], regex: /(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.\-\'\" ]+)(\])))/, next: "pop" }, { token: "rparen.doc", regex: "}|(?=$)", next: "pop" }, { include: "doc-syntax" }, { defaultToken: "text.doc" } ] }, { token: ["comment.doc.tag", "text.doc", "lparen.doc"], regex: "(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|" + "implements|external|exception|throws|enum|define|extends))(\\s*)({)", push: [ { token: "lparen.doc", regex: "{", push: [ { include: "doc-syntax" }, { token: "rparen.doc", regex: "}|(?=$)", next: "pop" } ] }, { token: "rparen.doc", regex: "}|(?=$)", next: "pop" }, { include: "doc-syntax" }, { defaultToken: "text.doc" } ] }, { token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"], regex: "(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|" + "requires|param|implements|function|extends|typedef|mixes|constructor|var|" + "memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|" + "throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#\.:\/~\"\\-]*)?" }, { token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"], regex: "(@method)(\\s+)(\\w[\\w\.\\(\\)]*)" }, { token: "comment.doc.tag", regex: "@access\\s+(?:private|public|protected)" }, { token: "comment.doc.tag", regex: "@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)" }, { token: "comment.doc.tag", regex: "@\\w+(?=\\s|$)" }, JsDocCommentHighlightRules.getTagRule(), { defaultToken: "comment.doc.body", caseInsensitive: true }], "doc-syntax": [{ token: "operator.doc", regex: /[|:]/ }, { token: "paren.doc", regex: /[\[\]]/ }] }; this.normalizeRules(); }; oop.inherits(JsDocCommentHighlightRules, TextHighlightRules); JsDocCommentHighlightRules.getTagRule = function(start) { return { token : "comment.doc.tag.storage.type", regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" }; }; JsDocCommentHighlightRules.getStartRule = function(start) { return { token : "comment.doc", // doc comment regex: /\/\*\*(?!\/)/, next : start }; }; JsDocCommentHighlightRules.getEndRule = function (start) { return { token : "comment.doc", // closing comment regex : "\\*\\/", next : start }; }; exports.JsDocCommentHighlightRules = JsDocCommentHighlightRules; ================================================ FILE: src/mode/json.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HighlightRules = require("./json_highlight_rules").JsonHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var WorkerClient = require("../worker/worker_client").WorkerClient; var Mode = function() { this.HighlightRules = HighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; 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); 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) { var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker"); 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/json"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/json5.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HighlightRules = require("./json5_highlight_rules").Json5HighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = HighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; 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/json5"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/json5_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var JsonHighlightRules = require("./json_highlight_rules").JsonHighlightRules; var Json5HighlightRules = function() { JsonHighlightRules.call(this); var startRules = [{ token : "variable", regex : /[a-zA-Z$_\u00a1-\uffff][\w$\u00a1-\uffff]*\s*(?=:)/ }, { token : "variable", regex : /['](?:(?:\\.)|(?:[^'\\]))*?[']\s*(?=:)/ }, { token : "constant.language.boolean", regex : /(?:null)\b/ }, { token : "string", regex : /'/, next : [{ token : "constant.language.escape", regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/, consumeLineEnd : true }, { token : "string", regex : /'|$/, next : "start" }, { defaultToken : "string" }] }, { token : "string", regex : /"(?![^"]*":)/, next : [{ token : "constant.language.escape", regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/, consumeLineEnd : true }, { token : "string", regex : /"|$/, next : "start" }, { defaultToken : "string" }] }, { token : "constant.numeric", regex : /[+-]?(?:Infinity|NaN)\b/ }]; for (var key in this.$rules) this.$rules[key].unshift.apply(this.$rules[key], startRules); this.normalizeRules(); }; oop.inherits(Json5HighlightRules, JsonHighlightRules); exports.Json5HighlightRules = Json5HighlightRules; ================================================ FILE: src/mode/json_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JsonHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "variable", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)' }, { token : "string", // single line regex : '"', next : "string" }, { 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 : "text", // single quoted strings are not allowed regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "comment", // comments are not allowed, but who cares? regex : "\\/\\/.*$" }, { token : "comment.start", // comments are not allowed, but who cares? regex : "\\/\\*", next : "comment" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "punctuation.operator", regex : /[,]/ }, { token : "text", regex : "\\s+" } ], "string" : [ { token : "constant.language.escape", regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/ }, { token : "string", regex : '"|$', next : "start" }, { defaultToken : "string" } ], "comment" : [ { token : "comment.end", // comments are not allowed, but who cares? regex : "\\*\\/", next : "start" }, { defaultToken: "comment" } ] }; }; oop.inherits(JsonHighlightRules, TextHighlightRules); exports.JsonHighlightRules = JsonHighlightRules; ================================================ FILE: src/mode/jsp.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var JspHighlightRules = require("./jsp_highlight_rules").JspHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = JspHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/jsp"; this.snippetFileId = "ace/snippets/jsp"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/jsp_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules; var JspHighlightRules = function() { HtmlHighlightRules.call(this); var builtinVariables = 'request|response|out|session|' + 'application|config|pageContext|page|Exception'; var keywords = 'page|include|taglib'; var startRules = [ { token : "comment", regex : "<%--", push : "jsp-dcomment" }, { token : "meta.tag", // jsp open tag regex : "<%@?|<%=?|<%!?|<jsp:[^>]+>", push : "jsp-start" } ]; var endRules = [ { token : "meta.tag", // jsp close tag regex : "%>|<\\/jsp:[^>]+>", next : "pop" }, { token: "variable.language", regex : builtinVariables }, { token: "keyword", regex : keywords } ]; for (var key in this.$rules) this.$rules[key].unshift.apply(this.$rules[key], startRules); this.embedRules(JavaHighlightRules, "jsp-", endRules, ["start"]); this.addRules({ "jsp-dcomment" : [{ token : "comment", regex : ".*?--%>", next : "pop" }] }); this.normalizeRules(); }; oop.inherits(JspHighlightRules, HtmlHighlightRules); exports.JspHighlightRules = JspHighlightRules; ================================================ FILE: src/mode/jssm.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var JSSMHighlightRules = require("./jssm_highlight_rules").JSSMHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = JSSMHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; // Extra logic goes here. this.$id = "ace/mode/jssm"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/jssm_highlight_rules.js ================================================ /* This file was autogenerated from ./jssm.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JSSMHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ token: "punctuation.definition.comment.mn", regex: /\/\*/, push: [{ token: "punctuation.definition.comment.mn", regex: /\*\//, next: "pop" }, { defaultToken: "comment.block.jssm" }], comment: "block comment" }, { token: "comment.line.jssm", regex: /\/\//, push: [{ token: "comment.line.jssm", regex: /$/, next: "pop" }, { defaultToken: "comment.line.jssm" }], comment: "block comment" }, { token: "entity.name.function", regex: /\${/, push: [{ token: "entity.name.function", regex: /}/, next: "pop" }, { defaultToken: "keyword.other" }], comment: "js outcalls" }, { token: "constant.numeric", regex: /[0-9]*\.[0-9]*\.[0-9]*/, comment: "semver" }, { token: "constant.language.jssmLanguage", regex: /graph_layout\s*:/, comment: "jssm language tokens" }, { token: "constant.language.jssmLanguage", regex: /machine_name\s*:/, comment: "jssm language tokens" }, { token: "constant.language.jssmLanguage", regex: /machine_version\s*:/, comment: "jssm language tokens" }, { token: "constant.language.jssmLanguage", regex: /jssm_version\s*:/, comment: "jssm language tokens" }, { token: "keyword.control.transition.jssmArrow.legal_legal", regex: /<->/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.legal_none", regex: /<-/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.none_legal", regex: /->/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.main_main", regex: /<=>/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.none_main", regex: /=>/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.main_none", regex: /<=/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.forced_forced", regex: /<~>/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.none_forced", regex: /~>/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.forced_none", regex: /<~/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.legal_main", regex: /<-=>/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.main_legal", regex: /<=->/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.legal_forced", regex: /<-~>/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.forced_legal", regex: /<~->/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.main_forced", regex: /<=~>/, comment: "transitions" }, { token: "keyword.control.transition.jssmArrow.forced_main", regex: /<~=>/, comment: "transitions" }, { token: "constant.numeric.jssmProbability", regex: /[0-9]+%/, comment: "edge probability annotation" }, { token: "constant.character.jssmAction", regex: /\'[^']*\'/, comment: "action annotation" }, { token: "entity.name.tag.jssmLabel.doublequoted", regex: /\"[^"]*\"/, comment: "jssm label annotation" }, { token: "entity.name.tag.jssmLabel.atom", regex: /[a-zA-Z0-9_.+&()#@!?,]/, comment: "jssm label annotation" }] }; this.normalizeRules(); }; JSSMHighlightRules.metaData = { fileTypes: ["jssm", "jssm_state"], name: "JSSM", scopeName: "source.jssm" }; oop.inherits(JSSMHighlightRules, TextHighlightRules); exports.JSSMHighlightRules = JSSMHighlightRules; ================================================ FILE: src/mode/jsx.js ================================================ "use strict"; var oop = require("../lib/oop"); var jsMode = require("./javascript").Mode; function Mode() { jsMode.call(this); this.$highlightRuleConfig = {jsx: true}; } oop.inherits(Mode, jsMode); (function() { // disable jshint this.createWorker = function() { return null; }; this.$id = "ace/mode/jsx"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/jsx_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var JsxHighlightRules = function () { JavaScriptHighlightRules.call(this, { jsx: true }); }; oop.inherits(JsxHighlightRules, JavaScriptHighlightRules); exports.JsxHighlightRules = JsxHighlightRules; ================================================ FILE: src/mode/julia.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var JuliaHighlightRules = require("./julia_highlight_rules").JuliaHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = JuliaHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.blockComment = ""; this.$id = "ace/mode/julia"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/julia_highlight_rules.js ================================================ /* This file was autogenerated from https://raw.github.com/JuliaLang/julia/master/contrib/Julia.tmbundle/Syntaxes/Julia.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JuliaHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { include: '#function_decl' }, { include: '#function_call' }, { include: '#type_decl' }, { include: '#keyword' }, { include: '#operator' }, { include: '#number' }, { include: '#string' }, { include: '#comment' } ], '#bracket': [ { token: 'keyword.bracket.julia', regex: '\\(|\\)|\\[|\\]|\\{|\\}|,' } ], '#comment': [ { token: [ 'punctuation.definition.comment.julia', 'comment.line.number-sign.julia' ], regex: '(#)(?!\\{)(.*$)'} ], '#function_call': [ { token: [ 'support.function.julia', 'text' ], regex: '([a-zA-Z0-9_]+!?)([\\w\\xff-\\u218e\\u2455-\\uffff]*\\()'} ], '#function_decl': [ { token: [ 'keyword.other.julia', 'meta.function.julia', 'entity.name.function.julia', 'meta.function.julia','text' ], regex: '(function|macro)(\\s*)([a-zA-Z0-9_\\{]+!?)([\\w\\xff-\\u218e\\u2455-\\uffff]*)([(\\\\{])'} ], '#keyword': [ { token: 'keyword.other.julia', regex: '\\b(?:function|type|immutable|macro|quote|abstract|bitstype|typealias|module|baremodule|new)\\b' }, { token: 'keyword.control.julia', regex: '\\b(?:if|else|elseif|while|for|in|begin|let|end|do|try|catch|finally|return|break|continue)\\b' }, { token: 'storage.modifier.variable.julia', regex: '\\b(?:global|local|const|export|import|importall|using)\\b' }, { token: 'variable.macro.julia', regex: '@[\\w\\xff-\\u218e\\u2455-\\uffff]+\\b' } ], '#number': [ { token: 'constant.numeric.julia', regex: '\\b0(?:x|X)[0-9a-fA-F]*|(?:\\b[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]*)?(?:im)?|\\bInf(?:32)?\\b|\\bNaN(?:32)?\\b|\\btrue\\b|\\bfalse\\b' } ], '#operator': [ { token: 'keyword.operator.update.julia', regex: '=|:=|\\+=|-=|\\*=|/=|//=|\\.//=|\\.\\*=|\\\\=|\\.\\\\=|^=|\\.^=|%=|\\|=|&=|\\$=|<<=|>>=' }, { token: 'keyword.operator.ternary.julia', regex: '\\?|:' }, { token: 'keyword.operator.boolean.julia', regex: '\\|\\||&&|!' }, { token: 'keyword.operator.arrow.julia', regex: '->|<-|-->' }, { token: 'keyword.operator.relation.julia', regex: '>|<|>=|<=|==|!=|\\.>|\\.<|\\.>=|\\.>=|\\.==|\\.!=|\\.=|\\.!|<:|:>' }, { token: 'keyword.operator.range.julia', regex: ':' }, { token: 'keyword.operator.shift.julia', regex: '<<|>>' }, { token: 'keyword.operator.bitwise.julia', regex: '\\||\\&|~' }, { token: 'keyword.operator.arithmetic.julia', regex: '\\+|-|\\*|\\.\\*|/|\\./|//|\\.//|%|\\.%|\\\\|\\.\\\\|\\^|\\.\\^' }, { token: 'keyword.operator.isa.julia', regex: '::' }, { token: 'keyword.operator.dots.julia', regex: '\\.(?=[a-zA-Z])|\\.\\.+' }, { token: 'keyword.operator.interpolation.julia', regex: '\\$#?(?=.)' }, { token: [ 'variable', 'keyword.operator.transposed-variable.julia' ], regex: '([\\w\\xff-\\u218e\\u2455-\\uffff]+)((?:\'|\\.\')*\\.?\')' }, { token: 'text', regex: '\\[|\\('}, { token: [ 'text', 'keyword.operator.transposed-matrix.julia' ], regex: "([\\]\\)])((?:'|\\.')*\\.?')"} ], '#string': [ { token: 'punctuation.definition.string.begin.julia', regex: '\'', push: [ { token: 'punctuation.definition.string.end.julia', regex: '\'', next: 'pop' }, { include: '#string_escaped_char' }, { defaultToken: 'string.quoted.single.julia' } ] }, { token: 'punctuation.definition.string.begin.julia', regex: '"', push: [ { token: 'punctuation.definition.string.end.julia', regex: '"', next: 'pop' }, { include: '#string_escaped_char' }, { defaultToken: 'string.quoted.double.julia' } ] }, { token: 'punctuation.definition.string.begin.julia', regex: '\\b[\\w\\xff-\\u218e\\u2455-\\uffff]+"', push: [ { token: 'punctuation.definition.string.end.julia', regex: '"[\\w\\xff-\\u218e\\u2455-\\uffff]*', next: 'pop' }, { include: '#string_custom_escaped_char' }, { defaultToken: 'string.quoted.custom-double.julia' } ] }, { token: 'punctuation.definition.string.begin.julia', regex: '`', push: [ { token: 'punctuation.definition.string.end.julia', regex: '`', next: 'pop' }, { include: '#string_escaped_char' }, { defaultToken: 'string.quoted.backtick.julia' } ] } ], '#string_custom_escaped_char': [ { token: 'constant.character.escape.julia', regex: '\\\\"' } ], '#string_escaped_char': [ { token: 'constant.character.escape.julia', regex: '\\\\(?:\\\\|[0-3]\\d{,2}|[4-7]\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}|.)' } ], '#type_decl': [ { token: [ 'keyword.control.type.julia', 'meta.type.julia', 'entity.name.type.julia', 'entity.other.inherited-class.julia', 'punctuation.separator.inheritance.julia', 'entity.other.inherited-class.julia' ], regex: '(type|immutable)(\\s+)([a-zA-Z0-9_]+)(?:(\\s*)(<:)(\\s*[.a-zA-Z0-9_:]+))?' }, { token: [ 'other.typed-variable.julia', 'support.type.julia' ], regex: '([a-zA-Z0-9_]+)(::[a-zA-Z0-9_{}]+)' } ] }; this.normalizeRules(); }; JuliaHighlightRules.metaData = { fileTypes: [ 'jl' ], firstLineMatch: '^#!.*\\bjulia\\s*$', foldingStartMarker: '^\\s*(?:if|while|for|begin|function|macro|module|baremodule|type|immutable|let)\\b(?!.*\\bend\\b).*$', foldingStopMarker: '^\\s*(?:end)\\b.*$', name: 'Julia', scopeName: 'source.julia' }; oop.inherits(JuliaHighlightRules, TextHighlightRules); exports.JuliaHighlightRules = JuliaHighlightRules; ================================================ FILE: src/mode/kotlin.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var KotlinHighlightRules = require("./kotlin_highlight_rules").KotlinHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = KotlinHighlightRules; 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/kotlin"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/kotlin_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var KotlinHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var keywordMapper = this.$keywords = this.createKeywordMapper({ "storage.modifier.kotlin": "var|val|public|private|protected|abstract|final|enum|open|attribute|" + "annotation|override|inline|var|val|vararg|lazy|in|out|internal|data|tailrec|operator|infix|const|" + "yield|typealias|typeof|sealed|inner|value|lateinit|external|suspend|noinline|crossinline|reified|" + "expect|actual", "keyword": "companion|class|object|interface|namespace|type|fun|constructor|if|else|while|for|do|return|when|" + "where|break|continue|try|catch|finally|throw|in|is|as|assert|constructor", "constant.language.kotlin": "true|false|null|this|super", "entity.name.function.kotlin": "get|set" }, "identifier"); this.$rules = { start: [{ include: "#comments" }, { token: [ "text", "keyword.other.kotlin", "text", "entity.name.package.kotlin", "text" ], regex: /^(\s*)(package)\b(?:(\s*)([^ ;$]+)(\s*))?/ }, { token: "comment", regex: /^\s*#!.*$/ }, { include: "#imports" }, { include: "#expressions" }, { token: "string", regex: /@[a-zA-Z][a-zA-Z:]*\b/ }, { token: ["keyword.other.kotlin", "text", "entity.name.variable.kotlin"], regex: /\b(var|val)(\s+)([a-zA-Z_][\w]*)\b/ }, { token: ["keyword.other.kotlin", "text", "entity.name.variable.kotlin", "paren.lparen"], regex: /(fun)(\s+)(\w+)(\()/, push: [{ token: ["variable.parameter.function.kotlin", "text", "keyword.operator"], regex: /(\w+)(\s*)(:)/ }, { token: "paren.rparen", regex: /\)/, next: "pop" }, { include: "#comments" }, { include: "#types" }, { include: "#expressions" }] }, { token: ["text", "keyword","text", "identifier"], regex: /^(\s*)(class)(\s*)([a-zA-Z]+)/, next: "#classes" }, { token: ["identifier", "punctuaction"], regex: /([a-zA-Z_][\w]*)(<)/, push: [{ include: "#generics" }, { include: "#defaultTypes" }, { token: "punctuation", regex: />/, next: "pop" }] }, { token: keywordMapper, regex: /[a-zA-Z_][\w]*\b/ }, { token: "paren.lparen", regex: /[{(\[]/ }, { token: "paren.rparen", regex: /[})\]]/ }], "#comments": [{ token: "comment", regex: /\/\*/, push: [{ token: "comment", regex: /\*\//, next: "pop" }, { defaultToken: "comment" }] }, { token: [ "text", "comment" ], regex: /(\s*)(\/\/.*$)/ }], "#constants": [{ token: "constant.numeric.kotlin", regex: /\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:(?:e|E)(?:\+|-)?[0-9]+)?)(?:[LlFfUuDd]|UL|ul)?\b/ }, { token: "constant.other.kotlin", regex: /\b[A-Z][A-Z0-9_]+\b/ }], "#expressions": [{ include: "#strings" }, { include: "#constants" }, { include: "#keywords" }], "#imports": [{ token: [ "text", "keyword.other.kotlin", "text", "keyword.other.kotlin" ], regex: /^(\s*)(import)(\s+[^ $]+\s+)((?:as)?)/ }], "#generics": [{ token: "punctuation", regex: /</, push: [{ token: "punctuation", regex: />/, next: "pop" }, { token: "storage.type.generic.kotlin", regex: /\w+/ }, { token: "keyword.operator", regex: /:/ }, { token: "punctuation", regex: /,/ }, { include: "#generics" }] }], "#classes": [{ include: "#generics" }, { token: "keyword", regex: /public|private|constructor/ }, { token: "string", regex: /@[a-zA-Z][a-zA-Z:]*\b/ }, { token: "text", regex: /(?=$|\(|{)/, next: "start" }], "#keywords": [{ token: "keyword.operator.kotlin", regex: /==|!=|===|!==|<=|>=|<|>|=>|->|::|\?:/ }, { token: "keyword.operator.assignment.kotlin", regex: /=/ }, { token: "keyword.operator.declaration.kotlin", regex: /:/, push: [{ token: "text", regex: /(?=$|{|=|,)/, next: "pop" }, { include: "#types" }] }, { token: "keyword.operator.dot.kotlin", regex: /\./ }, { token: "keyword.operator.increment-decrement.kotlin", regex: /\-\-|\+\+/ }, { token: "keyword.operator.arithmetic.kotlin", regex: /\-|\+|\*|\/|%/ }, { token: "keyword.operator.arithmetic.assign.kotlin", regex: /\+=|\-=|\*=|\/=/ }, { token: "keyword.operator.logical.kotlin", regex: /!|&&|\|\|/ }, { token: "keyword.operator.range.kotlin", regex: /\.\./ }, { token: "punctuation.kotlin", regex: /[;,]/ }], "#types": [{ include: "#defaultTypes" }, { token: "paren.lparen", regex: /\(/, push: [{ token: "paren.rparen", regex: /\)/, next: "pop" }, { include: "#defaultTypes" }, { token: "punctuation", regex: /,/ }] }, { include: "#generics" }, { token: "keyword.operator.declaration.kotlin", regex: /->/ }, { token: "paren.rparen", regex: /\)/ }, { token: "keyword.operator.declaration.kotlin", regex: /:/, push: [{ token: "text", regex: /(?=$|{|=|,)/, next: "pop" }, { include: "#types" }] }], "#defaultTypes": [{ token: "storage.type.buildin.kotlin", regex: /\b(Any|Unit|String|Int|Boolean|Char|Long|Double|Float|Short|Byte|dynamic|IntArray|BooleanArray|CharArray|LongArray|DoubleArray|FloatArray|ShortArray|ByteArray|Array|List|Map|Nothing|Enum|Throwable|Comparable)\b/ }], "#strings": [{ token: "string", regex: /"""/, push: [{ token: "string", regex: /"""/, next: "pop" }, { token: "variable.parameter.template.kotlin", regex: /\$\w+|\${[^}]+}/ }, { token: "constant.character.escape.kotlin", regex: /\\./ }, { defaultToken: "string" }] }, { token: "string", regex: /"/, push: [{ token: "string", regex: /"/, next: "pop" }, { token: "variable.parameter.template.kotlin", regex: /\$\w+|\$\{[^\}]+\}/ }, { token: "constant.character.escape.kotlin", regex: /\\./ }, { defaultToken: "string" }] }, { token: "string", regex: /'/, push: [{ token: "string", regex: /'/, next: "pop" }, { token: "constant.character.escape.kotlin", regex: /\\./ }, { defaultToken: "string" }] }, { token: "string", regex: /`/, push: [{ token: "string", regex: /`/, next: "pop" }, { defaultToken: "string" }] }] }; this.normalizeRules(); }; KotlinHighlightRules.metaData = { fileTypes: ["kt", "kts"], name: "Kotlin", scopeName: "source.Kotlin" }; oop.inherits(KotlinHighlightRules, TextHighlightRules); exports.KotlinHighlightRules = KotlinHighlightRules; ================================================ FILE: src/mode/latex.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var LatexHighlightRules = require("./latex_highlight_rules").LatexHighlightRules; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var LatexFoldMode = require("./folding/latex").FoldMode; var Mode = function() { this.HighlightRules = LatexHighlightRules; this.foldingRules = new LatexFoldMode(); this.$behaviour = new CstyleBehaviour({ braces: true }); }; oop.inherits(Mode, TextMode); (function() { this.type = "text"; this.lineCommentStart = "%"; this.$id = "ace/mode/latex"; this.getMatching = function(session, row, column) { if (row == undefined) row = session.selection.lead; if (typeof row == "object") { column = row.column; row = row.row; } var startToken = session.getTokenAt(row, column); if (!startToken) return; if (startToken.value == "\\begin" || startToken.value == "\\end") { return this.foldingRules.latexBlock(session, row, column, true); } }; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/latex_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LatexHighlightRules = function() { this.$rules = { "start" : [{ // A comment. Tex comments start with % and go to // the end of the line token : "comment", regex : "%.*$" }, { // Documentclass and usepackage token : ["keyword", "lparen", "variable.parameter", "rparen", "lparen", "storage.type", "rparen"], regex : "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})" }, { // A label token : ["keyword","lparen", "variable.parameter", "rparen"], regex : "(\\\\(?:label|v?ref|cite(?:[^{]*)))(?:({)([^}]*)(}))?" }, { // A Verbatim block token : ["storage.type", "lparen", "variable.parameter", "rparen"], regex : "(\\\\begin)({)(verbatim)(})", next : "verbatim" }, { token : ["storage.type", "lparen", "variable.parameter", "rparen"], regex : "(\\\\begin)({)(lstlisting)(})", next : "lstlisting" }, { // A block token : ["storage.type", "lparen", "variable.parameter", "rparen"], regex : "(\\\\(?:begin|end))({)([\\w*]*)(})" }, { token : "storage.type", regex : /\\verb\b\*?/, next : [{ token : ["keyword.operator", "string", "keyword.operator"], regex : "(.)(.*?)(\\1|$)|", next : "start" }] }, { // A tex command e.g. \foo token : "storage.type", regex : "\\\\[a-zA-Z]+" }, { // Curly and square braces token : "lparen", regex : "[[({]" }, { // Curly and square braces token : "rparen", regex : "[\\])}]" }, { // Escaped character (including new line) token : "constant.character.escape", regex : "\\\\[^a-zA-Z]?" }, { // An equation token : "string", regex : "\\${1,2}", next : "equation" }], "equation" : [{ token : "comment", regex : "%.*$" }, { token : "string", regex : "\\${1,2}", next : "start" }, { token : "constant.character.escape", regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)" }, { token : "error", regex : "^\\s*$", next : "start" }, { defaultToken : "string" }], "verbatim": [{ token : ["storage.type", "lparen", "variable.parameter", "rparen"], regex : "(\\\\end)({)(verbatim)(})", next : "start" }, { defaultToken : "text" }], "lstlisting": [{ token : ["storage.type", "lparen", "variable.parameter", "rparen"], regex : "(\\\\end)({)(lstlisting)(})", next : "start" }, { defaultToken : "text" }] }; this.normalizeRules(); }; oop.inherits(LatexHighlightRules, TextHighlightRules); exports.LatexHighlightRules = LatexHighlightRules; ================================================ FILE: src/mode/latte.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var LatteHighlightRules = require("./latte_highlight_rules").LatteHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { HtmlMode.call(this); this.HighlightRules = LatteHighlightRules; this.$outdent = new MatchingBraceOutdent(); }; oop.inherits(Mode, HtmlMode); (function() { this.blockComment = {start: "{*", end: "*}"}; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); if (state == "start") { var match = line.match(/^.*\{(?:if|else|elseif|ifset|elseifset|ifchanged|switch|case|foreach|iterateWhile|for|while|first|last|sep|try|capture|spaceless|snippet|block|define|embed|snippetArea)\b[^{]*$/); if (match) { indent += tab; } } return indent; }; this.checkOutdent = function(state, line, input) { return /^\s+\{\/$/.test(line + input); }; this.autoOutdent = function(state, doc, row) { }; this.$id = "ace/mode/latte"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/latte_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LatteHighlightRules = function() { // inherit from html HtmlHighlightRules.call(this); // add latte start tags to the HTML for (var rule in this.$rules) { this.$rules[rule].unshift( { token : "comment.start.latte", regex : "\\{\\*", push : [{ token : "comment.end.latte", regex : ".*\\*\\}", next : "pop" }, { defaultToken : "comment" }] }, { token : "meta.tag.punctuation.tag-open.latte", regex : "\\{(?![\\s'\"{}]|$)/?", push : [{ token : "meta.tag.latte", regex : "(?:_|=|[a-z]\\w*(?:[.:-]\\w+)*)?", next: [{ token : "meta.tag.punctuation.tag-close.latte", regex : "\\}", next : "pop" }, { include: "latte-content" }] }] }); } // add n:attribute to HTML tag this.$rules['tag_stuff'].unshift({ token : "meta.attribute.latte", regex : "n:[\\w-]+", next : [{ include: "tag_whitespace" }, { token : "keyword.operator.attribute-equals.xml", regex : "=", next : [{ token : "string.attribute-value.xml", regex : "'", next : [ {token : "string.attribute-value.xml", regex: "'", next: "tag_stuff"}, {include : "latte-content"} ] }, { token : "string.attribute-value.xml", regex : '"', next : [ {token : "string.attribute-value.xml", regex: '"', next: "tag_stuff"}, {include : "latte-content"} ] }, { token : "text.tag-whitespace.xml", regex : "\\s", next: "tag_stuff" }, { token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "tag_stuff" }, { include : "latte-content" }] }, { token : "empty", regex : "", next : "tag_stuff" }] }); // PHP content this.$rules["latte-content"] = [ { token : "comment.start.latte", // multi line comment regex : "\\/\\*", push : [ { token : "comment.end.latte", regex : "\\*\\/", next : "pop" }, { defaultToken : "comment" } ] }, { token : "string.start", // " string start regex : '"', push : [ { token : "constant.language.escape", regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})' }, { token : "variable", regex : /\$[\w]+(?:\[[\w\]+]|[=\-]>\w+)?/ }, { token : "variable", regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now }, {token : "string.end", regex : '"', next : "pop"}, {defaultToken : "string"} ] }, { token : "string.start", // ' string start regex : "'", push : [ {token : "constant.language.escape", regex : /\\['\\]/}, {token : "string.end", regex : "'", next : "pop"}, {defaultToken : "string"} ] }, { token : "keyword.control", regex : "\\b(?:INF|NAN|and|or|xor|AND|OR|XOR|clone|new|instanceof|return|continue|break|as)\\b" }, { token : "constant.language", regex : "\\b(?:true|false|null|TRUE|FALSE|NULL)\\b" }, { token : "variable", regex : /\$\w+/ }, { token : "constant.numeric", regex : "[+-]?[0-9]+(?:\\.[0-9]+)?(?:e[0-9]+)?" }, { token : ["support.class", "keyword.operator"], regex : "\\b(\\w+)(::)" }, { token : "constant.language", // constants regex : "\\b(?:[A-Z0-9_]+)\\b" }, { token : "string.unquoted", regex : "\\w+(?:-+\\w+)*" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "keyword.operator", regex : "::|=>|->|\\?->|\\?\\?->|\\+\\+|--|<<|>>|<=>|<=|>=|===|!==|==|!=|<>|&&|\\|\\||\\?\\?|\\?>|\\*\\*|\\.\\.\\.|[^'\"]" // =>, any char except quotes } ]; this.normalizeRules(); }; oop.inherits(LatteHighlightRules, TextHighlightRules); exports.LatteHighlightRules = LatteHighlightRules; ================================================ FILE: src/mode/less.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CssBehaviour = require("./behaviour/css").CssBehaviour; var CssCompletions = require("./css_completions").CssCompletions; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = LessHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CssBehaviour(); this.$completer = new CssCompletions(); 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); // ignore braces in comments var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } 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.getCompletions = function(state, session, pos, prefix) { // CSS completions only work with single (not nested) rulesets return this.$completer.getCompletions("ruleset", session, pos, prefix); }; this.$id = "ace/mode/less"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/less_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CssHighlightRules = require('./css_highlight_rules'); var LessHighlightRules = function() { var keywordList = "@import|@media|@font-face|@keyframes|@-webkit-keyframes|@supports|" + "@charset|@plugin|@namespace|@document|@page|@viewport|@-ms-viewport|" + "or|and|when|not"; var keywords = keywordList.split('|'); var properties = CssHighlightRules.supportType.split('|'); var keywordMapper = this.createKeywordMapper({ "support.constant": CssHighlightRules.supportConstant, "keyword": keywordList, "support.constant.color": CssHighlightRules.supportConstantColor, "support.constant.fonts": CssHighlightRules.supportConstantFonts }, "identifier", true); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : "\\/\\/.*$" }, { token : "comment", // multi line comment regex : "\\/\\*", next : "comment" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : ["constant.numeric", "keyword"], regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)" }, { token : "constant.numeric", // hex6 color regex : "#[a-f0-9]{6}" }, { token : "constant.numeric", // hex3 color regex : "#[a-f0-9]{3}" }, { token : "constant.numeric", regex : numRe }, { token : ["support.function", "paren.lparen", "string", "paren.rparen"], regex : "(url)(\\()(.*)(\\))" }, { token : ["support.function", "paren.lparen"], regex : "(:extend|[a-z0-9_\\-]+)(\\()" }, { token : function(value) { if (keywords.indexOf(value.toLowerCase()) > -1) return "keyword"; else return "variable"; }, regex : "[@\\$][a-z0-9_\\-@\\$]*\\b" }, { token : "variable", regex : "[@\\$]\\{[a-z0-9_\\-@\\$]*\\}" }, { token : function(first, second) { if(properties.indexOf(first.toLowerCase()) > -1) { return ["support.type.property", "text"]; } else { return ["support.type.unknownProperty", "text"]; } }, regex : "([a-z0-9-_]+)(\\s*:)" }, { token : "keyword", regex : "&" // special case - always treat as keyword }, { token : keywordMapper, regex : "\\-?[@a-z_][@a-z0-9_\\-]*" }, { token: "variable.language", regex: "#[a-z0-9-_]+" }, { token: "variable.language", regex: "\\.[a-z0-9-_]+" }, { token: "variable.language", regex: ":[a-z_][a-z0-9-_]*" }, { token: "constant", regex: "[a-z0-9-_]+" }, { token : "keyword.operator", regex : "<|>|<=|>=|=|!=|-|%|\\+|\\*" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" }, { caseInsensitive: true } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ] }; this.normalizeRules(); }; oop.inherits(LessHighlightRules, TextHighlightRules); exports.LessHighlightRules = LessHighlightRules; ================================================ FILE: src/mode/liquid.js ================================================ var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HtmlMode = require("./html").Mode; var JavascriptMode = require("./javascript").Mode; var JsonMode = require("./json").Mode; var CssMode = require("./css").Mode; var LiquidHighlightRules = require("./liquid_highlight_rules").LiquidHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; /* -------------------------------------------- */ /* FOLDS */ /* -------------------------------------------- */ var FoldMode = require("./folding/cstyle").FoldMode; /* -------------------------------------------- */ /* MODE */ /* -------------------------------------------- */ var Mode = function () { JsonMode.call(this); HtmlMode.call(this); CssMode.call(this); JavascriptMode.call(this); this.HighlightRules = LiquidHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function () { this.blockComment = {start: "<!--", end: "-->"}; this.voidElements = new HtmlMode().voidElements; 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; } } 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/liquid"; this.snippetFileId = "ace/snippets/liquid"; }.call(Mode.prototype)); exports.Mode = Mode; ================================================ FILE: src/mode/liquid_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var JsonHighlightRules = require("./json_highlight_rules").JsonHighlightRules; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var LiquidHighlightRules = function () { HtmlHighlightRules.call(this); /** * Embedded Matches * * Handles `onMatch` tokens and correct parses the * inner contents of the tag. */ function onMatchEmbedded(name) { const length = name.length; return function (value) { const idx = value.indexOf(name); const x = [ { type: "meta.tag.punctuation.tag-open", value: "{%" }, { type: "text", value: value.slice(2, idx) }, { type: "keyword.tag" + name + ".tag-name", value: value.slice(idx, idx + length) }, { type: "text", value: value.slice(idx + length, value.indexOf("%}")) }, { type: "meta.tag.punctuation.tag-close", value: "%}" } ]; return x; }; } for (var rule in this.$rules) { this.$rules[rule].unshift( { token: "comment.block", regex: /{%-?\s*comment\s*-?%}/, next: [ { token: "comment.block", regex: /{%-?\s*endcomment\s*-?%}/, next: "pop" }, { defaultToken: "comment", caseInsensitive: false } ] }, { token: "comment.line", regex: /{%-?\s*#/, next: [ { token: "comment.line", regex: /-?%}/, next: "pop" }, { defaultToken: "comment", caseInsensitive: false } ] }, { token: 'style.embedded.start', regex: /({%-?\s*\bstyle\b\s*-?%})/, next: "style-start", onMatch: onMatchEmbedded("style") }, { regex: /({%-?\s*\bstylesheet\b\s*-?%})/, next: "stylesheet-start", onMatch: onMatchEmbedded("stylesheet") }, { regex: /({%-?\s*\bschema\b\s*-?%})/, next: "schema-start", onMatch: onMatchEmbedded("schema") }, { regex: /({%-?\s*\bjavascript\b\s*-?%})/, next: "javascript-start", onMatch: onMatchEmbedded("javascript") }, { token: "meta.tag.punctuation.tag-open", regex: /({%)/, next: [ { token: "keyword.block", regex: /-?\s*[a-zA-Z_$][a-zA-Z0-9_$]+\b/, next: 'liquid-start' }, { token: "meta.tag.punctuation.tag-close", regex: /(-?)(%})/, next: "pop" } ] }, { token: "meta.tag.punctuation.ouput-open", regex: /({{)/, push: "liquid-start" } ); } /* -------------------------------------------- */ /* EMBEDDED REGIONS */ /* -------------------------------------------- */ this.embedRules(JsonHighlightRules, "schema-", [ { token: "schema-start", next: "pop", regex: /({%-?\s*\bendschema\b\s*-?%})/, onMatch: onMatchEmbedded("endschema") } ]); this.embedRules(JavaScriptHighlightRules, "javascript-", [ { token: "javascript-start", next: "pop", regex: /({%-?\s*\bendjavascript\b\s*-?%})/, onMatch: onMatchEmbedded("endjavascript") } ]); this.embedRules(CssHighlightRules, "style-", [ { token: "style-start", next: "pop", regex: /({%-?\s*\bendstyle\b\s*-?%})/, onMatch: onMatchEmbedded("endstyle") } ]); this.embedRules(CssHighlightRules, "stylesheet-", [ { token: "stylesheet-start", next: "pop", regex: /({%-?\s*\bendstylesheet\b\s*-?%})/, onMatch: onMatchEmbedded("endstylesheet") } ]); /* -------------------------------------------- */ /* LIQUID GRAMMARS */ /* -------------------------------------------- */ this.addRules({ "liquid-start": [ { token: "meta.tag.punctuation.ouput-close", regex: /}}/, next: "pop" }, { token: "meta.tag.punctuation.tag-close", regex: /%}/, next: "pop" }, { token: "string", regex: /['](?:(?:\\.)|(?:[^'\\]))*?[']/ }, { token: "string", regex: /["](?:(?:\\.)|(?:[^'\\]))*?["]/ }, { token: "constant.numeric", regex: /0[xX][0-9a-fA-F]+\b/ }, { token: "constant.numeric", regex: /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ }, { token: "keyword.operator", regex: /\*|\-|\+|=|!=|\?\|\:/ }, { token: "constant.language.boolean", regex: /(?:true|false|nil|empty)\b/ }, { token: "keyword.operator", regex: /\s+(?:and|contains|in|with)\b\s+/ }, { token: ["keyword.operator", "support.function"], regex: /(\|\s*)([a-zA-Z_]+)/ }, { token: "support.function", regex: /\s*([a-zA-Z_]+\b)(?=:)/ }, { token: "keyword.operator", regex: /(:)\s*(?=[a-zA-Z_])/ }, { token: [ "support.class", "keyword.operator", "support.object", "keyword.operator", "variable.parameter" ], regex: /(\w+)(\.)(\w+)(\.)?(\w+)?/ }, { token: "variable.parameter", regex: /\.([a-zA-Z_$][a-zA-Z0-9_$]*\b)$/ }, { token: "support.class", regex: /(?:additional_checkout_buttons|content_for_additional_checkout_buttons)\b/ }, { token: "paren.lparen", regex: /[\[\({]/ }, { token: "paren.rparen", regex: /[\])}]/ }, { token: "text", regex: /\s+/ } ] }); this.normalizeRules(); }; oop.inherits(LiquidHighlightRules, TextHighlightRules); exports.LiquidHighlightRules = LiquidHighlightRules; ================================================ FILE: src/mode/lisp.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var LispHighlightRules = require("./lisp_highlight_rules").LispHighlightRules; var Mode = function() { this.HighlightRules = LispHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.$id = "ace/mode/lisp"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/lisp_highlight_rules.js ================================================ /* THIS FILE WAS AUTOGENERATED BY Lisp.tmlanguage (UUID: 00D451C9-6B1D-11D9-8DFA-000D93589AF6) */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LispHighlightRules = function() { var keywordControl = "case|do|let|loop|if|else|when"; var keywordOperator = "eq|neq|and|or"; var constantLanguage = "null|nil"; var supportFunctions = "cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn"; var keywordMapper = this.createKeywordMapper({ "keyword.control": keywordControl, "keyword.operator": keywordOperator, "constant.language": constantLanguage, "support.function": supportFunctions }, "identifier", true); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start": [ { token : "comment", regex : ";.*$" }, { token: ["storage.type.function-type.lisp", "text", "entity.name.function.lisp"], regex: "(?:\\b(?:(defun|defmethod|defmacro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)" }, { token: ["punctuation.definition.constant.character.lisp", "constant.character.lisp"], regex: "(#)((?:\\w|[\\\\+-=<>'\"&#])+)" }, { token: ["punctuation.definition.variable.lisp", "variable.other.global.lisp", "punctuation.definition.variable.lisp"], regex: "(\\*)(\\S*)(\\*)" }, { 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 : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "string", regex : '"(?=.)', next : "qqstring" } ], "qqstring": [ { token: "constant.character.escape.lisp", regex: "\\\\." }, { token : "string", regex : '[^"\\\\]+' }, { token : "string", regex : "\\\\$", next : "qqstring" }, { token : "string", regex : '"|$', next : "start" } ] }; }; oop.inherits(LispHighlightRules, TextHighlightRules); exports.LispHighlightRules = LispHighlightRules; ================================================ FILE: src/mode/livescript.js ================================================ var identifier, LiveScriptMode, keywordend, stringfill; identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*'; exports.Mode = LiveScriptMode = (function(superclass){ var indenter, prototype = extend$((import$(LiveScriptMode, superclass).displayName = 'LiveScriptMode', LiveScriptMode), superclass).prototype, constructor = LiveScriptMode; function LiveScriptMode(){ var that; this.$tokenizer = new (require('../tokenizer')).Tokenizer(LiveScriptMode.Rules); if (that = require('../mode/matching_brace_outdent')) { this.$outdent = new that.MatchingBraceOutdent; } this.$id = "ace/mode/livescript"; this.$behaviour = new (require("./behaviour/cstyle").CstyleBehaviour)(); } indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$'); prototype.getNextLineIndent = function(state, line, tab){ var indent, tokens; indent = this.$getIndent(line); tokens = this.$tokenizer.getLineTokens(line, state).tokens; if (!(tokens.length && tokens[tokens.length - 1].type === 'comment')) { if (state === 'start' && indenter.test(line)) { indent += tab; } } return indent; }; prototype.lineCommentStart = "#"; prototype.blockComment = {start: "###", end: "###"}; prototype.checkOutdent = function(state, line, input){ var ref$; return (ref$ = this.$outdent) != null ? ref$.checkOutdent(line, input) : void 8; }; prototype.autoOutdent = function(state, doc, row){ var ref$; return (ref$ = this.$outdent) != null ? ref$.autoOutdent(doc, row) : void 8; }; return LiveScriptMode; }(require('../mode/text').Mode)); keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))'; stringfill = { defaultToken: 'string' }; 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: '[\\^!|&%+\\-]+' }, { token: 'text', regex: '\\s+' } ], heregex: [ { token: 'string.regex', regex: '.*?//[gimy$?]{0,4}', next: 'start' }, { token: 'string.regex', regex: '\\s*#{' }, { token: 'comment.regex', regex: '\\s+(?:#.*)?' }, { defaultToken: 'string.regex' } ], key: [ { token: 'keyword.operator', regex: '[.?@!]+' }, { token: 'identifier', regex: identifier, next: 'start' }, { token: 'text', regex: '', next: 'start' } ], comment: [ { token: 'comment.doc', regex: '.*?\\*/', next: 'start' }, { defaultToken: 'comment.doc' } ], 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 ] }; function extend$(sub, sup){ function fun(){} fun.prototype = (sub.superclass = sup).prototype; (sub.prototype = new fun).constructor = sub; if (typeof sup.extended == 'function') sup.extended(sub); return sub; } function import$(obj, src){ var own = {}.hasOwnProperty; for (var key in src) if (own.call(src, key)) obj[key] = src[key]; return obj; } ================================================ FILE: src/mode/logiql.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var LogiQLHighlightRules = require("./logiql_highlight_rules").LogiQLHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var TokenIterator = require("../token_iterator").TokenIterator; var Range = require("../range").Range; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { this.HighlightRules = LogiQLHighlightRules; this.foldingRules = new FoldMode(); this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; }; 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 (/comment|string/.test(endState)) return indent; if (tokens.length && tokens[tokens.length - 1].type == "comment.single") return indent; var match = line.match(); if (/(-->|<--|<-|->|{)\s*$/.test(line)) indent += tab; return indent; }; this.checkOutdent = function(state, line, input) { if (this.$outdent.checkOutdent(line, input)) return true; if (input !== "\n" && input !== "\r\n") return false; if (!/^\s+/.test(line)) return false; return true; }; this.autoOutdent = function(state, doc, row) { if (this.$outdent.autoOutdent(doc, row)) return; var prevLine = doc.getLine(row); var match = prevLine.match(/^\s+/); var column = prevLine.lastIndexOf(".") + 1; if (!match || !row || !column) return 0; var line = doc.getLine(row + 1); var startRange = this.getMatching(doc, {row: row, column: column}); if (!startRange || startRange.start.row == row) return 0; column = match[0].length; var indent = this.$getIndent(doc.getLine(startRange.start.row)); doc.replace(new Range(row + 1, 0, row + 1, column), indent); }; this.getMatching = function(session, row, column) { if (row == undefined) row = session.selection.lead; if (typeof row == "object") { column = row.column; row = row.row; } var startToken = session.getTokenAt(row, column); var KW_START = "keyword.start", KW_END = "keyword.end"; var tok; if (!startToken) return; if (startToken.type == KW_START) { var it = new TokenIterator(session, row, column); it.step = it.stepForward; } else if (startToken.type == KW_END) { var it = new TokenIterator(session, row, column); it.step = it.stepBackward; } else return; while (tok = it.step()) { if (tok.type == KW_START || tok.type == KW_END) break; } if (!tok || tok.type == startToken.type) return; var col = it.getCurrentTokenColumn(); var row = it.getCurrentTokenRow(); return new Range(row, col, row, col + tok.value.length); }; this.$id = "ace/mode/logiql"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/logiql_highlight_rules.js ================================================ /* THIS FILE WAS AUTOGENERATED FROM tool\LogicBlox.tmbundle\Syntaxes\LogicBlox.tmLanguage (UUID: 59bf5022-e261-453f-b1cb-9f9fa0712413) */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LogiQLHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'comment.block', regex: '/\\*', push: [ { token: 'comment.block', regex: '\\*/', next: 'pop' }, { defaultToken: 'comment.block' } ] //A block comment. }, { token: 'comment.single', regex: '//.*' //A single line comment. }, { token: 'constant.numeric', regex: '\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?[fd]?' //An integer constant. //Or a Real number. }, { token: 'string', regex: '"', push: [ { token: 'string', regex: '"', next: 'pop' }, { defaultToken: 'string' } ] //Strings }, { token: 'constant.language', regex: '\\b(true|false)\\b' //Boolean values. }, { token: 'entity.name.type.logicblox', regex: '`[a-zA-Z_:]+(\\d|\\a)*\\b' //LogicBlox Symbol }, { token: 'keyword.start', regex: '->', comment: 'Constraint' }, { token: 'keyword.start', regex: '-->', comment: 'Level 1 Constraint'}, { token: 'keyword.start', regex: '<-', comment: 'Rule' }, { token: 'keyword.start', regex: '<--', comment: 'Level 1 Rule' }, { token: 'keyword.end', regex: '\\.', comment: 'Terminator' }, { token: 'keyword.other', regex: '!', comment: 'Negation' }, { token: 'keyword.other', regex: ',', comment: 'Conjunction' }, { token: 'keyword.other', regex: ';', comment: 'Disjunction' }, { token: 'keyword.operator', regex: '<=|>=|!=|<|>', comment: 'Equality'}, { token: 'keyword.other', regex: '@', comment: 'Equality' }, { token: 'keyword.operator', regex: '\\+|-|\\*|/', comment: 'Arithmetic operations'}, { token: 'keyword', regex: '::', comment: 'Colon colon' }, { token: 'support.function', regex: '\\b(agg\\s*<<)', push: [ { include: '$self' }, { token: 'support.function', regex: '>>', next: 'pop' } ] //Aggregations }, { token: 'storage.modifier', regex: '\\b(lang:[\\w:]*)' //All the lang system predicates }, { token: [ 'storage.type', 'text' ], regex: '(export|sealed|clauses|block|alias|alias_all)(\\s*\\()(?=`)' //Module keywords }, { token: 'entity.name', regex: '[a-zA-Z_][a-zA-Z_0-9:]*(@prev|@init|@final)?(?=(\\(|\\[))' //A predicate name. }, { token: 'variable.parameter', regex: '([a-zA-Z][a-zA-Z_0-9]*|_)\\s*(?=(,|\\.|<-|->|\\)|\\]|=))' //A variable to a functional predicate. } ] }; this.normalizeRules(); }; oop.inherits(LogiQLHighlightRules, TextHighlightRules); exports.LogiQLHighlightRules = LogiQLHighlightRules; ================================================ FILE: src/mode/logiql_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var LogiQLMode = require("./logiql").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new LogiQLMode(); }, "test: toggle comment lines should prepend '//' to each line" : function() { var session = new EditSession([" abc", "cde", "fg"]); this.mode.toggleCommentLines("start", session, 0, 1); assert.equal(["// abc", "// cde", "fg"].join("\n"), session.toString()); }, "test: auto indent after ->" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", "parent(a, b) ->", " ")); }, "test: auto indent after <--" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", "foo <-- ", " ")); }, "test: no auto indent in multi line comment" : function() { assert.equal("", this.mode.getNextLineIndent("start", "/* -->", " ")); assert.equal(" ", this.mode.getNextLineIndent("start", " /* ->", " ")); assert.equal(" ", this.mode.getNextLineIndent("comment.block", " abcd", " ")); }, "test: no auto indent after -> in single line comment" : function() { assert.equal("", this.mode.getNextLineIndent("start", "//->", " ")); assert.equal(" ", this.mode.getNextLineIndent("start", " //->", " ")); }, "test: trigger outdent if line ends with ." : function() { assert.ok(this.mode.checkOutdent("start", " ", "\n")); assert.ok(this.mode.checkOutdent("start", " a ", "\r\n")); assert.ok(!this.mode.checkOutdent("start", "", "}")); assert.ok(!this.mode.checkOutdent("start", " ", "a }")); assert.ok(!this.mode.checkOutdent("start", " }", "}")); }, "test: auto outdent should indent the line with the same indent as the line with the matching ->" : function() { var session = new EditSession([" bar (a, b) ->", " foo(a)[1.2]", " bla.", " "], new LogiQLMode()); this.mode.autoOutdent("start", session, 2); assert.equal(" ", session.getLine(3)); }, "test: no auto outdent if no matching brace is found" : function() { var session = new EditSession([" bar (a, b) ->", " foo(a)[1.2].", " bla.", " "], new LogiQLMode()); this.mode.autoOutdent("start", session, 2); assert.equal(" ", session.getLine(3)); } }; require("../test/run")(module); ================================================ FILE: src/mode/logtalk.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var Tokenizer = require("../tokenizer").Tokenizer; var LogtalkHighlightRules = require("./logtalk_highlight_rules").LogtalkHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = LogtalkHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "%"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/logtalk"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/logtalk_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LogtalkHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'punctuation.definition.comment.logtalk', regex: '/\\*', push: [ { token: 'punctuation.definition.comment.logtalk', regex: '\\*/', next: 'pop' }, { defaultToken: 'comment.block.logtalk' } ] }, { todo: 'fix grouping', token: [ 'comment.line.percentage.logtalk', 'punctuation.definition.comment.logtalk' ], regex: '%.*$\\n?' }, { todo: 'fix grouping', token: [ 'storage.type.opening.logtalk', 'punctuation.definition.storage.type.logtalk' ], regex: ':-\\s(?:object|protocol|category|module)(?=[(])' }, { todo: 'fix grouping', token: [ 'storage.type.closing.logtalk', 'punctuation.definition.storage.type.logtalk' ], regex: ':-\\send_(?:object|protocol|category)(?=[.])' }, { caseInsensitive: false, token: 'storage.type.relations.logtalk', regex: '\\b(?:complements|extends|i(?:nstantiates|mp(?:orts|lements))|specializes)(?=[(])' }, { caseInsensitive: false, todo: 'fix grouping', token: [ 'storage.modifier.others.logtalk', 'punctuation.definition.storage.modifier.logtalk' ], regex: ':-\\s(?:e(?:lse|ndif)|built_in|dynamic|synchronized|threaded)(?=[.])' }, { caseInsensitive: false, todo: 'fix grouping', token: [ 'storage.modifier.others.logtalk', 'punctuation.definition.storage.modifier.logtalk' ], regex: ':-\\s(?:c(?:alls|oinductive)|e(?:lif|n(?:coding|sure_loaded)|xport)|i(?:f|n(?:clude|itialization|fo))|reexport|set_(?:logtalk|prolog)_flag|uses)(?=[(])' }, { caseInsensitive: false, todo: 'fix grouping', token: [ 'storage.modifier.others.logtalk', 'punctuation.definition.storage.modifier.logtalk' ], regex: ':-\\s(?:alias|info|d(?:ynamic|iscontiguous)|m(?:eta_(?:non_terminal|predicate)|ode|ultifile)|p(?:ublic|r(?:otected|ivate))|op|use(?:s|_module)|synchronized)(?=[(])' }, { token: 'keyword.operator.message-sending.logtalk', regex: '(:|::|\\^\\^)' }, { token: 'keyword.operator.external-call.logtalk', regex: '([{}])' }, { token: 'keyword.operator.mode.logtalk', regex: '(\\?|@)' }, { token: 'keyword.operator.comparison.term.logtalk', regex: '(@=<|@<|@>|@>=|==|\\\\==)' }, { token: 'keyword.operator.comparison.arithmetic.logtalk', regex: '(=<|<|>|>=|=:=|=\\\\=)' }, { token: 'keyword.operator.bitwise.logtalk', regex: '(<<|>>|/\\\\|\\\\/|\\\\)' }, { token: 'keyword.operator.evaluable.logtalk', regex: '\\b(?:e|pi|div|mod|rem)\\b(?![-!(^~])' }, { token: 'keyword.operator.evaluable.logtalk', regex: '(\\*\\*|\\+|-|\\*|/|//)' }, { token: 'keyword.operator.misc.logtalk', regex: '(:-|!|\\\\+|,|;|-->|->|=|\\=|\\.|=\\.\\.|\\^|\\bas\\b|\\bis\\b)' }, { caseInsensitive: false, token: 'support.function.evaluable.logtalk', regex: '\\b(a(bs|cos|sin|tan|tan2)|c(eiling|os)|div|exp|flo(at(_(integer|fractional)_part)?|or)|log|m(ax|in|od)|r(em|ound)|s(i(n|gn)|qrt)|t(an|runcate)|xor)(?=[(])' }, { token: 'support.function.control.logtalk', regex: '\\b(?:true|fa(?:il|lse)|repeat|(?:instantiation|system)_error)\\b(?![-!(^~])' }, { token: 'support.function.control.logtalk', regex: '\\b((?:uninstantiation|type|domain|existence|permission|representation|evaluation|resource|syntax)_error)(?=[(])' }, { token: 'support.function.control.logtalk', regex: '\\b(?:ca(?:ll|tch)|ignore|throw|once)(?=[(])' }, { token: 'support.function.chars-and-bytes-io.logtalk', regex: '\\b(?:(?:get|p(?:eek|ut))_(c(?:har|ode)|byte)|nl)(?=[(])' }, { token: 'support.function.chars-and-bytes-io.logtalk', regex: '\\bnl\\b' }, { token: 'support.function.atom-term-processing.logtalk', regex: '\\b(?:atom_(?:length|c(?:hars|o(?:ncat|des)))|sub_atom|char_code|number_c(?:har|ode)s)(?=[(])' }, { caseInsensitive: false, token: 'support.function.term-testing.logtalk', regex: '\\b(?:var|atom(ic)?|integer|float|c(?:allable|ompound)|n(?:onvar|umber)|ground|acyclic_term)(?=[(])' }, { token: 'support.function.term-comparison.logtalk', regex: '\\b(compare)(?=[(])' }, { token: 'support.function.term-io.logtalk', regex: '\\b(?:read(_term)?|write(?:q|_(?:canonical|term))?|(current_)?(?:char_conversion|op))(?=[(])' }, { caseInsensitive: false, token: 'support.function.term-creation-and-decomposition.logtalk', regex: '\\b(arg|copy_term|functor|numbervars|term_variables)(?=[(])' }, { caseInsensitive: false, token: 'support.function.term-unification.logtalk', regex: '\\b(subsumes_term|unify_with_occurs_check)(?=[(])' }, { caseInsensitive: false, token: 'support.function.stream-selection-and-control.logtalk', regex: '\\b(?:(?:se|curren)t_(?:in|out)put|open|close|flush_output|stream_property|at_end_of_stream|set_stream_position)(?=[(])' }, { token: 'support.function.stream-selection-and-control.logtalk', regex: '\\b(?:flush_output|at_end_of_stream)\\b' }, { token: 'support.function.prolog-flags.logtalk', regex: '\\b((?:se|curren)t_prolog_flag)(?=[(])' }, { token: 'support.function.compiling-and-loading.logtalk', regex: '\\b(logtalk_(?:compile|l(?:ibrary_path|oad|oad_context)|make(_target_action)?))(?=[(])' }, { token: 'support.function.compiling-and-loading.logtalk', regex: '\\b(logtalk_make)\\b' }, { caseInsensitive: false, token: 'support.function.event-handling.logtalk', regex: '\\b(?:(?:abolish|define)_events|current_event)(?=[(])' }, { token: 'support.function.implementation-defined-hooks.logtalk', regex: '\\b(?:(?:create|current|set)_logtalk_flag|halt)(?=[(])' }, { token: 'support.function.implementation-defined-hooks.logtalk', regex: '\\b(halt)\\b' }, { token: 'support.function.sorting.logtalk', regex: '\\b((key)?(sort))(?=[(])' }, { caseInsensitive: false, token: 'support.function.entity-creation-and-abolishing.logtalk', regex: '\\b((c(?:reate|urrent)|abolish)_(?:object|protocol|category))(?=[(])' }, { caseInsensitive: false, token: 'support.function.reflection.logtalk', regex: '\\b((object|protocol|category)_property|co(mplements_object|nforms_to_protocol)|extends_(object|protocol|category)|imp(orts_category|lements_protocol)|(instantiat|specializ)es_class)(?=[(])' }, { token: 'support.function.logtalk', regex: '\\b((?:for|retract)all)(?=[(])' }, { caseInsensitive: false, token: 'support.function.execution-context.logtalk', regex: '\\b(?:context|parameter|se(?:lf|nder)|this)(?=[(])' }, { token: 'support.function.database.logtalk', regex: '\\b(?:a(?:bolish|ssert(?:a|z))|clause|retract(all)?)(?=[(])' }, { token: 'support.function.all-solutions.logtalk', regex: '\\b((?:bag|set)of|f(?:ind|or)all)(?=[(])' }, { caseInsensitive: false, token: 'support.function.multi-threading.logtalk', regex: '\\b(threaded(_(ca(?:ll|ncel)|once|ignore|exit|peek|wait|notify))?)(?=[(])' }, { caseInsensitive: false, token: 'support.function.engines.logtalk', regex: '\\b(threaded_engine(_(create|destroy|self|next(?:_reified)?|yield|post|fetch))?)(?=[(])' }, { caseInsensitive: false, token: 'support.function.reflection.logtalk', regex: '\\b(?:current_predicate|predicate_property)(?=[(])' }, { token: 'support.function.event-handler.logtalk', regex: '\\b(?:before|after)(?=[(])' }, { token: 'support.function.message-forwarding-handler.logtalk', regex: '\\b(forward)(?=[(])' }, { token: 'support.function.grammar-rule.logtalk', regex: '\\b(?:expand_(?:goal|term)|(?:goal|term)_expansion|phrase)(?=[(])' }, { token: 'punctuation.definition.string.begin.logtalk', regex: '\'', push: [ { token: 'constant.character.escape.logtalk', regex: '\\\\([\\\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\\\)' }, { token: 'punctuation.definition.string.end.logtalk', regex: '\'', next: 'pop' }, { defaultToken: 'string.quoted.single.logtalk' } ] }, { token: 'punctuation.definition.string.begin.logtalk', regex: '"', push: [ { token: 'constant.character.escape.logtalk', regex: '\\\\([\\\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\\\)' }, { token: 'punctuation.definition.string.end.logtalk', regex: '"', next: 'pop' }, { defaultToken: 'string.quoted.double.logtalk' } ] }, { token: 'constant.numeric.logtalk', regex: '\\b(0b[0-1]+|0o[0-7]+|0x[0-9a-fA-F]+)\\b' }, { token: 'constant.numeric.logtalk', regex: '\\b(0\'\\\\.|0\'.|0\'\'|0\'")' }, { token: 'constant.numeric.logtalk', regex: '\\b(\\d+\\.?\\d*((e|E)(\\+|-)?\\d+)?)\\b' }, { token: 'variable.other.logtalk', regex: '\\b([A-Z_][A-Za-z0-9_]*)\\b' } ] }; this.normalizeRules(); }; oop.inherits(LogtalkHighlightRules, TextHighlightRules); exports.LogtalkHighlightRules = LogtalkHighlightRules; ================================================ FILE: src/mode/lsl.js ================================================ "use strict"; var Rules = require("./lsl_highlight_rules").LSLHighlightRules; var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent; var TextMode = require("./text").Mode; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var oop = require("../lib/oop"); var Mode = function() { this.HighlightRules = Rules; this.$outdent = new Outdent(); this.$behaviour = this.$defaultBehaviour; 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.block.lsl") { 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.$id = "ace/mode/lsl"; this.snippetFileId = "ace/snippets/lsl"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/lsl_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; oop.inherits(LSLHighlightRules, TextHighlightRules); function LSLHighlightRules() { var keywordMapper = this.createKeywordMapper({ "constant.language.float.lsl" : "DEG_TO_RAD|PI|PI_BY_TWO|RAD_TO_DEG|SQRT2|TWO_PI", "constant.language.integer.lsl": "ACTIVE|AGENT|AGENT_ALWAYS_RUN|AGENT_ATTACHMENTS|AGENT_AUTOPILOT|AGENT_AWAY|AGENT_BUSY|AGENT_BY_LEGACY_NAME|AGENT_BY_USERNAME|AGENT_CROUCHING|AGENT_FLYING|AGENT_IN_AIR|AGENT_LIST_PARCEL|AGENT_LIST_PARCEL_OWNER|AGENT_LIST_REGION|AGENT_MOUSELOOK|AGENT_ON_OBJECT|AGENT_SCRIPTED|AGENT_SITTING|AGENT_TYPING|AGENT_WALKING|ALL_SIDES|ANIM_ON|ATTACH_AVATAR_CENTER|ATTACH_BACK|ATTACH_BELLY|ATTACH_CHEST|ATTACH_CHIN|ATTACH_HEAD|ATTACH_HUD_BOTTOM|ATTACH_HUD_BOTTOM_LEFT|ATTACH_HUD_BOTTOM_RIGHT|ATTACH_HUD_CENTER_1|ATTACH_HUD_CENTER_2|ATTACH_HUD_TOP_CENTER|ATTACH_HUD_TOP_LEFT|ATTACH_HUD_TOP_RIGHT|ATTACH_LEAR|ATTACH_LEFT_PEC|ATTACH_LEYE|ATTACH_LFOOT|ATTACH_LHAND|ATTACH_LHIP|ATTACH_LLARM|ATTACH_LLLEG|ATTACH_LSHOULDER|ATTACH_LUARM|ATTACH_LULEG|ATTACH_MOUTH|ATTACH_NECK|ATTACH_NOSE|ATTACH_PELVIS|ATTACH_REAR|ATTACH_REYE|ATTACH_RFOOT|ATTACH_RHAND|ATTACH_RHIP|ATTACH_RIGHT_PEC|ATTACH_RLARM|ATTACH_RLLEG|ATTACH_RSHOULDER|ATTACH_RUARM|ATTACH_RULEG|AVOID_CHARACTERS|AVOID_DYNAMIC_OBSTACLES|AVOID_NONE|CAMERA_ACTIVE|CAMERA_BEHINDNESS_ANGLE|CAMERA_BEHINDNESS_LAG|CAMERA_DISTANCE|CAMERA_FOCUS|CAMERA_FOCUS_LAG|CAMERA_FOCUS_LOCKED|CAMERA_FOCUS_OFFSET|CAMERA_FOCUS_THRESHOLD|CAMERA_PITCH|CAMERA_POSITION|CAMERA_POSITION_LAG|CAMERA_POSITION_LOCKED|CAMERA_POSITION_THRESHOLD|CHANGED_ALLOWED_DROP|CHANGED_COLOR|CHANGED_INVENTORY|CHANGED_LINK|CHANGED_MEDIA|CHANGED_OWNER|CHANGED_REGION|CHANGED_REGION_START|CHANGED_SCALE|CHANGED_SHAPE|CHANGED_TELEPORT|CHANGED_TEXTURE|CHARACTER_ACCOUNT_FOR_SKIPPED_FRAMES|CHARACTER_AVOIDANCE_MODE|CHARACTER_CMD_JUMP|CHARACTER_CMD_SMOOTH_STOP|CHARACTER_CMD_STOP|CHARACTER_DESIRED_SPEED|CHARACTER_DESIRED_TURN_SPEED|CHARACTER_LENGTH|CHARACTER_MAX_ACCEL|CHARACTER_MAX_DECEL|CHARACTER_MAX_SPEED|CHARACTER_MAX_TURN_RADIUS|CHARACTER_ORIENTATION|CHARACTER_RADIUS|CHARACTER_STAY_WITHIN_PARCEL|CHARACTER_TYPE|CHARACTER_TYPE_A|CHARACTER_TYPE_B|CHARACTER_TYPE_C|CHARACTER_TYPE_D|CHARACTER_TYPE_NONE|CLICK_ACTION_BUY|CLICK_ACTION_NONE|CLICK_ACTION_OPEN|CLICK_ACTION_OPEN_MEDIA|CLICK_ACTION_PAY|CLICK_ACTION_PLAY|CLICK_ACTION_SIT|CLICK_ACTION_TOUCH|CONTENT_TYPE_ATOM|CONTENT_TYPE_FORM|CONTENT_TYPE_HTML|CONTENT_TYPE_JSON|CONTENT_TYPE_LLSD|CONTENT_TYPE_RSS|CONTENT_TYPE_TEXT|CONTENT_TYPE_XHTML|CONTENT_TYPE_XML|CONTROL_BACK|CONTROL_DOWN|CONTROL_FWD|CONTROL_LBUTTON|CONTROL_LEFT|CONTROL_ML_LBUTTON|CONTROL_RIGHT|CONTROL_ROT_LEFT|CONTROL_ROT_RIGHT|CONTROL_UP|DATA_BORN|DATA_NAME|DATA_ONLINE|DATA_PAYINFO|DATA_SIM_POS|DATA_SIM_RATING|DATA_SIM_STATUS|DEBUG_CHANNEL|DENSITY|ERR_GENERIC|ERR_MALFORMED_PARAMS|ERR_PARCEL_PERMISSIONS|ERR_RUNTIME_PERMISSIONS|ERR_THROTTLED|ESTATE_ACCESS_ALLOWED_AGENT_ADD|ESTATE_ACCESS_ALLOWED_AGENT_REMOVE|ESTATE_ACCESS_ALLOWED_GROUP_ADD|ESTATE_ACCESS_ALLOWED_GROUP_REMOVE|ESTATE_ACCESS_BANNED_AGENT_ADD|ESTATE_ACCESS_BANNED_AGENT_REMOVE|FALSE|FORCE_DIRECT_PATH|FRICTION|GCNP_RADIUS|GCNP_STATIC|GRAVITY_MULTIPLIER|HORIZONTAL|HTTP_BODY_MAXLENGTH|HTTP_BODY_TRUNCATED|HTTP_CUSTOM_HEADER|HTTP_METHOD|HTTP_MIMETYPE|HTTP_PRAGMA_NO_CACHE|HTTP_VERBOSE_THROTTLE|HTTP_VERIFY_CERT|INVENTORY_ALL|INVENTORY_ANIMATION|INVENTORY_BODYPART|INVENTORY_CLOTHING|INVENTORY_GESTURE|INVENTORY_LANDMARK|INVENTORY_NONE|INVENTORY_NOTECARD|INVENTORY_OBJECT|INVENTORY_SCRIPT|INVENTORY_SOUND|INVENTORY_TEXTURE|JSON_APPEND|KFM_CMD_PAUSE|KFM_CMD_PLAY|KFM_CMD_SET_MODE|KFM_CMD_STOP|KFM_COMMAND|KFM_DATA|KFM_FORWARD|KFM_LOOP|KFM_MODE|KFM_PING_PONG|KFM_REVERSE|KFM_ROTATION|KFM_TRANSLATION|LAND_LEVEL|LAND_LOWER|LAND_NOISE|LAND_RAISE|LAND_REVERT|LAND_SMOOTH|LINK_ALL_CHILDREN|LINK_ALL_OTHERS|LINK_ROOT|LINK_SET|LINK_THIS|LIST_STAT_GEOMETRIC_MEAN|LIST_STAT_MAX|LIST_STAT_MEAN|LIST_STAT_MEDIAN|LIST_STAT_MIN|LIST_STAT_NUM_COUNT|LIST_STAT_RANGE|LIST_STAT_STD_DEV|LIST_STAT_SUM|LIST_STAT_SUM_SQUARES|LOOP|MASK_BASE|MASK_EVERYONE|MASK_GROUP|MASK_NEXT|MASK_OWNER|OBJECT_ATTACHED_POINT|OBJECT_BODY_SHAPE_TYPE|OBJECT_CHARACTER_TIME|OBJECT_CLICK_ACTION|OBJECT_CREATOR|OBJECT_DESC|OBJECT_GROUP|OBJECT_HOVER_HEIGHT|OBJECT_LAST_OWNER_ID|OBJECT_NAME|OBJECT_OWNER|OBJECT_PATHFINDING_TYPE|OBJECT_PHANTOM|OBJECT_PHYSICS|OBJECT_PHYSICS_COST|OBJECT_POS|OBJECT_PRIM_EQUIVALENCE|OBJECT_RENDER_WEIGHT|OBJECT_RETURN_PARCEL|OBJECT_RETURN_PARCEL_OWNER|OBJECT_RETURN_REGION|OBJECT_ROOT|OBJECT_ROT|OBJECT_RUNNING_SCRIPT_COUNT|OBJECT_SCRIPT_MEMORY|OBJECT_SCRIPT_TIME|OBJECT_SERVER_COST|OBJECT_STREAMING_COST|OBJECT_TEMP_ON_REZ|OBJECT_TOTAL_SCRIPT_COUNT|OBJECT_UNKNOWN_DETAIL|OBJECT_VELOCITY|OPT_AVATAR|OPT_CHARACTER|OPT_EXCLUSION_VOLUME|OPT_LEGACY_LINKSET|OPT_MATERIAL_VOLUME|OPT_OTHER|OPT_STATIC_OBSTACLE|OPT_WALKABLE|PARCEL_COUNT_GROUP|PARCEL_COUNT_OTHER|PARCEL_COUNT_OWNER|PARCEL_COUNT_SELECTED|PARCEL_COUNT_TEMP|PARCEL_COUNT_TOTAL|PARCEL_DETAILS_AREA|PARCEL_DETAILS_DESC|PARCEL_DETAILS_GROUP|PARCEL_DETAILS_ID|PARCEL_DETAILS_NAME|PARCEL_DETAILS_OWNER|PARCEL_DETAILS_SEE_AVATARS|PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY|PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS|PARCEL_FLAG_ALLOW_CREATE_OBJECTS|PARCEL_FLAG_ALLOW_DAMAGE|PARCEL_FLAG_ALLOW_FLY|PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY|PARCEL_FLAG_ALLOW_GROUP_SCRIPTS|PARCEL_FLAG_ALLOW_LANDMARK|PARCEL_FLAG_ALLOW_SCRIPTS|PARCEL_FLAG_ALLOW_TERRAFORM|PARCEL_FLAG_LOCAL_SOUND_ONLY|PARCEL_FLAG_RESTRICT_PUSHOBJECT|PARCEL_FLAG_USE_ACCESS_GROUP|PARCEL_FLAG_USE_ACCESS_LIST|PARCEL_FLAG_USE_BAN_LIST|PARCEL_FLAG_USE_LAND_PASS_LIST|PARCEL_MEDIA_COMMAND_AGENT|PARCEL_MEDIA_COMMAND_AUTO_ALIGN|PARCEL_MEDIA_COMMAND_DESC|PARCEL_MEDIA_COMMAND_LOOP|PARCEL_MEDIA_COMMAND_LOOP_SET|PARCEL_MEDIA_COMMAND_PAUSE|PARCEL_MEDIA_COMMAND_PLAY|PARCEL_MEDIA_COMMAND_SIZE|PARCEL_MEDIA_COMMAND_STOP|PARCEL_MEDIA_COMMAND_TEXTURE|PARCEL_MEDIA_COMMAND_TIME|PARCEL_MEDIA_COMMAND_TYPE|PARCEL_MEDIA_COMMAND_UNLOAD|PARCEL_MEDIA_COMMAND_URL|PASS_ALWAYS|PASS_IF_NOT_HANDLED|PASS_NEVER|PASSIVE|PATROL_PAUSE_AT_WAYPOINTS|PAYMENT_INFO_ON_FILE|PAYMENT_INFO_USED|PAY_DEFAULT|PAY_HIDE|PERMISSION_ATTACH|PERMISSION_CHANGE_LINKS|PERMISSION_CONTROL_CAMERA|PERMISSION_DEBIT|PERMISSION_OVERRIDE_ANIMATIONS|PERMISSION_RETURN_OBJECTS|PERMISSION_SILENT_ESTATE_MANAGEMENT|PERMISSION_TAKE_CONTROLS|PERMISSION_TELEPORT|PERMISSION_TRACK_CAMERA|PERMISSION_TRIGGER_ANIMATION|PERM_ALL|PERM_COPY|PERM_MODIFY|PERM_MOVE|PERM_TRANSFER|PING_PONG|PRIM_ALPHA_MODE|PRIM_ALPHA_MODE_BLEND|PRIM_ALPHA_MODE_EMISSIVE|PRIM_ALPHA_MODE_MASK|PRIM_ALPHA_MODE_NONE|PRIM_BUMP_BARK|PRIM_BUMP_BLOBS|PRIM_BUMP_BRICKS|PRIM_BUMP_BRIGHT|PRIM_BUMP_CHECKER|PRIM_BUMP_CONCRETE|PRIM_BUMP_DARK|PRIM_BUMP_DISKS|PRIM_BUMP_GRAVEL|PRIM_BUMP_LARGETILE|PRIM_BUMP_NONE|PRIM_BUMP_SHINY|PRIM_BUMP_SIDING|PRIM_BUMP_STONE|PRIM_BUMP_STUCCO|PRIM_BUMP_SUCTION|PRIM_BUMP_TILE|PRIM_BUMP_WEAVE|PRIM_BUMP_WOOD|PRIM_COLOR|PRIM_DESC|PRIM_FLEXIBLE|PRIM_FULLBRIGHT|PRIM_GLOW|PRIM_HOLE_CIRCLE|PRIM_HOLE_DEFAULT|PRIM_HOLE_SQUARE|PRIM_HOLE_TRIANGLE|PRIM_LINK_TARGET|PRIM_MATERIAL|PRIM_MATERIAL_FLESH|PRIM_MATERIAL_GLASS|PRIM_MATERIAL_METAL|PRIM_MATERIAL_PLASTIC|PRIM_MATERIAL_RUBBER|PRIM_MATERIAL_STONE|PRIM_MATERIAL_WOOD|PRIM_MEDIA_ALT_IMAGE_ENABLE|PRIM_MEDIA_AUTO_LOOP|PRIM_MEDIA_AUTO_PLAY|PRIM_MEDIA_AUTO_SCALE|PRIM_MEDIA_AUTO_ZOOM|PRIM_MEDIA_CONTROLS|PRIM_MEDIA_CONTROLS_MINI|PRIM_MEDIA_CONTROLS_STANDARD|PRIM_MEDIA_CURRENT_URL|PRIM_MEDIA_FIRST_CLICK_INTERACT|PRIM_MEDIA_HEIGHT_PIXELS|PRIM_MEDIA_HOME_URL|PRIM_MEDIA_MAX_HEIGHT_PIXELS|PRIM_MEDIA_MAX_URL_LENGTH|PRIM_MEDIA_MAX_WHITELIST_COUNT|PRIM_MEDIA_MAX_WHITELIST_SIZE|PRIM_MEDIA_MAX_WIDTH_PIXELS|PRIM_MEDIA_PARAM_MAX|PRIM_MEDIA_PERMS_CONTROL|PRIM_MEDIA_PERMS_INTERACT|PRIM_MEDIA_PERM_ANYONE|PRIM_MEDIA_PERM_GROUP|PRIM_MEDIA_PERM_NONE|PRIM_MEDIA_PERM_OWNER|PRIM_MEDIA_WHITELIST|PRIM_MEDIA_WHITELIST_ENABLE|PRIM_MEDIA_WIDTH_PIXELS|PRIM_NAME|PRIM_NORMAL|PRIM_OMEGA|PRIM_PHANTOM|PRIM_PHYSICS|PRIM_PHYSICS_SHAPE_CONVEX|PRIM_PHYSICS_SHAPE_NONE|PRIM_PHYSICS_SHAPE_PRIM|PRIM_PHYSICS_SHAPE_TYPE|PRIM_POINT_LIGHT|PRIM_POSITION|PRIM_POS_LOCAL|PRIM_ROTATION|PRIM_ROT_LOCAL|PRIM_SCULPT_FLAG_INVERT|PRIM_SCULPT_FLAG_MIRROR|PRIM_SCULPT_TYPE_CYLINDER|PRIM_SCULPT_TYPE_MASK|PRIM_SCULPT_TYPE_PLANE|PRIM_SCULPT_TYPE_SPHERE|PRIM_SCULPT_TYPE_TORUS|PRIM_SHINY_HIGH|PRIM_SHINY_LOW|PRIM_SHINY_MEDIUM|PRIM_SHINY_NONE|PRIM_SIZE|PRIM_SLICE|PRIM_SPECULAR|PRIM_TEMP_ON_REZ|PRIM_TEXGEN|PRIM_TEXGEN_DEFAULT|PRIM_TEXGEN_PLANAR|PRIM_TEXT|PRIM_TEXTURE|PRIM_TYPE|PRIM_TYPE_BOX|PRIM_TYPE_CYLINDER|PRIM_TYPE_PRISM|PRIM_TYPE_RING|PRIM_TYPE_SCULPT|PRIM_TYPE_SPHERE|PRIM_TYPE_TORUS|PRIM_TYPE_TUBE|PROFILE_NONE|PROFILE_SCRIPT_MEMORY|PSYS_PART_BF_DEST_COLOR|PSYS_PART_BF_ONE|PSYS_PART_BF_ONE_MINUS_DEST_COLOR|PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA|PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR|PSYS_PART_BF_SOURCE_ALPHA|PSYS_PART_BF_SOURCE_COLOR|PSYS_PART_BF_ZERO|PSYS_PART_BLEND_FUNC_DEST|PSYS_PART_BLEND_FUNC_SOURCE|PSYS_PART_BOUNCE_MASK|PSYS_PART_EMISSIVE_MASK|PSYS_PART_END_ALPHA|PSYS_PART_END_COLOR|PSYS_PART_END_GLOW|PSYS_PART_END_SCALE|PSYS_PART_FLAGS|PSYS_PART_FOLLOW_SRC_MASK|PSYS_PART_FOLLOW_VELOCITY_MASK|PSYS_PART_INTERP_COLOR_MASK|PSYS_PART_INTERP_SCALE_MASK|PSYS_PART_MAX_AGE|PSYS_PART_RIBBON_MASK|PSYS_PART_START_ALPHA|PSYS_PART_START_COLOR|PSYS_PART_START_GLOW|PSYS_PART_START_SCALE|PSYS_PART_TARGET_LINEAR_MASK|PSYS_PART_TARGET_POS_MASK|PSYS_PART_WIND_MASK|PSYS_SRC_ACCEL|PSYS_SRC_ANGLE_BEGIN|PSYS_SRC_ANGLE_END|PSYS_SRC_BURST_PART_COUNT|PSYS_SRC_BURST_RADIUS|PSYS_SRC_BURST_RATE|PSYS_SRC_BURST_SPEED_MAX|PSYS_SRC_BURST_SPEED_MIN|PSYS_SRC_MAX_AGE|PSYS_SRC_OMEGA|PSYS_SRC_PATTERN|PSYS_SRC_PATTERN_ANGLE|PSYS_SRC_PATTERN_ANGLE_CONE|PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY|PSYS_SRC_PATTERN_DROP|PSYS_SRC_PATTERN_EXPLODE|PSYS_SRC_TARGET_KEY|PSYS_SRC_TEXTURE|PUBLIC_CHANNEL|PURSUIT_FUZZ_FACTOR|PURSUIT_GOAL_TOLERANCE|PURSUIT_INTERCEPT|PURSUIT_OFFSET|PU_EVADE_HIDDEN|PU_EVADE_SPOTTED|PU_FAILURE_DYNAMIC_PATHFINDING_DISABLED|PU_FAILURE_INVALID_GOAL|PU_FAILURE_INVALID_START|PU_FAILURE_NO_NAVMESH|PU_FAILURE_NO_VALID_DESTINATION|PU_FAILURE_OTHER|PU_FAILURE_PARCEL_UNREACHABLE|PU_FAILURE_TARGET_GONE|PU_FAILURE_UNREACHABLE|PU_GOAL_REACHED|PU_SLOWDOWN_DISTANCE_REACHED|RCERR_CAST_TIME_EXCEEDED|RCERR_SIM_PERF_LOW|RCERR_UNKNOWN|RC_DATA_FLAGS|RC_DETECT_PHANTOM|RC_GET_LINK_NUM|RC_GET_NORMAL|RC_GET_ROOT_KEY|RC_MAX_HITS|RC_REJECT_AGENTS|RC_REJECT_LAND|RC_REJECT_NONPHYSICAL|RC_REJECT_PHYSICAL|RC_REJECT_TYPES|REGION_FLAG_ALLOW_DAMAGE|REGION_FLAG_ALLOW_DIRECT_TELEPORT|REGION_FLAG_BLOCK_FLY|REGION_FLAG_BLOCK_TERRAFORM|REGION_FLAG_DISABLE_COLLISIONS|REGION_FLAG_DISABLE_PHYSICS|REGION_FLAG_FIXED_SUN|REGION_FLAG_RESTRICT_PUSHOBJECT|REGION_FLAG_SANDBOX|REMOTE_DATA_CHANNEL|REMOTE_DATA_REPLY|REMOTE_DATA_REQUEST|REQUIRE_LINE_OF_SIGHT|RESTITUTION|REVERSE|ROTATE|SCALE|SCRIPTED|SIM_STAT_PCT_CHARS_STEPPED|SMOOTH|STATUS_BLOCK_GRAB|STATUS_BLOCK_GRAB_OBJECT|STATUS_BOUNDS_ERROR|STATUS_CAST_SHADOWS|STATUS_DIE_AT_EDGE|STATUS_INTERNAL_ERROR|STATUS_MALFORMED_PARAMS|STATUS_NOT_FOUND|STATUS_NOT_SUPPORTED|STATUS_OK|STATUS_PHANTOM|STATUS_PHYSICS|STATUS_RETURN_AT_EDGE|STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z|STATUS_SANDBOX|STATUS_TYPE_MISMATCH|STATUS_WHITELIST_FAILED|STRING_TRIM|STRING_TRIM_HEAD|STRING_TRIM_TAIL|TOUCH_INVALID_FACE|TRAVERSAL_TYPE|TRAVERSAL_TYPE_FAST|TRAVERSAL_TYPE_NONE|TRAVERSAL_TYPE_SLOW|TRUE|TYPE_FLOAT|TYPE_INTEGER|TYPE_INVALID|TYPE_KEY|TYPE_ROTATION|TYPE_STRING|TYPE_VECTOR|VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY|VEHICLE_ANGULAR_DEFLECTION_TIMESCALE|VEHICLE_ANGULAR_FRICTION_TIMESCALE|VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE|VEHICLE_ANGULAR_MOTOR_DIRECTION|VEHICLE_ANGULAR_MOTOR_TIMESCALE|VEHICLE_BANKING_EFFICIENCY|VEHICLE_BANKING_MIX|VEHICLE_BANKING_TIMESCALE|VEHICLE_BUOYANCY|VEHICLE_FLAG_CAMERA_DECOUPLED|VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT|VEHICLE_FLAG_HOVER_TERRAIN_ONLY|VEHICLE_FLAG_HOVER_UP_ONLY|VEHICLE_FLAG_HOVER_WATER_ONLY|VEHICLE_FLAG_LIMIT_MOTOR_UP|VEHICLE_FLAG_LIMIT_ROLL_ONLY|VEHICLE_FLAG_MOUSELOOK_BANK|VEHICLE_FLAG_MOUSELOOK_STEER|VEHICLE_FLAG_NO_DEFLECTION_UP|VEHICLE_HOVER_EFFICIENCY|VEHICLE_HOVER_HEIGHT|VEHICLE_HOVER_TIMESCALE|VEHICLE_LINEAR_DEFLECTION_EFFICIENCY|VEHICLE_LINEAR_DEFLECTION_TIMESCALE|VEHICLE_LINEAR_FRICTION_TIMESCALE|VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE|VEHICLE_LINEAR_MOTOR_DIRECTION|VEHICLE_LINEAR_MOTOR_OFFSET|VEHICLE_LINEAR_MOTOR_TIMESCALE|VEHICLE_REFERENCE_FRAME|VEHICLE_TYPE_AIRPLANE|VEHICLE_TYPE_BALLOON|VEHICLE_TYPE_BOAT|VEHICLE_TYPE_CAR|VEHICLE_TYPE_NONE|VEHICLE_TYPE_SLED|VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY|VEHICLE_VERTICAL_ATTRACTION_TIMESCALE|VERTICAL|WANDER_PAUSE_AT_WAYPOINTS|XP_ERROR_EXPERIENCES_DISABLED|XP_ERROR_EXPERIENCE_DISABLED|XP_ERROR_EXPERIENCE_SUSPENDED|XP_ERROR_INVALID_EXPERIENCE|XP_ERROR_INVALID_PARAMETERS|XP_ERROR_KEY_NOT_FOUND|XP_ERROR_MATURITY_EXCEEDED|XP_ERROR_NONE|XP_ERROR_NOT_FOUND|XP_ERROR_NOT_PERMITTED|XP_ERROR_NO_EXPERIENCE|XP_ERROR_QUOTA_EXCEEDED|XP_ERROR_RETRY_UPDATE|XP_ERROR_STORAGE_EXCEPTION|XP_ERROR_STORE_DISABLED|XP_ERROR_THROTTLED|XP_ERROR_UNKNOWN_ERROR", "constant.language.integer.boolean.lsl" : "FALSE|TRUE", "constant.language.quaternion.lsl" : "ZERO_ROTATION", "constant.language.string.lsl" : "EOF|JSON_ARRAY|JSON_DELETE|JSON_FALSE|JSON_INVALID|JSON_NULL|JSON_NUMBER|JSON_OBJECT|JSON_STRING|JSON_TRUE|NULL_KEY|TEXTURE_BLANK|TEXTURE_DEFAULT|TEXTURE_MEDIA|TEXTURE_PLYWOOD|TEXTURE_TRANSPARENT|URL_REQUEST_DENIED|URL_REQUEST_GRANTED", "constant.language.vector.lsl" : "TOUCH_INVALID_TEXCOORD|TOUCH_INVALID_VECTOR|ZERO_VECTOR", "invalid.broken.lsl": "LAND_LARGE_BRUSH|LAND_MEDIUM_BRUSH|LAND_SMALL_BRUSH", "invalid.deprecated.lsl" : "ATTACH_LPEC|ATTACH_RPEC|DATA_RATING|OBJECT_ATTACHMENT_GEOMETRY_BYTES|OBJECT_ATTACHMENT_SURFACE_AREA|PRIM_CAST_SHADOWS|PRIM_MATERIAL_LIGHT|PRIM_TYPE_LEGACY|PSYS_SRC_INNERANGLE|PSYS_SRC_OUTERANGLE|VEHICLE_FLAG_NO_FLY_UP|llClearExperiencePermissions|llCloud|llGetExperienceList|llMakeExplosion|llMakeFire|llMakeFountain|llMakeSmoke|llRemoteDataSetRegion|llSound|llSoundPreload|llXorBase64Strings|llXorBase64StringsCorrect", "invalid.illegal.lsl": "event", "invalid.unimplemented.lsl": "CHARACTER_MAX_ANGULAR_ACCEL|CHARACTER_MAX_ANGULAR_SPEED|CHARACTER_TURN_SPEED_MULTIPLIER|PERMISSION_CHANGE_JOINTS|PERMISSION_CHANGE_PERMISSIONS|PERMISSION_EXPERIENCE|PERMISSION_RELEASE_OWNERSHIP|PERMISSION_REMAP_CONTROLS|PRIM_PHYSICS_MATERIAL|PSYS_SRC_OBJ_REL_MASK|llCollisionSprite|llPointAt|llRefreshPrimURL|llReleaseCamera|llRemoteLoadScript|llSetPrimURL|llStopPointAt|llTakeCamera", "reserved.godmode.lsl": "llGodLikeRezObject|llSetInventoryPermMask|llSetObjectPermMask", "reserved.log.lsl" : "print", "keyword.control.lsl" : "do|else|for|if|jump|return|while", "storage.type.lsl" : "float|integer|key|list|quaternion|rotation|string|vector", "support.function.lsl": "llAbs|llAcos|llAddToLandBanList|llAddToLandPassList|llAdjustSoundVolume|llAgentInExperience|llAllowInventoryDrop|llAngleBetween|llApplyImpulse|llApplyRotationalImpulse|llAsin|llAtan2|llAttachToAvatar|llAttachToAvatarTemp|llAvatarOnLinkSitTarget|llAvatarOnSitTarget|llAxes2Rot|llAxisAngle2Rot|llBase64ToInteger|llBase64ToString|llBreakAllLinks|llBreakLink|llCSV2List|llCastRay|llCeil|llClearCameraParams|llClearLinkMedia|llClearPrimMedia|llCloseRemoteDataChannel|llCollisionFilter|llCollisionSound|llCos|llCreateCharacter|llCreateKeyValue|llCreateLink|llDataSizeKeyValue|llDeleteCharacter|llDeleteKeyValue|llDeleteSubList|llDeleteSubString|llDetachFromAvatar|llDetectedGrab|llDetectedGroup|llDetectedKey|llDetectedLinkNumber|llDetectedName|llDetectedOwner|llDetectedPos|llDetectedRot|llDetectedTouchBinormal|llDetectedTouchFace|llDetectedTouchNormal|llDetectedTouchPos|llDetectedTouchST|llDetectedTouchUV|llDetectedType|llDetectedVel|llDialog|llDie|llDumpList2String|llEdgeOfWorld|llEjectFromLand|llEmail|llEscapeURL|llEuler2Rot|llEvade|llExecCharacterCmd|llFabs|llFleeFrom|llFloor|llForceMouselook|llFrand|llGenerateKey|llGetAccel|llGetAgentInfo|llGetAgentLanguage|llGetAgentList|llGetAgentSize|llGetAlpha|llGetAndResetTime|llGetAnimation|llGetAnimationList|llGetAnimationOverride|llGetAttached|llGetAttachedList|llGetBoundingBox|llGetCameraPos|llGetCameraRot|llGetCenterOfMass|llGetClosestNavPoint|llGetColor|llGetCreator|llGetDate|llGetDisplayName|llGetEnergy|llGetEnv|llGetExperienceDetails|llGetExperienceErrorMessage|llGetForce|llGetFreeMemory|llGetFreeURLs|llGetGMTclock|llGetGeometricCenter|llGetHTTPHeader|llGetInventoryCreator|llGetInventoryKey|llGetInventoryName|llGetInventoryNumber|llGetInventoryPermMask|llGetInventoryType|llGetKey|llGetLandOwnerAt|llGetLinkKey|llGetLinkMedia|llGetLinkName|llGetLinkNumber|llGetLinkNumberOfSides|llGetLinkPrimitiveParams|llGetListEntryType|llGetListLength|llGetLocalPos|llGetLocalRot|llGetMass|llGetMassMKS|llGetMaxScaleFactor|llGetMemoryLimit|llGetMinScaleFactor|llGetNextEmail|llGetNotecardLine|llGetNumberOfNotecardLines|llGetNumberOfPrims|llGetNumberOfSides|llGetObjectDesc|llGetObjectDetails|llGetObjectMass|llGetObjectName|llGetObjectPermMask|llGetObjectPrimCount|llGetOmega|llGetOwner|llGetOwnerKey|llGetParcelDetails|llGetParcelFlags|llGetParcelMaxPrims|llGetParcelMusicURL|llGetParcelPrimCount|llGetParcelPrimOwners|llGetPermissions|llGetPermissionsKey|llGetPhysicsMaterial|llGetPos|llGetPrimMediaParams|llGetPrimitiveParams|llGetRegionAgentCount|llGetRegionCorner|llGetRegionFPS|llGetRegionFlags|llGetRegionName|llGetRegionTimeDilation|llGetRootPosition|llGetRootRotation|llGetRot|llGetSPMaxMemory|llGetScale|llGetScriptName|llGetScriptState|llGetSimStats|llGetSimulatorHostname|llGetStartParameter|llGetStaticPath|llGetStatus|llGetSubString|llGetSunDirection|llGetTexture|llGetTextureOffset|llGetTextureRot|llGetTextureScale|llGetTime|llGetTimeOfDay|llGetTimestamp|llGetTorque|llGetUnixTime|llGetUsedMemory|llGetUsername|llGetVel|llGetWallclock|llGiveInventory|llGiveInventoryList|llGiveMoney|llGround|llGroundContour|llGroundNormal|llGroundRepel|llGroundSlope|llHTTPRequest|llHTTPResponse|llInsertString|llInstantMessage|llIntegerToBase64|llJson2List|llJsonGetValue|llJsonSetValue|llJsonValueType|llKey2Name|llKeyCountKeyValue|llKeysKeyValue|llLinkParticleSystem|llLinkSitTarget|llList2CSV|llList2Float|llList2Integer|llList2Json|llList2Key|llList2List|llList2ListStrided|llList2Rot|llList2String|llList2Vector|llListFindList|llListInsertList|llListRandomize|llListReplaceList|llListSort|llListStatistics|llListen|llListenControl|llListenRemove|llLoadURL|llLog|llLog10|llLookAt|llLoopSound|llLoopSoundMaster|llLoopSoundSlave|llMD5String|llManageEstateAccess|llMapDestination|llMessageLinked|llMinEventDelay|llModPow|llModifyLand|llMoveToTarget|llNavigateTo|llOffsetTexture|llOpenRemoteDataChannel|llOverMyLand|llOwnerSay|llParcelMediaCommandList|llParcelMediaQuery|llParseString2List|llParseStringKeepNulls|llParticleSystem|llPassCollisions|llPassTouches|llPatrolPoints|llPlaySound|llPlaySoundSlave|llPow|llPreloadSound|llPursue|llPushObject|llReadKeyValue|llRegionSay|llRegionSayTo|llReleaseControls|llReleaseURL|llRemoteDataReply|llRemoteLoadScriptPin|llRemoveFromLandBanList|llRemoveFromLandPassList|llRemoveInventory|llRemoveVehicleFlags|llRequestAgentData|llRequestDisplayName|llRequestExperiencePermissions|llRequestInventoryData|llRequestPermissions|llRequestSecureURL|llRequestSimulatorData|llRequestURL|llRequestUsername|llResetAnimationOverride|llResetLandBanList|llResetLandPassList|llResetOtherScript|llResetScript|llResetTime|llReturnObjectsByID|llReturnObjectsByOwner|llRezAtRoot|llRezObject|llRot2Angle|llRot2Axis|llRot2Euler|llRot2Fwd|llRot2Left|llRot2Up|llRotBetween|llRotLookAt|llRotTarget|llRotTargetRemove|llRotateTexture|llRound|llSHA1String|llSameGroup|llSay|llScaleByFactor|llScaleTexture|llScriptDanger|llScriptProfiler|llSendRemoteData|llSensor|llSensorRemove|llSensorRepeat|llSetAlpha|llSetAngularVelocity|llSetAnimationOverride|llSetBuoyancy|llSetCameraAtOffset|llSetCameraEyeOffset|llSetCameraParams|llSetClickAction|llSetColor|llSetContentType|llSetDamage|llSetForce|llSetForceAndTorque|llSetHoverHeight|llSetKeyframedMotion|llSetLinkAlpha|llSetLinkCamera|llSetLinkColor|llSetLinkMedia|llSetLinkPrimitiveParams|llSetLinkPrimitiveParamsFast|llSetLinkTexture|llSetLinkTextureAnim|llSetLocalRot|llSetMemoryLimit|llSetObjectDesc|llSetObjectName|llSetParcelMusicURL|llSetPayPrice|llSetPhysicsMaterial|llSetPos|llSetPrimMediaParams|llSetPrimitiveParams|llSetRegionPos|llSetRemoteScriptAccessPin|llSetRot|llSetScale|llSetScriptState|llSetSitText|llSetSoundQueueing|llSetSoundRadius|llSetStatus|llSetText|llSetTexture|llSetTextureAnim|llSetTimerEvent|llSetTorque|llSetTouchText|llSetVehicleFlags|llSetVehicleFloatParam|llSetVehicleRotationParam|llSetVehicleType|llSetVehicleVectorParam|llSetVelocity|llShout|llSin|llSitTarget|llSleep|llSqrt|llStartAnimation|llStopAnimation|llStopHover|llStopLookAt|llStopMoveToTarget|llStopSound|llStringLength|llStringToBase64|llStringTrim|llSubStringIndex|llTakeControls|llTan|llTarget|llTargetOmega|llTargetRemove|llTeleportAgent|llTeleportAgentGlobalCoords|llTeleportAgentHome|llTextBox|llToLower|llToUpper|llTransferLindenDollars|llTriggerSound|llTriggerSoundLimited|llUnSit|llUnescapeURL|llUpdateCharacter|llUpdateKeyValue|llVecDist|llVecMag|llVecNorm|llVolumeDetect|llWanderWithin|llWater|llWhisper|llWind|llXorBase64", "support.function.event.lsl" : "at_rot_target|at_target|attach|changed|collision|collision_end|collision_start|control|dataserver|email|experience_permissions|experience_permissions_denied|http_request|http_response|land_collision|land_collision_end|land_collision_start|link_message|listen|money|moving_end|moving_start|no_sensor|not_at_rot_target|not_at_target|object_rez|on_rez|path_update|remote_data|run_time_permissions|sensor|state_entry|state_exit|timer|touch|touch_end|touch_start|transaction_result" }, "identifier"); this.$rules = { "start" : [ { token : "comment.line.double-slash.lsl", regex : "\\/\\/.*$" }, { token : "comment.block.begin.lsl", regex : "\\/\\*", next : "comment" }, { token : "string.quoted.double.lsl", start : '"', end : '"', next : [{ token : "constant.character.escape.lsl", regex : /\\[tn"\\]/ }] }, { token : "constant.numeric.lsl", regex : "(0[xX][0-9a-fA-F]+|[+-]?[0-9]+(?:(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?)?)\\b" }, { token : "entity.name.state.lsl", regex : "\\b((state)\\s+[A-Za-z_]\\w*|default)\\b" }, { token : keywordMapper, regex : "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b" }, { token : "support.function.user-defined.lsl", regex : /\b([a-zA-Z_]\w*)(?=\(.*?\))/ }, { token : "keyword.operator.lsl", regex : "\\+\\+|\\-\\-|<<|>>|&&?|\\|\\|?|\\^|~|[!%<>=*+\\-\\/]=?" }, { token : "invalid.illegal.keyword.operator.lsl", regex : ":=?" }, { token : "punctuation.operator.lsl", regex : "\\,|\\;" }, { token : "paren.lparen.lsl", regex : "[\\[\\(\\{]" }, { token : "paren.rparen.lsl", regex : "[\\]\\)\\}]" }, { token : "text.lsl", regex : "\\s+" } ], "comment" : [ { token : "comment.block.end.lsl", regex : "\\*\\/", next : "start" }, { defaultToken : "comment.block.lsl" } ] }; this.normalizeRules(); } exports.LSLHighlightRules = LSLHighlightRules; ================================================ FILE: src/mode/lua.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules; var LuaFoldMode = require("./folding/lua").FoldMode; var Range = require("../range").Range; var WorkerClient = require("../worker/worker_client").WorkerClient; var Mode = function() { this.HighlightRules = LuaHighlightRules; this.foldingRules = new LuaFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "--[[", end: "--]]"}; var indentKeywords = { "function": 1, "then": 1, "do": 1, "else": 1, "elseif": 1, "repeat": 1, "end": -1, "until": -1 }; var outdentKeywords = [ "else", "elseif", "end", "until" ]; function getNetIndentLevel(tokens) { var level = 0; // Support single-line blocks by decrementing the indent level if // an ending token is found for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; if (token.type == "keyword") { if (token.value in indentKeywords) { level += indentKeywords[token.value]; } } else if (token.type == "paren.lparen") { level += token.value.length; } else if (token.type == "paren.rparen") { level -= token.value.length; } } // Limit the level to +/- 1 since usually users only indent one level // at a time regardless of the logical nesting level if (level < 0) { return -1; } else if (level > 0) { return 1; } else { return 0; } } this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); var level = 0; var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (state == "start") { level = getNetIndentLevel(tokens); } if (level > 0) { return indent + tab; } else if (level < 0 && indent.substr(indent.length - tab.length) == tab) { // Don't do a next-line outdent if we're going to do a real outdent of this line if (!this.checkOutdent(state, line, "\n")) { return indent.substr(0, indent.length - tab.length); } } return indent; }; this.checkOutdent = function(state, line, input) { if (input != "\n" && input != "\r" && input != "\r\n") return false; if (line.match(/^\s*[\)\}\]]$/)) return true; var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens || !tokens.length) return false; return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1); }; this.getMatching = function(session, row, column) { if (row == undefined) { var pos = session.selection.lead; column = pos.column; row = pos.row; } var startToken = session.getTokenAt(row, column); if (startToken && startToken.value in indentKeywords) return this.foldingRules.luaBlock(session, row, column, true); }; this.autoOutdent = function(state, session, row) { var line = session.getLine(row); var column = line.match(/^\s*/)[0].length; if (!column || !row) return; var startRange = this.getMatching(session, row, column + 1); if (!startRange || startRange.start.row == row) return; var indent = this.$getIndent(session.getLine(startRange.start.row)); if (indent.length != column) { session.replace(new Range(row, 0, row, column), indent); session.outdentRows(new Range(row + 1, 0, row + 1, 0)); } }; this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/lua_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/lua"; this.snippetFileId = "ace/snippets/lua"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/lua_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LuaHighlightRules = function() { var keywords = ( "break|do|else|elseif|end|for|function|if|in|local|repeat|"+ "return|then|until|while|or|and|not" ); var builtinConstants = ("true|false|nil|_G|_VERSION"); var functions = ( // builtinFunctions "string|xpcall|package|tostring|print|os|unpack|require|"+ "getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+ "collectgarbage|getmetatable|module|rawset|math|debug|"+ "pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+ "pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|"+ "load|error|loadfile|"+ "sub|upper|len|gfind|rep|find|match|char|dump|gmatch|"+ "reverse|byte|format|gsub|lower|preload|loadlib|loaded|"+ "loaders|cpath|config|path|seeall|exit|setlocale|date|"+ "getenv|difftime|remove|time|clock|tmpname|rename|execute|"+ "lines|write|close|flush|open|output|type|read|stderr|"+ "stdin|input|stdout|popen|tmpfile|log|max|acos|huge|"+ "ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|"+ "frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|"+ "atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|"+ "gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+ "setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+ "foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+ "status|wrap|create|running|"+ // metatableMethods "__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+ "__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber" ); var stdLibaries = ("string|package|os|io|math|debug|table|coroutine"); var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn"); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "support.function": functions, "keyword.deprecated": deprecatedIn5152, "constant.library": stdLibaries, "constant.language": builtinConstants, "variable.language": "self" }, "identifier"); var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; var integer = "(?:" + decimalInteger + "|" + hexInteger + ")"; var fraction = "(?:\\.\\d+)"; var intPart = "(?:\\d+)"; var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; var floatNumber = "(?:" + pointFloat + ")"; this.$rules = { "start" : [{ stateName: "bracketedComment", onMatch : function(value, currentState, stack){ stack.unshift(this.next, value.length - 2, currentState); return "comment"; }, regex : /\-\-\[=*\[/, next : [ { onMatch : function(value, currentState, stack) { if (value.length == stack[1]) { stack.shift(); stack.shift(); this.next = stack.shift(); } else { this.next = ""; } return "comment"; }, regex : /\]=*\]/, next : "start" }, { defaultToken: "comment.body" } ] }, { token : "comment", regex : "\\-\\-.*$" }, { stateName: "bracketedString", onMatch : function(value, currentState, stack){ stack.unshift(this.next, value.length, currentState); return "string.start"; }, regex : /\[=*\[/, next : [ { onMatch : function(value, currentState, stack) { if (value.length == stack[1]) { stack.shift(); stack.shift(); this.next = stack.shift(); } else { this.next = ""; } return "string.end"; }, regex : /\]=*\]/, next : "start" }, { defaultToken : "string" } ] }, { token : "string", // " string regex : '"(?:[^\\\\]|\\\\.)*?"' }, { token : "string", // ' string regex : "'(?:[^\\\\]|\\\\.)*?'" }, { token : "constant.numeric", // float regex : floatNumber }, { token : "constant.numeric", // integer regex : integer + "\\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+|\\w+" } ] }; this.normalizeRules(); }; oop.inherits(LuaHighlightRules, TextHighlightRules); exports.LuaHighlightRules = LuaHighlightRules; ================================================ FILE: src/mode/luapage.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var LuaMode = require("./lua").Mode; var LuaPageHighlightRules = require("./luapage_highlight_rules").LuaPageHighlightRules; var Mode = function() { HtmlMode.call(this); this.HighlightRules = LuaPageHighlightRules; this.createModeDelegates({ "lua-": LuaMode }); }; oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/luapage"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/luapage_highlight_rules.js ================================================ // LuaPage implements the LuaPage markup as described by the Kepler Project's CGILua // documentation: http://keplerproject.github.com/cgilua/manual.html#templates "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules; var LuaPageHighlightRules = function() { HtmlHighlightRules.call(this); var startRules = [ { token: "keyword", regex: "<\\%\\=?", push: "lua-start" }, { token: "keyword", regex: "<\\?lua\\=?", push: "lua-start" } ]; var endRules = [ { token: "keyword", regex: "\\%>", next: "pop" }, { token: "keyword", regex: "\\?>", next: "pop" } ]; this.embedRules(LuaHighlightRules, "lua-", endRules, ["start"]); for (var key in this.$rules) this.$rules[key].unshift.apply(this.$rules[key], startRules); this.normalizeRules(); }; oop.inherits(LuaPageHighlightRules, HtmlHighlightRules); exports.LuaPageHighlightRules = LuaPageHighlightRules; ================================================ FILE: src/mode/lucene.js ================================================ 'use strict'; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var LuceneHighlightRules = require("./lucene_highlight_rules").LuceneHighlightRules; var Mode = function() { this.HighlightRules = LuceneHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/lucene"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/lucene_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LuceneHighlightRules = function() { this.$rules = { "start" : [ { token: "constant.language.escape", regex: /\\[\-+&|!(){}\[\]^"~*?:\\]/ }, { token: "constant.character.negation", regex: "\\-" }, { token: "constant.character.interro", regex: "\\?" }, { token: "constant.character.required", regex: "\\+" }, { token: "constant.character.asterisk", regex: "\\*" }, { token: 'constant.character.proximity', regex: '~(?:0\\.[0-9]+|[0-9]+)?' }, { token: 'keyword.operator', regex: '(AND|OR|NOT|TO)\\b' }, { token: "paren.lparen", regex: "[\\(\\{\\[]" }, { token: "paren.rparen", regex: "[\\)\\}\\]]" }, { token: "keyword.operator", regex: /[><=^]/ }, { token: "constant.numeric", regex: /\d[\d.-]*/ }, { token: "string", regex: /"(?:\\"|[^"])*"/ }, { token: "keyword", regex: /(?:\\.|[^\s\-+&|!(){}\[\]^"~*?:\\])+:/, next: "maybeRegex" }, { token: "term", regex: /\w+/ }, { token: "text", regex: /\s+/ } ], "maybeRegex": [{ token: "text", regex: /\s+/ }, { token: "string.regexp.start", regex: "/", next: "regex" }, { regex: "", next: "start" }], "regex": [ { token: "regexp.keyword.operator", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" }, { // flag token: "string.regexp.end", regex: "/[sxngimy]*", next: "start" }, { // invalid operators token : "invalid", regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ }, { // operators token : "constant.language.escape", regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ }, { // optional operators token: "constant.language.escape", regex: "<\d+-\d+>|[~&@]" }, { token : "constant.language.delimiter", regex: /\|/ }, { token: "constant.language.escape", regex: /\[\^?/, next: "regex_character_class" }, { token: "empty", regex: "$", next: "start" }, { defaultToken: "string.regexp" } ], "regex_character_class": [ { token: "regexp.charclass.keyword.operator", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" }, { token: "constant.language.escape", regex: "]", next: "regex" }, { token: "constant.language.escape", regex: "-" }, { token: "empty", regex: "$", next: "start" }, { defaultToken: "string.regexp.characterclass" } ] }; }; oop.inherits(LuceneHighlightRules, TextHighlightRules); exports.LuceneHighlightRules = LuceneHighlightRules; ================================================ FILE: src/mode/makefile.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MakefileHighlightRules = require("./makefile_highlight_rules").MakefileHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = MakefileHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$indentWithTabs = true; this.$id = "ace/mode/makefile"; this.snippetFileId = "ace/snippets/makefile"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/makefile_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ShHighlightFile = require("./sh_highlight_rules"); var MakefileHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var keywordMapper = this.createKeywordMapper({ "keyword": ShHighlightFile.reservedKeywords, "support.function.builtin": ShHighlightFile.languageConstructs, "invalid.deprecated": "debugger" }, "string"); this.$rules = { "start": [ { token: "string.interpolated.backtick.makefile", regex: "`", next: "shell-start" }, { token: "punctuation.definition.comment.makefile", regex: /#(?=.)/, next: "comment" }, { token: [ "keyword.control.makefile"], regex: "^(?:\\s*\\b)(\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\b)" }, {// ^([^\t ]+(\s[^\t ]+)*:(?!\=))\s*.* token: ["entity.name.function.makefile", "text"], regex: "^([^\\t ]+(?:\\s[^\\t ]+)*:)(\\s*.*)" } ], "comment": [ { token : "punctuation.definition.comment.makefile", regex : /.+\\/ }, { token : "punctuation.definition.comment.makefile", regex : ".+", next : "start" } ], "shell-start": [ { token: keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token: "string", regex : "\\w+" }, { token : "string.interpolated.backtick.makefile", regex : "`", next : "start" } ] }; }; oop.inherits(MakefileHighlightRules, TextHighlightRules); exports.MakefileHighlightRules = MakefileHighlightRules; ================================================ FILE: src/mode/markdown.js ================================================ "use strict"; var oop = require("../lib/oop"); var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var TextMode = require("./text").Mode; var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules; var MarkdownFoldMode = require("./folding/markdown").FoldMode; var Mode = function() { this.HighlightRules = MarkdownHighlightRules; this.createModeDelegates({ javascript: require("./javascript").Mode, html: require("./html").Mode, bash: require("./sh").Mode, sh: require("./sh").Mode, xml: require("./xml").Mode, css: require("./css").Mode }); this.foldingRules = new MarkdownFoldMode(); this.$behaviour = new CstyleBehaviour({ braces: true }); }; oop.inherits(Mode, TextMode); (function() { this.type = "text"; this.blockComment = {start: "<!--", end: "-->"}; this.$quotes = {'"': '"', "`": "`"}; this.getNextLineIndent = function(state, line, tab) { if (state == "listblock") { var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line); if (!match) return ""; var marker = match[2]; if (!marker) marker = parseInt(match[3], 10) + 1 + "."; return match[1] + marker + match[4]; } else { return this.$getIndent(line); } }; this.$id = "ace/mode/markdown"; this.snippetFileId = "ace/snippets/markdown"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/markdown_highlight_rules.js ================================================ "use strict"; var modes = require("../config").$modes; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var escaped = function(ch) { return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*"; }; var MarkdownHighlightRules = function() { HtmlHighlightRules.call(this); // regexp must not have capturing parentheses // regexps are ordered -> the first match is used var codeBlockStartRule = { token : "support.function", regex : /^\s*(```+[^`]*|~~~+[^~]*)$/, onMatch: function(value, state, stack, line) { var m = value.match(/^(\s*)([`~]+)(.*)/); var language = /[\w-]+|$/.exec(m[3])[0]; // TODO lazy-load modes if (!modes[language]) language = ""; stack.unshift("githubblock", [], [m[1], m[2], language], state); return this.token; }, next : "githubblock" }; var codeBlockRules = [{ token : "support.function", regex : ".*", onMatch: function(value, state, stack, line) { var embedState = stack[1]; var indent = stack[2][0]; var endMarker = stack[2][1]; var language = stack[2][2]; var m = /^(\s*)(`+|~+)\s*$/.exec(value); if ( m && m[1].length < indent.length + 3 && m[2].length >= endMarker.length && m[2][0] == endMarker[0] ) { stack.splice(0, 3); this.next = stack.shift(); return this.token; } this.next = ""; if (language && modes[language]) { var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0)); stack[1] = data.state; return data.tokens; } return this.token; } }]; this.$rules["start"].unshift({ token : "empty_line", regex : '^$', next: "allowBlock" }, { // h1 token: "markup.heading.1", regex: "^=+(?=\\s*$)" }, { // h2 token: "markup.heading.2", regex: "^\\-+(?=\\s*$)" }, { token : function(value) { return "markup.heading." + value.length; }, regex : /^#{1,6}(?=\s|$)/, next : "header" }, codeBlockStartRule, { // block quote token : "string.blockquote", regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+", next : "blockquote" }, { // HR * - _ token : "constant", regex : "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$", next: "allowBlock" }, { // list token : "markup.list", regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", next : "listblock-start" }, { include : "basic" }); this.addRules({ "basic" : [{ token : "constant.language.escape", regex : /\\[\\`*_{}\[\]()#+\-.!]/ }, { // code span ` token : "support.function", regex : "(`+)(.*?[^`])(\\1)" }, { // reference token : ["text", "constant", "text", "url", "string", "text"], regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$" }, { // link by reference token : ["text", "string", "text", "constant", "text"], regex : "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)("+ escaped("]") + ")(\\])" }, { // link by url token : ["text", "string", "text", "markup.underline", "string", "text"], regex : "(\\!?\\[)(" + // [ escaped("]") + // link text or alt text ")(\\]\\()"+ // ]( '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image '(\\s*"' + escaped('"') + '"\\s*)?' + // "title" "(\\))" // ) }, { // strong ** __ token : "string.strong", regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)" }, { // emphasis * _ token : "string.emphasis", regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)" }, { // token : ["text", "url", "text"], regex : "(<)("+ "(?:https?|ftp|dict):[^'\">\\s]+"+ "|"+ "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+ ")(>)" }], // code block "allowBlock": [ {token : "support.function", regex : "^ {4}.+", next : "allowBlock"}, {token : "empty_line", regex : '^$', next: "allowBlock"}, {token : "empty", regex : "", next : "start"} ], "header" : [{ regex: "$", next : "start" }, { include: "basic" }, { defaultToken : "heading" } ], "listblock-start" : [{ token : "support.variable", regex : /(?:\[[ x]\])?/, next : "listblock" }], "listblock" : [ { // Lists only escape on completely blank lines. token : "empty_line", regex : "^$", next : "start" }, { // list token : "markup.list", regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+", next : "listblock-start" }, { include : "basic", noEscape: true }, codeBlockStartRule, { defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly } ], "blockquote" : [ { // Blockquotes only escape on blank lines. token : "empty_line", regex : "^\\s*$", next : "start" }, { // block quote token : "string.blockquote", regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+", next : "blockquote" }, { include : "basic", noEscape: true }, { defaultToken : "string.blockquote" } ], "githubblock" : codeBlockRules }); this.normalizeRules(); }; oop.inherits(MarkdownHighlightRules, TextHighlightRules); exports.MarkdownHighlightRules = MarkdownHighlightRules; ================================================ FILE: src/mode/mask.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MaskHighlightRules = require("./mask_highlight_rules").MaskHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CssBehaviour = require("./behaviour/css").CssBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = MaskHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CssBehaviour(); 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); // ignore braces in comments var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } 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.$id = "ace/mode/mask"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/mask_highlight_rules.js ================================================ "use strict"; exports.MaskHighlightRules = MaskHighlightRules; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextRules = require("./text_highlight_rules").TextHighlightRules; var JSRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var CssRules = require("./css_highlight_rules").CssHighlightRules; var MDRules = require("./markdown_highlight_rules").MarkdownHighlightRules; var HTMLRules = require("./html_highlight_rules").HtmlHighlightRules; var token_TAG = "keyword.support.constant.language", token_COMPO = "support.function.markup.bold", token_KEYWORD = "keyword", token_LANG = "constant.language", token_UTIL = "keyword.control.markup.italic", token_ATTR = "support.variable.class", token_PUNKT = "keyword.operator", token_ITALIC = "markup.italic", token_BOLD = "markup.bold", token_LPARE = "paren.lparen", token_RPARE = "paren.rparen"; var const_FUNCTIONS, const_KEYWORDS, const_CONST, const_TAGS; (function(){ const_FUNCTIONS = lang.arrayToMap( ("log").split("|") ); const_CONST = lang.arrayToMap( (":dualbind|:bind|:import|slot|event|style|html|markdown|md").split("|") ); const_KEYWORDS = lang.arrayToMap( ("debugger|define|var|if|each|for|of|else|switch|case|with|visible|+if|+each|+for|+switch|+with|+visible|include|import").split("|") ); const_TAGS = lang.arrayToMap( ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" + "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" + "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" + "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" + "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" + "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" + "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" + "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" + "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|") ); }()); function MaskHighlightRules () { this.$rules = { "start" : [ Token("comment", "\\/\\/.*$"), Token("comment", "\\/\\*", [ Token("comment", ".*?\\*\\/", "start"), Token("comment", ".+") ]), Blocks.string("'''"), Blocks.string('"""'), Blocks.string('"'), Blocks.string("'"), Blocks.syntax(/(markdown|md)\b/, "md-multiline", "multiline"), Blocks.syntax(/html\b/, "html-multiline", "multiline"), Blocks.syntax(/(slot|event)\b/, "js-block", "block"), Blocks.syntax(/style\b/, "css-block", "block"), Blocks.syntax(/var\b/, "js-statement", "attr"), Blocks.tag(), Token(token_LPARE, "[[({>]"), Token(token_RPARE, "[\\])};]", "start"), { caseInsensitive: true } ] }; var rules = this; addJavaScript("interpolation", /\]/, token_RPARE + "." + token_ITALIC); addJavaScript("statement", /\)|}|;/); addJavaScript("block", /\}/); addCss(); addMarkdown(); addHtml(); function addJavaScript(name, escape, closeType) { var prfx = "js-" + name + "-", rootTokens = name === "block" ? ["start"] : ["start", "no_regex"]; add( JSRules , prfx , escape , rootTokens , closeType ); } function addCss() { add(CssRules, "css-block-", /\}/); } function addMarkdown() { add(MDRules, "md-multiline-", /("""|''')/, []); } function addHtml() { add(HTMLRules, "html-multiline-", /("""|''')/); } function add(Rules, strPrfx, rgxEnd, rootTokens, closeType) { var next = "pop"; var tokens = rootTokens || [ "start" ]; if (tokens.length === 0) { tokens = null; } if (/block|multiline/.test(strPrfx)) { next = strPrfx + "end"; rules.$rules[next] = [ Token("empty", "", "start") ]; } rules.embedRules( Rules , strPrfx , [ Token(closeType || token_RPARE, rgxEnd, next) ] , tokens , tokens == null ? true : false ); } this.normalizeRules(); } oop.inherits(MaskHighlightRules, TextRules); var Blocks = { string: function(str, next){ var token = Token( "string.start" , str , [ Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()), Token("string.end", str, "pop"), { defaultToken: "string" } ] , next ); if (str.length === 1){ var escaped = Token("string.escape", "\\\\" + str); token.push.unshift(escaped); } return token; }, interpolation: function(){ return [ Token(token_UTIL, /\s*\w*\s*:/), "js-interpolation-start" ]; }, tagHead: function (rgx) { return Token(token_ATTR, rgx, [ Token(token_ATTR, /[\w\-_]+/), Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()), Blocks.goUp() ]); }, tag: function () { return { token: 'tag', onMatch : function(value) { if (void 0 !== const_KEYWORDS[value]) return token_KEYWORD; if (void 0 !== const_CONST[value]) return token_LANG; if (void 0 !== const_FUNCTIONS[value]) return "support.function"; if (void 0 !== const_TAGS[value.toLowerCase()]) return token_TAG; return token_COMPO; }, regex : /([@\w\-_:+]+)|((^|\s)(?=\s*(\.|#)))/, push: [ Blocks.tagHead(/\./) , Blocks.tagHead(/#/) , Blocks.expression(), Blocks.attribute(), Token(token_LPARE, /[;>{]/, "pop") ] }; }, syntax: function(rgx, next, type){ return { token: token_LANG, regex : rgx, push: ({ "attr": [ next + "-start", Token(token_PUNKT, /;/, "start") ], "multiline": [ Blocks.tagHead(/\./) , Blocks.tagHead(/#/) , Blocks.attribute(), Blocks.expression(), Token(token_LPARE, /[>\{]/), Token(token_PUNKT, /;/, "start"), Token(token_LPARE, /'''|"""/, [ next + "-start" ]) ], "block": [ Blocks.tagHead(/\./) , Blocks.tagHead(/#/) , Blocks.attribute(), Blocks.expression(), Token(token_LPARE, /\{/, [ next + "-start" ]) ] })[type] }; }, attribute: function(){ return Token(function(value){ return /^x\-/.test(value) ? token_ATTR + "." + token_BOLD : token_ATTR; }, /[\w_-]+/, [ Token(token_PUNKT, /\s*=\s*/, [ Blocks.string('"'), Blocks.string("'"), Blocks.word(), Blocks.goUp() ]), Blocks.goUp() ]); }, expression: function(){ return Token(token_LPARE, /\(/, [ "js-statement-start" ]); }, word: function(){ return Token("string", /[\w-_]+/); }, goUp: function(){ return Token("text", "", "pop"); }, goStart: function(){ return Token("text", "", "start"); } }; function Token(token, rgx, mix) { var push, next, onMatch; if (arguments.length === 4) { push = mix; next = arguments[3]; } else if (typeof mix === "string") { next = mix; } else { push = mix; } if (typeof token === "function") { onMatch = token; token = "empty"; } return { token: token, regex: rgx, push: push, next: next, onMatch: onMatch }; } ================================================ FILE: src/mode/matching_brace_outdent.js ================================================ "use strict"; var Range = require("../range").Range; var MatchingBraceOutdent = function() {}; (function() { this.checkOutdent = function(line, input) { if (! /^\s+$/.test(line)) return false; return /^\s*\}/.test(input); }; this.autoOutdent = function(doc, row) { var line = doc.getLine(row); var match = line.match(/^(\s*\})/); if (!match) return 0; var column = match[1].length; var openBracePos = doc.findMatchingBracket({row: row, column: column}); if (!openBracePos || openBracePos.row == row) return 0; var indent = this.$getIndent(doc.getLine(openBracePos.row)); doc.replace(new Range(row, 0, row, column-1), indent); }; this.$getIndent = function(line) { return line.match(/^\s*/)[0]; }; }).call(MatchingBraceOutdent.prototype); exports.MatchingBraceOutdent = MatchingBraceOutdent; ================================================ FILE: src/mode/matching_parens_outdent.js ================================================ "use strict"; var Range = require("../range").Range; var MatchingParensOutdent = function() {}; (function() { this.checkOutdent = function(line, input) { if (! /^\s+$/.test(line)) return false; return /^\s*\)/.test(input); }; this.autoOutdent = function(doc, row) { var line = doc.getLine(row); var match = line.match(/^(\s*\))/); if (!match) return 0; var column = match[1].length; var openBracePos = doc.findMatchingBracket({row: row, column: column}); if (!openBracePos || openBracePos.row == row) return 0; var indent = this.$getIndent(doc.getLine(openBracePos.row)); doc.replace(new Range(row, 0, row, column-1), indent); }; this.$getIndent = function(line) { var match = line.match(/^(\s+)/); if (match) { return match[1]; } return ""; }; }).call(MatchingParensOutdent.prototype); exports.MatchingParensOutdent = MatchingParensOutdent; ================================================ FILE: src/mode/matlab.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MatlabHighlightRules = require("./matlab_highlight_rules").MatlabHighlightRules; var Mode = function() { this.HighlightRules = MatlabHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "%"; this.blockComment = {start: "%{", end: "%}"}; this.$id = "ace/mode/matlab"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/matlab_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MatlabHighlightRules = function() { var keywords = ( "break|case|catch|classdef|continue|else|elseif|end|for|function|global|if|otherwise|parfor|persistent|return|spmd|switch|try|while" ); var builtinConstants = ( "true|false|inf|Inf|nan|NaN|eps|pi|ans|nargin|nargout|varargin|varargout" ); var builtinFunctions = ( "abs|accumarray|acos(?:d|h)?|acot(?:d|h)?|acsc(?:d|h)?|actxcontrol(?:list|select)?|actxGetRunningServer|actxserver|addlistener|addpath|addpref|addtodate|"+ "airy|align|alim|all|allchild|alpha|alphamap|amd|ancestor|and|angle|annotation|any|area|arrayfun|asec(?:d|h)?|asin(?:d|h)?|assert|assignin|atan(?:2|d|h)?|" + "audiodevinfo|audioplayer|audiorecorder|aufinfo|auread|autumn|auwrite|avifile|aviinfo|aviread|axes|axis|balance|bar(?:3|3h|h)?|base2dec|beep|BeginInvoke|bench|"+ "bessel(?:h|i|j|k|y)|beta|betainc|betaincinv|betaln|bicg|bicgstab|bicgstabl|bin2dec|bitand|bitcmp|bitget|bitmax|bitnot|bitor|bitset|bitshift|bitxor|blanks|blkdiag|"+ "bone|box|brighten|brush|bsxfun|builddocsearchdb|builtin|bvp4c|bvp5c|bvpget|bvpinit|bvpset|bvpxtend|calendar|calllib|callSoapService|camdolly|cameratoolbar|camlight|"+ "camlookat|camorbit|campan|campos|camproj|camroll|camtarget|camup|camva|camzoom|cart2pol|cart2sph|cast|cat|caxis|cd|cdf2rdf|cdfepoch|cdfinfo|cdflib(?:.(?:close|closeVar|"+ "computeEpoch|computeEpoch16|create|createAttr|createVar|delete|deleteAttr|deleteAttrEntry|deleteAttrgEntry|deleteVar|deleteVarRecords|epoch16Breakdown|epochBreakdown|getAttrEntry|"+ "getAttrgEntry|getAttrMaxEntry|getAttrMaxgEntry|getAttrName|getAttrNum|getAttrScope|getCacheSize|getChecksum|getCompression|getCompressionCacheSize|getConstantNames|"+ "getConstantValue|getCopyright|getFileBackward|getFormat|getLibraryCopyright|getLibraryVersion|getMajority|getName|getNumAttrEntries|getNumAttrgEntries|getNumAttributes|"+ "getNumgAttributes|getReadOnlyMode|getStageCacheSize|getValidate|getVarAllocRecords|getVarBlockingFactor|getVarCacheSize|getVarCompression|getVarData|getVarMaxAllocRecNum|"+ "getVarMaxWrittenRecNum|getVarName|getVarNum|getVarNumRecsWritten|getVarPadValue|getVarRecordData|getVarReservePercent|getVarsMaxWrittenRecNum|getVarSparseRecords|getVersion|"+ "hyperGetVarData|hyperPutVarData|inquire|inquireAttr|inquireAttrEntry|inquireAttrgEntry|inquireVar|open|putAttrEntry|putAttrgEntry|putVarData|putVarRecordData|renameAttr|"+ "renameVar|setCacheSize|setChecksum|setCompression|setCompressionCacheSize|setFileBackward|setFormat|setMajority|setReadOnlyMode|setStageCacheSize|setValidate|"+ "setVarAllocBlockRecords|setVarBlockingFactor|setVarCacheSize|setVarCompression|setVarInitialRecs|setVarPadValue|SetVarReservePercent|setVarsCacheSize|setVarSparseRecords))?|"+ "cdfread|cdfwrite|ceil|cell2mat|cell2struct|celldisp|cellfun|cellplot|cellstr|cgs|checkcode|checkin|checkout|chol|cholinc|cholupdate|circshift|cla|clabel|class|clc|clear|"+ "clearvars|clf|clipboard|clock|close|closereq|cmopts|cmpermute|cmunique|colamd|colon|colorbar|colordef|colormap|colormapeditor|colperm|Combine|comet|comet3|commandhistory|"+ "commandwindow|compan|compass|complex|computer|cond|condeig|condest|coneplot|conj|containers.Map|contour(?:3|c|f|slice)?|contrast|conv|conv2|convhull|convhulln|convn|cool|"+ "copper|copyfile|copyobj|corrcoef|cos(?:d|h)?|cot(?:d|h)?|cov|cplxpair|cputime|createClassFromWsdl|createSoapMessage|cross|csc(?:d|h)?|csvread|csvwrite|ctranspose|cumprod|"+ "cumsum|cumtrapz|curl|customverctrl|cylinder|daqread|daspect|datacursormode|datatipinfo|date|datenum|datestr|datetick|datevec|dbclear|dbcont|dbdown|dblquad|dbmex|dbquit|"+ "dbstack|dbstatus|dbstep|dbstop|dbtype|dbup|dde23|ddeget|ddesd|ddeset|deal|deblank|dec2base|dec2bin|dec2hex|decic|deconv|del2|delaunay|delaunay3|delaunayn|DelaunayTri|delete|"+ "demo|depdir|depfun|det|detrend|deval|diag|dialog|diary|diff|diffuse|dir|disp|display|dither|divergence|dlmread|dlmwrite|dmperm|doc|docsearch|dos|dot|dragrect|drawnow|dsearch|"+ "dsearchn|dynamicprops|echo|echodemo|edit|eig|eigs|ellipj|ellipke|ellipsoid|empty|enableNETfromNetworkDrive|enableservice|EndInvoke|enumeration|eomday|eq|erf|erfc|erfcinv|"+ "erfcx|erfinv|error|errorbar|errordlg|etime|etree|etreeplot|eval|evalc|evalin|event.(?:EventData|listener|PropertyEvent|proplistener)|exifread|exist|exit|exp|expint|expm|"+ "expm1|export2wsdlg|eye|ezcontour|ezcontourf|ezmesh|ezmeshc|ezplot|ezplot3|ezpolar|ezsurf|ezsurfc|factor|factorial|fclose|feather|feature|feof|ferror|feval|fft|fft2|fftn|"+ "fftshift|fftw|fgetl|fgets|fieldnames|figure|figurepalette|fileattrib|filebrowser|filemarker|fileparts|fileread|filesep|fill|fill3|filter|filter2|find|findall|findfigs|"+ "findobj|findstr|finish|fitsdisp|fitsinfo|fitsread|fitswrite|fix|flag|flipdim|fliplr|flipud|floor|flow|fminbnd|fminsearch|fopen|format|fplot|fprintf|frame2im|fread|freqspace|"+ "frewind|fscanf|fseek|ftell|FTP|full|fullfile|func2str|functions|funm|fwrite|fzero|gallery|gamma|gammainc|gammaincinv|gammaln|gca|gcbf|gcbo|gcd|gcf|gco|ge|genpath|genvarname|"+ "get|getappdata|getenv|getfield|getframe|getpixelposition|getpref|ginput|gmres|gplot|grabcode|gradient|gray|graymon|grid|griddata(?:3|n)?|griddedInterpolant|gsvd|gt|gtext|"+ "guidata|guide|guihandles|gunzip|gzip|h5create|h5disp|h5info|h5read|h5readatt|h5write|h5writeatt|hadamard|handle|hankel|hdf|hdf5|hdf5info|hdf5read|hdf5write|hdfinfo|"+ "hdfread|hdftool|help|helpbrowser|helpdesk|helpdlg|helpwin|hess|hex2dec|hex2num|hgexport|hggroup|hgload|hgsave|hgsetget|hgtransform|hidden|hilb|hist|histc|hold|home|horzcat|"+ "hostid|hot|hsv|hsv2rgb|hypot|ichol|idivide|ifft|ifft2|ifftn|ifftshift|ilu|im2frame|im2java|imag|image|imagesc|imapprox|imfinfo|imformats|import|importdata|imread|imwrite|"+ "ind2rgb|ind2sub|inferiorto|info|inline|inmem|inpolygon|input|inputdlg|inputname|inputParser|inspect|instrcallback|instrfind|instrfindall|int2str|integral(?:2|3)?|interp(?:1|"+ "1q|2|3|ft|n)|interpstreamspeed|intersect|intmax|intmin|inv|invhilb|ipermute|isa|isappdata|iscell|iscellstr|ischar|iscolumn|isdir|isempty|isequal|isequaln|isequalwithequalnans|"+ "isfield|isfinite|isfloat|isglobal|ishandle|ishghandle|ishold|isinf|isinteger|isjava|iskeyword|isletter|islogical|ismac|ismatrix|ismember|ismethod|isnan|isnumeric|isobject|"+ "isocaps|isocolors|isonormals|isosurface|ispc|ispref|isprime|isprop|isreal|isrow|isscalar|issorted|isspace|issparse|isstr|isstrprop|isstruct|isstudent|isunix|isvarname|"+ "isvector|javaaddpath|javaArray|javachk|javaclasspath|javacomponent|javaMethod|javaMethodEDT|javaObject|javaObjectEDT|javarmpath|jet|keyboard|kron|lasterr|lasterror|"+ "lastwarn|lcm|ldivide|ldl|le|legend|legendre|length|libfunctions|libfunctionsview|libisloaded|libpointer|libstruct|license|light|lightangle|lighting|lin2mu|line|lines|"+ "linkaxes|linkdata|linkprop|linsolve|linspace|listdlg|listfonts|load|loadlibrary|loadobj|log|log10|log1p|log2|loglog|logm|logspace|lookfor|lower|ls|lscov|lsqnonneg|lsqr|"+ "lt|lu|luinc|magic|makehgtform|mat2cell|mat2str|material|matfile|matlab.io.MatFile|matlab.mixin.(?:Copyable|Heterogeneous(?:.getDefaultScalarElement)?)|matlabrc|"+ "matlabroot|max|maxNumCompThreads|mean|median|membrane|memmapfile|memory|menu|mesh|meshc|meshgrid|meshz|meta.(?:class(?:.fromName)?|DynamicProperty|EnumeratedValue|event|"+ "MetaData|method|package(?:.(?:fromName|getAllPackages))?|property)|metaclass|methods|methodsview|mex(?:.getCompilerConfigurations)?|MException|mexext|mfilename|min|minres|"+ "minus|mislocked|mkdir|mkpp|mldivide|mlint|mlintrpt|mlock|mmfileinfo|mmreader|mod|mode|more|move|movefile|movegui|movie|movie2avi|mpower|mrdivide|msgbox|mtimes|mu2lin|"+ "multibandread|multibandwrite|munlock|namelengthmax|nargchk|narginchk|nargoutchk|native2unicode|nccreate|ncdisp|nchoosek|ncinfo|ncread|ncreadatt|ncwrite|ncwriteatt|"+ "ncwriteschema|ndgrid|ndims|ne|NET(?:.(?:addAssembly|Assembly|convertArray|createArray|createGeneric|disableAutoRelease|enableAutoRelease|GenericClass|invokeGenericMethod|"+ "NetException|setStaticProperty))?|netcdf.(?:abort|close|copyAtt|create|defDim|defGrp|defVar|defVarChunking|defVarDeflate|defVarFill|defVarFletcher32|delAtt|endDef|getAtt|"+ "getChunkCache|getConstant|getConstantNames|getVar|inq|inqAtt|inqAttID|inqAttName|inqDim|inqDimID|inqDimIDs|inqFormat|inqGrpName|inqGrpNameFull|inqGrpParent|inqGrps|"+ "inqLibVers|inqNcid|inqUnlimDims|inqVar|inqVarChunking|inqVarDeflate|inqVarFill|inqVarFletcher32|inqVarID|inqVarIDs|open|putAtt|putVar|reDef|renameAtt|renameDim|renameVar|"+ "setChunkCache|setDefaultFormat|setFill|sync)|newplot|nextpow2|nnz|noanimate|nonzeros|norm|normest|not|notebook|now|nthroot|null|num2cell|num2hex|num2str|numel|nzmax|"+ "ode(?:113|15i|15s|23|23s|23t|23tb|45)|odeget|odeset|odextend|onCleanup|ones|open|openfig|opengl|openvar|optimget|optimset|or|ordeig|orderfields|ordqz|ordschur|orient|"+ "orth|pack|padecoef|pagesetupdlg|pan|pareto|parseSoapResponse|pascal|patch|path|path2rc|pathsep|pathtool|pause|pbaspect|pcg|pchip|pcode|pcolor|pdepe|pdeval|peaks|perl|perms|"+ "permute|pie|pink|pinv|planerot|playshow|plot|plot3|plotbrowser|plotedit|plotmatrix|plottools|plotyy|plus|pol2cart|polar|poly|polyarea|polyder|polyeig|polyfit|polyint|polyval|"+ "polyvalm|pow2|power|ppval|prefdir|preferences|primes|print|printdlg|printopt|printpreview|prod|profile|profsave|propedit|propertyeditor|psi|publish|PutCharArray|PutFullMatrix|"+ "PutWorkspaceData|pwd|qhull|qmr|qr|qrdelete|qrinsert|qrupdate|quad|quad2d|quadgk|quadl|quadv|questdlg|quit|quiver|quiver3|qz|rand|randi|randn|randperm|RandStream(?:.(?:create|"+ "getDefaultStream|getGlobalStream|list|setDefaultStream|setGlobalStream))?|rank|rat|rats|rbbox|rcond|rdivide|readasync|real|reallog|realmax|realmin|realpow|realsqrt|record|"+ "rectangle|rectint|recycle|reducepatch|reducevolume|refresh|refreshdata|regexp|regexpi|regexprep|regexptranslate|rehash|rem|Remove|RemoveAll|repmat|reset|reshape|residue|"+ "restoredefaultpath|rethrow|rgb2hsv|rgb2ind|rgbplot|ribbon|rmappdata|rmdir|rmfield|rmpath|rmpref|rng|roots|rose|rosser|rot90|rotate|rotate3d|round|rref|rsf2csf|run|save|saveas|"+ "saveobj|savepath|scatter|scatter3|schur|sec|secd|sech|selectmoveresize|semilogx|semilogy|sendmail|serial|set|setappdata|setdiff|setenv|setfield|setpixelposition|setpref|setstr|"+ "setxor|shading|shg|shiftdim|showplottool|shrinkfaces|sign|sin(?:d|h)?|size|slice|smooth3|snapnow|sort|sortrows|sound|soundsc|spalloc|spaugment|spconvert|spdiags|specular|speye|"+ "spfun|sph2cart|sphere|spinmap|spline|spones|spparms|sprand|sprandn|sprandsym|sprank|spring|sprintf|spy|sqrt|sqrtm|squeeze|ss2tf|sscanf|stairs|startup|std|stem|stem3|stopasync|"+ "str2double|str2func|str2mat|str2num|strcat|strcmp|strcmpi|stream2|stream3|streamline|streamparticles|streamribbon|streamslice|streamtube|strfind|strjust|strmatch|strncmp|"+ "strncmpi|strread|strrep|strtok|strtrim|struct2cell|structfun|strvcat|sub2ind|subplot|subsasgn|subsindex|subspace|subsref|substruct|subvolume|sum|summer|superclasses|superiorto|"+ "support|surf|surf2patch|surface|surfc|surfl|surfnorm|svd|svds|swapbytes|symamd|symbfact|symmlq|symrcm|symvar|system|tan(?:d|h)?|tar|tempdir|tempname|tetramesh|texlabel|text|"+ "textread|textscan|textwrap|tfqmr|throw|tic|Tiff(?:.(?:getTagNames|getVersion))?|timer|timerfind|timerfindall|times|timeseries|title|toc|todatenum|toeplitz|toolboxdir|trace|"+ "transpose|trapz|treelayout|treeplot|tril|trimesh|triplequad|triplot|TriRep|TriScatteredInterp|trisurf|triu|tscollection|tsearch|tsearchn|tstool|type|typecast|uibuttongroup|"+ "uicontextmenu|uicontrol|uigetdir|uigetfile|uigetpref|uiimport|uimenu|uiopen|uipanel|uipushtool|uiputfile|uiresume|uisave|uisetcolor|uisetfont|uisetpref|uistack|uitable|"+ "uitoggletool|uitoolbar|uiwait|uminus|undocheckout|unicode2native|union|unique|unix|unloadlibrary|unmesh|unmkpp|untar|unwrap|unzip|uplus|upper|urlread|urlwrite|usejava|"+ "userpath|validateattributes|validatestring|vander|var|vectorize|ver|verctrl|verLessThan|version|vertcat|VideoReader(?:.isPlatformSupported)?|VideoWriter(?:.getProfiles)?|"+ "view|viewmtx|visdiff|volumebounds|voronoi|voronoin|wait|waitbar|waitfor|waitforbuttonpress|warndlg|warning|waterfall|wavfinfo|wavplay|wavread|wavrecord|wavwrite|web|weekday|"+ "what|whatsnew|which|whitebg|who|whos|wilkinson|winopen|winqueryreg|winter|wk1finfo|wk1read|wk1write|workspace|xlabel|xlim|xlsfinfo|xlsread|xlswrite|xmlread|xmlwrite|xor|xslt|"+ "ylabel|ylim|zeros|zip|zlabel|zlim|zoom|addedvarplot|andrewsplot|anova(?:1|2|n)|ansaribradley|aoctool|barttest|bbdesign|beta(?:cdf|fit|inv|like|pdf|rnd|stat)|bino(?:cdf|fit|inv|"+ "pdf|rnd|stat)|biplot|bootci|bootstrp|boxplot|candexch|candgen|canoncorr|capability|capaplot|caseread|casewrite|categorical|ccdesign|cdfplot|chi2(?:cdf|gof|inv|pdf|rnd|stat)|"+ "cholcov|Classification(?:BaggedEnsemble|Discriminant(?:.(?:fit|make|template))?|Ensemble|KNN(?:.(?:fit|template))?|PartitionedEnsemble|PartitionedModel|Tree(?:.(?:fit|"+ "template))?)|classify|classregtree|cluster|clusterdata|cmdscale|combnk|Compact(?:Classification(?:Discriminant|Ensemble|Tree)|Regression(?:Ensemble|Tree)|TreeBagger)|confusionmat|"+ "controlchart|controlrules|cophenet|copula(?:cdf|fit|param|pdf|rnd|stat)|cordexch|corr|corrcov|coxphfit|createns|crosstab|crossval|cvpartition|datasample|dataset|daugment|dcovary|"+ "dendrogram|dfittool|disttool|dummyvar|dwtest|ecdf|ecdfhist|ev(?:cdf|fit|inv|like|pdf|rnd|stat)|ExhaustiveSearcher|exp(?:cdf|fit|inv|like|pdf|rnd|stat)|factoran|fcdf|ff2n|finv|"+ "fitdist|fitensemble|fpdf|fracfact|fracfactgen|friedman|frnd|fstat|fsurfht|fullfact|gagerr|gam(?:cdf|fit|inv|like|pdf|rnd|stat)|GeneralizedLinearModel(?:.fit)?|geo(?:cdf|inv|mean|"+ "pdf|rnd|stat)|gev(?:cdf|fit|inv|like|pdf|rnd|stat)|gline|glmfit|glmval|glyphplot|gmdistribution(?:.fit)?|gname|gp(?:cdf|fit|inv|like|pdf|rnd|stat)|gplotmatrix|grp2idx|grpstats|"+ "gscatter|haltonset|harmmean|hist3|histfit|hmm(?:decode|estimate|generate|train|viterbi)|hougen|hyge(?:cdf|inv|pdf|rnd|stat)|icdf|inconsistent|interactionplot|invpred|iqr|iwishrnd|"+ "jackknife|jbtest|johnsrnd|KDTreeSearcher|kmeans|knnsearch|kruskalwallis|ksdensity|kstest|kstest2|kurtosis|lasso|lassoglm|lassoPlot|leverage|lhsdesign|lhsnorm|lillietest|"+ "LinearModel(?:.fit)?|linhyptest|linkage|logn(?:cdf|fit|inv|like|pdf|rnd|stat)|lsline|mad|mahal|maineffectsplot|manova1|manovacluster|mdscale|mhsample|mle|mlecov|mnpdf|"+ "mnrfit|mnrnd|mnrval|moment|multcompare|multivarichart|mvn(?:cdf|pdf|rnd)|mvregress|mvregresslike|mvt(?:cdf|pdf|rnd)|NaiveBayes(?:.fit)?|nan(?:cov|max|mean|median|min|std|"+ "sum|var)|nbin(?:cdf|fit|inv|pdf|rnd|stat)|ncf(?:cdf|inv|pdf|rnd|stat)|nct(?:cdf|inv|pdf|rnd|stat)|ncx2(?:cdf|inv|pdf|rnd|stat)|NeighborSearcher|nlinfit|nlintool|nlmefit|nlmefitsa|"+ "nlparci|nlpredci|nnmf|nominal|NonLinearModel(?:.fit)?|norm(?:cdf|fit|inv|like|pdf|rnd|stat)|normplot|normspec|ordinal|outlierMeasure|parallelcoords|paretotails|partialcorr|"+ "pcacov|pcares|pdf|pdist|pdist2|pearsrnd|perfcurve|perms|piecewisedistribution|plsregress|poiss(?:cdf|fit|inv|pdf|rnd|tat)|polyconf|polytool|prctile|princomp|ProbDist(?:Kernel|"+ "Parametric|UnivKernel|UnivParam)?|probplot|procrustes|qqplot|qrandset|qrandstream|quantile|randg|random|randsample|randtool|range|rangesearch|ranksum|rayl(?:cdf|fit|inv|pdf|"+ "rnd|stat)|rcoplot|refcurve|refline|regress|Regression(?:BaggedEnsemble|Ensemble|PartitionedEnsemble|PartitionedModel|Tree(?:.(?:fit|template))?)|regstats|relieff|ridge|"+ "robustdemo|robustfit|rotatefactors|rowexch|rsmdemo|rstool|runstest|sampsizepwr|scatterhist|sequentialfs|signrank|signtest|silhouette|skewness|slicesample|sobolset|squareform|"+ "statget|statset|stepwise|stepwisefit|surfht|tabulate|tblread|tblwrite|tcdf|tdfread|tiedrank|tinv|tpdf|TreeBagger|treedisp|treefit|treeprune|treetest|treeval|trimmean|trnd|tstat|"+ "ttest|ttest2|unid(?:cdf|inv|pdf|rnd|stat)|unif(?:cdf|inv|it|pdf|rnd|stat)|vartest(?:2|n)?|wbl(?:cdf|fit|inv|like|pdf|rnd|stat)|wblplot|wishrnd|x2fx|xptread|zscore|ztest"+ "adapthisteq|analyze75info|analyze75read|applycform|applylut|axes2pix|bestblk|blockproc|bwarea|bwareaopen|bwboundaries|bwconncomp|bwconvhull|bwdist|bwdistgeodesic|bweuler|"+ "bwhitmiss|bwlabel|bwlabeln|bwmorph|bwpack|bwperim|bwselect|bwtraceboundary|bwulterode|bwunpack|checkerboard|col2im|colfilt|conndef|convmtx2|corner|cornermetric|corr2|cp2tform|"+ "cpcorr|cpselect|cpstruct2pairs|dct2|dctmtx|deconvblind|deconvlucy|deconvreg|deconvwnr|decorrstretch|demosaic|dicom(?:anon|dict|info|lookup|read|uid|write)|edge|edgetaper|entropy|"+ "entropyfilt|fan2para|fanbeam|findbounds|fliptform|freqz2|fsamp2|fspecial|ftrans2|fwind1|fwind2|getheight|getimage|getimagemodel|getline|getneighbors|getnhood|getpts|"+ "getrangefromclass|getrect|getsequence|gray2ind|graycomatrix|graycoprops|graydist|grayslice|graythresh|hdrread|hdrwrite|histeq|hough|houghlines|houghpeaks|iccfind|iccread|"+ "iccroot|iccwrite|idct2|ifanbeam|im2bw|im2col|im2double|im2int16|im2java2d|im2single|im2uint16|im2uint8|imabsdiff|imadd|imadjust|ImageAdapter|imageinfo|imagemodel|imapplymatrix|"+ "imattributes|imbothat|imclearborder|imclose|imcolormaptool|imcomplement|imcontour|imcontrast|imcrop|imdilate|imdisplayrange|imdistline|imdivide|imellipse|imerode|imextendedmax|"+ "imextendedmin|imfill|imfilter|imfindcircles|imfreehand|imfuse|imgca|imgcf|imgetfile|imhandles|imhist|imhmax|imhmin|imimposemin|imlincomb|imline|immagbox|immovie|immultiply|imnoise|"+ "imopen|imoverview|imoverviewpanel|impixel|impixelinfo|impixelinfoval|impixelregion|impixelregionpanel|implay|impoint|impoly|impositionrect|improfile|imputfile|impyramid|"+ "imreconstruct|imrect|imregconfig|imregionalmax|imregionalmin|imregister|imresize|imroi|imrotate|imsave|imscrollpanel|imshow|imshowpair|imsubtract|imtool|imtophat|imtransform|"+ "imview|ind2gray|ind2rgb|interfileinfo|interfileread|intlut|ippl|iptaddcallback|iptcheckconn|iptcheckhandle|iptcheckinput|iptcheckmap|iptchecknargin|iptcheckstrs|iptdemos|iptgetapi|"+ "iptGetPointerBehavior|iptgetpref|ipticondir|iptnum2ordinal|iptPointerManager|iptprefs|iptremovecallback|iptSetPointerBehavior|iptsetpref|iptwindowalign|iradon|isbw|isflat|isgray|"+ "isicc|isind|isnitf|isrgb|isrset|lab2double|lab2uint16|lab2uint8|label2rgb|labelmatrix|makecform|makeConstrainToRectFcn|makehdr|makelut|makeresampler|maketform|mat2gray|mean2|"+ "medfilt2|montage|nitfinfo|nitfread|nlfilter|normxcorr2|ntsc2rgb|openrset|ordfilt2|otf2psf|padarray|para2fan|phantom|poly2mask|psf2otf|qtdecomp|qtgetblk|qtsetblk|radon|rangefilt|"+ "reflect|regionprops|registration.metric.(?:MattesMutualInformation|MeanSquares)|registration.optimizer.(?:OnePlusOneEvolutionary|RegularStepGradientDescent)|rgb2gray|"+ "rgb2ntsc|rgb2ycbcr|roicolor|roifill|roifilt2|roipoly|rsetwrite|std2|stdfilt|strel|stretchlim|subimage|tformarray|tformfwd|tforminv|tonemap|translate|truesize|uintlut|viscircles|"+ "warp|watershed|whitepoint|wiener2|xyz2double|xyz2uint16|ycbcr2rgb|bintprog|color|fgoalattain|fminbnd|fmincon|fminimax|fminsearch|fminunc|fseminf|fsolve|fzero|fzmult|gangstr|ktrlink|"+ "linprog|lsqcurvefit|lsqlin|lsqnonlin|lsqnonneg|optimget|optimset|optimtool|quadprog" ); var storageType = ( "cell|struct|char|double|single|logical|u?int(?:8|16|32|64)|sparse" ); var keywordMapper = this.createKeywordMapper({ "storage.type": storageType, "support.function": builtinFunctions, "keyword": keywords, "constant.language": builtinConstants }, "identifier", true); this.$rules = { // allowQstring start: [{ token : "string", regex : "'", stateName : "qstring", next : [{ token : "constant.language.escape", regex : "''" }, { token : "string", regex : "'|$", next : "start" }, { defaultToken: "string" }] }, { token : "text", regex : "\\s+" }, { regex: "", next: "noQstring" }], noQstring : [{ regex: "^\\s*%{\\s*$", token: "comment.start", push: "blockComment" }, { token : "comment", regex : "%[^\r\n]*" }, { token : "string", regex : '"', stateName : "qqstring", next : [{ token : "constant.language.escape", regex : /\\./ }, { token : "string", regex : "\\\\$", next : "qqstring" }, { token : "string", regex : '"|$', next : "start" }, { defaultToken: "string" }] }, { 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 : "\\+|\\-|\\/|\\/\\/|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=", next: "start" }, { token : "punctuation.operator", regex : "\\?|\\:|\\,|\\;|\\.", next: "start" }, { token : "paren.lparen", regex : "[({\\[]", next: "start" }, { token : "paren.rparen", regex : "[\\]})]" }, { token : "text", regex : "\\s+" }, { token : "text", regex : "$", next : "start" }], blockComment: [{ regex: "^\\s*%{\\s*$", token: "comment.start", push: "blockComment" }, { regex: "^\\s*%}\\s*$", token: "comment.end", next: "pop" }, { defaultToken: "comment" }] }; this.normalizeRules(); }; oop.inherits(MatlabHighlightRules, TextHighlightRules); exports.MatlabHighlightRules = MatlabHighlightRules; ================================================ FILE: src/mode/maze.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MazeHighlightRules = require("./maze_highlight_rules").MazeHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = MazeHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/maze"; this.snippetFileId = "ace/snippets/maze"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/maze_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MazeHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ token: "keyword.control", regex: /##|``/, comment: "Wall" }, { token: "entity.name.tag", regex: /\.\./, comment: "Path" }, { token: "keyword.control", regex: /<>/, comment: "Splitter" }, { token: "entity.name.tag", regex: /\*[\*A-Za-z0-9]/, comment: "Signal" }, { token: "constant.numeric", regex: /[0-9]{2}/, comment: "Pause" }, { token: "keyword.control", regex: /\^\^/, comment: "Start" }, { token: "keyword.control", regex: /\(\)/, comment: "Hole" }, { token: "support.function", regex: />>/, comment: "Out" }, { token: "support.function", regex: />\//, comment: "Ln Out" }, { token: "support.function", regex: /<</, comment: "In" }, { token: "keyword.control", regex: /--/, comment: "One use" }, { token: "constant.language", regex: /%[LRUDNlrudn]/, comment: "Direction" }, { token: [ "entity.name.function", "keyword.other", "keyword.operator", "keyword.other", "keyword.operator", "constant.numeric", "keyword.operator", "keyword.other", "keyword.operator", "constant.numeric", "string.quoted.double", "string.quoted.single" ], regex: /([A-Za-z][A-Za-z0-9])( *-> *)(?:([-+*\/]=)( *)((?:-)?)([0-9]+)|(=)( *)(?:((?:-)?)([0-9]+)|("[^"]*")|('[^']*')))/, comment: "Assignment function" }, { token: [ "entity.name.function", "keyword.other", "keyword.control", "keyword.other", "keyword.operator", "keyword.other", "keyword.operator", "constant.numeric", "entity.name.tag", "keyword.other", "keyword.control", "keyword.other", "constant.language", "keyword.other", "keyword.control", "keyword.other", "constant.language" ], regex: /([A-Za-z][A-Za-z0-9])( *-> *)(IF|if)( *)(?:([<>]=?|==)( *)((?:-)?)([0-9]+)|(\*[\*A-Za-z0-9]))( *)(THEN|then)( *)(%[LRUDNlrudn])(?:( *)(ELSE|else)( *)(%[LRUDNlrudn]))?/, comment: "Equality Function" }, { token: "entity.name.function", regex: /[A-Za-z][A-Za-z0-9]/, comment: "Function cell" }, { token: "comment.line.double-slash", regex: / *\/\/.*/, comment: "Comment" }] }; this.normalizeRules(); }; MazeHighlightRules.metaData = { fileTypes: ["mz"], name: "Maze", scopeName: "source.maze" }; oop.inherits(MazeHighlightRules, TextHighlightRules); exports.MazeHighlightRules = MazeHighlightRules; ================================================ FILE: src/mode/mediawiki.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MediaWikiHighlightRules = require("./mediawiki_highlight_rules").MediaWikiHighlightRules; var Mode = function() { this.HighlightRules = MediaWikiHighlightRules; }; oop.inherits(Mode, TextMode); (function() { this.type = "text"; this.blockComment = {start: "<!--", end: "-->"}; this.$id = "ace/mode/mediawiki"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/mediawiki_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MediaWikiHighlightRules = function() { this.$rules = { start: [{ include: "#switch" }, { include: "#redirect" }, { include: "#variable" }, { include: "#comment" }, { include: "#entity" }, { include: "#emphasis" }, { include: "#tag" }, { include: "#table" }, { include: "#hr" }, { include: "#heading" }, { include: "#link" }, { include: "#list" }, { include: "#template" }], "#hr": [{ token: "markup.bold", regex: /^[-]{4,}/ }], "#switch": [{ token: "constant.language", regex: /(__NOTOC__|__FORCETOC__|__TOC__|__NOEDITSECTION__|__NEWSECTIONLINK__|__NONEWSECTIONLINK__|__NOWYSIWYG__|__NOGALLERY__|__HIDDENCAT__|__EXPECTUNUSEDCATEGORY__|__NOCONTENTCONVERT__|__NOCC__|__NOTITLECONVERT__|__NOTC__|__START__|__END__|__INDEX__|__NOINDEX__|__STATICREDIRECT__|__NOGLOBAL__|__DISAMBIG__)/ }], "#redirect": [{ token: [ "keyword.control.redirect", "meta.keyword.control" ], regex: /(^#REDIRECT|^#redirect|^#Redirect)(\s+)/ }], "#variable": [{ token: "storage.type.variable", regex: /{{{/, push: [{ token: "storage.type.variable", regex: /}}}/, next: "pop" }, { token: [ "text", "variable.other", "text", "keyword.operator" ], regex: /(\s*)(\w+)(\s*)((?:\|)?)/ }, { defaultToken: "storage.type.variable" }] }], "#entity": [{ token: "constant.character.entity", regex: /&\w+;/ }], "#list": [{ token: "markup.bold", regex: /^[#*;:]+/, push: [{ token: "markup.list", regex: /$/, next: "pop" }, { include: "$self" }, { defaultToken: "markup.list" }] }], "#template": [{ token: [ "storage.type.function", "meta.template", "entity.name.function", "meta.template" ], regex: /({{)(\s*)([#\w: ]+)(\s*)/, push: [{ token: "storage.type.function", regex: /}}/, next: "pop" }, { token: [ "storage", "meta.structure.dictionary", "support.type.property-name", "meta.structure.dictionary", "punctuation.separator.dictionary.key-value", "meta.structure.dictionary", "meta.structure.dictionary.value" ], regex: /(\|)(\s*)([a-zA-Z-]*)(\s*)(=)(\s*)([^|}]*)/, push: [{ token: "meta.structure.dictionary", regex: /(?=}}|[|])/, next: "pop" }, { defaultToken: "meta.structure.dictionary" }] }, { token: ["storage", "meta.template.value"], regex: /(\|)(.*?)/, push: [{ token: [], regex: /(?=}}|[|])/, next: "pop" }, { include: "$self" }, { defaultToken: "meta.template.value" }] }, { defaultToken: "meta.template" }] }], "#link": [{ token: [ "punctuation.definition.tag.begin", "meta.tag.link.internal", "entity.name.tag", "meta.tag.link.internal", "string.other.link.title", "meta.tag.link.internal", "punctuation.definition.tag" ], regex: /(\[\[)(\s*)((?:Category|Wikipedia)?)(:?)([^\]\]\|]+)(\s*)((?:\|)*)/, push: [{ token: "punctuation.definition.tag.end", regex: /\]\]/, next: "pop" }, { include: "$self" }, { defaultToken: "meta.tag.link.internal" }] }, { token: [ "punctuation.definition.tag.begin", "meta.tag.link.external", "meta.tag.link.external", "string.unquoted", "punctuation.definition.tag.end" ], regex: /(\[)(.*?)([\s]+)(.*?)(\])/ }], "#comment": [{ token: "punctuation.definition.comment.html", regex: /<!--/, push: [{ token: "punctuation.definition.comment.html", regex: /-->/, next: "pop" }, { defaultToken: "comment.block.html" }] }], "#emphasis": [{ token: [ "punctuation.definition.tag.begin", "markup.italic.bold", "punctuation.definition.tag.end" ], regex: /(''''')(?!')(.*?)('''''|$)/ }, { token: [ "punctuation.definition.tag.begin", "markup.bold", "punctuation.definition.tag.end" ], regex: /(''')(?!')(.*?)('''|$)/ }, { token: [ "punctuation.definition.tag.begin", "markup.italic", "punctuation.definition.tag.end" ], regex: /('')(?!')(.*?)(''|$)/ }], "#heading": [{ token: [ "punctuation.definition.heading", "entity.name.section", "punctuation.definition.heading" ], regex: /(={1,6})(.+?)(\1)(?!=)/ }], "#tag": [{ token: [ "punctuation.definition.tag.begin", "entity.name.tag", "meta.tag.block.ref", "punctuation.definition.tag.end" ], regex: /(<)(ref)((?:\s+.*?)?)(>)/, caseInsensitive: true, push: [{ token: [ "punctuation.definition.tag.begin", "entity.name.tag", "meta.tag.block.ref", "punctuation.definition.tag.end" ], regex: /(<\/)(ref)(\s*)(>)/, caseInsensitive: true, next: "pop" }, { include: "$self" }, { defaultToken: "meta.tag.block.ref" }] }, { token: [ "punctuation.definition.tag.begin", "entity.name.tag", "meta.tag.block.nowiki", "punctuation.definition.tag.end" ], regex: /(<)(nowiki)((?:\s+.*?)?)(>)/, caseInsensitive: true, push: [{ token: [ "punctuation.definition.tag.begin", "entity.name.tag", "meta.tag.block.nowiki", "punctuation.definition.tag.end" ], regex: /(<\/)(nowiki)(\s*)(>)/, caseInsensitive: true, next: "pop" }, { defaultToken: "meta.tag.block.nowiki" }] }, { token: [ "punctuation.definition.tag.begin", "entity.name.tag" ], regex: /(<\/?)(noinclude|includeonly|onlyinclude)(?=\W)/, caseInsensitive: true, push: [{ token: [ "invalid.illegal", "punctuation.definition.tag.end" ], regex: /((?:\/)?)(>)/, next: "pop" }, { include: "#attribute" }, { defaultToken: "meta.tag.block.any" }] }, { token: [ "punctuation.definition.tag.begin", "entity.name.tag" ], regex: /(<)(br|wbr|hr|meta|link)(?=\W)/, caseInsensitive: true, push: [{ token: "punctuation.definition.tag.end", regex: /\/?>/, next: "pop" }, { include: "#attribute" }, { defaultToken: "meta.tag.other" }] }, { token: [ "punctuation.definition.tag.begin", "entity.name.tag" ], regex: /(<\/?)(div|center|span|h1|h2|h3|h4|h5|h6|bdo|em|strong|cite|dfn|code|samp|kbd|var|abbr|blockquote|q|sub|sup|p|pre|ins|del|ul|ol|li|dl|dd|dt|table|caption|thead|tfoot|tbody|colgroup|col|tr|td|th|a|img|video|source|track|tt|b|i|big|small|strike|s|u|font|ruby|rb|rp|rt|rtc|math|figure|figcaption|bdi|data|time|mark|html)(?=\W)/, caseInsensitive: true, push: [{ token: [ "invalid.illegal", "punctuation.definition.tag.end" ], regex: /((?:\/)?)(>)/, next: "pop" }, { include: "#attribute" }, { defaultToken: "meta.tag.block" }] }, { token: [ "punctuation.definition.tag.begin", "invalid.illegal" ], regex: /(<\/)(br|wbr|hr|meta|link)(?=\W)/, caseInsensitive: true, push: [{ token: "punctuation.definition.tag.end", regex: /\/?>/, next: "pop" }, { include: "#attribute" }, { defaultToken: "meta.tag.other" }] }], "#caption": [{ token: [ "meta.tag.block.table-caption", "punctuation.definition.tag.begin" ], regex: /^(\s*)(\|\+)/, push: [{ token: "meta.tag.block.table-caption", regex: /$/, next: "pop" }, { defaultToken: "meta.tag.block.table-caption" }] }], "#tr": [{ token: [ "meta.tag.block.tr", "punctuation.definition.tag.begin", "meta.tag.block.tr", "invalid.illegal" ], regex: /^(\s*)(\|\-)([\s]*)(.*)/ }], "#th": [{ token: [ "meta.tag.block.th.heading", "punctuation.definition.tag.begin", "meta.tag.block.th.heading", "punctuation.definition.tag", "markup.bold" ], regex: /^(\s*)(!)(?:(.*?)(\|))?(.*?)(?=!!|$)/, push: [{ token: "meta.tag.block.th.heading", regex: /$/, next: "pop" }, { token: [ "punctuation.definition.tag.begin", "meta.tag.block.th.inline", "punctuation.definition.tag", "markup.bold" ], regex: /(!!)(?:(.*?)(\|))?(.*?)(?=!!|$)/ }, { include: "$self" }, { defaultToken: "meta.tag.block.th.heading" }] }], "#td": [{ token: [ "meta.tag.block.td", "punctuation.definition.tag.begin" ], regex: /^(\s*)(\|)/, push: [{ token: "meta.tag.block.td", regex: /$/, next: "pop" }, { include: "$self" }, { defaultToken: "meta.tag.block.td" }] }], "#table": [{ patterns: [{ name: "meta.tag.block.table", begin: "^\\s*({\\|)(.*?)$", end: "^\\s*\\|}", beginCaptures: { 1: { name: "punctuation.definition.tag.begin" }, 2: { patterns: [{ include: "#attribute" }] }, 3: { name: "invalid.illegal" } }, endCaptures: { 0: { name: "punctuation.definition.tag.end" } }, patterns: [{ include: "#comment" }, { include: "#template" }, { include: "#caption" }, { include: "#tr" }, { include: "#th" }, { include: "#td" }] }], repository: { caption: { name: "meta.tag.block.table-caption", begin: "^\\s*(\\|\\+)", end: "$", beginCaptures: { 1: { name: "punctuation.definition.tag.begin" } } }, tr: { name: "meta.tag.block.tr", match: "^\\s*(\\|\\-)[\\s]*(.*)", captures: { 1: { name: "punctuation.definition.tag.begin" }, 2: { name: "invalid.illegal" } } }, th: { name: "meta.tag.block.th.heading", begin: "^\\s*(!)((.*?)(\\|))?(.*?)(?=(!!)|$)", end: "$", beginCaptures: { 1: { name: "punctuation.definition.tag.begin" }, 3: { patterns: [{ include: "#attribute" }] }, 4: { name: "punctuation.definition.tag" }, 5: { name: "markup.bold" } }, patterns: [{ name: "meta.tag.block.th.inline", match: "(!!)((.*?)(\\|))?(.*?)(?=(!!)|$)", captures: { 1: { name: "punctuation.definition.tag.begin" }, 3: { patterns: [{ include: "#attribute" }] }, 4: { name: "punctuation.definition.tag" }, 5: { name: "markup.bold" } } }, { include: "$self" }] }, td: { name: "meta.tag.block.td", begin: "^\\s*(\\|)", end: "$", beginCaptures: { 1: { name: "punctuation.definition.tag.begin" }, 2: { patterns: [{ include: "#attribute" }] }, 3: { name: "punctuation.definition.tag" } }, patterns: [{ include: "$self" }] } } }], "#attribute": [{ include: "#string" }, { token: "entity.other.attribute-name", regex: /\w+/ }], "#string": [{ token: "string.quoted.double", regex: /\"/, push: [{ token: "string.quoted.double", regex: /\"/, next: "pop" }, { defaultToken: "string.quoted.double" }] }, { token: "string.quoted.single", regex: /\'/, push: [{ token: "string.quoted.single", regex: /\'/, next: "pop" }, { defaultToken: "string.quoted.single" }] }], "#url": [{ token: "markup.underline.link", regex: /(?:http(?:s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:\/?#\[\]@!\$&'\(\)\*\+,;=.]+/ }, { token: "invalid.illegal", regex: /.*/ }] }; this.normalizeRules(); }; MediaWikiHighlightRules.metaData = { name: "MediaWiki", scopeName: "text.html.mediawiki", fileTypes: ["mediawiki", "wiki"] }; oop.inherits(MediaWikiHighlightRules, TextHighlightRules); exports.MediaWikiHighlightRules = MediaWikiHighlightRules; ================================================ FILE: src/mode/mel.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MELHighlightRules = require("./mel_highlight_rules").MELHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = MELHighlightRules; this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/mel"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/mel_highlight_rules.js ================================================ /* THIS FILE WAS AUTOGENERATED FROM MEL.tmLanguage (UUID: 69554E52-391D-42BC-9F65-7A77444BA1CF) */ /**************************************************************** * IT MIGHT NOT BE PERFECT, PARTICULARLY: * * IN DECIDING STATES TO TRANSITION TO, * * IGNORING WHITESPACE, * * IGNORING GROUPS WITH ?:, * * EXTENDING EXISTING MODES, * * GATHERING KEYWORDS, OR * * DECIDING WHEN TO USE PUSH. * * ...But it's a good start from an existing *.tmlanguage file. * ****************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MELHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { caseInsensitive: true, token: 'storage.type.mel', regex: '\\b(matrix|string|vector|float|int|void)\\b' }, { caseInsensitive: true, token: 'support.function.mel', regex: '\\b((s(h(ow(ManipCtx|S(hadingGroupAttrEditor|electionInTitle)|H(idden|elp)|Window)|el(f(Button|TabLayout|Layout)|lField)|ading(GeometryRelCtx|Node|Connection|LightRelCtx))|y(s(tem|File)|mbol(Button|CheckBox))|nap(shot|Mode|2to2 |TogetherCtx|Key)|c(ulpt|ene(UIReplacement|Editor)|ale(BrushBrightness |Constraint|Key(Ctx)?)?|r(ipt(Node|Ctx|Table|edPanel(Type)?|Job|EditorInfo)|oll(Field|Layout))|mh)|t(itch(Surface(Points)?|AndExplodeShell )|a(ckTrace|rt(sWith |String ))|r(cmp|i(ng(ToStringArray |Array(Remove(Duplicates | )|C(ount |atenate )|ToString |Intersector))|p )|oke))|i(n(gleProfileBirailSurface)?|ze|gn|mplify)|o(u(nd(Control)?|rce)|ft(Mod(Ctx)?)?|rt)|u(perCtx|rface(S(haderList|ampler))?|b(st(itute(Geometry|AllString )?|ring)|d(M(irror|a(tchTopology|p(SewMove|Cut)))|iv(Crease|DisplaySmoothness)?|C(ollapse|leanTopology)|T(o(Blind|Poly)|ransferUVsToCache)|DuplicateAndConnect|EditUV|ListComponentConversion|AutoProjection)))|p(h(ere|rand)|otLight(PreviewPort)?|aceLocator|r(ing|eadSheetEditor))|e(t(s|MenuMode|Sta(te |rtupMessage|mpDensity )|NodeTypeFlag|ConstraintRestPosition |ToolTo|In(putDeviceMapping|finity)|D(ynamic|efaultShadingGroup|rivenKeyframe)|UITemplate|P(ar(ticleAttr|ent)|roject )|E(scapeCtx|dit(or|Ctx))|Key(Ctx|frame|Path)|F(ocus|luidAttr)|Attr(Mapping)?)|parator|ed|l(ect(Mode|ionConnection|Context|Type|edNodes|Pr(iority|ef)|Key(Ctx)?)?|LoadSettings)|archPathArray )|kin(Cluster|Percent)|q(uareSurface|rt)|w(itchTable|atchDisplayPort)|a(ve(Menu|Shelf|ToolSettings|I(nitialState|mage)|Pref(s|Objects)|Fluid|A(ttrPreset |llShelves))|mpleImage)|rtContext|mooth(step|Curve|TangentSurface))|h(sv_to_rgb|yp(ot|er(Graph|Shade|Panel))|i(tTest|de|lite)|ot(Box|key(Check)?)|ud(Button|Slider(Button)?)|e(lp(Line)?|adsUpDisplay|rmite)|wRe(nder(Load)?|flectionMap)|ard(enPointCurve|ware(RenderPanel)?))|n(o(nLinear|ise|de(Type|IconButton|Outliner|Preset)|rmal(ize |Constraint))|urbs(Boolean|S(elect|quare)|C(opyUVSet|ube)|To(Subdiv|Poly(gonsPref)?)|Plane|ViewDirectionVector )|ew(ton|PanelItems)|ame(space(Info)?|Command|Field))|c(h(oice|dir|eck(Box(Grp)?|DefaultRenderGlobals)|a(n(nelBox|geSubdiv(Region|ComponentDisplayLevel))|racter(Map|OutlineEditor)?))|y(cleCheck|linder)|tx(Completion|Traverse|EditMode|Abort)|irc(ularFillet|le)|o(s|n(str(uctionHistory|ain(Value)?)|nect(ionInfo|Control|Dynamic|Joint|Attr)|t(extInfo|rol)|dition|e|vert(SolidTx|Tessellation|Unit|FromOldLayers |Lightmap)|firmDialog)|py(SkinWeights|Key|Flexor|Array )|l(or(Slider(Grp|ButtonGrp)|Index(SliderGrp)?|Editor|AtPoint)?|umnLayout|lision)|arsenSubdivSelectionList|m(p(onentEditor|utePolysetVolume |actHairSystem )|mand(Port|Echo|Line)))|u(tKey|r(ve(MoveEPCtx|SketchCtx|CVCtx|Intersect|OnSurface|E(ditorCtx|PCtx)|AddPtCtx)?|rent(Ctx|Time(Ctx)?|Unit)))|p(GetSolverAttr|Button|S(olver(Types)?|e(t(SolverAttr|Edit)|am))|C(o(nstraint|llision)|ache)|Tool|P(anel|roperty))|eil|l(ip(Schedule(rOutliner)?|TrimBefore |Editor(CurrentTimeCtx)?)?|ose(Surface|Curve)|uster|ear(Cache)?|amp)|a(n(CreateManip|vas)|tch(Quiet)?|pitalizeString |mera(View)?)|r(oss(Product )?|eate(RenderLayer|MotionField |SubdivRegion|N(ode|ewShelf )|D(isplayLayer|rawCtx)|Editor))|md(Shell|FileOutput))|M(R(ender(ShadowData|Callback|Data|Util|View|Line(Array)?)|ampAttribute)|G(eometryData|lobal)|M(odelMessage|essage|a(nipData|t(erial|rix)))|BoundingBox|S(yntax|ceneMessage|t(atus|ring(Array)?)|imple|pace|elect(ion(Mask|List)|Info)|watchRender(Register|Base))|H(ardwareRenderer|WShaderSwatchGenerator)|NodeMessage|C(o(nditionMessage|lor(Array)?|m(putation|mand(Result|Message)))|ursor|loth(Material|S(ystem|olverRegister)|Con(straint|trol)|Triangle|Particle|Edge|Force)|allbackIdArray)|T(ypeId|ime(r(Message)?|Array)?|oolsInfo|esselationParams|r(imBoundaryArray|ansformationMatrix))|I(ntArray|t(Geometry|Mesh(Polygon|Edge|Vertex|FaceVertex)|S(urfaceCV|electionList)|CurveCV|Instancer|eratorType|D(ependency(Graph|Nodes)|ag)|Keyframe)|k(System|HandleGroup)|mage)|3dView|Object(SetMessage|Handle|Array)?|D(G(M(odifier|essage)|Context)|ynSwept(Triangle|Line)|istance|oubleArray|evice(State|Channel)|a(ta(Block|Handle)|g(M(odifier|essage)|Path(Array)?))|raw(Request(Queue)?|Info|Data|ProcedureBase))|U(serEventMessage|i(nt(Array|64Array)|Message))|P(o(int(Array)?|lyMessage)|lug(Array)?|rogressWindow|x(G(eometry(Iterator|Data)|lBuffer)|M(idiInputDevice|odelEditorCommand|anipContainer)|S(urfaceShape(UI)?|pringNode|electionContext)|HwShaderNode|Node|Co(ntext(Command)?|m(ponentShape|mand))|T(oolCommand|ransform(ationMatrix)?)|IkSolver(Node)?|3dModelView|ObjectSet|D(eformerNode|ata|ragAndDropBehavior)|PolyT(weakUVCommand|rg)|EmitterNode|F(i(eldNode|leTranslator)|luidEmitterNode)|LocatorNode))|E(ulerRotation|vent(Message)?)|ayatomr|Vector(Array)?|Quaternion|F(n(R(otateManip|eflectShader|adialField)|G(e(nericAttribute|ometry(Data|Filter))|ravityField)|M(otionPath|es(sageAttribute|h(Data)?)|a(nip3D|trix(Data|Attribute)))|B(l(innShader|endShapeDeformer)|ase)|S(caleManip|t(ateManip|ring(Data|ArrayData))|ingleIndexedComponent|ubd(Names|Data)?|p(hereData|otLight)|et|kinCluster)|HikEffector|N(on(ExtendedLight|AmbientLight)|u(rbs(Surface(Data)?|Curve(Data)?)|meric(Data|Attribute))|ewtonField)|C(haracter|ircleSweepManip|ompo(nent(ListData)?|undAttribute)|urveSegmentManip|lip|amera)|T(ypedAttribute|oggleManip|urbulenceField|r(ipleIndexedComponent|ansform))|I(ntArrayData|k(Solver|Handle|Joint|Effector))|D(ynSweptGeometryData|i(s(cManip|tanceManip)|rection(Manip|alLight))|ouble(IndexedComponent|ArrayData)|ependencyNode|a(ta|gNode)|ragField)|U(ni(tAttribute|formField)|Int64ArrayData)|P(hong(Shader|EShader)|oint(On(SurfaceManip|CurveManip)|Light|ArrayData)|fxGeometry|lugin(Data)?|arti(cleSystem|tion))|E(numAttribute|xpression)|V(o(lume(Light|AxisField)|rtexField)|ectorArrayData)|KeyframeDelta(Move|B(lockAddRemove|reakdown)|Scale|Tangent|InfType|Weighted|AddRemove)?|F(ield|luid|reePointTriadManip)|W(ireDeformer|eightGeometryFilter)|L(ight(DataAttribute)?|a(yeredShader|ttice(D(eformer|ata))?|mbertShader))|A(ni(sotropyShader|mCurve)|ttribute|irField|r(eaLight|rayAttrsData)|mbientLight))?|ile(IO|Object)|eedbackLine|loat(Matrix|Point(Array)?|Vector(Array)?|Array))|L(i(ghtLinks|brary)|ockMessage)|A(n(im(Message|C(ontrol|urveC(hange|lipboard(Item(Array)?)?))|Util)|gle)|ttribute(Spec(Array)?|Index)|r(rayData(Builder|Handle)|g(Database|Parser|List))))|t(hreePointArcCtx|ime(Control|Port|rX)|o(ol(Button|HasOptions|Collection|Dropped|PropertyWindow)|NativePath |upper|kenize(List )?|l(ower|erance)|rus|ggle(WindowVisibility|Axis)?)|u(rbulence|mble(Ctx)?)|ex(RotateContext|M(oveContext|anipContext)|t(ScrollList|Curves|ure(HairColor |DisplacePlane |PlacementContext|Window)|ToShelf |Field(Grp|ButtonGrp)?)?|S(caleContext|electContext|mudgeUVContext)|WinToolCtx)|woPointArcCtx|a(n(gentConstraint)?|bLayout)|r(im|unc(ate(HairCache|FluidCache))?|a(ns(formLimits|lator)|c(e|k(Ctx)?))))|i(s(olateSelect|Connected|True|Dirty|ParentOf |Valid(String |ObjectName |UiName )|AnimCurve )|n(s(tance(r)?|ert(Joint(Ctx)?|K(not(Surface|Curve)|eyCtx)))|heritTransform|t(S(crollBar|lider(Grp)?)|er(sect|nalVar|ToUI )|Field(Grp)?))|conText(Radio(Button|Collection)|Button|StaticLabel|CheckBox)|temFilter(Render|Type|Attr)?|prEngine|k(S(ystem(Info)?|olver|plineHandleCtx)|Handle(Ctx|DisplayScale)?|fkDisplayMethod)|m(portComposerCurves |fPlugins|age))|o(ceanNurbsPreviewPlane |utliner(Panel|Editor)|p(tion(Menu(Grp)?|Var)|en(GLExtension|MayaPref))|verrideModifier|ffset(Surface|Curve(OnSurface)?)|r(ientConstraint|bit(Ctx)?)|b(soleteProc |j(ect(Center|Type(UI)?|Layer )|Exists)))|d(yn(RelEd(itor|Panel)|Globals|C(ontrol|ache)|P(a(intEditor|rticleCtx)|ref)|Exp(ort|ression)|amicLoad)|i(s(connect(Joint|Attr)|tanceDim(Context|ension)|pla(y(RGBColor|S(tats|urface|moothness)|C(olor|ull)|Pref|LevelOfDetail|Affected)|cementToPoly)|kCache|able)|r(name |ect(ionalLight|KeyCtx)|map)|mWhen)|o(cServer|Blur|t(Product )?|ubleProfileBirailSurface|peSheetEditor|lly(Ctx)?)|uplicate(Surface|Curve)?|e(tach(Surface|Curve|DeviceAttr)|vice(Panel|Editor)|f(ine(DataServer|VirtualDevice)|ormer|ault(Navigation|LightListCheckBox))|l(ete(Sh(elfTab |adingGroupsAndMaterials )|U(nusedBrushes |I)|Attr)?|randstr)|g_to_rad)|agPose|r(opoffLocator|ag(gerContext)?)|g(timer|dirty|Info|eval))|CBG |u(serCtx|n(t(angleUV|rim)|i(t|form)|do(Info)?|loadPlugin|assignInputDevice|group)|iTemplate|p(dateAE |Axis)|v(Snapshot|Link))|joint(C(tx|luster)|DisplayScale|Lattice)?|p(sd(ChannelOutliner|TextureFile|E(ditTextureFile|xport))|close|i(c(ture|kWalk)|xelMove)|o(se|int(MatrixMult |C(onstraint|urveConstraint)|On(Surface|Curve)|Position|Light)|p(upMenu|en)|w|l(y(Reduce|GeoSampler|M(irrorFace|ove(UV|Edge|Vertex|Facet(UV)?)|erge(UV|Edge(Ctx)?|Vertex|Facet(Ctx)?)|ap(Sew(Move)?|Cut|Del))|B(oolOp|evel|l(indData|endColor))|S(traightenUVBorder|oftEdge|u(perCtx|bdivide(Edge|Facet))|p(her(icalProjection|e)|lit(Ring|Ctx|Edge|Vertex)?)|e(tToFaceNormal|parate|wEdge|lect(Constraint(Monitor)?|EditCtx))|mooth)|Normal(izeUV|PerVertex)?|C(hipOff|ylind(er|ricalProjection)|o(ne|pyUV|l(or(BlindData|Set|PerVertex)|lapse(Edge|Facet)))|u(t(Ctx)?|be)|l(ipboard|oseBorder)|acheMonitor|rea(seEdge|teFacet(Ctx)?))|T(o(Subdiv|rus)|r(iangulate|ansfer))|In(stallAction|fo)|Options|D(uplicate(Edge|AndConnect)|el(Edge|Vertex|Facet))|U(nite|VSet)|P(yramid|oke|lan(e|arProjection)|r(ism|ojection))|E(ditUV|valuate|xtrude(Edge|Facet))|Qu(eryBlindData|ad)|F(orceUV|lip(UV|Edge))|WedgeFace|L(istComponentConversion|ayoutUV)|A(utoProjection|ppend(Vertex|FacetCtx)?|verage(Normal|Vertex)))|eVectorConstraint))|utenv|er(cent|formanceOptions)|fxstrokes|wd|l(uginInfo|a(y(b(last|ackOptions))?|n(e|arSrf)))|a(steKey|ne(l(History|Configuration)?|Layout)|thAnimation|irBlend|use|lettePort|r(ti(cle(RenderInfo|Instancer|Exists)?|tion)|ent(Constraint)?|am(Dim(Context|ension)|Locator)))|r(int|o(j(ect(ion(Manip|Context)|Curve|Tangent)|FileViewer)|pMo(dCtx|ve)|gress(Bar|Window)|mptDialog)|eloadRefEd))|e(n(codeString|d(sWith |String )|v|ableDevice)|dit(RenderLayer(Globals|Members)|or(Template)?|DisplayLayer(Globals|Members)|AttrLimits )|v(ent|al(Deferred|Echo)?)|quivalent(Tol | )|ffector|r(f|ror)|x(clusiveLightCheckBox|t(end(Surface|Curve)|rude)|ists|p(ortComposerCurves |ression(EditorListen)?)?|ec(uteForEachObject )?|actWorldBoundingBox)|mit(ter)?)|v(i(sor|ew(Set|HeadOn|2dToolCtx|C(lipPlane|amera)|Place|Fit|LookAt))|o(lumeAxis|rtex)|e(ctorize|rifyCmd )|alidateShelfName )|key(Tangent|frame(Region(MoveKeyCtx|S(caleKeyCtx|e(tKeyCtx|lectKeyCtx))|CurrentTimeCtx|TrackCtx|InsertKeyCtx|D(irectKeyCtx|ollyCtx))|Stats|Outliner)?)|qu(it|erySubdiv)|f(c(heck|lose)|i(nd(RelatedSkinCluster |MenuItem |er|Keyframe|AllIntersections )|tBspline|l(ter(StudioImport|Curve|Expand)?|e(BrowserDialog|test|Info|Dialog|Extension )?|letCurve)|rstParentOf )|o(ntDialog|pen|rmLayout)|print|eof|flush|write|l(o(or|w|at(S(crollBar|lider(Grp|ButtonGrp|2)?)|Eq |Field(Grp)?))|u(shUndo|id(CacheInfo|Emitter|VoxelInfo))|exor)|r(omNativePath |e(eFormFillet|wind|ad)|ameLayout)|get(word|line)|mod)|w(hatIs|i(ndow(Pref)?|re(Context)?)|orkspace|ebBrowser(Prefs)?|a(itCursor|rning)|ri(nkle(Context)?|teTake))|l(s(T(hroughFilter|ype )|UI)?|i(st(Relatives|MenuAnnotation |Sets|History|NodeTypes|C(onnections|ameras)|Transforms |InputDevice(s|Buttons|Axes)|erEditor|DeviceAttachments|Unselected |A(nimatable|ttr))|n(step|eIntersection )|ght(link|List(Panel|Editor)?))|o(ckNode|okThru|ft|ad(NewShelf |P(lugin|refObjects)|Fluid)|g)|a(ssoContext|y(out|er(Button|ed(ShaderPort|TexturePort)))|ttice(DeformKeyCtx)?|unch(ImageEditor)?))|a(ssign(Command|InputDevice)|n(notate|im(C(one|urveEditor)|Display|View)|gle(Between)?)|tt(ach(Surface|Curve|DeviceAttr)|r(ibute(Menu|Info|Exists|Query)|NavigationControlGrp|Co(ntrolGrp|lorSliderGrp|mpatibility)|PresetEditWin|EnumOptionMenu(Grp)?|Field(Grp|SliderGrp)))|i(r|mConstraint)|d(d(NewShelfTab|Dynamic|PP|Attr(ibuteEditorNodeHelp)?)|vanceToNextDrivenKey)|uto(Place|Keyframe)|pp(endStringArray|l(y(Take|AttrPreset)|icationName))|ffect(s|edNet)|l(i(as(Attr)?|gn(Surface|C(tx|urve))?)|lViewFit)|r(c(len|Len(DimContext|gthDimension))|t(BuildPaintMenu|Se(tPaintCtx|lectCtx)|3dPaintCtx|UserPaintCtx|PuttyCtx|FluidAttrCtx|Attr(SkinPaintCtx|Ctx|PaintVertexCtx))|rayMapper)|mbientLight|b(s|out))|r(igid(Body|Solver)|o(t(at(ionInterpolation|e))?|otOf |undConstantRadius|w(ColumnLayout|Layout)|ll(Ctx)?)|un(up|TimeCommand)|e(s(olutionNode|et(Tool|AE )|ampleFluid)|hash|n(der(GlobalsNode|Manip|ThumbnailUpdate|Info|er|Partition|QualityNode|Window(SelectContext|Editor)|LayerButton)?|ame(SelectionList |UI|Attr)?)|cord(Device|Attr)|target|order(Deformers)?|do|v(olve|erse(Surface|Curve))|quires|f(ineSubdivSelectionList|erence(Edit|Query)?|resh(AE )?)|loadImage|adTake|root|move(MultiInstance|Joint)|build(Surface|Curve))|a(n(d(state|omizeFollicles )?|geControl)|d(i(o(MenuItemCollection|Button(Grp)?|Collection)|al)|_to_deg)|mpColorPort)|gb_to_hsv)|g(o(toBindPose |al)|e(t(M(odifiers|ayaPanelTypes )|Classification|InputDeviceRange|pid|env|DefaultBrush|Pa(nel|rticleAttr)|F(ileList|luidAttr)|A(ttr|pplicationVersionAsFloat ))|ometryConstraint)|l(Render(Editor)?|obalStitch)|a(uss|mma)|r(id(Layout)?|oup(ObjectsByName )?|a(dientControl(NoAttr)?|ph(SelectContext|TrackCtx|DollyCtx)|vity|bColor))|match)|x(pmPicker|form|bmLangPathList )|m(i(n(imizeApp)?|rrorJoint)|o(del(CurrentTimeCtx|Panel|Editor)|use|v(In|e(IKtoFK |VertexAlongDirection|KeyCtx)?|Out))|u(te|ltiProfileBirailSurface)|e(ssageLine|nu(BarLayout|Item(ToShelf )?|Editor)?|mory)|a(nip(Rotate(Context|LimitsCtx)|Move(Context|LimitsCtx)|Scale(Context|LimitsCtx)|Options)|tch|ke(Roll |SingleSurface|TubeOn |Identity|Paintable|bot|Live)|rker|g|x))|b(in(Membership|d(Skin|Pose))|o(neLattice|undary|x(ZoomCtx|DollyCtx))|u(tton(Manip)?|ild(BookmarkMenu|KeyframeMenu)|fferCurve)|e(ssel|vel(Plus)?)|l(indDataType|end(Shape(Panel|Editor)?|2|TwoAttr))|a(sename(Ex | )|tchRender|ke(Results|Simulation|Clip|PartialHistory|FluidShading )))))\\b' }, { caseInsensitive: true, token: 'support.constant.mel', regex: '\\b(s(h(ellTessellate|a(d(ing(Map|Engine)|erGlow)|pe))|n(ow|apshot(Shape)?)|c(ulpt|aleConstraint|ript)|t(yleCurve|itch(Srf|AsNurbsShell)|u(cco|dioClearCoat)|encil|roke(Globals)?)|i(ngleShadingSwitch|mpleVolumeShader)|o(ftMod(Manip|Handle)?|lidFractal)|u(rface(Sha(der|pe)|Info|EdManip|VarGroup|Luminance)|b(Surface|d(M(odifier(UV|World)?|ap(SewMove|Cut|pingManip))|B(lindData|ase)|iv(ReverseFaces|SurfaceVarGroup|Co(llapse|mponentId)|To(Nurbs|Poly))?|HierBlind|CleanTopology|Tweak(UV)?|P(lanarProj|rojManip)|LayoutUV|A(ddTopology|utoProj))|Curve))|p(BirailSrf|otLight|ring)|e(tRange|lectionListOperator)|k(inCluster|etchPlane)|quareSrf|ampler(Info)?|m(ooth(Curve|TangentSrf)|ear))|h(svToRgb|yper(GraphInfo|View|Layout)|ik(Solver|Handle|Effector)|oldMatrix|eightField|w(Re(nderGlobals|flectionMap)|Shader)|a(ir(System|Constraint|TubeShader)|rd(enPoint|wareRenderGlobals)))|n(o(n(ExtendedLightShapeNode|Linear|AmbientLightShapeNode)|ise|rmalConstraint)|urbs(Surface|Curve|T(oSubdiv(Proc)?|essellate)|DimShape)|e(twork|wtonField))|c(h(o(ice|oser)|ecker|aracter(Map|Offset)?)|o(n(straint|tr(olPoint|ast)|dition)|py(ColorSet|UVSet))|urve(Range|Shape|Normalizer(Linear|Angle)?|In(tersect|fo)|VarGroup|From(Mesh(CoM|Edge)?|Su(rface(Bnd|CoS|Iso)?|bdiv(Edge|Face)?)))|l(ip(Scheduler|Library)|o(se(stPointOnSurface|Surface|Curve)|th|ud)|uster(Handle)?|amp)|amera(View)?|r(eate(BPManip|ColorSet|UVSet)|ater))|t(ime(ToUnitConversion|Function)?|oo(nLineAttributes|lDrawManip)|urbulenceField|ex(BaseDeformManip|ture(BakeSet|2d|ToGeom|3d|Env)|SmudgeUVManip|LatticeDeformManip)|weak|angentConstraint|r(i(pleShadingSwitch|m(WithBoundaries)?)|ansform(Geometry)?))|i(n(s(tancer|ertKnot(Surface|Curve))|tersectSurface)|k(RPsolver|MCsolver|S(ystem|olver|Csolver|plineSolver)|Handle|PASolver|Effector)|m(plicit(Box|Sphere|Cone)|agePlane))|o(cean(Shader)?|pticalFX|ffset(Surface|C(os|urve))|ldBlindDataBase|rient(Constraint|ationMarker)|bject(RenderFilter|MultiFilter|BinFilter|S(criptFilter|et)|NameFilter|TypeFilter|Filter|AttrFilter))|d(yn(Globals|Base)|i(s(tance(Between|DimShape)|pla(yLayer(Manager)?|cementShader)|kCache)|rect(ionalLight|edDisc)|mensionShape)|o(ubleShadingSwitch|f)|pBirailSrf|e(tach(Surface|Curve)|pendNode|f(orm(Bend|S(ine|quash)|Twist|ableShape|F(unc|lare)|Wave)|ault(RenderUtilityList|ShaderList|TextureList|LightList))|lete(Co(lorSet|mponent)|UVSet))|ag(Node|Pose)|r(opoffLocator|agField))|u(seBackground|n(trim|i(t(Conversion|ToTimeConversion)|formField)|known(Transform|Dag)?)|vChooser)|j(iggle|oint(Cluster|Ffd|Lattice)?)|p(sdFileTex|hong(E)?|o(s(tProcessList|itionMarker)|int(MatrixMult|Constraint|On(SurfaceInfo|CurveInfo)|Emitter|Light)|l(y(Reduce|M(irror|o(difier(UV|World)?|ve(UV|Edge|Vertex|Face(tUV)?))|erge(UV|Edge|Vert|Face)|ap(Sew(Move)?|Cut|Del))|B(oolOp|evel|lindData|ase)|S(traightenUVBorder|oftEdge|ubd(Edge|Face)|p(h(ere|Proj)|lit(Ring|Edge|Vert)?)|e(parate|wEdge)|mooth(Proxy|Face)?)|Normal(izeUV|PerVertex)?|C(hipOff|yl(inder|Proj)|o(ne|pyUV|l(orPerVertex|lapse(Edge|F)))|u(t(Manip(Container)?)?|be)|loseBorder|rea(seEdge|t(or|eFace)))|T(o(Subdiv|rus)|weak(UV)?|r(iangulate|ansfer))|OptUvs|D(uplicateEdge|el(Edge|Vertex|Facet))|Unite|P(yramid|oke(Manip)?|lan(e|arProj)|r(i(sm|mitive)|oj))|Extrude(Edge|Vertex|Face)|VertexNormalManip|Quad|Flip(UV|Edge)|WedgeFace|LayoutUV|A(utoProj|ppend(Vertex)?|verageVertex))|eVectorConstraint))|fx(Geometry|Hair|Toon)|l(usMinusAverage|a(n(e|arTrimSurface)|ce(2dTexture|3dTexture)))|a(ssMatrix|irBlend|r(ti(cle(SamplerInfo|C(olorMapper|loud)|TranspMapper|IncandMapper|AgeMapper)?|tion)|ent(Constraint|Tessellate)|amDimension))|r(imitive|o(ject(ion|Curve|Tangent)|xyManager)))|e(n(tity|v(Ball|ironmentFog|S(phere|ky)|C(hrome|ube)|Fog))|x(t(end(Surface|Curve)|rude)|p(lodeNurbsShell|ression)))|v(iewManip|o(lume(Shader|Noise|Fog|Light|AxisField)|rtexField)|e(ctor(RenderGlobals|Product)|rtexBakeSet))|quadShadingSwitch|f(i(tBspline|eld|l(ter(Resample|Simplify|ClosestSample|Euler)?|e|letCurve))|o(urByFourMatrix|llicle)|urPointOn(MeshInfo|Subd)|f(BlendSrf(Obsolete)?|d|FilletSrf)|l(ow|uid(S(hape|liceManip)|Texture(2D|3D)|Emitter)|exorShape)|ra(ctal|meCache))|w(tAddMatrix|ire|ood|eightGeometryFilter|ater|rap)|l(ight(Info|Fog|Li(st|nker))?|o(cator|okAt|d(Group|Thresholds)|ft)|uminance|ea(stSquaresModifier|ther)|a(yered(Shader|Texture)|ttice|mbert))|a(n(notationShape|i(sotropic|m(Blend(InOut)?|C(urve(T(T|U|L|A)|U(T|U|L|A))?|lip)))|gleBetween)|tt(ach(Surface|Curve)|rHierarchyTest)|i(rField|mConstraint)|dd(Matrix|DoubleLinear)|udio|vg(SurfacePoints|NurbsSurfacePoints|Curves)|lign(Manip|Surface|Curve)|r(cLengthDimension|tAttrPaintTest|eaLight|rayMapper)|mbientLight|bstractBase(NurbsConversion|Create))|r(igid(Body|Solver|Constraint)|o(ck|undConstantRadius)|e(s(olution|ultCurve(TimeTo(Time|Unitless|Linear|Angular))?)|nder(Rect|Globals(List)?|Box|Sphere|Cone|Quality|L(ight|ayer(Manager)?))|cord|v(olve(dPrimitive)?|erse(Surface|Curve)?)|f(erence|lect)|map(Hsv|Color|Value)|build(Surface|Curve))|a(dialField|mp(Shader)?)|gbToHsv|bfSrf)|g(uide|eo(Connect(or|able)|metry(Shape|Constraint|VarGroup|Filter))|lobal(Stitch|CacheControl)|ammaCorrect|r(id|oup(Id|Parts)|a(nite|vityField)))|Fur(Globals|Description|Feedback|Attractors)|xformManip|m(o(tionPath|untain|vie)|u(te|lt(Matrix|i(plyDivide|listerLight)|DoubleLinear))|pBirailSrf|e(sh(VarGroup)?|ntalray(Texture|IblShape))|a(terialInfo|ke(Group|Nurb(sSquare|Sphere|C(ylinder|ircle|one|ube)|Torus|Plane)|CircularArc|T(hreePointCircularArc|extCurves|woPointCircularArc))|rble))|b(irailSrf|o(neLattice|olean|undary(Base)?)|u(lge|mp(2d|3d))|evel(Plus)?|l(in(n|dDataTemplate)|end(Shape|Color(s|Sets)|TwoAttr|Device|Weighted)?)|a(se(GeometryVarGroup|ShadingSwitch|Lattice)|keSet)|r(ownian|ush)))\\b' }, { caseInsensitive: true, token: 'keyword.control.mel', regex: '\\b(if|in|else|for|while|break|continue|case|default|do|switch|return|switch|case|source|catch|alias)\\b' }, { token: 'keyword.other.mel', regex: '\\b(global)\\b' }, { caseInsensitive: true, token: 'constant.language.mel', regex: '\\b(null|undefined)\\b' }, { token: 'constant.numeric.mel', 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.mel', regex: '"', push: [ { token: 'constant.character.escape.mel', regex: '\\\\.' }, { token: 'punctuation.definition.string.end.mel', regex: '"', next: 'pop' }, { defaultToken: 'string.quoted.double.mel' } ] }, { token: [ 'variable.other.mel', 'punctuation.definition.variable.mel' ], regex: '(\\$)([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*?\\b)' }, { token: 'punctuation.definition.string.begin.mel', regex: '\'', push: [ { token: 'constant.character.escape.mel', regex: '\\\\.' }, { token: 'punctuation.definition.string.end.mel', regex: '\'', next: 'pop' }, { defaultToken: 'string.quoted.single.mel' } ] }, { token: 'constant.language.mel', regex: '\\b(false|true|yes|no|on|off)\\b' }, { token: 'punctuation.definition.comment.mel', regex: '/\\*', push: [ { token: 'punctuation.definition.comment.mel', regex: '\\*/', next: 'pop' }, { defaultToken: 'comment.block.mel' } ] }, { token: [ 'comment.line.double-slash.mel', 'punctuation.definition.comment.mel' ], regex: '(//)(.*$\\n?)' }, { caseInsensitive: true, token: 'keyword.operator.mel', regex: '\\b(instanceof)\\b' }, { token: 'keyword.operator.symbolic.mel', regex: '[-\\!\\%\\&\\*\\+\\=\\/\\?\\:]' }, { token: [ 'meta.preprocessor.mel', 'punctuation.definition.preprocessor.mel' ], regex: '(^[ \\t]*)((?:#)[a-zA-Z]+)' }, { token: [ 'meta.function.mel', 'keyword.other.mel', 'storage.type.mel', 'entity.name.function.mel', 'punctuation.section.function.mel' ], regex: '(global\\s*)?(proc\\s*)(\\w+\\s*\\[?\\]?\\s+|\\s+)([A-Za-z_][A-Za-z0-9_\\.]*)(\\s*\\()', push: [ { include: '$self' }, { token: 'punctuation.section.function.mel', regex: '\\)', next: 'pop' }, { defaultToken: 'meta.function.mel' } ] } ] }; this.normalizeRules(); }; oop.inherits(MELHighlightRules, TextHighlightRules); exports.MELHighlightRules = MELHighlightRules; ================================================ FILE: src/mode/mips.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MIPSHighlightRules = require("./mips_highlight_rules").MIPSHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = MIPSHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ["#"]; this.$id = "ace/mode/mips"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/mips_highlight_rules.js ================================================ /* This file was autogenerated from mips.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MIPSHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used 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; this.$rules = { start: [{ token: "storage.modifier.mips", regex: /\.\b(?:align|ascii|asciiz|byte|double|extern|float|globl|space|word)\b/, comment: "Assembler directives for data storage" }, { token: "entity.name.section.mips", regex: /\.\b(?:data|text|kdata|ktext|)\b/, comment: "Segements: .data .text" }, { token: "variable.parameter.mips", regex: /\$(?:(?:3[01]|[12]?[0-9]|[0-9])|zero|at|v[01]|a[0-3]|s[0-7]|t[0-9]|k[01]|gp|sp|fp|ra)/, comment: "Registers by id $1, $2, ..." }, { token: "variable.parameter.mips", regex: /\$f(?:[0-9]|[1-2][0-9]|3[0-1])/, comment: "Floating point registers" }, { token: "support.function.source.mips", regex: /\b(?:(?:add|sub|div|l|mov|mult|neg|s|c\.eq|c\.le|c\.lt)\.[ds]|cvt\.s\.[dw]|cvt\.d\.[sw]|cvt\.w\.[ds]|bc1[tf])\b/, comment: "The MIPS floating-point instruction set" }, { token: "support.function.source.mips", regex: /\b(?:add|addu|addi|addiu|sub|subu|and|andi|or|not|ori|nor|xor|xori|slt|sltu|slti|sltiu|sll|sllv|rol|srl|sra|srlv|ror|j|jr|jal|beq|bne|lw|sw|lb|sb|lui|move|mfhi|mflo|mthi|mtlo)\b/, comment: "Just the hardcoded instructions provided by the MIPS assembly language" }, { token: "support.function.other.mips", regex: /\b(?:abs|b|beqz|bge|bgt|bgtu|ble|bleu|blt|bltu|bnez|div|divu|la|li|move|mul|neg|not|rem|remu|seq|sge|sgt|sle|sne)\b/, comment: "Pseudo instructions" }, { token: "entity.name.function.mips", regex: /\bsyscall\b/, comment: "Other" }, { token : "string", // character regex : "(?:'\")(?:" + escapeRe + "|.)?(?:'\")" }, { token : "string.start", regex : '\'', stateName: "qstring", next: [ { token: "string", regex: /\\\s*$/, next: "qqstring" }, { token: "constant.language.escape", regex: escapeRe }, { token: "string.end", regex: '\'|$', next: "start" }, { defaultToken: "string"} ] }, { token : "string.start", regex : '"', stateName: "qqstring", next: [ { token: "string", regex: /\\\s*$/, next: "qqstring" }, { token: "constant.language.escape", regex: escapeRe }, { token: "string.end", regex: '"|$', next: "start" }, { defaultToken: "string"} ] }, { token: "constant.numeric.mips", regex: /\b(?:\d+|0(?:x|X)[a-fA-F0-9]+)\b/, comment: "Numbers like +12, -3, 55, 0x3F" }, { token: "entity.name.tag.mips", regex: /\b[\w]+\b:/, comment: "Labels at line start: begin_repeat: add ..." }, { token: "comment.assembly", regex: /#.*$/, comment: "Single line comments" }] }; this.normalizeRules(); }; MIPSHighlightRules.metaData = { fileTypes: ["s", "asm"], name: "MIPS", scopeName: "source.mips" }; oop.inherits(MIPSHighlightRules, TextHighlightRules); exports.MIPSHighlightRules = MIPSHighlightRules; ================================================ FILE: src/mode/mixal.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MixalHighlightRules = require("./mixal_highlight_rules").MixalHighlightRules; var Mode = function() { this.HighlightRules = MixalHighlightRules; }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/mixal"; this.lineCommentStart = "*"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/mixal_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MixalHighlightRules = function() { var isValidSymbol = function(string) { return string && string.search(/^[A-Z\u0394\u03a0\u03a30-9]{1,10}$/) > -1 && string.search(/[A-Z\u0394\u03a0\u03a3]/) > -1; }; var isValidOp = function(op) { return op && [ 'NOP', 'ADD', 'FADD', 'SUB', 'FSUB', 'MUL', 'FMUL', 'DIV', 'FDIV', 'NUM', 'CHAR', 'HLT', 'SLA', 'SRA', 'SLAX', 'SRAX', 'SLC', 'SRC', 'MOVE', 'LDA', 'LD1', 'LD2', 'LD3', 'LD4', 'LD5', 'LD6', 'LDX', 'LDAN', 'LD1N', 'LD2N', 'LD3N', 'LD4N', 'LD5N', 'LD6N', 'LDXN', 'STA', 'ST1', 'ST2', 'ST3', 'ST4', 'ST5', 'ST6', 'STX', 'STJ', 'STZ', 'JBUS', 'IOC', 'IN', 'OUT', 'JRED', 'JMP', 'JSJ', 'JOV', 'JNOV', 'JL', 'JE', 'JG', 'JGE', 'JNE', 'JLE', 'JAN', 'JAZ', 'JAP', 'JANN', 'JANZ', 'JANP', 'J1N', 'J1Z', 'J1P', 'J1NN', 'J1NZ', 'J1NP', 'J2N', 'J2Z', 'J2P', 'J2NN', 'J2NZ', 'J2NP','J3N', 'J3Z', 'J3P', 'J3NN', 'J3NZ', 'J3NP', 'J4N', 'J4Z', 'J4P', 'J4NN', 'J4NZ', 'J4NP', 'J5N', 'J5Z', 'J5P', 'J5NN', 'J5NZ', 'J5NP','J6N', 'J6Z', 'J6P', 'J6NN', 'J6NZ', 'J6NP', 'JXN', 'JXZ', 'JXP', 'JXNN', 'JXNZ', 'JXNP', 'INCA', 'DECA', 'ENTA', 'ENNA', 'INC1', 'DEC1', 'ENT1', 'ENN1', 'INC2', 'DEC2', 'ENT2', 'ENN2', 'INC3', 'DEC3', 'ENT3', 'ENN3', 'INC4', 'DEC4', 'ENT4', 'ENN4', 'INC5', 'DEC5', 'ENT5', 'ENN5', 'INC6', 'DEC6', 'ENT6', 'ENN6', 'INCX', 'DECX', 'ENTX', 'ENNX', 'CMPA', 'FCMP', 'CMP1', 'CMP2', 'CMP3', 'CMP4', 'CMP5', 'CMP6', 'CMPX', 'EQU', 'ORIG', 'CON', 'ALF', 'END' ].indexOf(op) > -1; }; var containsOnlySupportedCharacters = function(string) { return string && string.search(/[^ A-Z\u0394\u03a0\u03a30-9.,()+*/=$<>@;:'-]/) == -1; }; this.$rules = { "start" : [{ token: "comment.line.character", regex: /^ *\*.*$/ }, { token: function(label, space0, keyword, space1, literal, comment) { return [ isValidSymbol(label) ? "variable.other" : "invalid.illegal", "text", "keyword.control", "text", containsOnlySupportedCharacters(literal) ? "text" : "invalid.illegal", "comment.line.character" ]; }, regex: /^(\S+)?( +)(ALF)( )(.{5})(\s+.*)?$/ }, { token: function(label, space0, keyword, space1, literal, comment) { return [ isValidSymbol(label) ? "variable.other" : "invalid.illegal", "text", "keyword.control", "text", containsOnlySupportedCharacters(literal) ? "text" : "invalid.illegal", "comment.line.character" ]; }, regex: /^(\S+)?( +)(ALF)( )(\S.{4})(\s+.*)?$/ }, { token: function(label, space0, op, comment) { return [ isValidSymbol(label) ? "variable.other" : "invalid.illegal", "text", isValidOp(op) ? "keyword.control" : "invalid.illegal", "comment.line.character" ]; }, regex: /^(\S+)?( +)(\S+)(?:\s*)$/ }, { token: function(label, space0, op, space1, address, comment) { return [ isValidSymbol(label) ? "variable.other" : "invalid.illegal", "text", isValidOp(op) ? "keyword.control" : "invalid.illegal", "text", containsOnlySupportedCharacters(address) ? "text" : "invalid.illegal", "comment.line.character" ]; }, regex: /^(\S+)?( +)(\S+)( +)(\S+)(\s+.*)?$/ }, { defaultToken: "text" }] }; }; oop.inherits(MixalHighlightRules, TextHighlightRules); exports.MixalHighlightRules = MixalHighlightRules; ================================================ FILE: src/mode/mushcode.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MushCodeRules = require("./mushcode_highlight_rules").MushCodeRules; var PythonFoldMode = require("./folding/pythonic").FoldMode; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = MushCodeRules; this.foldingRules = new PythonFoldMode("\\:"); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { 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; }; var outdents = { "pass": 1, "return": 1, "raise": 1, "break": 1, "continue": 1 }; this.checkOutdent = function(state, line, input) { if (input !== "\r\n" && input !== "\r" && input !== "\n") return false; var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens) return false; // ignore trailing comments do { var last = tokens.pop(); } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/)))); if (!last) return false; return (last.type == "keyword" && outdents[last.value]); }; this.autoOutdent = function(state, doc, row) { // outdenting in python is slightly different because it always applies // to the next line and only of a new line is inserted row += 1; var indent = this.$getIndent(doc.getLine(row)); var tab = doc.getTabString(); if (indent.slice(-tab.length) == tab) doc.remove(new Range(row, indent.length-tab.length, row, indent.length)); }; this.$id = "ace/mode/mushcode"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/mushcode_highlight_rules.js ================================================ /* * MUSHCodeMode */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MushCodeRules = function() { var keywords = ( "@if|"+ "@ifelse|"+ "@switch|"+ "@halt|"+ "@dolist|"+ "@create|"+ "@scent|"+ "@sound|"+ "@touch|"+ "@ataste|"+ "@osound|"+ "@ahear|"+ "@aahear|"+ "@amhear|"+ "@otouch|"+ "@otaste|"+ "@drop|"+ "@odrop|"+ "@adrop|"+ "@dropfail|"+ "@odropfail|"+ "@smell|"+ "@oemit|"+ "@emit|"+ "@pemit|"+ "@parent|"+ "@clone|"+ "@taste|"+ "whisper|"+ "page|"+ "say|"+ "pose|"+ "semipose|"+ "teach|"+ "touch|"+ "taste|"+ "smell|"+ "listen|"+ "look|"+ "move|"+ "go|"+ "home|"+ "follow|"+ "unfollow|"+ "desert|"+ "dismiss|"+ "@tel" ); var builtinConstants = ( "=#0" ); var builtinFunctions = ( "default|"+ "edefault|"+ "eval|"+ "get_eval|"+ "get|"+ "grep|"+ "grepi|"+ "hasattr|"+ "hasattrp|"+ "hasattrval|"+ "hasattrpval|"+ "lattr|"+ "nattr|"+ "poss|"+ "udefault|"+ "ufun|"+ "u|"+ "v|"+ "uldefault|"+ "xget|"+ "zfun|"+ "band|"+ "bnand|"+ "bnot|"+ "bor|"+ "bxor|"+ "shl|"+ "shr|"+ "and|"+ "cand|"+ "cor|"+ "eq|"+ "gt|"+ "gte|"+ "lt|"+ "lte|"+ "nand|"+ "neq|"+ "nor|"+ "not|"+ "or|"+ "t|"+ "xor|"+ "con|"+ "entrances|"+ "exit|"+ "followers|"+ "home|"+ "lcon|"+ "lexits|"+ "loc|"+ "locate|"+ "lparent|"+ "lsearch|"+ "next|"+ "num|"+ "owner|"+ "parent|"+ "pmatch|"+ "rloc|"+ "rnum|"+ "room|"+ "where|"+ "zone|"+ "worn|"+ "held|"+ "carried|"+ "acos|"+ "asin|"+ "atan|"+ "ceil|"+ "cos|"+ "e|"+ "exp|"+ "fdiv|"+ "fmod|"+ "floor|"+ "log|"+ "ln|"+ "pi|"+ "power|"+ "round|"+ "sin|"+ "sqrt|"+ "tan|"+ "aposs|"+ "andflags|"+ "conn|"+ "commandssent|"+ "controls|"+ "doing|"+ "elock|"+ "findable|"+ "flags|"+ "fullname|"+ "hasflag|"+ "haspower|"+ "hastype|"+ "hidden|"+ "idle|"+ "isbaker|"+ "lock|"+ "lstats|"+ "money|"+ "who|"+ "name|"+ "nearby|"+ "obj|"+ "objflags|"+ "photo|"+ "poll|"+ "powers|"+ "pendingtext|"+ "receivedtext|"+ "restarts|"+ "restarttime|"+ "subj|"+ "shortestpath|"+ "tmoney|"+ "type|"+ "visible|"+ "cat|"+ "element|"+ "elements|"+ "extract|"+ "filter|"+ "filterbool|"+ "first|"+ "foreach|"+ "fold|"+ "grab|"+ "graball|"+ "index|"+ "insert|"+ "itemize|"+ "items|"+ "iter|"+ "last|"+ "ldelete|"+ "map|"+ "match|"+ "matchall|"+ "member|"+ "mix|"+ "munge|"+ "pick|"+ "remove|"+ "replace|"+ "rest|"+ "revwords|"+ "setdiff|"+ "setinter|"+ "setunion|"+ "shuffle|"+ "sort|"+ "sortby|"+ "splice|"+ "step|"+ "wordpos|"+ "words|"+ "add|"+ "lmath|"+ "max|"+ "mean|"+ "median|"+ "min|"+ "mul|"+ "percent|"+ "sign|"+ "stddev|"+ "sub|"+ "val|"+ "bound|"+ "abs|"+ "inc|"+ "dec|"+ "dist2d|"+ "dist3d|"+ "div|"+ "floordiv|"+ "mod|"+ "modulo|"+ "remainder|"+ "vadd|"+ "vdim|"+ "vdot|"+ "vmag|"+ "vmax|"+ "vmin|"+ "vmul|"+ "vsub|"+ "vunit|"+ "regedit|"+ "regeditall|"+ "regeditalli|"+ "regediti|"+ "regmatch|"+ "regmatchi|"+ "regrab|"+ "regraball|"+ "regraballi|"+ "regrabi|"+ "regrep|"+ "regrepi|"+ "after|"+ "alphamin|"+ "alphamax|"+ "art|"+ "before|"+ "brackets|"+ "capstr|"+ "case|"+ "caseall|"+ "center|"+ "containsfansi|"+ "comp|"+ "decompose|"+ "decrypt|"+ "delete|"+ "edit|"+ "encrypt|"+ "escape|"+ "if|"+ "ifelse|"+ "lcstr|"+ "left|"+ "lit|"+ "ljust|"+ "merge|"+ "mid|"+ "ostrlen|"+ "pos|"+ "repeat|"+ "reverse|"+ "right|"+ "rjust|"+ "scramble|"+ "secure|"+ "space|"+ "spellnum|"+ "squish|"+ "strcat|"+ "strmatch|"+ "strinsert|"+ "stripansi|"+ "stripfansi|"+ "strlen|"+ "switch|"+ "switchall|"+ "table|"+ "tr|"+ "trim|"+ "ucstr|"+ "unsafe|"+ "wrap|"+ "ctitle|"+ "cwho|"+ "channels|"+ "clock|"+ "cflags|"+ "ilev|"+ "itext|"+ "inum|"+ "convsecs|"+ "convutcsecs|"+ "convtime|"+ "ctime|"+ "etimefmt|"+ "isdaylight|"+ "mtime|"+ "secs|"+ "msecs|"+ "starttime|"+ "time|"+ "timefmt|"+ "timestring|"+ "utctime|"+ "atrlock|"+ "clone|"+ "create|"+ "cook|"+ "dig|"+ "emit|"+ "lemit|"+ "link|"+ "oemit|"+ "open|"+ "pemit|"+ "remit|"+ "set|"+ "tel|"+ "wipe|"+ "zemit|"+ "fbcreate|"+ "fbdestroy|"+ "fbwrite|"+ "fbclear|"+ "fbcopy|"+ "fbcopyto|"+ "fbclip|"+ "fbdump|"+ "fbflush|"+ "fbhset|"+ "fblist|"+ "fbstats|"+ "qentries|"+ "qentry|"+ "play|"+ "ansi|"+ "break|"+ "c|"+ "asc|"+ "die|"+ "isdbref|"+ "isint|"+ "isnum|"+ "isletters|"+ "linecoords|"+ "localize|"+ "lnum|"+ "nameshort|"+ "null|"+ "objeval|"+ "r|"+ "rand|"+ "s|"+ "setq|"+ "setr|"+ "soundex|"+ "soundslike|"+ "valid|"+ "vchart|"+ "vchart2|"+ "vlabel|"+ "@@|"+ "bakerdays|"+ "bodybuild|"+ "box|"+ "capall|"+ "catalog|"+ "children|"+ "ctrailer|"+ "darttime|"+ "debt|"+ "detailbar|"+ "exploredroom|"+ "fansitoansi|"+ "fansitoxansi|"+ "fullbar|"+ "halfbar|"+ "isdarted|"+ "isnewbie|"+ "isword|"+ "lambda|"+ "lobjects|"+ "lplayers|"+ "lthings|"+ "lvexits|"+ "lvobjects|"+ "lvplayers|"+ "lvthings|"+ "newswrap|"+ "numsuffix|"+ "playerson|"+ "playersthisweek|"+ "randomad|"+ "randword|"+ "realrandword|"+ "replacechr|"+ "second|"+ "splitamount|"+ "strlenall|"+ "text|"+ "third|"+ "tofansi|"+ "totalac|"+ "unique|"+ "getaddressroom|"+ "listpropertycomm|"+ "listpropertyres|"+ "lotowner|"+ "lotrating|"+ "lotratingcount|"+ "lotvalue|"+ "boughtproduct|"+ "companyabb|"+ "companyicon|"+ "companylist|"+ "companyname|"+ "companyowners|"+ "companyvalue|"+ "employees|"+ "invested|"+ "productlist|"+ "productname|"+ "productowners|"+ "productrating|"+ "productratingcount|"+ "productsoldat|"+ "producttype|"+ "ratedproduct|"+ "soldproduct|"+ "topproducts|"+ "totalspentonproduct|"+ "totalstock|"+ "transfermoney|"+ "uniquebuyercount|"+ "uniqueproductsbought|"+ "validcompany|"+ "deletepicture|"+ "fbsave|"+ "getpicturesecurity|"+ "haspicture|"+ "listpictures|"+ "picturesize|"+ "replacecolor|"+ "rgbtocolor|"+ "savepicture|"+ "setpicturesecurity|"+ "showpicture|"+ "piechart|"+ "piechartlabel|"+ "createmaze|"+ "drawmaze|"+ "drawwireframe" ); var keywordMapper = this.createKeywordMapper({ "invalid.deprecated": "debugger", "support.function": builtinFunctions, "constant.language": builtinConstants, "keyword": keywords }, "identifier"); var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?"; var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; var octInteger = "(?:0[oO]?[0-7]+)"; var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; var binInteger = "(?:0[bB][01]+)"; var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")"; var exponent = "(?:[eE][+-]?\\d+)"; var fraction = "(?:\\.\\d+)"; var intPart = "(?:\\d+)"; var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")"; var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; this.$rules = { "start" : [ { token : "variable", // mush substitution register regex : "%[0-9]{1}" }, { token : "variable", // mush substitution register regex : "%q[0-9A-Za-z]{1}" }, { token : "variable", // mush special character register regex : "%[a-zA-Z]{1}" }, { token: "variable.language", regex: "%[a-z0-9-_]+" }, { token : "constant.numeric", // imaginary regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b" }, { token : "constant.numeric", // float regex : floatNumber }, { token : "constant.numeric", // long integer regex : integer + "[lL]\\b" }, { token : "constant.numeric", // integer regex : integer + "\\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(MushCodeRules, TextHighlightRules); exports.MushCodeRules = MushCodeRules; ================================================ FILE: src/mode/mysql.js ================================================ var oop = require("../lib/oop"); var TextMode = require("../mode/text").Mode; var MysqlHighlightRules = require("./mysql_highlight_rules").MysqlHighlightRules; var Mode = function() { this.HighlightRules = MysqlHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ["--", "#"]; // todo space this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/mysql"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/mysql_highlight_rules.js ================================================ var oop = require("../lib/oop"); var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var MysqlHighlightRules = function() { var mySqlKeywords = /*sql*/ "alter|and|as|asc|between|count|create|delete|desc|distinct|drop|from|lateral|having|in|insert|into|is|join|like|not|on|or|order|select|set|table|union|intersect|except|update|values|where" /*mysql*/ + "|accessible|action|add|after|algorithm|all|analyze|asensitive|at|authors|auto_increment|autocommit|avg|avg_row_length|before|binary|binlog|both|btree|cache|call|cascade|cascaded|case|catalog_name|chain|change|changed|character|check|checkpoint|checksum|class_origin|client_statistics|close|code|collate|collation|collations|column|columns|comment|commit|committed|completion|concurrent|condition|connection|consistent|constraint|contains|continue|contributors|convert|cross|current_date|current_time|current_timestamp|current_user|cursor|data|database|databases|day_hour|day_microsecond|day_minute|day_second|deallocate|dec|declare|default|delay_key_write|delayed|delimiter|des_key_file|describe|deterministic|dev_pop|dev_samp|deviance|directory|disable|discard|distinctrow|div|dual|dumpfile|each|elseif|enable|enclosed|end|ends|engine|engines|enum|errors|escape|escaped|even|event|events|every|execute|exists|exit|explain|extended|fast|fetch|field|fields|first|flush|for|force|foreign|found_rows|full|fulltext|function|general|global|grant|grants|group|by|group_concat|handler|hash|help|high_priority|hosts|hour_microsecond|hour_minute|hour_second|if|ignore|ignore_server_ids|import|index|index_statistics|infile|inner|innodb|inout|insensitive|insert_method|install|interval|invoker|isolation|iterate|key|keys|kill|language|last|leading|leave|left|level|limit|linear|lines|list|load|local|localtime|localtimestamp|lock|logs|low_priority|master|master_heartbeat_period|master_ssl_verify_server_cert|masters|match|max|max_rows|maxvalue|message_text|middleint|migrate|min|min_rows|minute_microsecond|minute_second|mod|mode|modifies|modify|mutex|mysql_errno|natural|next|no|no_write_to_binlog|offline|offset|one|online|open|optimize|option|optionally|out|outer|outfile|pack_keys|parser|partition|partitions|password|phase|plugin|plugins|prepare|preserve|prev|primary|privileges|procedure|processlist|profile|profiles|purge|query|quick|range|read|read_write|reads|real|rebuild|recover|references|regexp|relaylog|release|remove|rename|reorganize|repair|repeatable|replace|require|resignal|restrict|resume|return|returns|revoke|right|rlike|rollback|rollup|row|row_format|rtree|savepoint|schedule|schema|schema_name|schemas|second_microsecond|security|sensitive|separator|serializable|server|session|share|show|signal|slave|slow|smallint|snapshot|soname|spatial|specific|sql|sql_big_result|sql_buffer_result|sql_cache|sql_calc_found_rows|sql_no_cache|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|start|starting|starts|status|std|stddev|stddev_pop|stddev_samp|storage|straight_join|subclass_origin|sum|suspend|table_name|table_statistics|tables|tablespace|temporary|terminated|to|trailing|transaction|trigger|triggers|truncate|uncommitted|undo|uninstall|unique|unlock|upgrade|usage|use|use_frm|user|user_resources|user_statistics|using|utc_date|utc_time|utc_timestamp|value|variables|varying|view|views|warnings|when|while|with|work|write|xa|xor|year_month|zerofill|begin|do|then|else|loop|repeat"; var builtins = "rank|coalesce|ifnull|isnull|nvl"; var variable = "charset|clear|connect|edit|ego|exit|go|help|nopager|notee|nowarning|pager|print|prompt|quit|rehash|source|status|system|tee"; var datetimeFunctions = 'adddate|addtime|convert_tz|curdate|current_date|current_time|current_timestamp|curtime|date|date_add|date_format|date_sub|datediff|day|dayname|dayofmonth|dayofweek|dayofyear|extract|from_days|from_unixtime|get_format|hour|last_day|localtime|localtimestamp|makedate|maketime|microsecond|minute|month|monthname|now|period_add|period_diff|quarter|sec_to_time|second|str_to_date|subdate|subtime|sysdate|time|time_format|time_to_sec|timediff|timestamp|timestampadd|timestampdiff|to_days|to_seconds|unix_timestamp|utc_date|utc_time|utc_timestamp|week|weekday|weekofyear|year|yearweek'; var encryptionFunctions = 'aes_decrypt|aes_encrypt|compress|md|random_bytes|sha|sha|statement_digest|statement_digest_text|uncompress|uncompressed_length|validate_password_strength'; var mathFunctions = 'abs|acos|asin|atan|atan|ceil|ceiling|conv|cos|cot|crc|degrees|div|exp|floor|ln|log|log10|log2|mod|pi|pow|power|radians|rand|round|sign|sin|sqrt|tan|truncate'; var stringFunctions = 'ascii|bin|bit_length|char|char_length|character_length|concat|concat_ws|elt|export_set|field|find_in_set|format|from_base|hex|insert|instr|lcase|left|length|like|load_file|locate|lower|lpad|ltrim|make_set|match|mid|not|not|oct|octet_length|ord|position|quote|regexp|regexp_instr|regexp_like|regexp_replace|regexp_substr|repeat|replace|reverse|right|rlike|rpad|rtrim|soundex|sounds|space|strcmp|substr|substring|substring_index|to_base|trim|ucase|unhex|upper|weight_string'; //operatorChars: /^[*+\-%<>!=&|^]/, var dataTypes = ( "bool|boolean|bit|blob|decimal|double|enum|float|long|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|" + "bigint|int|int1|int2|int3|int4|int8|integer|float|float4|float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year|unsigned|signed|numeric" ); var keywordMapper = this.createKeywordMapper({ "support.function": [builtins, datetimeFunctions, encryptionFunctions, mathFunctions, stringFunctions].join('|'), "keyword": mySqlKeywords, "storage.type": dataTypes, "constant": "false|true|null|unknown|ODBCdotTable|zerolessFloat", "variable.language": variable }, "identifier", true); function string(rule) { var start = rule.start; var escapeSeq = rule.escape; return { token: "string.start", regex: start, next: [ {token: "constant.language.escape", regex: escapeSeq}, {token: "string.end", next: "start", regex: start}, {defaultToken: "string"} ] }; } this.$rules = { "start" : [ { token : "comment", regex : "(?:-- |#).*$" }, string({start: '"', escape: /\\[0'"bnrtZ\\%_]?/}), string({start: "'", escape: /\\[0'"bnrtZ\\%_]?/}), DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi line comment regex : /\/\*/, next : "comment" }, { token : "constant.numeric", // hex regex : /0[xX][0-9a-fA-F]+|[xX]'[0-9a-fA-F]+'|0[bB][01]+|[bB]'[01]+'/ }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "constant.class", regex : "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "constant.buildin", regex : "`[^`]*`" }, { token : "keyword.operator", regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=" }, { token : "paren.lparen", regex : "[\\(]" }, { token : "paren.rparen", regex : "[\\)]" }, { token : "text", regex : "\\s+" } ], "comment" : [ {token : "comment", regex : "\\*\\/", next : "start"}, {defaultToken : "comment"} ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.normalizeRules(); }; oop.inherits(MysqlHighlightRules, TextHighlightRules); exports.MysqlHighlightRules = MysqlHighlightRules; ================================================ FILE: src/mode/nasal.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 */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var NasalHighlightRules = require("./nasal_highlight_rules").NasalHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = NasalHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { // this.lineCommentStart = ""//""; // this.blockComment = {start: ""/*"", end: ""*/""}; // Extra logic goes here. this.$id = "ace/mode/nasal"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/nasal_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://github.com/BobDotCom/Nasal.tmbundle/blob/95113f60db7cb7ac7b6c3d854683773879407a48/Syntaxes/Nasal.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var NasalHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ token: "constant.other.allcaps.nasal", regex: /\b[[:upper:]_][[:upper:][:digit:]_]*\b(?![\.\(\'\"])/, comment: "Match identifiers in ALL_CAPS as constants, except when followed by `.`, `(`, `'`, or `\"`." }, { todo: { token: [ "support.class.nasal", "meta.function.nasal", "entity.name.function.nasal", "meta.function.nasal", "keyword.operator.nasal", "meta.function.nasal", "storage.type.function.nasal", "meta.function.nasal", "punctuation.definition.parameters.begin.nasal" ], regex: /([a-zA-Z_?.$][\w?.$]*)(\.)([a-zA-Z_?.$][\w?.$]*)(\s*)(=)(\s*)(func)(\s*)(\()/, push: [{ token: "punctuation.definition.parameters.end.nasal", regex: /\)/, next: "pop" }, { include: "$self" }, { token: "variable.parameter.nasal", regex: /\w/ }, { defaultToken: "meta.function.nasal" }] }, comment: "match stuff like: Sound.play = func() { … }" }, { todo: { token: [ "entity.name.function.nasal", "meta.function.nasal", "keyword.operator.nasal", "meta.function.nasal", "storage.type.function.nasal", "meta.function.nasal", "punctuation.definition.parameters.begin.nasal" ], regex: /([a-zA-Z_?$][\w?$]*)(\s*)(=)(\s*)(func)(\s*)(\()/, push: [{ token: "punctuation.definition.parameters.end.nasal", regex: /\)/, next: "pop" }, { include: "$self" }, { token: "variable.parameter.nasal", regex: /\w/ }, { defaultToken: "meta.function.nasal" }] }, comment: "match stuff like: play = func() { … }" }, { todo: { token: [ "entity.name.function.nasal", "meta.function.nasal", "keyword.operator.nasal", "meta.function.nasal", "storage.type.function.nasal", "meta.function.nasal", "punctuation.definition.parameters.begin.nasal" ], regex: /([a-zA-Z_?$][\w?$]*)(\s*)(=)(\s*\(\s*)(func)(\s*)(\()/, push: [{ token: "punctuation.definition.parameters.end.nasal", regex: /\)/, next: "pop" }, { include: "$self" }, { token: "variable.parameter.nasal", regex: /\w/ }, { defaultToken: "meta.function.nasal" }] }, comment: "match stuff like: play = (func() { … }" }, { todo: { token: [ "entity.name.function.nasal", "meta.function.hash.nasal", "storage.type.function.nasal", "meta.function.hash.nasal", "punctuation.definition.parameters.begin.nasal" ], regex: /\b([a-zA-Z_?.$][\w?.$]*)(\s*:\s*\b)(func)(\s*)(\()/, push: [{ token: "punctuation.definition.parameters.end.nasal", regex: /\)/, next: "pop" }, { include: "$self" }, { token: "variable.parameter.nasal", regex: /\w/ }, { defaultToken: "meta.function.hash.nasal" }] }, comment: "match stuff like: foobar: func() { … }" }, { todo: { token: [ "storage.type.function.nasal", "meta.function.nasal", "punctuation.definition.parameters.begin.nasal" ], regex: /\b(func)(\s*)(\()/, push: [{ token: "punctuation.definition.parameters.end.nasal", regex: /\)/, next: "pop" }, { include: "$self" }, { token: "variable.parameter.nasal", regex: /\w/ }, { defaultToken: "meta.function.nasal" }] }, comment: "match stuff like: func() { … }" }, { token: [ "keyword.operator.new.nasal", "meta.class.instance.constructor", "entity.name.type.instance.nasal" ], regex: /(new)(\s+)(\w+(?:\.\w*)?)/ }, { token: "keyword.control.nasal", regex: /\b(?:if|else|elsif|while|for|foreach|forindex)\b/ }, { token: "keyword.control.nasal", regex: /\b(?:break(?:\s+[A-Z]{2,16})?(?=\s*(?:;|\}))|continue(?:\s+[A-Z]{2,16})?(?=\s*(?:;|\}))|[A-Z]{2,16}(?=\s*;(?:[^\)#;]*?;){0,2}[^\)#;]*?\)))\b/ }, { token: "keyword.operator.nasal", regex: /!|\*|\-|\+|~|\/|==|=|!=|<=|>=|<|>|!|\?|\:|\*=|\/=|\+=|\-=|~=|\.\.\.|\b(?:and|or)\b/ }, { token: "variable.language.nasal", regex: /\b(?:me|arg|parents|obj)\b/ }, { token: "storage.type.nasal", regex: /\b(?:return|var)\b/ }, { token: "constant.language.nil.nasal", regex: /\bnil\b/ }, { token: "punctuation.definition.string.begin.nasal", regex: /'/, push: [{ token: "punctuation.definition.string.end.nasal", regex: /'/, next: "pop" }, { token: "constant.character.escape.nasal", regex: /\\'/ }, { defaultToken: "string.quoted.single.nasal" }], comment: "Single quoted strings" }, { token: "punctuation.definition.string.begin.nasal", regex: /"/, push: [{ token: "punctuation.definition.string.end.nasal", regex: /"/, next: "pop" }, { token: "constant.character.escape.nasal", regex: /\\(?:x[\da-fA-F]{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|r|n|t|\\|")/ }, { token: "constant.character.escape.nasal", regex: /%(?:%|(?:\d+\$)?[+-]?(?:[ 0]|'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX])/ }, { defaultToken: "string.quoted.double.nasal" }], comment: "Double quoted strings" }, { token: [ "punctuation.definition.string.begin.nasal", "string.other", "punctuation.definition.string.end.nasal" ], regex: /(`)(.)(`)/, comment: "Single-byte ASCII character constants" }, { token: [ "punctuation.definition.comment.nasal", "comment.line.hash.nasal" ], regex: /(#)(.*$)/, comment: "Comments" }, { token: "constant.numeric.nasal", regex: /(?:(?:\b[0-9]+)?\.)?\b[0-9]+(?:[eE][-+]?[0-9]+)?\b/, comment: "Integers, floats, and scientific format" }, { token: "constant.numeric.nasal", regex: /0[x|X][0-9a-fA-F]+/, comment: "Hex codes" }, { token: "punctuation.terminator.statement.nasal", regex: /\;/ }, { token: [ "punctuation.section.scope.begin.nasal", "punctuation.section.scope.end.nasal" ], regex: /(\[)(\])/ }, { todo: { token: "punctuation.section.scope.begin.nasal", regex: /\{/, push: [{ token: "punctuation.section.scope.end.nasal", regex: /\}/, next: "pop" }, { include: "$self" }] } }, { todo: { token: "punctuation.section.scope.begin.nasal", regex: /\(/, push: [{ token: "punctuation.section.scope.end.nasal", regex: /\)/, next: "pop" }, { include: "$self" }] } }, { token: "invalid.illegal", regex: /%|\$|@|&|\^|\||\\|`/, comment: "Illegal characters" }, { todo: { comment: "TODO: Symbols in hash keys" }, comment: "TODO: Symbols in hash keys" }, { token: "variable.language.nasal", regex: /\b(?:append|bind|call|caller|chr|closure|cmp|compile|contains|delete|die|find|ghosttype|id|int|keys|left|num|pop|right|setsize|size|sort|split|sprintf|streq|substr|subvec|typeof|readline)\b/, comment: "Core functions" }, { token: "variable.language.nasal", regex: /\b(?:abort|abs|aircraftToCart|addcommand|airportinfo|airwaysRoute|assert|carttogeod|cmdarg|courseAndDistance|createDiscontinuity|createViaTo|createWP|createWPFrom|defined|directory|fgcommand|findAirportsByICAO|findAirportsWithinRange|findFixesByID|findNavaidByFrequency|findNavaidsByFrequency|findNavaidsByID|findNavaidsWithinRange|finddata|flightplan|geodinfo|geodtocart|get_cart_ground_intersection|getprop|greatCircleMove|interpolate|isa|logprint|magvar|maketimer|start|stop|restart|maketimestamp|md5|navinfo|parse_markdown|parsexml|print|printf|printlog|rand|registerFlightPlanDelegate|removecommand|removelistener|resolvepath|setlistener|_setlistener|setprop|srand|systime|thisfunc|tileIndex|tilePath|values)\b/, comment: "FG ext core functions" }, { token: "variable.language.nasal", regex: /\b(?:singleShot|isRunning|simulatedTime)\b/, comment: "FG ext core functions" }, { token: "constant.language.nasal", regex: /\b(?:D2R|FPS2KT|FT2M|GAL2L|IN2M|KG2LB|KT2FPS|KT2MPS|LG2GAL|LB2KG|M2FT|M2IN|M2NM|MPS2KT|NM2M|R2D)\b/, comment: "FG ext core constants" }, { token: "support.function.nasal", regex: /\b(?:addChild|addChildren|alias|clearValue|equals|getAliasTarget|getAttribute|getBoolValue|getChild|getChildren|getIndex|getName|getNode|getParent|getPath|getType|getValue|getValues|initNode|remove|removeAllChildren|removeChild|removeChildren|setAttribute|setBoolValue|setDoubleValue|setIntValue|setValue|setValues|unalias|compileCondition|condition|copy|dump|getNode|nodeList|runBinding|setAll|wrap|wrapNode)\b/, comment: "FG func props" }, { token: "support.class.nasal", regex: /\bNode\b/, comment: "FG node class" }, { token: "variable.language.nasal", regex: /\b(?:props|globals)\b/, comment: "FG func props variables" }, { todo: { token: [ "support.function.nasal", "punctuation.definition.arguments.begin.nasal" ], regex: /\b([a-zA-Z_?$][\w?$]*)(\()/, push: [{ token: "punctuation.definition.arguments.end.nasal", regex: /\)/, next: "pop" }, { include: "$self" }, { defaultToken: "meta.function-call.nasal" }] }, comment: "function call" }] }; this.normalizeRules(); }; NasalHighlightRules.metaData = { fileTypes: ["nas"], name: "Nasal", scopeName: "source.nasal" }; oop.inherits(NasalHighlightRules, TextHighlightRules); exports.NasalHighlightRules = NasalHighlightRules; ================================================ FILE: src/mode/nginx.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var NginxHighlightRules = require("./nginx_highlight_rules").NginxHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { TextMode.call(this); this.HighlightRules = NginxHighlightRules; this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function () { this.lineCommentStart = "#"; this.$id = "ace/mode/nginx"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/nginx_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var NginxHighlightRules = function () { var keywords = "include|index|absolute_redirect|aio|output_buffers|directio|sendfile|aio_write|alias|root|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|default_type|disable_symlinks|directio_alignment|error_page|etag|if_modified_since|ignore_invalid_headers|internal|keepalive_requests|keepalive_disable|keepalive_timeout|limit_except|large_client_header_buffers|limit_rate|limit_rate_after|lingering_close|lingering_time|lingering_timeout|listen|log_not_found|log_subrequest|max_ranges|merge_slashes|msie_padding|msie_refresh|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|output_buffers|port_in_redirect|postpone_output|read_ahead|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|satisfy|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|subrequest_output_buffer_size|tcp_nodelay|tcp_nopush|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|variables_hash_bucket_size|variables_hash_max_size|accept_mutex|accept_mutex_delay|debug_connection|error_log|daemon|debug_points|env|load_module|lock_file|master_process|multi_accept|pcre_jit|pid|ssl_engine|thread_pool|timer_resolution|use|user|worker_aio_requests|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_shutdown_timeout|working_directory|allow|deny|add_before_body|add_after_body|addition_types|api|status_zone|auth_basic|auth_basic_user_file|auth_jwt|auth_jwt|auth_jwt_claim_set|auth_jwt_header_set|auth_jwt_key_file|auth_jwt_key_request|auth_jwt_leeway|auth_request|auth_request_set|autoindex|autoindex_exact_size|autoindex_format|autoindex_localtime|ancient_browser|ancient_browser_value|modern_browser|modern_browser_value|charset|charset_map|charset_types|override_charset|source_charset|create_full_put_path|dav_access|dav_methods|min_delete_depth|empty_gif|f4f|f4f_buffer_size|fastcgi_bind|fastcgi_buffer_size|fastcgi_buffering|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_background_update|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_age|fastcgi_cache_lock_timeout|fastcgi_cache_max_range_offset|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_revalidate|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_catch_stderr|fastcgi_connect_timeout|fastcgi_force_ranges|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_limit_rate|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_next_upstream_timeout|fastcgi_next_upstream_tries|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_pass_request_body|fastcgi_pass_request_headers|fastcgi_read_timeout|fastcgi_request_buffering|fastcgi_send_lowat|fastcgi_send_timeout|fastcgi_socket_keepalive|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geoip_country|geoip_city|geoip_org|geoip_proxy|geoip_proxy_recursive|grpc_bind|grpc_buffer_size|grpc_connect_timeout|grpc_hide_header|grpc_ignore_headers|grpc_intercept_errors|grpc_next_upstream|grpc_next_upstream_timeout|grpc_next_upstream_tries|grpc_pass|grpc_pass_header|grpc_read_timeout|grpc_send_timeout|grpc_set_header|grpc_socket_keepalive|grpc_ssl_certificate|grpc_ssl_certificate_key|grpc_ssl_ciphers|grpc_ssl_crl|grpc_ssl_name|grpc_ssl_password_file|grpc_ssl_protocols|grpc_ssl_server_name|grpc_ssl_session_reuse|grpc_ssl_trusted_certificate|grpc_ssl_verify|grpc_ssl_verify_depth|gunzip|gunzip_buffers|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_types|gzip_vary|gzip_static|add_header|add_trailer|expires|hlshls_buffers|hls_forward_args|hls_fragment|hls_mp4_buffer_size|hls_mp4_max_buffer_size|image_filter|image_filter_buffer|image_filter_interlace|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|image_filter_webp_quality|js_content|js_include|js_set|keyval|keyval_zone|limit_conn|limit_conn_log_level|limit_conn_status|limit_conn_zone|limit_zone|limit_req|limit_req_log_level|limit_req_status|limit_req_zone|access_log|log_format|open_log_file_cache|map_hash_bucket_size|map_hash_max_size|memcached_bind|memcached_buffer_size|memcached_connect_timeout|memcached_force_ranges|memcached_gzip_flag|memcached_next_upstream|memcached_next_upstream_timeout|memcached_next_upstream_tries|memcached_pass|memcached_read_timeout|memcached_send_timeout|memcached_socket_keepalive|mirror|mirror_request_body|mp4|mp4_buffer_size|mp4_max_buffer_size|mp4_limit_rate|mp4_limit_rate_after|perl_modules|perl_require|perl_set|proxy_bind|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_background_update|proxy_cache_bypass|proxy_cache_convert_head|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_age|proxy_cache_lock_timeout|proxy_cache_max_range_offset|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_purge|proxy_cache_revalidate|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_force_ranges|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_limit_rate|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_next_upstream_timeout|proxy_next_upstream_tries|proxy_no_cache|proxy_pass|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_socket_keepalive|proxy_ssl_certificate|proxy_ssl_certificate_key|proxy_ssl_ciphers|proxy_ssl_crl|proxy_ssl_name|proxy_ssl_password_file|proxy_ssl_protocols|proxy_ssl_server_name|proxy_ssl_session_reuse|proxy_ssl_trusted_certificate|proxy_ssl_verify|proxy_ssl_verify_depth|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|random_index|set_real_ip_from|real_ip_header|real_ip_recursive|referer_hash_bucket_size|referer_hash_max_size|valid_referers|break|return|rewrite_log|set|uninitialized_variable_warn|scgi_bind|scgi_buffer_size|scgi_buffering|scgi_buffers|scgi_busy_buffers_size|scgi_cache|scgi_cache_background_update|scgi_cache_key|scgi_cache_lock|scgi_cache_lock_age|scgi_cache_lock_timeout|scgi_cache_max_range_offset|scgi_cache_methods|scgi_cache_min_uses|scgi_cache_path|scgi_cache_purge|scgi_cache_revalidate|scgi_cache_use_stale|scgi_cache_valid|scgi_connect_timeout|scgi_force_ranges|scgi_hide_header|scgi_ignore_client_abort|scgi_ignore_headers|scgi_intercept_errors|scgi_limit_rate|scgi_max_temp_file_size|scgi_next_upstream|scgi_next_upstream_timeout|scgi_next_upstream_tries|scgi_no_cache|scgi_param|scgi_pass|scgi_pass_header|scgi_pass_request_body|scgi_pass_request_headers|scgi_read_timeout|scgi_request_buffering|scgi_send_timeout|scgi_socket_keepalive|scgi_store|scgi_store_access|scgi_temp_file_write_size|scgi_temp_path|secure_link|secure_link_md5|secure_link_secret|session_log|session_log_format|session_log_zone|slice|spdy_chunk_size|spdy_headers_comp|ssi|ssi_last_modified|ssi_min_file_chunk|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_buffer_size|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_early_data|ssl_ecdh_curve|ssl_password_file|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_ticket_key|ssl_session_tickets|ssl_session_timeout|ssl_stapling|ssl_stapling_file|ssl_stapling_responder|ssl_stapling_verify|ssl_trusted_certificate|ssl_verify_client|ssl_verify_depth|status|status_format|status_zone|stub_status|sub_filter|sub_filter_last_modified|sub_filter_once|sub_filter_types|server|zone|state|hash|ip_hash|keepalive|keepalive_requests|keepalive_timeout|ntlm|least_conn|least_time|queue|random|sticky|sticky_cookie_insert|upstream_conf|health_check|userid|userid_domain|userid_expires|userid_mark|userid_name|userid_p3p|userid_path|userid_service|uwsgi_bind|uwsgi_buffer_size|uwsgi_buffering|uwsgi_buffers|uwsgi_busy_buffers_size|uwsgi_cache|uwsgi_cache_background_update|uwsgi_cache_bypass|uwsgi_cache_key|uwsgi_cache_lock|uwsgi_cache_lock_age|uwsgi_cache_lock_timeout|uwsgi_cache_max_range_offset|uwsgi_cache_methods|uwsgi_cache_min_uses|uwsgi_cache_path|uwsgi_cache_purge|uwsgi_cache_revalidate|uwsgi_cache_use_stale|uwsgi_cache_valid|uwsgi_connect_timeout|uwsgi_force_ranges|uwsgi_hide_header|uwsgi_ignore_client_abort|uwsgi_ignore_headers|uwsgi_intercept_errors|uwsgi_limit_rate|uwsgi_max_temp_file_size|uwsgi_modifier1|uwsgi_modifier2|uwsgi_next_upstream|uwsgi_next_upstream_timeout|uwsgi_next_upstream_tries|uwsgi_no_cache|uwsgi_param|uwsgi_pass|uwsgi_pass_header|uwsgi_pass_request_body|uwsgi_pass_request_headers|uwsgi_read_timeout|uwsgi_request_buffering|uwsgi_send_timeout|uwsgi_socket_keepalive|uwsgi_ssl_certificate|uwsgi_ssl_certificate_key|uwsgi_ssl_ciphers|uwsgi_ssl_crl|uwsgi_ssl_name|uwsgi_ssl_password_file|uwsgi_ssl_protocols|uwsgi_ssl_server_name|uwsgi_ssl_session_reuse|uwsgi_ssl_trusted_certificate|uwsgi_ssl_verify|uwsgi_ssl_verify_depth|uwsgi_store|uwsgi_store_access|uwsgi_temp_file_write_size|uwsgi_temp_path|http2_body_preread_size|http2_chunk_size|http2_idle_timeout|http2_max_concurrent_pushes|http2_max_concurrent_streams|http2_max_field_size|http2_max_header_size|http2_max_requests|http2_push|http2_push_preload|http2_recv_buffer_size|http2_recv_timeout|xml_entities|xslt_last_modified|xslt_param|xslt_string_param|xslt_stylesheet|xslt_types|listen|protocol|resolver|resolver_timeout|timeout|auth_http|auth_http_header|auth_http_pass_client_cert|auth_http_timeout|proxy_buffer|proxy_pass_error_message|proxy_timeout|xclient|starttls|imap_auth|imap_capabilities|imap_client_buffer|pop3_auth|pop3_capabilities|smtp_auth|smtp_capabilities|smtp_client_buffer|smtp_greeting_delay|preread_buffer_size|preread_timeout|proxy_protocol_timeout|js_access|js_filter|js_preread|proxy_download_rate|proxy_requests|proxy_responses|proxy_upload_rate|ssl_handshake_timeout|ssl_preread|health_check_timeout|zone_sync|zone_sync_buffers|zone_sync_connect_retry_interval|zone_sync_connect_timeout|zone_sync_interval|zone_sync_recv_buffer_size|zone_sync_server|zone_sync_ssl|zone_sync_ssl_certificate|zone_sync_ssl_certificate_key|zone_sync_ssl_ciphers|zone_sync_ssl_crl|zone_sync_ssl_name|zone_sync_ssl_password_file|zone_sync_ssl_protocols|zone_sync_ssl_server_name|zone_sync_ssl_trusted_certificate|zone_sync_ssl_verify_depth|zone_sync_timeout|google_perftools_profiles|proxy|perl"; this.$rules = { "start": [{ token: ["storage.type", "text", "string.regexp", "paren.lparen"], regex: "\\b(location)(\\s+)([\\^]?~[\\*]?\\s+.*?)({)" }, { token: ["storage.type", "text", "text", "paren.lparen"], regex: "\\b(location|match|upstream)(\\s+)(.*?)({)" }, { token: ["storage.type", "text", "string", "text", "variable", "text", "paren.lparen"], regex: '\\b(split_clients|map)(\\s+)(\\".*\\")(\\s+)(\\$[\\w_]+)(\\s*)({)' }, { token: ["storage.type", "text", "paren.lparen"], regex: "\\b(http|events|server|mail|stream)(\\s*)({)" }, { token: ["storage.type", "text", "variable", "text", "variable", "text", "paren.lparen"], regex: '\\b(geo|map)(\\s+)(\\$[\\w_]+)?(\\s*)(\\$[\\w_]+)(\\s*)({)' }, { token: "paren.rparen", regex: "(})" }, { token: "paren.lparen", regex: "({)" }, { token: ["storage.type", "text", "paren.lparen"], regex: "\\b(if)(\\s+)(\\()", push: [{ token: "paren.rparen", regex: "\\)|$", next: "pop" }, { include: "lexical" }] }, { token: "keyword", regex: "\\b(" + keywords + ")\\b", push: [{ token: "punctuation", regex: ";", next: "pop" }, { include: "lexical" }] }, { token: ["keyword", "text", "string.regexp", "text", "punctuation"], regex: "\\b(rewrite)(\\s)(\\S*)(\\s.*)(;)" }, { include: "lexical" }, { include: "comments" }], comments: [{ token: "comment", regex: '#.*$' }], lexical: [{ token: "string", regex: "'", push: [{ token: "string", regex: "'", next: "pop" }, { include: "variables" }, { defaultToken: "string" }] }, { token: "string", regex: '"', push: [{ token: "string", regex: '"', next: "pop" }, { include: "variables" }, { defaultToken: "string" }] }, { token: "string.regexp", regex: /[!]?[~][*]?\s+.*(?=\))/ }, { token: "string.regexp", regex: /[\^]\S*(?=;$)/ }, { token: "string.regexp", regex: /[\^]\S*(?=;|\s|$)/ }, { token: "keyword.operator", regex: "\\B(\\+|\\-|\\*|\\=|!=)\\B" }, { token: "constant.language", regex: "\\b(true|false|on|off|all|any|main|always)\\b" }, { token: "text", regex: "\\s+" }, { include: "variables" } ], variables: [{ token: "variable", regex: "\\$[\\w_]+" }, { token: "variable.language", regex: "\\b(GET|POST|HEAD)\\b" }] }; this.normalizeRules(); }; oop.inherits(NginxHighlightRules, TextHighlightRules); exports.NginxHighlightRules = NginxHighlightRules; ================================================ FILE: src/mode/nim.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var NimHighlightRules = require("./nim_highlight_rules").NimHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { TextMode.call(this); this.HighlightRules = NimHighlightRules; this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function () { this.lineCommentStart = "#"; this.blockComment = {start: "#[", end: "]#", nestable: true}; this.$id = "ace/mode/nim"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/nim_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var NimHighlightRules = function () { var keywordMapper = this.createKeywordMapper({ "variable": "var|let|const", "keyword": "assert|parallel|spawn|export|include|from|template|mixin|bind|import|concept|raise|defer|try|finally|except|converter|proc|func|macro|method|and|or|not|xor|shl|shr|div|mod|in|notin|is|isnot|of|static|if|elif|else|case|of|discard|when|return|yield|block|break|while|echo|continue|asm|using|cast|addr|unsafeAddr|type|ref|ptr|do|declared|defined|definedInScope|compiles|sizeOf|is|shallowCopy|getAst|astToStr|spawn|procCall|for|iterator|as", "storage.type": "newSeq|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|char|bool|string|set|pointer|float32|float64|enum|object|cstring|array|seq|openArray|varargs|UncheckedArray|tuple|set|distinct|void|auto|openarray|range", "support.function": "lock|ze|toU8|toU16|toU32|ord|low|len|high|add|pop|contains|card|incl|excl|dealloc|inc", "constant.language": "nil|true|false" }, "identifier"); var hexNumber = "(?:0[xX][\\dA-Fa-f][\\dA-Fa-f_]*)"; var decNumber = "(?:[0-9][\\d_]*)"; var octNumber = "(?:0o[0-7][0-7_]*)"; var binNumber = "(?:0[bB][01][01_]*)"; var intNumber = "(?:" + hexNumber + "|" + decNumber + "|" + octNumber + "|" + binNumber + ")(?:'?[iIuU](?:8|16|32|64)|u)?\\b"; var exponent = "(?:[eE][+-]?[\\d][\\d_]*)"; var floatNumber = "(?:[\\d][\\d_]*(?:[.][\\d](?:[\\d_]*)" + exponent + "?)|" + exponent + ")"; var floatNumberExt = "(?:" + hexNumber + "(?:'(?:(?:[fF](?:32|64)?)|[dD])))|(?:" + floatNumber + "|" + decNumber + "|" + octNumber + "|" + binNumber + ")(?:'(?:(?:[fF](?:32|64)?)|[dD]))"; var stringEscape = "\\\\([abeprcnlftv\\\"']|x[0-9A-Fa-f]{2}|[0-2][0-9]{2}|u[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"; var identifier = '[a-zA-Z][a-zA-Z0-9_]*'; this.$rules = { "start": [{ token: ["identifier", "keyword.operator", "support.function"], regex: "(" + identifier + ")([.]{1})(" + identifier + ")(?=\\()" }, {//pragmas token: "paren.lparen", regex: "(\\{\\.)", next: [{ token: "paren.rparen", regex: '(\\.\\}|\\})', next: "start" }, { include: "methods" }, { token: "identifier", regex: identifier }, { token: "punctuation", regex: /[,]/ }, { token: "keyword.operator", regex: /[=:.]/ }, { token: "paren.lparen", regex: /[[(]/ }, { token: "paren.rparen", regex: /[\])]/ }, { include: "math" }, { include: "strings" }, { defaultToken: "text" }] }, { token: "comment.doc.start", regex: /##\[(?!])/, push: "docBlockComment" }, { token: "comment.start", regex: /#\[(?!])/, push: "blockComment" }, { token: "comment.doc", regex: '##.*$' }, { token: "comment", regex: '#.*$' }, { include: "strings" }, {// character token: "string", regex: "'(?:\\\\(?:[abercnlftv]|x[0-9A-Fa-f]{2}|[0-2][0-9]{2}|u[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})|.{1})?'" }, { include: "methods" }, { token: keywordMapper, regex: "[a-zA-Z][a-zA-Z0-9_]*\\b" }, { token: ["keyword.operator", "text", "storage.type"], regex: "([:])(\\s+)(" + identifier + ")(?=$|\\)|\\[|,|\\s+=|;|\\s+\\{)" }, { token: "paren.lparen", regex: /\[\.|{\||\(\.|\[:|[[({`]/ }, { token: "paren.rparen", regex: /\.\)|\|}|\.]|[\])}]/ }, { token: "keyword.operator", regex: /[=+\-*\/<>@$~&%|!?^.:\\]/ }, { token: "punctuation", regex: /[,;]/ }, { include: "math" }], blockComment: [{ regex: /#\[]/, token: "comment" }, { regex: /#\[(?!])/, token: "comment.start", push: "blockComment" }, { regex: /]#/, token: "comment.end", next: "pop" }, { defaultToken: "comment" }], docBlockComment: [{ regex: /##\[]/, token: "comment.doc" }, { regex: /##\[(?!])/, token: "comment.doc.start", push: "docBlockComment" }, { regex: /]##/, token: "comment.doc.end", next: "pop" }, { defaultToken: "comment.doc" }], math: [{ token: "constant.float", regex: floatNumberExt }, { token: "constant.float", regex: floatNumber }, { token: "constant.integer", regex: intNumber }], methods: [{ token: "support.function", regex: "(\\w+)(?=\\()" }], strings: [{ token: "string", regex: '(\\b' + identifier + ')?"""', push: [{ token: "string", regex: '"""', next: "pop" }, { defaultToken: "string" }] }, { token: "string", regex: "\\b" + identifier + '"(?=.)', push: [{ token: "string", regex: '"|$', next: "pop" }, { defaultToken: "string" }] }, { token: "string", regex: '"', push: [{ token: "string", regex: '"|$', next: "pop" }, { token: "constant.language.escape", regex: stringEscape }, { defaultToken: "string" }] }] }; this.normalizeRules(); }; oop.inherits(NimHighlightRules, TextHighlightRules); exports.NimHighlightRules = NimHighlightRules; ================================================ FILE: src/mode/nix.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var CMode = require("./c_cpp").Mode; var NixHighlightRules = require("./nix_highlight_rules").NixHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { CMode.call(this); this.HighlightRules = NixHighlightRules; this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, CMode); (function() { this.lineCommentStart = "#"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/nix"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/nix_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var NixHighlightRules = function() { var constantLanguage = "true|false"; var keywordControl = "with|import|if|else|then|inherit"; var keywordDeclaration = "let|in|rec"; var keywordMapper = this.createKeywordMapper({ "constant.language.nix": constantLanguage, "keyword.control.nix": keywordControl, "keyword.declaration.nix": keywordDeclaration }, "identifier"); this.$rules = { "start": [{ token: "comment", regex: /#.*$/ }, { token: "comment", regex: /\/\*/, next: "comment" }, { token: "constant", regex: "<[^>]+>" }, { regex: "(==|!=|<=?|>=?)", token: ["keyword.operator.comparison.nix"] }, { regex: "((?:[+*/%-]|\\~)=)", token: ["keyword.operator.assignment.arithmetic.nix"] }, { regex: "=", token: "keyword.operator.assignment.nix" }, { token: "string", regex: "''", next: "qqdoc" }, { token: "string", regex: "'", next: "qstring" }, { token: "string", regex: '"', push: "qqstring" }, { token: "constant.numeric", // hex regex: "0[xX][0-9a-fA-F]+\\b" }, { token: "constant.numeric", // float regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token: keywordMapper, regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { regex: "}", token: function(val, start, stack) { return stack[1] && stack[1].charAt(0) == "q" ? "constant.language.escape" : "text"; }, next: "pop" }], "comment": [{ token: "comment", // closing comment regex: "\\*\\/", next: "start" }, { defaultToken: "comment" }], "qqdoc": [ { token: "constant.language.escape", regex: /\$\{/, push: "start" }, { token: "string", regex: "''", next: "pop" }, { defaultToken: "string" }], "qqstring": [ { token: "constant.language.escape", regex: /\$\{/, push: "start" }, { token: "string", regex: '"', next: "pop" }, { defaultToken: "string" }], "qstring": [ { token: "constant.language.escape", regex: /\$\{/, push: "start" }, { token: "string", regex: "'", next: "pop" }, { defaultToken: "string" }] }; this.normalizeRules(); }; oop.inherits(NixHighlightRules, TextHighlightRules); exports.NixHighlightRules = NixHighlightRules; ================================================ FILE: src/mode/nsis.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var NSISHighlightRules = require("./nsis_highlight_rules").NSISHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = NSISHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = [";", "#"]; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/nsis"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/nsis_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var NSISHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ token: "keyword.compiler.nsis", regex: /^\s*!(?:include|addincludedir|addplugindir|appendfile|assert|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|gettlbversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|makensis|searchparse|searchreplace|uninstfinalize)\b/, caseInsensitive: true }, { token: "keyword.command.nsis", regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, caseInsensitive: true }, { token: "keyword.control.nsis", regex: /^\s*!(?:ifdef|ifndef|if|ifmacrodef|ifmacrondef|else|endif)\b/, caseInsensitive: true }, { token: "keyword.plugin.nsis", regex: /^\s*\w+::\w+/, caseInsensitive: true }, { token: "keyword.operator.comparison.nsis", regex: /[!<>]?=|<>|<|>/ }, { token: "support.function.nsis", regex: /(?:\b|^\s*)(?:Function|FunctionEnd|Section|SectionEnd|SectionGroup|SectionGroupEnd|PageEx|PageExEnd)\b/, caseInsensitive: true }, { token: "support.library.nsis", regex: /\${[\w\.:-]+}/ }, { token: "constant.nsis", regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/, caseInsensitive: true }, { token: "constant.library.nsis", regex: /\${(?:AtLeastServicePack|AtLeastWin7|AtLeastWin8|AtLeastWin10|AtLeastWin95|AtLeastWin98|AtLeastWin2000|AtLeastWin2003|AtLeastWin2008|AtLeastWin2008R2|AtLeastWinME|AtLeastWinNT4|AtLeastWinVista|AtLeastWinXP|AtMostServicePack|AtMostWin7|AtMostWin8|AtMostWin10|AtMostWin95|AtMostWin98|AtMostWin2000|AtMostWin2003|AtMostWin2008|AtMostWin2008R2|AtMostWinME|AtMostWinNT4|AtMostWinVista|AtMostWinXP|IsDomainController|IsNT|IsServer|IsServicePack|IsWin7|IsWin8|IsWin10|IsWin95|IsWin98|IsWin2000|IsWin2003|IsWin2008|IsWin2008R2|IsWinME|IsWinNT4|IsWinVista|IsWinXP)}/ }, { token: "constant.language.boolean.true.nsis", regex: /\b(?:true|on)\b/ }, { token: "constant.language.boolean.false.nsis", regex: /\b(?:false|off)\b/ }, { token: "constant.language.option.nsis", regex: /(?:\b|^\s*)(?:(?:un\.)?components|(?:un\.)?custom|(?:un\.)?directory|(?:un\.)?instfiles|(?:un\.)?license|uninstConfirm|admin|all|amd64-unicode|auto|both|bottom|bzip2|current|force|hide|highest|ifdiff|ifnewer|lastused|leave|left|listonly|lzma|nevershow|none|normal|notset|right|show|silent|silentlog|textonly|top|try|user|Win10|Win7|Win8|WinVista|x86-(ansi|unicode)|zlib)\b/, caseInsensitive: true }, { token: "constant.language.slash-option.nsis", regex: /\b\/(?:a|BRANDING|CENTER|COMPONENTSONLYONCUSTOM|CUSTOMSTRING=|date|e|ENABLECANCEL|FILESONLY|file|FINAL|GLOBAL|gray|ifempty|ifndef|ignorecase|IMGID=|ITALIC|LANG=|NOCUSTOM|noerrors|NONFATAL|nonfatal|oname=|o|REBOOTOK|redef|RESIZETOFIT|r|SHORT|SILENT|SOLID|STRIKE|TRIM|UNDERLINE|utcdate|windows|x)\b/, caseInsensitive: true }, { token: "constant.numeric.nsis", regex: /\b(?:0(?:x|X)[0-9a-fA-F]+|[0-9]+(?:\.[0-9]+)?)\b/ }, { token: "entity.name.function.nsis", regex: /\$\([\w\.:-]+\)/ }, { token: "storage.type.function.nsis", regex: /\$\w+/ }, { token: "punctuation.definition.string.begin.nsis", regex: /`/, push: [{ token: "punctuation.definition.string.end.nsis", regex: /`/, next: "pop" }, { token: "constant.character.escape.nsis", regex: /\$\\./ }, { defaultToken: "string.quoted.back.nsis" }] }, { token: "punctuation.definition.string.begin.nsis", regex: /"/, push: [{ token: "punctuation.definition.string.end.nsis", regex: /"/, next: "pop" }, { token: "constant.character.escape.nsis", regex: /\$\\./ }, { defaultToken: "string.quoted.double.nsis" }] }, { token: "punctuation.definition.string.begin.nsis", regex: /'/, push: [{ token: "punctuation.definition.string.end.nsis", regex: /'/, next: "pop" }, { token: "constant.character.escape.nsis", regex: /\$\\./ }, { defaultToken: "string.quoted.single.nsis" }] }, { token: [ "punctuation.definition.comment.nsis", "comment.line.nsis" ], regex: /(;|#)(.*$)/ }, { token: "punctuation.definition.comment.nsis", regex: /\/\*/, push: [{ token: "punctuation.definition.comment.nsis", regex: /\*\//, next: "pop" }, { defaultToken: "comment.block.nsis" }] }, { token: "text", regex: /(?:!include|!insertmacro)\b/ }] }; this.normalizeRules(); }; NSISHighlightRules.metaData = { comment: "\n\ttodo: - highlight functions\n\t", fileTypes: ["nsi", "nsh"], name: "NSIS", scopeName: "source.nsis" }; oop.inherits(NSISHighlightRules, TextHighlightRules); exports.NSISHighlightRules = NSISHighlightRules; ================================================ FILE: src/mode/nunjucks.js ================================================ "use strict"; var oop = require("../lib/oop"); var NunjucksFoldMode = require("./folding/nunjucks").FoldMode; var lang = require("../lib/lang"); var HtmlMode = require("./html").Mode; var NunjucksHighlightRules = require("./nunjucks_highlight_rules").NunjucksHighlightRules; // http://www.w3.org/TR/html5/syntax.html#void-elements var voidElements = [ "area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr" ]; var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"]; var Mode = function () { this.HighlightRules = NunjucksHighlightRules; this.foldingRules = new NunjucksFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags)); }; oop.inherits(Mode, HtmlMode); (function () { this.$id = "ace/mode/nunjucks"; this.voidElements = lang.arrayToMap(voidElements); }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/nunjucks_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var NunjucksHighlightRules = function() { HtmlHighlightRules.call(this); this.$rules["start"].unshift({ token: "punctuation.begin", regex: /{{-?/, push: [{ token: "punctuation.end", regex: /-?}}/, next: "pop" }, {include: "expression"} ] }, { token: "punctuation.begin", regex: /{%-?/, push: [{ token: "punctuation.end", regex: /-?%}/, next: "pop" }, { token: "constant.language.escape", regex: /\b(r\/.*\/[gimy]?)\b/ }, {include: "statement"} ] }, { token: "comment.begin", regex: /{#/, push: [{ token: "comment.end", regex: /#}/, next: "pop" }, {defaultToken: "comment"} ] }); this.addRules({ attribute_value: [{ token: "string.attribute-value.xml", regex: "'", push: [ {token: "string.attribute-value.xml", regex: "'", next: "pop"}, { token: "punctuation.begin", regex: /{{-?/, push: [{ token: "punctuation.end", regex: /-?}}/, next: "pop" }, {include: "expression"} ] }, {include: "attr_reference"}, {defaultToken: "string.attribute-value.xml"} ] }, { token: "string.attribute-value.xml", regex: '"', push: [ {token: "string.attribute-value.xml", regex: '"', next: "pop"}, { token: "punctuation.begin", regex: /{{-?/, push: [{ token: "punctuation.end", regex: /-?}}/, next: "pop" }, {include: "expression"} ] }, {include: "attr_reference"}, {defaultToken: "string.attribute-value.xml"} ] }], "statement": [{ token: "keyword.control", regex: /\b(block|endblock|extends|endif|elif|for|endfor|asyncEach|endeach|include|asyncAll|endall|macro|endmacro|set|endset|ignore missing|as|from|raw|verbatim|filter|endfilter)\b/ }, {include: "expression"} ], "expression": [{ token: "constant.language", regex: /\b(true|false|none)\b/ }, { token: "string", regex: /"/, push: [{ token: "string", regex: /"/, next: "pop" }, {include: "escapeStrings"}, {defaultToken: "string"} ] }, { token: "string", regex: /'/, push: [{ token: "string", regex: /'/, next: "pop" }, {include: "escapeStrings"}, {defaultToken: "string"} ] }, { token: "constant.numeric", // hexadecimal, octal and binary regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ }, { token: "constant.numeric", // decimal integers and floats regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/ }, { token: "keyword.operator", regex: /\+|-|\/\/|\/|%|\*\*|\*|===|==|!==|!=|>=|>|<=|</ }, { token: "keyword.control", regex: /\b(and|else|if|in|import|not|or)\b/ }, { token: "support.function", regex: /[a-zA-Z_]+(?=\()/ }, { token: "paren.lpar", regex: /[(\[{]/ }, { token: "paren.rpar", regex: /[)\]}]/ }, { token: "punctuation", regex: /[,]/ }, { token: ["punctuation", "support.function"], regex: /(\.)([a-zA-Z_][a-zA-Z0-9_]*)(?=\()/ }, { token: ["punctuation", "variable.parameter"], regex: /(\.)([a-zA-Z_][a-zA-Z0-9_]*)/ }, { token: ["punctuation", "text", "support.other"], regex: /(\|)(\s)*([a-zA-Z_][a-zA-Z0-9_]*)/ }, { token: "variable", regex: /[a-zA-Z_][a-zA-Z0-9_]*/ } ], "escapeStrings": [{ token: "constant.language.escape", regex: /(\\\\n)|(\\\\)|(\\")|(\\')|(\\a)|(\\b)|(\\f)|(\\n)|(\\r)|(\\t)|(\\v)/ }, { token: "constant.language.escape", regex: /\\(?:x[0-9A-F]{2}|(?:U[0-9A-Fa-f]{8})|(?:u[0-9A-Fa-f]{4})|(?:N{[a-zA-Z ]+}))/ }] }); this.normalizeRules(); }; oop.inherits(NunjucksHighlightRules, TextHighlightRules); exports.NunjucksHighlightRules = NunjucksHighlightRules; ================================================ FILE: src/mode/objectivec.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ObjectiveCHighlightRules = require("./objectivec_highlight_rules").ObjectiveCHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = ObjectiveCHighlightRules; this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/objectivec"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/objectivec_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var CHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; var ObjectiveCHighlightRules = function() { var NSKeywords = { "support.function.cocoa.leopard": "NSRectToCGRect|NSRectFromCGRect|NSMakeCollectable|NSStringFromProtocol|NSSizeToCGSize|NSSizeFromCGSize|NSDrawNinePartImage|NSDrawThreePartImage|NSPointToCGPoint|NSPointFromCGPoint|NSProtocolFromString|NSEventMaskFromType|NSValue", "support.function.cocoa": "NSRoundDownToMultipleOfPageSize|NSRoundUpToMultipleOfPageSize|NSRunCriticalAlertPanel|NSRunCriticalAlertPanelRelativeToWindow|NSRunInformationalAlertPanel|NSRunInformationalAlertPanelRelativeToWindow|NSRunAlertPanel|NSRunAlertPanelRelativeToWindow|NSResetMapTable|NSResetHashTable|NSRecycleZone|NSRectClip|NSRectClipList|NSRectFill|NSRectFillUsingOperation|NSRectFillList|NSRectFillListUsingOperation|NSRectFillListWithGrays|NSRectFillListWithColors|NSRectFillListWithColorsUsingOperation|NSRectFromString|NSRecordAllocationEvent|NSReturnAddress|NSReleaseAlertPanel|NSReadPixel|NSRealMemoryAvailable|NSReallocateCollectable|NSRegisterServicesProvider|NSRangeFromString|NSGetSizeAndAlignment|NSGetCriticalAlertPanel|NSGetInformationalAlertPanel|NSGetUncaughtExceptionHandler|NSGetFileType|NSGetFileTypes|NSGetWindowServerMemory|NSGetAlertPanel|NSMinX|NSMinY|NSMidX|NSMidY|NSMouseInRect|NSMapRemove|NSMapGet|NSMapMember|NSMapInsert|NSMapInsertIfAbsent|NSMapInsertKnownAbsent|NSMakeRect|NSMakeRange|NSMakeSize|NSMakePoint|NSMaxRange|NSMaxX|NSMaxY|NSBitsPerSampleFromDepth|NSBitsPerPixelFromDepth|NSBestDepth|NSBeep|NSBeginCriticalAlertSheet|NSBeginInformationalAlertSheet|NSBeginAlertSheet|NSShouldRetainWithZone|NSShowsServicesMenuItem|NSShowAnimationEffect|NSStringFromRect|NSStringFromRange|NSStringFromMapTable|NSStringFromSize|NSStringFromSelector|NSStringFromHashTable|NSStringFromClass|NSStringFromPoint|NSSizeFromString|NSSetShowsServicesMenuItem|NSSetZoneName|NSSetUncaughtExceptionHandler|NSSetFocusRingStyle|NSSelectorFromString|NSSearchPathForDirectoriesInDomains|NSSwapBigShortToHost|NSSwapBigIntToHost|NSSwapBigDoubleToHost|NSSwapBigFloatToHost|NSSwapBigLongToHost|NSSwapBigLongLongToHost|NSSwapShort|NSSwapHostShortToBig|NSSwapHostShortToLittle|NSSwapHostIntToBig|NSSwapHostIntToLittle|NSSwapHostDoubleToBig|NSSwapHostDoubleToLittle|NSSwapHostFloatToBig|NSSwapHostFloatToLittle|NSSwapHostLongToBig|NSSwapHostLongToLittle|NSSwapHostLongLongToBig|NSSwapHostLongLongToLittle|NSSwapInt|NSSwapDouble|NSSwapFloat|NSSwapLittleShortToHost|NSSwapLittleIntToHost|NSSwapLittleDoubleToHost|NSSwapLittleFloatToHost|NSSwapLittleLongToHost|NSSwapLittleLongLongToHost|NSSwapLong|NSSwapLongLong|NSHighlightRect|NSHostByteOrder|NSHomeDirectory|NSHomeDirectoryForUser|NSHeight|NSHashRemove|NSHashGet|NSHashInsert|NSHashInsertIfAbsent|NSHashInsertKnownAbsent|NSHFSTypeCodeFromFileType|NSHFSTypeOfFile|NSNumberOfColorComponents|NSNextMapEnumeratorPair|NSNextHashEnumeratorItem|NSContainsRect|NSConvertGlyphsToPackedGlyphs|NSConvertSwappedDoubleToHost|NSConvertSwappedFloatToHost|NSConvertHostDoubleToSwapped|NSConvertHostFloatToSwapped|NSCountMapTable|NSCountHashTable|NSCountFrames|NSCountWindows|NSCountWindowsForContext|NSCopyMemoryPages|NSCopyMapTableWithZone|NSCopyBits|NSCopyHashTableWithZone|NSCopyObject|NSColorSpaceFromDepth|NSCompareMapTables|NSCompareHashTables|NSClassFromString|NSCreateMapTable|NSCreateMapTableWithZone|NSCreateHashTable|NSCreateHashTableWithZone|NSCreateZone|NSCreateFilenamePboardType|NSCreateFileContentsPboardType|NSTemporaryDirectory|NSIsControllerMarker|NSIsEmptyRect|NSIsFreedObject|NSInsetRect|NSIncrementExtraRefCount|NSIntersectsRect|NSIntersectionRect|NSIntersectionRange|NSInterfaceStyleForKey|NSIntegralRect|NSZoneRealloc|NSZoneMalloc|NSZoneName|NSZoneCalloc|NSZoneFromPointer|NSZoneFree|NSOpenStepRootDirectory|NSOffsetRect|NSDisableScreenUpdates|NSDivideRect|NSDottedFrameRect|NSDecimalRound|NSDecimalMultiply|NSDecimalString|NSDecimalSubtract|NSDecimalNormalize|NSDecimalCopy|NSDecimalCompact|NSDecimalCompare|NSDecimalIsNotANumber|NSDecimalDivide|NSDecimalPower|NSDecimalAdd|NSDecrementExtraRefCountWasZero|NSDefaultMallocZone|NSDeallocateMemoryPages|NSDeallocateObject|NSDrawGroove|NSDrawGrayBezel|NSDrawBitmap|NSDrawButton|NSDrawColorTiledRects|NSDrawTiledRects|NSDrawDarkBezel|NSDrawWhiteBezel|NSDrawWindowBackground|NSDrawLightBezel|NSUserName|NSUnionRect|NSUnionRange|NSUnregisterServicesProvider|NSUpdateDynamicServices|NSJavaBundleSetup|NSJavaBundleCleanup|NSJavaSetup|NSJavaSetupVirtualMachine|NSJavaNeedsToLoadClasses|NSJavaNeedsVirtualMachine|NSJavaClassesForBundle|NSJavaClassesFromPath|NSJavaObjectNamedInPath|NSJavaProvidesClasses|NSPointInRect|NSPointFromString|NSPerformService|NSPlanarFromDepth|NSPageSize|NSEndMapTableEnumeration|NSEndHashTableEnumeration|NSEnumerateMapTable|NSEnumerateHashTable|NSEnableScreenUpdates|NSEqualRects|NSEqualRanges|NSEqualSizes|NSEqualPoints|NSEraseRect|NSExtraRefCount|NSFileTypeForHFSTypeCode|NSFullUserName|NSFreeMapTable|NSFreeHashTable|NSFrameRect|NSFrameRectWithWidth|NSFrameRectWithWidthUsingOperation|NSFrameAddress|NSWindowList|NSWindowListForContext|NSWidth|NSLocationInRange|NSLog|NSLogv|NSLogPageSize|NSAccessibilityRoleDescription|NSAccessibilityRoleDescriptionForUIElement|NSAccessibilityRaiseBadArgumentException|NSAccessibilityUnignoredChildren|NSAccessibilityUnignoredChildrenForOnlyChild|NSAccessibilityUnignoredDescendant|NSAccessibilityUnignoredAncestor|NSAccessibilityPostNotification|NSAccessibilityActionDescription|NSApplicationMain|NSApplicationLoad|NSAvailableWindowDepths|NSAllMapTableValues|NSAllMapTableKeys|NSAllHashTableObjects|NSAllocateMemoryPages|NSAllocateCollectable|NSAllocateObject", "support.class.cocoa.leopard": "NSRuleEditor|NSGarbageCollector|NSGradient|NSMapTable|NSHashTable|NSCondition|NSCollectionView|NSCollectionViewItem|NSToolbarItemGroup|NSTextInputClient|NSTreeNode|NSTrackingArea|NSInvocationOperation|NSOperation|NSOperationQueue|NSDictionaryController|NSDockTile|NSPointerFunctions|NSPointerArray|NSPathControl|NSPathControlDelegate|NSPathComponentCell|NSPathCell|NSPathCellDelegate|NSPrintPanelAccessorizing|NSPredicateEditor|NSPredicateEditorRowTemplate|NSViewController|NSFastEnumeration|NSAnimationContext|NSAnimatablePropertyContainer", "support.class.cocoa": "NSRunLoop|NSRulerMarker|NSRulerView|NSResponder|NSRecursiveLock|NSRelativeSpecifier|NSRandomSpecifier|NSRangeSpecifier|NSGetCommand|NSGlyphGenerator|NSGlyphStorage|NSGlyphInfo|NSGraphicsContext|NSXMLNode|NSXMLDocument|NSXMLDTD|NSXMLDTDNode|NSXMLParser|NSXMLElement|NSMiddleSpecifier|NSMovie|NSMovieView|NSMoveCommand|NSMutableString|NSMutableSet|NSMutableCharacterSet|NSMutableCopying|NSMutableIndexSet|NSMutableDictionary|NSMutableData|NSMutableURLRequest|NSMutableParagraphStyle|NSMutableAttributedString|NSMutableArray|NSMessagePort|NSMessagePortNameServer|NSMenu|NSMenuItem|NSMenuItemCell|NSMenuView|NSMethodSignature|NSMetadataItem|NSMetadataQuery|NSMetadataQueryResultGroup|NSMetadataQueryAttributeValueTuple|NSMachBootstrapServer|NSMachPort|NSMatrix|NSBitmapImageRep|NSBox|NSBundle|NSButton|NSButtonCell|NSBezierPath|NSBrowser|NSBrowserCell|NSShadow|NSScanner|NSScriptSuiteRegistry|NSScriptCoercionHandler|NSScriptCommand|NSScriptCommandDescription|NSScriptClassDescription|NSScriptObjectSpecifier|NSScriptExecutionContext|NSScriptWhoseTest|NSScroller|NSScrollView|NSScreen|NSStepper|NSStepperCell|NSStatusBar|NSStatusItem|NSString|NSStream|NSSimpleHorizontalTypesetter|NSSimpleCString|NSSocketPort|NSSocketPortNameServer|NSSound|NSSortDescriptor|NSSpecifierTest|NSSpeechRecognizer|NSSpeechSynthesizer|NSSpellServer|NSSpellChecker|NSSplitView|NSSecureTextField|NSSecureTextFieldCell|NSSet|NSSetCommand|NSSearchField|NSSearchFieldCell|NSSerializer|NSSegmentedControl|NSSegmentedCell|NSSlider|NSSliderCell|NSSavePanel|NSHost|NSHTTPCookie|NSHTTPCookieStorage|NSHTTPURLResponse|NSHelpManager|NSNib|NSNibConnector|NSNibControlConnector|NSNibOutletConnector|NSNotification|NSNotificationCenter|NSNotificationQueue|NSNull|NSNumber|NSNumberFormatter|NSNetService|NSNetServiceBrowser|NSNameSpecifier|NSChangeSpelling|NSCharacterSet|NSConstantString|NSConnection|NSControl|NSController|NSConditionLock|NSCoding|NSCoder|NSCountCommand|NSCountedSet|NSCopying|NSColor|NSColorSpace|NSColorPickingCustom|NSColorPickingDefault|NSColorPicker|NSColorPanel|NSColorWell|NSColorList|NSCompoundPredicate|NSComparisonPredicate|NSComboBox|NSComboBoxCell|NSCustomImageRep|NSCursor|NSCIImageRep|NSCell|NSClipView|NSCloseCommand|NSCloneCommand|NSClassDescription|NSCachedImageRep|NSCachedURLResponse|NSCalendar|NSCalendarDate|NSCreateCommand|NSThread|NSTypesetter|NSTimeZone|NSTimer|NSToolbar|NSToolbarItem|NSToolbarItemValidations|NSTokenField|NSTokenFieldCell|NSText|NSTextBlock|NSTextStorage|NSTextContainer|NSTextTab|NSTextTable|NSTextTableBlock|NSTextInput|NSTextView|NSTextField|NSTextFieldCell|NSTextList|NSTextAttachment|NSTextAttachmentCell|NSTask|NSTableHeaderCell|NSTableHeaderView|NSTableColumn|NSTableView|NSTabView|NSTabViewItem|NSTreeController|NSIndexSpecifier|NSIndexSet|NSIndexPath|NSInputManager|NSInputStream|NSInputServiceProvider|NSInputServer|NSInputServerMouseTracker|NSInvocation|NSIgnoreMisspelledWords|NSImage|NSImageRep|NSImageCell|NSImageView|NSOutputStream|NSOutlineView|NSOpenGLContext|NSOpenGLPixelBuffer|NSOpenGLPixelFormat|NSOpenGLView|NSOpenPanel|NSObjCTypeSerializationCallBack|NSObject|NSObjectController|NSDistantObject|NSDistantObjectRequest|NSDistributedNotificationCenter|NSDistributedLock|NSDictionary|NSDirectoryEnumerator|NSDocument|NSDocumentController|NSDeserializer|NSDecimalNumber|NSDecimalNumberBehaviors|NSDecimalNumberHandler|NSDeleteCommand|NSDate|NSDateComponents|NSDatePicker|NSDatePickerCell|NSDateFormatter|NSData|NSDrawer|NSDraggingInfo|NSUserInterfaceValidations|NSUserDefaults|NSUserDefaultsController|NSURL|NSURLResponse|NSURLRequest|NSURLHandle|NSURLHandleClient|NSURLConnection|NSURLCache|NSURLCredential|NSURLCredentialStorage|NSURLDownload|NSURLDownloadDelegate|NSURLProtocol|NSURLProtocolClient|NSURLProtectionSpace|NSURLAuthenticationChallenge|NSURLAuthenticationChallengeSender|NSUniqueIDSpecifier|NSUndoManager|NSUnarchiver|NSPipe|NSPositionalSpecifier|NSPopUpButton|NSPopUpButtonCell|NSPort|NSPortMessage|NSPortNameServer|NSPortCoder|NSPICTImageRep|NSPersistentDocument|NSPDFImageRep|NSPasteboard|NSPanel|NSParagraphStyle|NSPageLayout|NSPrintInfo|NSPrinter|NSPrintOperation|NSPrintPanel|NSProcessInfo|NSProtocolChecker|NSPropertySpecifier|NSPropertyListSerialization|NSProgressIndicator|NSProxy|NSPredicate|NSEnumerator|NSEvent|NSEPSImageRep|NSError|NSException|NSExistsCommand|NSExpression|NSView|NSViewAnimation|NSValidatedToobarItem|NSValidatedUserInterfaceItem|NSValueTransformer|NSKeyedUnarchiver|NSKeyedArchiver|NSQuickDrawView|NSQuitCommand|NSFileManager|NSFileHandle|NSFileWrapper|NSFont|NSFontManager|NSFontDescriptor|NSFontPanel|NSFormCell|NSFormatter|NSWhoseSpecifier|NSWindow|NSWindowController|NSWorkspace|NSLock|NSLocking|NSLocale|NSLogicalTest|NSLevelIndicator|NSLevelIndicatorCell|NSLayoutManager|NSAssertionHandler|NSAnimation|NSActionCell|NSAttributedString|NSAutoreleasePool|NSATSTypesetter|NSApplication|NSAppleScript|NSAppleEventManager|NSAppleEventDescriptor|NSAffineTransform|NSAlert|NSArchiver|NSArray|NSArrayController", "support.type.cocoa.leopard": "", "support.class.quartz": "CISampler|CIContext|CIColor|CIImage|CIImageAccumulator|CIPlugIn|CIPlugInRegistration|CIVector|CIKernel|CIFilter|CIFilterGenerator|CIFilterShape|CARenderer|CAMediaTiming|CAMediaTimingFunction|CABasicAnimation|CAScrollLayer|CAConstraint|CAConstraintLayoutManager|CATiledLayer|CATextLayer|CATransition|CATransaction|CAOpenGLLayer|CAPropertyAnimation|CAKeyframeAnimation|CALayer|CAAnimation|CAAnimationGroup|CAAction", "support.type.quartz": "CGFloat|CGPoint|CGSize|CGRect|CIFormat|CAConstraintAttribute", "support.type.cocoa": "NSRect|NSRectEdge|NSRange|NSGlyph|NSGlyphRelation|NSGlyphLayoutMode|NSGradientType|NSModalSession|NSMatrixMode|NSMapEnumerator|NSBitmapImageFileType|NSBorderType|NSButtonType|NSBezelStyle|NSBackingStoreType|NSBrowserColumnResizingType|NSScrollerPart|NSScrollerArrow|NSScrollArrowPosition|NSScreenAuxiliaryOpaque|NSStringEncoding|NSSize|NSSocketNativeHandle|NSSelectionGranularity|NSSelectionDirection|NSSelectionAffinity|NSSwappedDouble|NSSwappedFloat|NSSaveOperationType|NSHashEnumerator|NSHandler|NSHandler2|NSControlSize|NSControlTint|NSCompositingOperation|NSComparisonResult|NSCellState|NSCellType|NSCellImagePosition|NSCellAttribute|NSThreadPrivate|NSTypesetterGlyphInfo|NSTickMarkPosition|NSTitlePosition|NSTimeInterval|NSToolTipTag|NSToolbarSizeMode|NSToolbarDisplayMode|NSTokenStyle|NSTIFFCompression|NSTextTabType|NSTextAlignment|NSTabState|NSTableViewDropOperation|NSTabViewType|NSTrackingRectTag|NSImageInterpolation|NSZone|NSOpenGLContextAuxiliary|NSOpenGLPixelFormatAuxiliary|NSDocumentChangeType|NSDatePickerElementFlags|NSDrawerState|NSDragOperation|NSUsableScrollerParts|NSPoint|NSPrintingPageOrder|NSProgressIndicatorStyle|NSProgressIndicatorThickness|NSProgressIndicatorThreadInfo|NSEventType|NSKeyValueObservingOptions|NSFontSymbolicTraits|NSFontTraitMask|NSFontAction|NSFocusRingType|NSWindowOrderingMode|NSWindowDepth|NSWorkspaceIconCreationOptions|NSWorkspaceLaunchOptions|NSWritingDirection|NSLineBreakMode|NSLayoutStatus|NSLayoutDirection|NSAnimationProgress|NSAnimationEffect|NSApplicationTerminateReply|NSApplicationDelegateReply|NSApplicationPrintReply|NSAppleEventManagerSuspensionID|NSAffineTransformStruct|NSAlertStyle", "support.constant.cocoa": "NSRGBModeColorPanel|NSRGBColorSpaceModel|NSRightMouseDown|NSRightMouseDownMask|NSRightMouseDragged|NSRightMouseDraggedMask|NSRightMouseUp|NSRightMouseUpMask|NSRightTextMovement|NSRightTextAlignment|NSRightTabsBezelBorder|NSRightTabStopType|NSRightArrowFunctionKey|NSRoundRectBezelStyle|NSRoundBankers|NSRoundedBezelStyle|NSRoundedTokenStyle|NSRoundedDisclosureBezelStyle|NSRoundDown|NSRoundUp|NSRoundPlain|NSRoundLineCapStyle|NSRoundLineJoinStyle|NSRunStoppedResponse|NSRunContinuesResponse|NSRunAbortedResponse|NSResizableWindowMask|NSResetCursorRectsRunLoopOrdering|NSResetFunctionKey|NSRecessedBezelStyle|NSReceiversCantHandleCommandScriptError|NSReceiverEvaluationScriptError|NSReturnTextMovement|NSRedoFunctionKey|NSRequiredArgumentsMissingScriptError|NSRelevancyLevelIndicatorStyle|NSRelativeBefore|NSRelativeAfter|NSRegularSquareBezelStyle|NSRegularControlSize|NSRemoveTraitFontAction|NSRandomSubelement|NSRangeDateMode|NSRatingLevelIndicatorStyle|NSRadioModeMatrix|NSRadioButton|NSGIFFileType|NSGlyphBelow|NSGlyphInscribeBelow|NSGlyphInscribeBase|NSGlyphInscribeOverstrike|NSGlyphInscribeOverBelow|NSGlyphInscribeAbove|NSGlyphLayoutWithPrevious|NSGlyphLayoutAtAPoint|NSGlyphLayoutAgainstAPoint|NSGlyphAttributeBidiLevel|NSGlyphAttributeSoft|NSGlyphAttributeInscribe|NSGlyphAttributeElastic|NSGlyphAbove|NSGrooveBorder|NSGreaterThanComparison|NSGreaterThanOrEqualToComparison|NSGreaterThanOrEqualToPredicateOperatorType|NSGreaterThanPredicateOperatorType|NSGrayModeColorPanel|NSGrayColorSpaceModel|NSGradientNone|NSGradientConcaveStrong|NSGradientConcaveWeak|NSGradientConvexStrong|NSGradientConvexWeak|NSGraphiteControlTint|NSXMLNotationDeclarationKind|NSXMLNodeCompactEmptyElement|NSXMLNodeIsCDATA|NSXMLNodeOptionsNone|NSXMLNodeUseSingleQuotes|NSXMLNodeUseDoubleQuotes|NSXMLNodePreserveNamespaceOrder|NSXMLNodePreserveCharacterReferences|NSXMLNodePreserveCDATA|NSXMLNodePreserveDTD|NSXMLNodePreservePrefixes|NSXMLNodePreserveEntities|NSXMLNodePreserveEmptyElements|NSXMLNodePreserveQuotes|NSXMLNodePreserveWhitespace|NSXMLNodePreserveAttributeOrder|NSXMLNodePreserveAll|NSXMLNodePrettyPrint|NSXMLNodeExpandEmptyElement|NSXMLNamespaceKind|NSXMLCommentKind|NSXMLTextKind|NSXMLInvalidKind|NSXMLDocumentXMLKind|NSXMLDocumentXHTMLKind|NSXMLDocumentXInclude|NSXMLDocumentHTMLKind|NSXMLDocumentTidyXML|NSXMLDocumentTidyHTML|NSXMLDocumentTextKind|NSXMLDocumentIncludeContentTypeDeclaration|NSXMLDocumentValidate|NSXMLDocumentKind|NSXMLDTDKind|NSXMLParserGTRequiredError|NSXMLParserXMLDeclNotStartedError|NSXMLParserXMLDeclNotFinishedError|NSXMLParserMisplacedXMLDeclarationError|NSXMLParserMisplacedCDATAEndStringError|NSXMLParserMixedContentDeclNotStartedError|NSXMLParserMixedContentDeclNotFinishedError|NSXMLParserStandaloneValueError|NSXMLParserStringNotStartedError|NSXMLParserStringNotClosedError|NSXMLParserSpaceRequiredError|NSXMLParserSeparatorRequiredError|NSXMLParserNMTOKENRequiredError|NSXMLParserNotationNotStartedError|NSXMLParserNotationNotFinishedError|NSXMLParserNotWellBalancedError|NSXMLParserNoDTDError|NSXMLParserNamespaceDeclarationError|NSXMLParserNAMERequiredError|NSXMLParserCharacterRefInDTDError|NSXMLParserCharacterRefInPrologError|NSXMLParserCharacterRefInEpilogError|NSXMLParserCharacterRefAtEOFError|NSXMLParserConditionalSectionNotStartedError|NSXMLParserConditionalSectionNotFinishedError|NSXMLParserCommentNotFinishedError|NSXMLParserCommentContainsDoubleHyphenError|NSXMLParserCDATANotFinishedError|NSXMLParserTagNameMismatchError|NSXMLParserInternalError|NSXMLParserInvalidHexCharacterRefError|NSXMLParserInvalidCharacterRefError|NSXMLParserInvalidCharacterInEntityError|NSXMLParserInvalidCharacterError|NSXMLParserInvalidConditionalSectionError|NSXMLParserInvalidDecimalCharacterRefError|NSXMLParserInvalidURIError|NSXMLParserInvalidEncodingNameError|NSXMLParserInvalidEncodingError|NSXMLParserOutOfMemoryError|NSXMLParserDocumentStartError|NSXMLParserDelegateAbortedParseError|NSXMLParserDOCTYPEDeclNotFinishedError|NSXMLParserURIRequiredError|NSXMLParserURIFragmentError|NSXMLParserUndeclaredEntityError|NSXMLParserUnparsedEntityError|NSXMLParserUnknownEncodingError|NSXMLParserUnfinishedTagError|NSXMLParserPCDATARequiredError|NSXMLParserPublicIdentifierRequiredError|NSXMLParserParsedEntityRefMissingSemiError|NSXMLParserParsedEntityRefNoNameError|NSXMLParserParsedEntityRefInInternalSubsetError|NSXMLParserParsedEntityRefInInternalError|NSXMLParserParsedEntityRefInPrologError|NSXMLParserParsedEntityRefInEpilogError|NSXMLParserParsedEntityRefAtEOFError|NSXMLParserProcessingInstructionNotStartedError|NSXMLParserProcessingInstructionNotFinishedError|NSXMLParserPrematureDocumentEndError|NSXMLParserEncodingNotSupportedError|NSXMLParserEntityRefInDTDError|NSXMLParserEntityRefInPrologError|NSXMLParserEntityRefInEpilogError|NSXMLParserEntityReferenceMissingSemiError|NSXMLParserEntityReferenceWithoutNameError|NSXMLParserEntityRefLoopError|NSXMLParserEntityRefAtEOFError|NSXMLParserEntityBoundaryError|NSXMLParserEntityNotStartedError|NSXMLParserEntityNotFinishedError|NSXMLParserEntityIsParameterError|NSXMLParserEntityIsExternalError|NSXMLParserEntityValueRequiredError|NSXMLParserEqualExpectedError|NSXMLParserElementContentDeclNotStartedError|NSXMLParserElementContentDeclNotFinishedError|NSXMLParserExternalStandaloneEntityError|NSXMLParserExternalSubsetNotFinishedError|NSXMLParserExtraContentError|NSXMLParserEmptyDocumentError|NSXMLParserLiteralNotStartedError|NSXMLParserLiteralNotFinishedError|NSXMLParserLTRequiredError|NSXMLParserLTSlashRequiredError|NSXMLParserLessThanSymbolInAttributeError|NSXMLParserAttributeRedefinedError|NSXMLParserAttributeHasNoValueError|NSXMLParserAttributeNotStartedError|NSXMLParserAttributeNotFinishedError|NSXMLParserAttributeListNotStartedError|NSXMLParserAttributeListNotFinishedError|NSXMLProcessingInstructionKind|NSXMLEntityGeneralKind|NSXMLEntityDeclarationKind|NSXMLEntityUnparsedKind|NSXMLEntityParsedKind|NSXMLEntityParameterKind|NSXMLEntityPredefined|NSXMLElementDeclarationMixedKind|NSXMLElementDeclarationUndefinedKind|NSXMLElementDeclarationElementKind|NSXMLElementDeclarationEmptyKind|NSXMLElementDeclarationKind|NSXMLElementDeclarationAnyKind|NSXMLElementKind|NSXMLAttributeNMTokensKind|NSXMLAttributeNMTokenKind|NSXMLAttributeNotationKind|NSXMLAttributeCDATAKind|NSXMLAttributeIDRefsKind|NSXMLAttributeIDRefKind|NSXMLAttributeIDKind|NSXMLAttributeDeclarationKind|NSXMLAttributeEntityKind|NSXMLAttributeEntitiesKind|NSXMLAttributeEnumerationKind|NSXMLAttributeKind|NSMinXEdge|NSMiniaturizableWindowMask|NSMinYEdge|NSMinuteCalendarUnit|NSMiterLineJoinStyle|NSMiddleSubelement|NSMixedState|NSMonthCalendarUnit|NSModeSwitchFunctionKey|NSMouseMoved|NSMouseMovedMask|NSMouseEntered|NSMouseEnteredMask|NSMouseEventSubtype|NSMouseExited|NSMouseExitedMask|NSMoveToBezierPathElement|NSMomentaryChangeButton|NSMomentaryPushButton|NSMomentaryPushInButton|NSMomentaryLight|NSMomentaryLightButton|NSMenuFunctionKey|NSMacintoshInterfaceStyle|NSMacOSRomanStringEncoding|NSMatchesPredicateOperatorType|NSMappedRead|NSMaxXEdge|NSMaxYEdge|NSMACHOperatingSystem|NSBMPFileType|NSBottomTabsBezelBorder|NSBoldFontMask|NSBorderlessWindowMask|NSBoxSecondary|NSBoxSeparator|NSBoxOldStyle|NSBoxPrimary|NSButtLineCapStyle|NSBezelBorder|NSBevelLineJoinStyle|NSBelowBottom|NSBelowTop|NSBeginsWithComparison|NSBeginsWithPredicateOperatorType|NSBeginFunctionKey|NSBlueControlTint|NSBackspaceCharacter|NSBacktabTextMovement|NSBackingStoreRetained|NSBackingStoreBuffered|NSBackingStoreNonretained|NSBackTabCharacter|NSBackwardsSearch|NSBackgroundTab|NSBrowserNoColumnResizing|NSBrowserUserColumnResizing|NSBrowserAutoColumnResizing|NSBreakFunctionKey|NSShiftJISStringEncoding|NSShiftKeyMask|NSShowControlGlyphs|NSShowInvisibleGlyphs|NSShadowlessSquareBezelStyle|NSSysReqFunctionKey|NSSystemDomainMask|NSSystemDefined|NSSystemDefinedMask|NSSystemFunctionKey|NSSymbolStringEncoding|NSScannedOption|NSScaleNone|NSScaleToFit|NSScaleProportionally|NSScrollerNoPart|NSScrollerIncrementPage|NSScrollerIncrementLine|NSScrollerIncrementArrow|NSScrollerDecrementPage|NSScrollerDecrementLine|NSScrollerDecrementArrow|NSScrollerKnob|NSScrollerKnobSlot|NSScrollerArrowsMinEnd|NSScrollerArrowsMaxEnd|NSScrollerArrowsNone|NSScrollerArrowsDefaultSetting|NSScrollWheel|NSScrollWheelMask|NSScrollLockFunctionKey|NSScreenChangedEventType|NSStopFunctionKey|NSStringDrawingOneShot|NSStringDrawingDisableScreenFontSubstitution|NSStringDrawingUsesDeviceMetrics|NSStringDrawingUsesFontLeading|NSStringDrawingUsesLineFragmentOrigin|NSStreamStatusReading|NSStreamStatusNotOpen|NSStreamStatusClosed|NSStreamStatusOpen|NSStreamStatusOpening|NSStreamStatusError|NSStreamStatusWriting|NSStreamStatusAtEnd|NSStreamEventHasBytesAvailable|NSStreamEventHasSpaceAvailable|NSStreamEventNone|NSStreamEventOpenCompleted|NSStreamEventEndEncountered|NSStreamEventErrorOccurred|NSSingleDateMode|NSSingleUnderlineStyle|NSSizeDownFontAction|NSSizeUpFontAction|NSSolarisOperatingSystem|NSSunOSOperatingSystem|NSSpecialPageOrder|NSSecondCalendarUnit|NSSelectByCharacter|NSSelectByParagraph|NSSelectByWord|NSSelectingNext|NSSelectingPrevious|NSSelectionAffinityDownstream|NSSelectionAffinityUpstream|NSSelectedTab|NSSelectFunctionKey|NSSegmentSwitchTrackingMomentary|NSSegmentSwitchTrackingSelectOne|NSSegmentSwitchTrackingSelectAny|NSSquareLineCapStyle|NSSwitchButton|NSSaveToOperation|NSSaveOptionsYes|NSSaveOptionsNo|NSSaveOptionsAsk|NSSaveOperation|NSSaveAsOperation|NSSmallSquareBezelStyle|NSSmallControlSize|NSSmallCapsFontMask|NSSmallIconButtonBezelStyle|NSHighlightModeMatrix|NSHSBModeColorPanel|NSHourMinuteSecondDatePickerElementFlag|NSHourMinuteDatePickerElementFlag|NSHourCalendarUnit|NSHorizontalRuler|NSHomeFunctionKey|NSHTTPCookieAcceptPolicyNever|NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain|NSHTTPCookieAcceptPolicyAlways|NSHelpButtonBezelStyle|NSHelpKeyMask|NSHelpFunctionKey|NSHeavierFontAction|NSHPUXOperatingSystem|NSYearMonthDayDatePickerElementFlag|NSYearMonthDatePickerElementFlag|NSYearCalendarUnit|NSNonStandardCharacterSetFontMask|NSNonZeroWindingRule|NSNonactivatingPanelMask|NSNonLossyASCIIStringEncoding|NSNoBorder|NSNotificationSuspensionBehaviorHold|NSNotificationSuspensionBehaviorCoalesce|NSNotificationSuspensionBehaviorDeliverImmediately|NSNotificationSuspensionBehaviorDrop|NSNotificationNoCoalescing|NSNotificationCoalescingOnSender|NSNotificationCoalescingOnName|NSNotificationDeliverImmediately|NSNotificationPostToAllSessions|NSNotPredicateType|NSNotEqualToPredicateOperatorType|NSNoScriptError|NSNoScrollerParts|NSNoSubelement|NSNoSpecifierError|NSNoCellMask|NSNoTitle|NSNoTopLevelContainersSpecifierError|NSNoTabsBezelBorder|NSNoTabsNoBorder|NSNoTabsLineBorder|NSNoInterfaceStyle|NSNoImage|NSNoUnderlineStyle|NSNoFontChangeAction|NSNullGlyph|NSNullCellType|NSNumericSearch|NSNumericPadKeyMask|NSNumberFormatterRoundHalfDown|NSNumberFormatterRoundHalfUp|NSNumberFormatterRoundHalfEven|NSNumberFormatterRoundCeiling|NSNumberFormatterRoundDown|NSNumberFormatterRoundUp|NSNumberFormatterRoundFloor|NSNumberFormatterBehavior10|NSNumberFormatterBehaviorDefault|NSNumberFormatterScientificStyle|NSNumberFormatterSpellOutStyle|NSNumberFormatterNoStyle|NSNumberFormatterCurrencyStyle|NSNumberFormatterDecimalStyle|NSNumberFormatterPercentStyle|NSNumberFormatterPadBeforeSuffix|NSNumberFormatterPadBeforePrefix|NSNumberFormatterPadAfterSuffix|NSNumberFormatterPadAfterPrefix|NSNetServicesBadArgumentError|NSNetServicesNotFoundError|NSNetServicesCollisionError|NSNetServicesCancelledError|NSNetServicesTimeoutError|NSNetServicesInvalidError|NSNetServicesUnknownError|NSNetServicesActivityInProgress|NSNetworkDomainMask|NSNewlineCharacter|NSNextStepInterfaceStyle|NSNextFunctionKey|NSNEXTSTEPStringEncoding|NSNativeShortGlyphPacking|NSNaturalTextAlignment|NSNarrowFontMask|NSChangeReadOtherContents|NSChangeGrayCell|NSChangeGrayCellMask|NSChangeBackgroundCell|NSChangeBackgroundCellMask|NSChangeCleared|NSChangeDone|NSChangeUndone|NSChangeAutosaved|NSCMYKModeColorPanel|NSCMYKColorSpaceModel|NSCircularBezelStyle|NSCircularSlider|NSConstantValueExpressionType|NSContinuousCapacityLevelIndicatorStyle|NSContentsCellMask|NSContainsComparison|NSContainerSpecifierError|NSControlGlyph|NSControlKeyMask|NSCondensedFontMask|NSColorPanelRGBModeMask|NSColorPanelGrayModeMask|NSColorPanelHSBModeMask|NSColorPanelCMYKModeMask|NSColorPanelColorListModeMask|NSColorPanelCustomPaletteModeMask|NSColorPanelCrayonModeMask|NSColorPanelWheelModeMask|NSColorPanelAllModesMask|NSColorListModeColorPanel|NSCoreServiceDirectory|NSCompositeXOR|NSCompositeSourceIn|NSCompositeSourceOut|NSCompositeSourceOver|NSCompositeSourceAtop|NSCompositeHighlight|NSCompositeCopy|NSCompositeClear|NSCompositeDestinationIn|NSCompositeDestinationOut|NSCompositeDestinationOver|NSCompositeDestinationAtop|NSCompositePlusDarker|NSCompositePlusLighter|NSCompressedFontMask|NSCommandKeyMask|NSCustomSelectorPredicateOperatorType|NSCustomPaletteModeColorPanel|NSCursorUpdate|NSCursorUpdateMask|NSCursorPointingDevice|NSCurveToBezierPathElement|NSCenterTextAlignment|NSCenterTabStopType|NSCellHighlighted|NSCellHasImageHorizontal|NSCellHasImageOnLeftOrBottom|NSCellHasOverlappingImage|NSCellChangesContents|NSCellIsBordered|NSCellIsInsetButton|NSCellDisabled|NSCellEditable|NSCellLightsByGray|NSCellLightsByBackground|NSCellLightsByContents|NSCellAllowsMixedState|NSClipPagination|NSClosePathBezierPathElement|NSClosableWindowMask|NSClockAndCalendarDatePickerStyle|NSClearControlTint|NSClearDisplayFunctionKey|NSClearLineFunctionKey|NSCaseInsensitiveSearch|NSCaseInsensitivePredicateOption|NSCannotCreateScriptCommandError|NSCancelButton|NSCancelTextMovement|NSCachesDirectory|NSCalculationNoError|NSCalculationOverflow|NSCalculationDivideByZero|NSCalculationUnderflow|NSCalculationLossOfPrecision|NSCarriageReturnCharacter|NSCriticalRequest|NSCriticalAlertStyle|NSCrayonModeColorPanel|NSThickSquareBezelStyle|NSThickerSquareBezelStyle|NSTypesetterBehavior|NSTypesetterHorizontalTabAction|NSTypesetterContainerBreakAction|NSTypesetterZeroAdvancementAction|NSTypesetterOriginalBehavior|NSTypesetterParagraphBreakAction|NSTypesetterWhitespaceAction|NSTypesetterLineBreakAction|NSTypesetterLatestBehavior|NSTickMarkRight|NSTickMarkBelow|NSTickMarkLeft|NSTickMarkAbove|NSTitledWindowMask|NSTimeZoneDatePickerElementFlag|NSToolbarItemVisibilityPriorityStandard|NSToolbarItemVisibilityPriorityHigh|NSToolbarItemVisibilityPriorityUser|NSToolbarItemVisibilityPriorityLow|NSTopTabsBezelBorder|NSToggleButton|NSTIFFCompressionNone|NSTIFFCompressionNEXT|NSTIFFCompressionCCITTFAX3|NSTIFFCompressionCCITTFAX4|NSTIFFCompressionOldJPEG|NSTIFFCompressionJPEG|NSTIFFCompressionPackBits|NSTIFFCompressionLZW|NSTIFFFileType|NSTerminateNow|NSTerminateCancel|NSTerminateLater|NSTextReadInapplicableDocumentTypeError|NSTextReadWriteErrorMinimum|NSTextReadWriteErrorMaximum|NSTextBlockMinimumHeight|NSTextBlockMinimumWidth|NSTextBlockMiddleAlignment|NSTextBlockMargin|NSTextBlockMaximumHeight|NSTextBlockMaximumWidth|NSTextBlockBottomAlignment|NSTextBlockBorder|NSTextBlockBaselineAlignment|NSTextBlockHeight|NSTextBlockTopAlignment|NSTextBlockPercentageValueType|NSTextBlockPadding|NSTextBlockWidth|NSTextBlockAbsoluteValueType|NSTextStorageEditedCharacters|NSTextStorageEditedAttributes|NSTextCellType|NSTexturedRoundedBezelStyle|NSTexturedBackgroundWindowMask|NSTexturedSquareBezelStyle|NSTextTableFixedLayoutAlgorithm|NSTextTableAutomaticLayoutAlgorithm|NSTextFieldRoundedBezel|NSTextFieldSquareBezel|NSTextFieldAndStepperDatePickerStyle|NSTextWriteInapplicableDocumentTypeError|NSTextListPrependEnclosingMarker|NSTwoByteGlyphPacking|NSTabCharacter|NSTabTextMovement|NSTabletPoint|NSTabletPointMask|NSTabletPointEventSubtype|NSTabletProximity|NSTabletProximityMask|NSTabletProximityEventSubtype|NSTableColumnNoResizing|NSTableColumnUserResizingMask|NSTableColumnAutoresizingMask|NSTableViewReverseSequentialColumnAutoresizingStyle|NSTableViewGridNone|NSTableViewSolidHorizontalGridLineMask|NSTableViewSolidVerticalGridLineMask|NSTableViewSequentialColumnAutoresizingStyle|NSTableViewNoColumnAutoresizing|NSTableViewUniformColumnAutoresizingStyle|NSTableViewFirstColumnOnlyAutoresizingStyle|NSTableViewLastColumnOnlyAutoresizingStyle|NSTrackModeMatrix|NSInsertCharFunctionKey|NSInsertFunctionKey|NSInsertLineFunctionKey|NSIntType|NSInternalScriptError|NSInternalSpecifierError|NSIndexSubelement|NSInvalidIndexSpecifierError|NSInformationalRequest|NSInformationalAlertStyle|NSInPredicateOperatorType|NSItalicFontMask|NSISO2022JPStringEncoding|NSISOLatin1StringEncoding|NSISOLatin2StringEncoding|NSIdentityMappingCharacterCollection|NSIllegalTextMovement|NSImageRight|NSImageRepMatchesDevice|NSImageRepLoadStatusReadingHeader|NSImageRepLoadStatusCompleted|NSImageRepLoadStatusInvalidData|NSImageRepLoadStatusUnexpectedEOF|NSImageRepLoadStatusUnknownType|NSImageRepLoadStatusWillNeedAllData|NSImageBelow|NSImageCellType|NSImageCacheBySize|NSImageCacheNever|NSImageCacheDefault|NSImageCacheAlways|NSImageInterpolationHigh|NSImageInterpolationNone|NSImageInterpolationDefault|NSImageInterpolationLow|NSImageOnly|NSImageOverlaps|NSImageFrameGroove|NSImageFrameGrayBezel|NSImageFrameButton|NSImageFrameNone|NSImageFramePhoto|NSImageLoadStatusReadError|NSImageLoadStatusCompleted|NSImageLoadStatusCancelled|NSImageLoadStatusInvalidData|NSImageLoadStatusUnexpectedEOF|NSImageLeft|NSImageAlignRight|NSImageAlignBottom|NSImageAlignBottomRight|NSImageAlignBottomLeft|NSImageAlignCenter|NSImageAlignTop|NSImageAlignTopRight|NSImageAlignTopLeft|NSImageAlignLeft|NSImageAbove|NSOnState|NSOneByteGlyphPacking|NSOnOffButton|NSOnlyScrollerArrows|NSOtherMouseDown|NSOtherMouseDownMask|NSOtherMouseDragged|NSOtherMouseDraggedMask|NSOtherMouseUp|NSOtherMouseUpMask|NSOtherTextMovement|NSOSF1OperatingSystem|NSOpenGLGOResetLibrary|NSOpenGLGORetainRenderers|NSOpenGLGOClearFormatCache|NSOpenGLGOFormatCacheSize|NSOpenGLPFARobust|NSOpenGLPFARendererID|NSOpenGLPFAMinimumPolicy|NSOpenGLPFAMultisample|NSOpenGLPFAMultiScreen|NSOpenGLPFAMPSafe|NSOpenGLPFAMaximumPolicy|NSOpenGLPFABackingStore|NSOpenGLPFAScreenMask|NSOpenGLPFAStencilSize|NSOpenGLPFAStereo|NSOpenGLPFASingleRenderer|NSOpenGLPFASupersample|NSOpenGLPFASamples|NSOpenGLPFASampleBuffers|NSOpenGLPFASampleAlpha|NSOpenGLPFANoRecovery|NSOpenGLPFAColorSize|NSOpenGLPFAColorFloat|NSOpenGLPFACompliant|NSOpenGLPFAClosestPolicy|NSOpenGLPFAOffScreen|NSOpenGLPFADoubleBuffer|NSOpenGLPFADepthSize|NSOpenGLPFAPixelBuffer|NSOpenGLPFAVirtualScreenCount|NSOpenGLPFAFullScreen|NSOpenGLPFAWindow|NSOpenGLPFAAccumSize|NSOpenGLPFAAccelerated|NSOpenGLPFAAuxBuffers|NSOpenGLPFAAuxDepthStencil|NSOpenGLPFAAlphaSize|NSOpenGLPFAAllRenderers|NSOpenStepUnicodeReservedBase|NSOperationNotSupportedForKeyScriptError|NSOperationNotSupportedForKeySpecifierError|NSOffState|NSOKButton|NSOrPredicateType|NSObjCBitfield|NSObjCBoolType|NSObjCShortType|NSObjCStringType|NSObjCStructType|NSObjCSelectorType|NSObjCNoType|NSObjCCharType|NSObjCObjectType|NSObjCDoubleType|NSObjCUnionType|NSObjCPointerType|NSObjCVoidType|NSObjCFloatType|NSObjCLongType|NSObjCLonglongType|NSObjCArrayType|NSDisclosureBezelStyle|NSDiscreteCapacityLevelIndicatorStyle|NSDisplayWindowRunLoopOrdering|NSDiacriticInsensitivePredicateOption|NSDirectSelection|NSDirectPredicateModifier|NSDocModalWindowMask|NSDocumentDirectory|NSDocumentationDirectory|NSDoubleType|NSDownTextMovement|NSDownArrowFunctionKey|NSDescendingPageOrder|NSDesktopDirectory|NSDecimalTabStopType|NSDeviceNColorSpaceModel|NSDeviceIndependentModifierFlagsMask|NSDeveloperDirectory|NSDeveloperApplicationDirectory|NSDefaultControlTint|NSDefaultTokenStyle|NSDeleteCharacter|NSDeleteCharFunctionKey|NSDeleteFunctionKey|NSDeleteLineFunctionKey|NSDemoApplicationDirectory|NSDayCalendarUnit|NSDateFormatterMediumStyle|NSDateFormatterBehavior10|NSDateFormatterBehaviorDefault|NSDateFormatterShortStyle|NSDateFormatterNoStyle|NSDateFormatterFullStyle|NSDateFormatterLongStyle|NSDrawerClosingState|NSDrawerClosedState|NSDrawerOpeningState|NSDrawerOpenState|NSDragOperationGeneric|NSDragOperationMove|NSDragOperationNone|NSDragOperationCopy|NSDragOperationDelete|NSDragOperationPrivate|NSDragOperationEvery|NSDragOperationLink|NSDragOperationAll|NSUserCancelledError|NSUserDirectory|NSUserDomainMask|NSUserFunctionKey|NSURLHandleNotLoaded|NSURLHandleLoadSucceeded|NSURLHandleLoadInProgress|NSURLHandleLoadFailed|NSURLCredentialPersistenceNone|NSURLCredentialPersistencePermanent|NSURLCredentialPersistenceForSession|NSUnscaledWindowMask|NSUncachedRead|NSUnicodeStringEncoding|NSUnitalicFontMask|NSUnifiedTitleAndToolbarWindowMask|NSUndoCloseGroupingRunLoopOrdering|NSUndoFunctionKey|NSUndefinedDateComponent|NSUnderlineStyleSingle|NSUnderlineStyleNone|NSUnderlineStyleThick|NSUnderlineStyleDouble|NSUnderlinePatternSolid|NSUnderlinePatternDot|NSUnderlinePatternDash|NSUnderlinePatternDashDot|NSUnderlinePatternDashDotDot|NSUnknownColorSpaceModel|NSUnknownPointingDevice|NSUnknownPageOrder|NSUnknownKeyScriptError|NSUnknownKeySpecifierError|NSUnboldFontMask|NSUtilityWindowMask|NSUTF8StringEncoding|NSUpdateWindowsRunLoopOrdering|NSUpTextMovement|NSUpArrowFunctionKey|NSJustifiedTextAlignment|NSJPEG2000FileType|NSJPEGFileType|NSJapaneseEUCGlyphPacking|NSJapaneseEUCStringEncoding|NSPostNow|NSPosterFontMask|NSPostWhenIdle|NSPostASAP|NSPositionReplace|NSPositionBefore|NSPositionBeginning|NSPositionEnd|NSPositionAfter|NSPositiveIntType|NSPositiveDoubleType|NSPositiveFloatType|NSPopUpNoArrow|NSPopUpArrowAtBottom|NSPopUpArrowAtCenter|NSPowerOffEventType|NSPortraitOrientation|NSPNGFileType|NSPushInCell|NSPushInCellMask|NSPushOnPushOffButton|NSPenTipMask|NSPenUpperSideMask|NSPenPointingDevice|NSPenLowerSideMask|NSPeriodic|NSPeriodicMask|NSPPScaleField|NSPPStatusTitle|NSPPStatusField|NSPPSaveButton|NSPPNoteTitle|NSPPNoteField|NSPPNameTitle|NSPPNameField|NSPPCopiesField|NSPPTitleField|NSPPImageButton|NSPPOptionsButton|NSPPPaperFeedButton|NSPPPageRangeTo|NSPPPageRangeFrom|NSPPPageChoiceMatrix|NSPPPreviewButton|NSPPLayoutButton|NSPlainTextTokenStyle|NSPauseFunctionKey|NSParagraphSeparatorCharacter|NSPageDownFunctionKey|NSPageUpFunctionKey|NSPrintingReplyLater|NSPrintingSuccess|NSPrintingCancelled|NSPrintingFailure|NSPrintScreenFunctionKey|NSPrinterTableNotFound|NSPrinterTableOK|NSPrinterTableError|NSPrintFunctionKey|NSPropertyListXMLFormat|NSPropertyListMutableContainers|NSPropertyListMutableContainersAndLeaves|NSPropertyListBinaryFormat|NSPropertyListImmutable|NSPropertyListOpenStepFormat|NSProprietaryStringEncoding|NSProgressIndicatorBarStyle|NSProgressIndicatorSpinningStyle|NSProgressIndicatorPreferredSmallThickness|NSProgressIndicatorPreferredThickness|NSProgressIndicatorPreferredLargeThickness|NSProgressIndicatorPreferredAquaThickness|NSPressedTab|NSPrevFunctionKey|NSPLHeightForm|NSPLCancelButton|NSPLTitleField|NSPLImageButton|NSPLOKButton|NSPLOrientationMatrix|NSPLUnitsButton|NSPLPaperNameButton|NSPLWidthForm|NSEnterCharacter|NSEndsWithComparison|NSEndsWithPredicateOperatorType|NSEndFunctionKey|NSEvenOddWindingRule|NSEverySubelement|NSEvaluatedObjectExpressionType|NSEqualToComparison|NSEqualToPredicateOperatorType|NSEraserPointingDevice|NSEraCalendarUnit|NSEraDatePickerElementFlag|NSExclude10|NSExcludeQuickDrawElementsIconCreationOption|NSExpandedFontMask|NSExecuteFunctionKey|NSViewMinXMargin|NSViewMinYMargin|NSViewMaxXMargin|NSViewMaxYMargin|NSViewHeightSizable|NSViewNotSizable|NSViewWidthSizable|NSViaPanelFontAction|NSVerticalRuler|NSValidationErrorMinimum|NSValidationErrorMaximum|NSVariableExpressionType|NSKeySpecifierEvaluationScriptError|NSKeyDown|NSKeyDownMask|NSKeyUp|NSKeyUpMask|NSKeyPathExpressionType|NSKeyValueMinusSetMutation|NSKeyValueSetSetMutation|NSKeyValueChangeReplacement|NSKeyValueChangeRemoval|NSKeyValueChangeSetting|NSKeyValueChangeInsertion|NSKeyValueIntersectSetMutation|NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld|NSKeyValueUnionSetMutation|NSKeyValueValidationError|NSQTMovieNormalPlayback|NSQTMovieLoopingBackAndForthPlayback|NSQTMovieLoopingPlayback|NSF11FunctionKey|NSF17FunctionKey|NSF12FunctionKey|NSF18FunctionKey|NSF13FunctionKey|NSF19FunctionKey|NSF14FunctionKey|NSF15FunctionKey|NSF1FunctionKey|NSF10FunctionKey|NSF16FunctionKey|NSF7FunctionKey|NSFindPanelActionReplace|NSFindPanelActionReplaceAndFind|NSFindPanelActionReplaceAll|NSFindPanelActionReplaceAllInSelection|NSFindPanelActionShowFindPanel|NSFindPanelActionSetFindString|NSFindPanelActionSelectAll|NSFindPanelActionSelectAllInSelection|NSFindPanelActionNext|NSFindPanelActionPrevious|NSFindFunctionKey|NSFitPagination|NSFileReadNoSuchFileError|NSFileReadNoPermissionError|NSFileReadCorruptFileError|NSFileReadInvalidFileNameError|NSFileReadInapplicableStringEncodingError|NSFileReadUnsupportedSchemeError|NSFileReadUnknownError|NSFileHandlingPanelCancelButton|NSFileHandlingPanelOKButton|NSFileNoSuchFileError|NSFileErrorMinimum|NSFileErrorMaximum|NSFileWriteNoPermissionError|NSFileWriteInvalidFileNameError|NSFileWriteInapplicableStringEncodingError|NSFileWriteOutOfSpaceError|NSFileWriteUnsupportedSchemeError|NSFileWriteUnknownError|NSFileLockingError|NSFixedPitchFontMask|NSF21FunctionKey|NSF27FunctionKey|NSF22FunctionKey|NSF28FunctionKey|NSF23FunctionKey|NSF29FunctionKey|NSF24FunctionKey|NSF25FunctionKey|NSF2FunctionKey|NSF20FunctionKey|NSF26FunctionKey|NSFontMonoSpaceTrait|NSFontModernSerifsClass|NSFontBoldTrait|NSFontSymbolicClass|NSFontScriptsClass|NSFontSlabSerifsClass|NSFontSansSerifClass|NSFontCondensedTrait|NSFontCollectionApplicationOnlyMask|NSFontClarendonSerifsClass|NSFontTransitionalSerifsClass|NSFontIntegerAdvancementsRenderingMode|NSFontItalicTrait|NSFontOldStyleSerifsClass|NSFontOrnamentalsClass|NSFontDefaultRenderingMode|NSFontUnknownClass|NSFontUIOptimizedTrait|NSFontPanelShadowEffectModeMask|NSFontPanelStandardModesMask|NSFontPanelStrikethroughEffectModeMask|NSFontPanelSizeModeMask|NSFontPanelCollectionModeMask|NSFontPanelTextColorEffectModeMask|NSFontPanelDocumentColorEffectModeMask|NSFontPanelUnderlineEffectModeMask|NSFontPanelFaceModeMask|NSFontPanelAllModesMask|NSFontPanelAllEffectsModeMask|NSFontExpandedTrait|NSFontVerticalTrait|NSFontFamilyClassMask|NSFontFreeformSerifsClass|NSFontAntialiasedRenderingMode|NSFontAntialiasedIntegerAdvancementsRenderingMode|NSFocusRingBelow|NSFocusRingTypeNone|NSFocusRingTypeDefault|NSFocusRingTypeExterior|NSFocusRingOnly|NSFocusRingAbove|NSFourByteGlyphPacking|NSFormattingError|NSFormattingErrorMinimum|NSFormattingErrorMaximum|NSFormFeedCharacter|NSF8FunctionKey|NSFunctionExpressionType|NSFunctionKeyMask|NSF31FunctionKey|NSF32FunctionKey|NSF33FunctionKey|NSF34FunctionKey|NSF35FunctionKey|NSF3FunctionKey|NSF30FunctionKey|NSF9FunctionKey|NSF4FunctionKey|NSFPRevertButton|NSFPSizeTitle|NSFPSizeField|NSFPSetButton|NSFPCurrentField|NSFPPreviewButton|NSFPPreviewField|NSFloatingPointSamplesBitmapFormat|NSFloatType|NSFlagsChanged|NSFlagsChangedMask|NSFaxButton|NSF5FunctionKey|NSF6FunctionKey|NSWheelModeColorPanel|NSWindowsNTOperatingSystem|NSWindowsCP1251StringEncoding|NSWindowsCP1252StringEncoding|NSWindowsCP1253StringEncoding|NSWindowsCP1254StringEncoding|NSWindowsCP1250StringEncoding|NSWindows95InterfaceStyle|NSWindows95OperatingSystem|NSWindowMiniaturizeButton|NSWindowMovedEventType|NSWindowBelow|NSWindowCloseButton|NSWindowToolbarButton|NSWindowZoomButton|NSWindowOut|NSWindowDocumentIconButton|NSWindowExposedEventType|NSWindowAbove|NSWorkspaceLaunchNewInstance|NSWorkspaceLaunchInhibitingBackgroundOnly|NSWorkspaceLaunchDefault|NSWorkspaceLaunchPreferringClassic|NSWorkspaceLaunchWithoutActivation|NSWorkspaceLaunchWithoutAddingToRecents|NSWorkspaceLaunchAsync|NSWorkspaceLaunchAndHide|NSWorkspaceLaunchAndHideOthers|NSWorkspaceLaunchAndPrint|NSWorkspaceLaunchAllowingClassicStartup|NSWeekdayCalendarUnit|NSWeekdayOrdinalCalendarUnit|NSWeekCalendarUnit|NSWantsBidiLevels|NSWarningAlertStyle|NSWritingDirectionRightToLeft|NSWritingDirectionNatural|NSWritingDirectionLeftToRight|NSWrapCalendarComponents|NSListModeMatrix|NSLineMovesRight|NSLineMovesDown|NSLineMovesUp|NSLineMovesLeft|NSLineBorder|NSLineBreakByCharWrapping|NSLineBreakByClipping|NSLineBreakByTruncatingMiddle|NSLineBreakByTruncatingHead|NSLineBreakByTruncatingTail|NSLineBreakByWordWrapping|NSLineSeparatorCharacter|NSLineSweepRight|NSLineSweepDown|NSLineSweepUp|NSLineSweepLeft|NSLineToBezierPathElement|NSLineDoesntMove|NSLinearSlider|NSLiteralSearch|NSLikePredicateOperatorType|NSLighterFontAction|NSLibraryDirectory|NSLocalDomainMask|NSLessThanComparison|NSLessThanOrEqualToComparison|NSLessThanOrEqualToPredicateOperatorType|NSLessThanPredicateOperatorType|NSLeftMouseDown|NSLeftMouseDownMask|NSLeftMouseDragged|NSLeftMouseDraggedMask|NSLeftMouseUp|NSLeftMouseUpMask|NSLeftTextMovement|NSLeftTextAlignment|NSLeftTabsBezelBorder|NSLeftTabStopType|NSLeftArrowFunctionKey|NSLayoutRightToLeft|NSLayoutNotDone|NSLayoutCantFit|NSLayoutOutOfGlyphs|NSLayoutDone|NSLayoutLeftToRight|NSLandscapeOrientation|NSLABColorSpaceModel|NSAsciiWithDoubleByteEUCGlyphPacking|NSAscendingPageOrder|NSAnyType|NSAnyPredicateModifier|NSAnyEventMask|NSAnchoredSearch|NSAnimationBlocking|NSAnimationNonblocking|NSAnimationNonblockingThreaded|NSAnimationEffectDisappearingItemDefault|NSAnimationEffectPoof|NSAnimationEaseIn|NSAnimationEaseInOut|NSAnimationEaseOut|NSAnimationLinear|NSAndPredicateType|NSAtBottom|NSAttachmentCharacter|NSAtomicWrite|NSAtTop|NSASCIIStringEncoding|NSAdobeGB1CharacterCollection|NSAdobeCNS1CharacterCollection|NSAdobeJapan1CharacterCollection|NSAdobeJapan2CharacterCollection|NSAdobeKorea1CharacterCollection|NSAddTraitFontAction|NSAdminApplicationDirectory|NSAutosaveOperation|NSAutoPagination|NSApplicationSupportDirectory|NSApplicationDirectory|NSApplicationDefined|NSApplicationDefinedMask|NSApplicationDelegateReplySuccess|NSApplicationDelegateReplyCancel|NSApplicationDelegateReplyFailure|NSApplicationDeactivatedEventType|NSApplicationActivatedEventType|NSAppKitDefined|NSAppKitDefinedMask|NSAlternateKeyMask|NSAlphaShiftKeyMask|NSAlphaNonpremultipliedBitmapFormat|NSAlphaFirstBitmapFormat|NSAlertSecondButtonReturn|NSAlertThirdButtonReturn|NSAlertOtherReturn|NSAlertDefaultReturn|NSAlertErrorReturn|NSAlertFirstButtonReturn|NSAlertAlternateReturn|NSAllScrollerParts|NSAllDomainsMask|NSAllPredicateModifier|NSAllLibrariesDirectory|NSAllApplicationsDirectory|NSArgumentsWrongScriptError|NSArgumentEvaluationScriptError|NSAboveBottom|NSAboveTop|NSAWTEventType", "support.constant.notification.cocoa.leopard": "NSMenuDidBeginTrackingNotification|NSViewDidUpdateTrackingAreasNotification", "support.constant.notification.cocoa": "NSMenuDidRemoveItemNotification|NSMenuDidSendActionNotification|NSMenuDidChangeItemNotification|NSMenuDidEndTrackingNotification|NSMenuDidAddItemNotification|NSMenuWillSendActionNotification|NSSystemColorsDidChangeNotification|NSSplitViewDidResizeSubviewsNotification|NSSplitViewWillResizeSubviewsNotification|NSContextHelpModeDidDeactivateNotification|NSContextHelpModeDidActivateNotification|NSControlTintDidChangeNotification|NSControlTextDidBeginEditingNotification|NSControlTextDidChangeNotification|NSControlTextDidEndEditingNotification|NSColorPanelColorDidChangeNotification|NSColorListDidChangeNotification|NSComboBoxSelectionIsChangingNotification|NSComboBoxSelectionDidChangeNotification|NSComboBoxWillDismissNotification|NSComboBoxWillPopUpNotification|NSClassDescriptionNeededForClassNotification|NSToolbarDidRemoveItemNotification|NSToolbarWillAddItemNotification|NSTextStorageDidProcessEditingNotification|NSTextStorageWillProcessEditingNotification|NSTextDidBeginEditingNotification|NSTextDidChangeNotification|NSTextDidEndEditingNotification|NSTextViewDidChangeSelectionNotification|NSTextViewDidChangeTypingAttributesNotification|NSTextViewWillChangeNotifyingTextViewNotification|NSTableViewSelectionIsChangingNotification|NSTableViewSelectionDidChangeNotification|NSTableViewColumnDidResizeNotification|NSTableViewColumnDidMoveNotification|NSImageRepRegistryDidChangeNotification|NSOutlineViewSelectionIsChangingNotification|NSOutlineViewSelectionDidChangeNotification|NSOutlineViewColumnDidResizeNotification|NSOutlineViewColumnDidMoveNotification|NSOutlineViewItemDidCollapseNotification|NSOutlineViewItemDidExpandNotification|NSOutlineViewItemWillCollapseNotification|NSOutlineViewItemWillExpandNotification|NSDrawerDidCloseNotification|NSDrawerDidOpenNotification|NSDrawerWillCloseNotification|NSDrawerWillOpenNotification|NSPopUpButtonCellWillPopUpNotification|NSPopUpButtonWillPopUpNotification|NSViewGlobalFrameDidChangeNotification|NSViewBoundsDidChangeNotification|NSViewFocusDidChangeNotification|NSViewFrameDidChangeNotification|NSFontSetChangedNotification|NSWindowDidResizeNotification|NSWindowDidResignMainNotification|NSWindowDidResignKeyNotification|NSWindowDidMiniaturizeNotification|NSWindowDidMoveNotification|NSWindowDidBecomeMainNotification|NSWindowDidBecomeKeyNotification|NSWindowDidChangeScreenNotification|NSWindowDidChangeScreenProfileNotification|NSWindowDidDeminiaturizeNotification|NSWindowDidUpdateNotification|NSWindowDidEndSheetNotification|NSWindowDidExposeNotification|NSWindowWillMiniaturizeNotification|NSWindowWillMoveNotification|NSWindowWillBeginSheetNotification|NSWindowWillCloseNotification|NSWorkspaceSessionDidResignActiveNotification|NSWorkspaceSessionDidBecomeActiveNotification|NSWorkspaceDidMountNotification|NSWorkspaceDidTerminateApplicationNotification|NSWorkspaceDidUnmountNotification|NSWorkspaceDidPerformFileOperationNotification|NSWorkspaceDidWakeNotification|NSWorkspaceDidLaunchApplicationNotification|NSWorkspaceWillSleepNotification|NSWorkspaceWillUnmountNotification|NSWorkspaceWillPowerOffNotification|NSWorkspaceWillLaunchApplicationNotification|NSAntialiasThresholdChangedNotification|NSApplicationDidResignActiveNotification|NSApplicationDidBecomeActiveNotification|NSApplicationDidHideNotification|NSApplicationDidChangeScreenParametersNotification|NSApplicationDidUnhideNotification|NSApplicationDidUpdateNotification|NSApplicationDidFinishLaunchingNotification|NSApplicationWillResignActiveNotification|NSApplicationWillBecomeActiveNotification|NSApplicationWillHideNotification|NSApplicationWillTerminateNotification|NSApplicationWillUnhideNotification|NSApplicationWillUpdateNotification|NSApplicationWillFinishLaunchingNotification|NSAppleEventManagerWillProcessFirstEventNotification", "support.constant.cocoa.leopard": "NSRuleEditorRowTypeSimple|NSRuleEditorRowTypeCompound|NSRuleEditorNestingModeSingle|NSRuleEditorNestingModeSimple|NSRuleEditorNestingModeCompound|NSRuleEditorNestingModeList|NSGradientDrawsBeforeStartingLocation|NSGradientDrawsAfterEndingLocation|NSMinusSetExpressionType|NSMachPortDeallocateReceiveRight|NSMachPortDeallocateSendRight|NSMachPortDeallocateNone|NSMapTableStrongMemory|NSMapTableCopyIn|NSMapTableZeroingWeakMemory|NSMapTableObjectPointerPersonality|NSBoxCustom|NSBundleExecutableArchitectureX86|NSBundleExecutableArchitectureI386|NSBundleExecutableArchitecturePPC|NSBundleExecutableArchitecturePPC64|NSBetweenPredicateOperatorType|NSBackgroundStyleRaised|NSBackgroundStyleDark|NSBackgroundStyleLight|NSBackgroundStyleLowered|NSStringDrawingTruncatesLastVisibleLine|NSStringEncodingConversionExternalRepresentation|NSStringEncodingConversionAllowLossy|NSSubqueryExpressionType|NSSpeechSentenceBoundary|NSSpeechImmediateBoundary|NSSpeechWordBoundary|NSSpellingStateGrammarFlag|NSSpellingStateSpellingFlag|NSSplitViewDividerStyleThin|NSSplitViewDividerStyleThick|NSServiceRequestTimedOutError|NSServiceMiscellaneousError|NSServiceMalformedServiceDictionaryError|NSServiceInvalidPasteboardDataError|NSServiceErrorMinimum|NSServiceErrorMaximum|NSServiceApplicationNotFoundError|NSServiceApplicationLaunchFailedError|NSSegmentStyleRoundRect|NSSegmentStyleRounded|NSSegmentStyleSmallSquare|NSSegmentStyleCapsule|NSSegmentStyleTexturedRounded|NSSegmentStyleTexturedSquare|NSSegmentStyleAutomatic|NSHUDWindowMask|NSHashTableStrongMemory|NSHashTableCopyIn|NSHashTableZeroingWeakMemory|NSHashTableObjectPointerPersonality|NSNoModeColorPanel|NSNetServiceNoAutoRename|NSChangeRedone|NSContainsPredicateOperatorType|NSColorRenderingIntentRelativeColorimetric|NSColorRenderingIntentSaturation|NSColorRenderingIntentDefault|NSColorRenderingIntentPerceptual|NSColorRenderingIntentAbsoluteColorimetric|NSCollectorDisabledOption|NSCellHitNone|NSCellHitContentArea|NSCellHitTrackableArea|NSCellHitEditableTextArea|NSTimeZoneNameStyleShortStandard|NSTimeZoneNameStyleShortDaylightSaving|NSTimeZoneNameStyleStandard|NSTimeZoneNameStyleDaylightSaving|NSTextFieldDatePickerStyle|NSTableViewSelectionHighlightStyleRegular|NSTableViewSelectionHighlightStyleSourceList|NSTrackingMouseMoved|NSTrackingMouseEnteredAndExited|NSTrackingCursorUpdate|NSTrackingInVisibleRect|NSTrackingEnabledDuringMouseDrag|NSTrackingAssumeInside|NSTrackingActiveInKeyWindow|NSTrackingActiveInActiveApp|NSTrackingActiveWhenFirstResponder|NSTrackingActiveAlways|NSIntersectSetExpressionType|NSIndexedColorSpaceModel|NSImageScaleNone|NSImageScaleProportionallyDown|NSImageScaleProportionallyUpOrDown|NSImageScaleAxesIndependently|NSOpenGLPFAAllowOfflineRenderers|NSOperationQueueDefaultMaxConcurrentOperationCount|NSOperationQueuePriorityHigh|NSOperationQueuePriorityNormal|NSOperationQueuePriorityVeryHigh|NSOperationQueuePriorityVeryLow|NSOperationQueuePriorityLow|NSDiacriticInsensitiveSearch|NSDownloadsDirectory|NSUnionSetExpressionType|NSUTF16BigEndianStringEncoding|NSUTF16StringEncoding|NSUTF16LittleEndianStringEncoding|NSUTF32BigEndianStringEncoding|NSUTF32StringEncoding|NSUTF32LittleEndianStringEncoding|NSPointerFunctionsMachVirtualMemory|NSPointerFunctionsMallocMemory|NSPointerFunctionsStrongMemory|NSPointerFunctionsStructPersonality|NSPointerFunctionsCStringPersonality|NSPointerFunctionsCopyIn|NSPointerFunctionsIntegerPersonality|NSPointerFunctionsZeroingWeakMemory|NSPointerFunctionsOpaqueMemory|NSPointerFunctionsOpaquePersonality|NSPointerFunctionsObjectPointerPersonality|NSPointerFunctionsObjectPersonality|NSPathStyleStandard|NSPathStyleNavigationBar|NSPathStylePopUp|NSPatternColorSpaceModel|NSPrintPanelShowsScaling|NSPrintPanelShowsCopies|NSPrintPanelShowsOrientation|NSPrintPanelShowsPaperSize|NSPrintPanelShowsPageRange|NSPrintPanelShowsPageSetupAccessory|NSPrintPanelShowsPreview|NSExecutableRuntimeMismatchError|NSExecutableNotLoadableError|NSExecutableErrorMinimum|NSExecutableErrorMaximum|NSExecutableLinkError|NSExecutableLoadError|NSExecutableArchitectureMismatchError|NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionPrior|NSFindPanelSubstringMatchTypeStartsWith|NSFindPanelSubstringMatchTypeContains|NSFindPanelSubstringMatchTypeEndsWith|NSFindPanelSubstringMatchTypeFullWord|NSFileReadTooLargeError|NSFileReadUnknownStringEncodingError|NSForcedOrderingSearch|NSWindowBackingLocationMainMemory|NSWindowBackingLocationDefault|NSWindowBackingLocationVideoMemory|NSWindowSharingReadOnly|NSWindowSharingReadWrite|NSWindowSharingNone|NSWindowCollectionBehaviorMoveToActiveSpace|NSWindowCollectionBehaviorCanJoinAllSpaces|NSWindowCollectionBehaviorDefault|NSWidthInsensitiveSearch|NSAggregateExpressionType" }; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var escapedConstRe = "\\\\(?:[abefnrtv'\"?\\\\]|" + "[0-3]\\d{1,2}|" + "[4-7]\\d?|" + "222|" + "x[a-zA-Z0-9]+)"; var specialVariables = [{ regex: "\\b_cmd\\b", token: "variable.other.selector.objc" }, { regex: "\\b(?:self|super)\\b", token: "variable.language.objc" } ]; var cObj = new CHighlightRules(NSKeywords); var cRules = cObj.getRules(); this.$keywordList = cObj.$keywordList; this.$rules = { "start": [ { token : "comment", regex : "\\/\\/.*$" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi line comment regex : "\\/\\*", next : "comment" }, { token: [ "storage.type.objc", "punctuation.definition.storage.type.objc", "entity.name.type.objc", "text", "entity.other.inherited-class.objc" ], regex: "(@)(interface|protocol)(?!.+;)(\\s+[A-Za-z_][A-Za-z0-9_]*)(\\s*:\\s*)([A-Za-z]+)" }, { token: [ "storage.type.objc" ], regex: "(@end)" }, { token: [ "storage.type.objc", "entity.name.type.objc", "entity.other.inherited-class.objc" ], regex: "(@implementation)(\\s+[A-Za-z_][A-Za-z0-9_]*)(\\s*?::\\s*(?:[A-Za-z][A-Za-z0-9]*))?" }, { token: "string.begin.objc", regex: '@"', next: "constant_NSString" }, { token: "storage.type.objc", regex: "\\bid\\s*<", next: "protocol_list" }, { token: "keyword.control.macro.objc", regex: "\\bNS_DURING|NS_HANDLER|NS_ENDHANDLER\\b" }, { token: ["punctuation.definition.keyword.objc", "keyword.control.exception.objc"], regex: "(@)(try|catch|finally|throw)\\b" }, { token: ["punctuation.definition.keyword.objc", "keyword.other.objc"], regex: "(@)(defs|encode)\\b" }, { token: ["storage.type.id.objc", "text"], regex: "(\\bid\\b)(\\s|\\n)?" }, { token: "storage.type.objc", regex: "\\bIBOutlet|IBAction|BOOL|SEL|id|unichar|IMP|Class\\b" }, { token: [ "punctuation.definition.storage.type.objc", "storage.type.objc"], regex: "(@)(class|protocol)\\b" }, { token: [ "punctuation.definition.storage.type.objc", "punctuation"], regex: "(@selector)(\\s*\\()", next: "selectors" }, { token: [ "punctuation.definition.storage.modifier.objc", "storage.modifier.objc"], regex: "(@)(synchronized|public|private|protected|package)\\b" }, { token: "constant.language.objc", regex: "\\bYES|NO|Nil|nil\\b" }, { token: "support.variable.foundation", regex: "\\bNSApp\\b" }, { token : cObj.getKeywords(), regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token: "punctuation.section.scope.begin.objc", regex: "\\[", next: "bracketed_content" }, { token: "meta.function.objc", regex: "^(?:-|\\+)\\s*" } ], "constant_NSString": [ { token: "constant.character.escape.objc", regex: escapedConstRe }, { token: "invalid.illegal.unknown-escape.objc", regex: "\\\\." }, { token: "string", regex: '[^"\\\\]+' }, { token: "punctuation.definition.string.end", regex: "\"", next: "start" } ], "protocol_list": [ { token: "punctuation.section.scope.end.objc", regex: ">", next: "start" }, { token: "support.other.protocol.objc", regex: "\bNS(?:GlyphStorage|M(?:utableCopying|enuItem)|C(?:hangeSpelling|o(?:ding|pying|lorPicking(?:Custom|Default)))|T(?:oolbarItemValidations|ext(?:Input|AttachmentCell))|I(?:nputServ(?:iceProvider|erMouseTracker)|gnoreMisspelledWords)|Obj(?:CTypeSerializationCallBack|ect)|D(?:ecimalNumberBehaviors|raggingInfo)|U(?:serInterfaceValidations|RL(?:HandleClient|DownloadDelegate|ProtocolClient|AuthenticationChallengeSender))|Validated(?:ToobarItem|UserInterfaceItem)|Locking)\b" } ], "selectors": [ { token: "support.function.any-method.name-of-parameter.objc", regex: "\\b(?:[a-zA-Z_:][\\w]*)+" }, { token: "punctuation", regex: "\\)", next: "start" } ], "bracketed_content": [ { token: "punctuation.section.scope.end.objc", regex: "]", next: "start" }, { token: ["support.function.any-method.objc"], regex: "(?:predicateWithFormat:| NSPredicate predicateWithFormat:)", next: "start" }, { token: "support.function.any-method.objc", regex: "\\w+(?::|(?=]))", next: "start" } ], "bracketed_strings": [ { token: "punctuation.section.scope.end.objc", regex: "]", next: "start" }, { token: "keyword.operator.logical.predicate.cocoa", regex: "\\b(?:AND|OR|NOT|IN)\\b" }, { token: ["invalid.illegal.unknown-method.objc", "punctuation.separator.arguments.objc"], regex: "\\b(\\w+)(:)" }, { regex: "\\b(?:ALL|ANY|SOME|NONE)\\b", token: "constant.language.predicate.cocoa" }, { regex: "\\b(?:NULL|NIL|SELF|TRUE|YES|FALSE|NO|FIRST|LAST|SIZE)\\b", token: "constant.language.predicate.cocoa" }, { regex: "\\b(?:MATCHES|CONTAINS|BEGINSWITH|ENDSWITH|BETWEEN)\\b", token: "keyword.operator.comparison.predicate.cocoa" }, { regex: "\\bC(?:ASEINSENSITIVE|I)\\b", token: "keyword.other.modifier.predicate.cocoa" }, { regex: "\\b(?:ANYKEY|SUBQUERY|CAST|TRUEPREDICATE|FALSEPREDICATE)\\b", token: "keyword.other.predicate.cocoa" }, { regex: escapedConstRe, token: "constant.character.escape.objc" }, { regex: "\\\\.", token: "invalid.illegal.unknown-escape.objc" }, { token: "string", regex: '[^"\\\\]' }, { token: "punctuation.definition.string.end.objc", regex: "\"", next: "predicates" } ], "comment" : [ { token : "comment", // closing comment regex : ".*?\\*\\/", next : "start" }, { defaultToken : "comment" } ], "methods" : [ { token : "meta.function.objc", regex : "(?=\\{|#)|;", next : "start" } ] }; // copy in C-Rules directly for (var r in cRules) { if (this.$rules[r]) { if (this.$rules[r].push) this.$rules[r].push.apply(this.$rules[r], cRules[r]); } else { this.$rules[r] = cRules[r]; } } this.$rules.bracketed_content = this.$rules.bracketed_content.concat( this.$rules.start, specialVariables ); this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; oop.inherits(ObjectiveCHighlightRules, CHighlightRules); exports.ObjectiveCHighlightRules = ObjectiveCHighlightRules; ================================================ FILE: src/mode/ocaml.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var OcamlHighlightRules = require("./ocaml_highlight_rules").OcamlHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = OcamlHighlightRules; this.$behaviour = this.$defaultBehaviour; this.$outdent = new MatchingBraceOutdent(); }; oop.inherits(Mode, TextMode); var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/; (function() { this.toggleCommentLines = function(state, doc, startRow, endRow) { var i, line; var outdent = true; var re = /^\s*\(\*(.*)\*\)/; for (i=startRow; i<= endRow; i++) { if (!re.test(doc.getLine(i))) { outdent = false; break; } } var range = new Range(0, 0, 0, 0); for (i=startRow; i<= endRow; i++) { line = doc.getLine(i); range.start.row = i; range.end.row = i; range.end.column = line.length; doc.replace(range, outdent ? line.match(re)[1] : "(*" + line + "*)"); } }; 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.$id = "ace/mode/ocaml"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/ocaml_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var OcamlHighlightRules = function() { var keywords = ( "and|as|assert|begin|class|constraint|do|done|downto|else|end|" + "exception|external|for|fun|function|functor|if|in|include|" + "inherit|initializer|lazy|let|match|method|module|mutable|new|" + "object|of|open|or|private|rec|sig|struct|then|to|try|type|val|" + "virtual|when|while|with" ); var builtinConstants = ("true|false"); var builtinFunctions = ( "abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" + "add_available_units|add_big_int|add_buffer|add_channel|add_char|" + "add_initializer|add_int_big_int|add_interfaces|add_num|add_string|" + "add_substitute|add_substring|alarm|allocated_bytes|allow_only|" + "allow_unsafe_modules|always|append|appname_get|appname_set|" + "approx_num_exp|approx_num_fix|arg|argv|arith_status|array|" + "array1_of_genarray|array2_of_genarray|array3_of_genarray|asin|asr|" + "assoc|assq|at_exit|atan|atan2|auto_synchronize|background|basename|" + "beginning_of_input|big_int_of_int|big_int_of_num|big_int_of_string|bind|" + "bind_class|bind_tag|bits|bits_of_float|black|blit|blit_image|blue|bool|" + "bool_of_string|bounded_full_split|bounded_split|bounded_split_delim|" + "bprintf|break|broadcast|bscanf|button_down|c_layout|capitalize|cardinal|" + "cardinal|catch|catch_break|ceil|ceiling_num|channel|char|char_of_int|" + "chdir|check|check_suffix|chmod|choose|chop_extension|chop_suffix|chown|" + "chown|chr|chroot|classify_float|clear|clear_available_units|" + "clear_close_on_exec|clear_graph|clear_nonblock|clear_parser|" + "close|close|closeTk|close_box|close_graph|close_in|close_in_noerr|" + "close_out|close_out_noerr|close_process|close_process|" + "close_process_full|close_process_in|close_process_out|close_subwindow|" + "close_tag|close_tbox|closedir|closedir|closure_tag|code|combine|" + "combine|combine|command|compact|compare|compare_big_int|compare_num|" + "complex32|complex64|concat|conj|connect|contains|contains_from|contents|" + "copy|cos|cosh|count|count|counters|create|create_alarm|create_image|" + "create_matrix|create_matrix|create_matrix|create_object|" + "create_object_and_run_initializers|create_object_opt|create_process|" + "create_process|create_process_env|create_process_env|create_table|" + "current|current_dir_name|current_point|current_x|current_y|curveto|" + "custom_tag|cyan|data_size|decr|decr_num|default_available_units|delay|" + "delete_alarm|descr_of_in_channel|descr_of_out_channel|destroy|diff|dim|" + "dim1|dim2|dim3|dims|dirname|display_mode|div|div_big_int|div_num|" + "double_array_tag|double_tag|draw_arc|draw_char|draw_circle|draw_ellipse|" + "draw_image|draw_poly|draw_poly_line|draw_rect|draw_segments|draw_string|" + "dummy_pos|dummy_table|dump_image|dup|dup2|elements|empty|end_of_input|" + "environment|eprintf|epsilon_float|eq_big_int|eq_num|equal|err_formatter|" + "error_message|escaped|establish_server|executable_name|execv|execve|execvp|" + "execvpe|exists|exists2|exit|exp|failwith|fast_sort|fchmod|fchown|field|" + "file|file_exists|fill|fill_arc|fill_circle|fill_ellipse|fill_poly|fill_rect|" + "filter|final_tag|finalise|find|find_all|first_chars|firstkey|flatten|" + "float|float32|float64|float_of_big_int|float_of_bits|float_of_int|" + "float_of_num|float_of_string|floor|floor_num|flush|flush_all|flush_input|" + "flush_str_formatter|fold|fold_left|fold_left2|fold_right|fold_right2|" + "for_all|for_all2|force|force_newline|force_val|foreground|fork|" + "format_of_string|formatter_of_buffer|formatter_of_out_channel|" + "fortran_layout|forward_tag|fprintf|frexp|from|from_channel|from_file|" + "from_file_bin|from_function|from_string|fscanf|fst|fstat|ftruncate|" + "full_init|full_major|full_split|gcd_big_int|ge_big_int|ge_num|" + "genarray_of_array1|genarray_of_array2|genarray_of_array3|get|" + "get_all_formatter_output_functions|get_approx_printing|get_copy|" + "get_ellipsis_text|get_error_when_null_denominator|get_floating_precision|" + "get_formatter_output_functions|get_formatter_tag_functions|get_image|" + "get_margin|get_mark_tags|get_max_boxes|get_max_indent|get_method|" + "get_method_label|get_normalize_ratio|get_normalize_ratio_when_printing|" + "get_print_tags|get_state|get_variable|getcwd|getegid|getegid|getenv|" + "getenv|getenv|geteuid|geteuid|getgid|getgid|getgrgid|getgrgid|getgrnam|" + "getgrnam|getgroups|gethostbyaddr|gethostbyname|gethostname|getitimer|" + "getlogin|getpeername|getpid|getppid|getprotobyname|getprotobynumber|" + "getpwnam|getpwuid|getservbyname|getservbyport|getsockname|getsockopt|" + "getsockopt_float|getsockopt_int|getsockopt_optint|gettimeofday|getuid|" + "global_replace|global_substitute|gmtime|green|grid|group_beginning|" + "group_end|gt_big_int|gt_num|guard|handle_unix_error|hash|hash_param|" + "hd|header_size|i|id|ignore|in_channel_length|in_channel_of_descr|incr|" + "incr_num|index|index_from|inet_addr_any|inet_addr_of_string|infinity|" + "infix_tag|init|init_class|input|input_binary_int|input_byte|input_char|" + "input_line|input_value|int|int16_signed|int16_unsigned|int32|int64|" + "int8_signed|int8_unsigned|int_of_big_int|int_of_char|int_of_float|" + "int_of_num|int_of_string|integer_num|inter|interactive|inv|invalid_arg|" + "is_block|is_empty|is_implicit|is_int|is_int_big_int|is_integer_num|" + "is_relative|iter|iter2|iteri|join|junk|key_pressed|kill|kind|kprintf|" + "kscanf|land|last_chars|layout|lazy_from_fun|lazy_from_val|lazy_is_val|" + "lazy_tag|ldexp|le_big_int|le_num|length|lexeme|lexeme_char|lexeme_end|" + "lexeme_end_p|lexeme_start|lexeme_start_p|lineto|link|list|listen|lnot|" + "loadfile|loadfile_private|localtime|lock|lockf|log|log10|logand|lognot|" + "logor|logxor|lor|lower_window|lowercase|lseek|lsl|lsr|lstat|lt_big_int|" + "lt_num|lxor|magenta|magic|mainLoop|major|major_slice|make|make_formatter|" + "make_image|make_lexer|make_matrix|make_self_init|map|map2|map_file|mapi|" + "marshal|match_beginning|match_end|matched_group|matched_string|max|" + "max_array_length|max_big_int|max_elt|max_float|max_int|max_num|" + "max_string_length|mem|mem_assoc|mem_assq|memq|merge|min|min_big_int|" + "min_elt|min_float|min_int|min_num|minor|minus_big_int|minus_num|" + "minus_one|mkdir|mkfifo|mktime|mod|mod_big_int|mod_float|mod_num|modf|" + "mouse_pos|moveto|mul|mult_big_int|mult_int_big_int|mult_num|nan|narrow|" + "nat_of_num|nativeint|neg|neg_infinity|new_block|new_channel|new_method|" + "new_variable|next|nextkey|nice|nice|no_scan_tag|norm|norm2|not|npeek|" + "nth|nth_dim|num_digits_big_int|num_dims|num_of_big_int|num_of_int|" + "num_of_nat|num_of_ratio|num_of_string|O|obj|object_tag|ocaml_version|" + "of_array|of_channel|of_float|of_int|of_int32|of_list|of_nativeint|" + "of_string|one|openTk|open_box|open_connection|open_graph|open_hbox|" + "open_hovbox|open_hvbox|open_in|open_in_bin|open_in_gen|open_out|" + "open_out_bin|open_out_gen|open_process|open_process_full|open_process_in|" + "open_process_out|open_subwindow|open_tag|open_tbox|open_temp_file|" + "open_vbox|opendbm|opendir|openfile|or|os_type|out_channel_length|" + "out_channel_of_descr|output|output_binary_int|output_buffer|output_byte|" + "output_char|output_string|output_value|over_max_boxes|pack|params|" + "parent_dir_name|parse|parse_argv|partition|pause|peek|pipe|pixels|" + "place|plot|plots|point_color|polar|poll|pop|pos_in|pos_out|pow|" + "power_big_int_positive_big_int|power_big_int_positive_int|" + "power_int_positive_big_int|power_int_positive_int|power_num|" + "pp_close_box|pp_close_tag|pp_close_tbox|pp_force_newline|" + "pp_get_all_formatter_output_functions|pp_get_ellipsis_text|" + "pp_get_formatter_output_functions|pp_get_formatter_tag_functions|" + "pp_get_margin|pp_get_mark_tags|pp_get_max_boxes|pp_get_max_indent|" + "pp_get_print_tags|pp_open_box|pp_open_hbox|pp_open_hovbox|pp_open_hvbox|" + "pp_open_tag|pp_open_tbox|pp_open_vbox|pp_over_max_boxes|pp_print_as|" + "pp_print_bool|pp_print_break|pp_print_char|pp_print_cut|pp_print_float|" + "pp_print_flush|pp_print_if_newline|pp_print_int|pp_print_newline|" + "pp_print_space|pp_print_string|pp_print_tab|pp_print_tbreak|" + "pp_set_all_formatter_output_functions|pp_set_ellipsis_text|" + "pp_set_formatter_out_channel|pp_set_formatter_output_functions|" + "pp_set_formatter_tag_functions|pp_set_margin|pp_set_mark_tags|" + "pp_set_max_boxes|pp_set_max_indent|pp_set_print_tags|pp_set_tab|" + "pp_set_tags|pred|pred_big_int|pred_num|prerr_char|prerr_endline|" + "prerr_float|prerr_int|prerr_newline|prerr_string|print|print_as|" + "print_bool|print_break|print_char|print_cut|print_endline|print_float|" + "print_flush|print_if_newline|print_int|print_newline|print_space|" + "print_stat|print_string|print_tab|print_tbreak|printf|prohibit|" + "public_method_label|push|putenv|quo_num|quomod_big_int|quote|raise|" + "raise_window|ratio_of_num|rcontains_from|read|read_float|read_int|" + "read_key|read_line|readdir|readdir|readlink|really_input|receive|recv|" + "recvfrom|red|ref|regexp|regexp_case_fold|regexp_string|" + "regexp_string_case_fold|register|register_exception|rem|remember_mode|" + "remove|remove_assoc|remove_assq|rename|replace|replace_first|" + "replace_matched|repr|reset|reshape|reshape_1|reshape_2|reshape_3|rev|" + "rev_append|rev_map|rev_map2|rewinddir|rgb|rhs_end|rhs_end_pos|rhs_start|" + "rhs_start_pos|rindex|rindex_from|rlineto|rmdir|rmoveto|round_num|" + "run_initializers|run_initializers_opt|scanf|search_backward|" + "search_forward|seek_in|seek_out|select|self|self_init|send|sendto|set|" + "set_all_formatter_output_functions|set_approx_printing|" + "set_binary_mode_in|set_binary_mode_out|set_close_on_exec|" + "set_close_on_exec|set_color|set_ellipsis_text|" + "set_error_when_null_denominator|set_field|set_floating_precision|" + "set_font|set_formatter_out_channel|set_formatter_output_functions|" + "set_formatter_tag_functions|set_line_width|set_margin|set_mark_tags|" + "set_max_boxes|set_max_indent|set_method|set_nonblock|set_nonblock|" + "set_normalize_ratio|set_normalize_ratio_when_printing|set_print_tags|" + "set_signal|set_state|set_tab|set_tag|set_tags|set_text_size|" + "set_window_title|setgid|setgid|setitimer|setitimer|setsid|setsid|" + "setsockopt|setsockopt|setsockopt_float|setsockopt_float|setsockopt_int|" + "setsockopt_int|setsockopt_optint|setsockopt_optint|setuid|setuid|" + "shift_left|shift_left|shift_left|shift_right|shift_right|shift_right|" + "shift_right_logical|shift_right_logical|shift_right_logical|show_buckets|" + "shutdown|shutdown|shutdown_connection|shutdown_connection|sigabrt|" + "sigalrm|sigchld|sigcont|sigfpe|sighup|sigill|sigint|sigkill|sign_big_int|" + "sign_num|signal|signal|sigpending|sigpending|sigpipe|sigprocmask|" + "sigprocmask|sigprof|sigquit|sigsegv|sigstop|sigsuspend|sigsuspend|" + "sigterm|sigtstp|sigttin|sigttou|sigusr1|sigusr2|sigvtalrm|sin|singleton|" + "sinh|size|size|size_x|size_y|sleep|sleep|sleep|slice_left|slice_left|" + "slice_left_1|slice_left_2|slice_right|slice_right|slice_right_1|" + "slice_right_2|snd|socket|socket|socket|socketpair|socketpair|sort|sound|" + "split|split_delim|sprintf|sprintf|sqrt|sqrt|sqrt_big_int|square_big_int|" + "square_num|sscanf|stable_sort|stable_sort|stable_sort|stable_sort|stable_sort|" + "stable_sort|stat|stat|stat|stat|stat|stats|stats|std_formatter|stdbuf|" + "stderr|stderr|stderr|stdib|stdin|stdin|stdin|stdout|stdout|stdout|" + "str_formatter|string|string_after|string_before|string_match|" + "string_of_big_int|string_of_bool|string_of_float|string_of_format|" + "string_of_inet_addr|string_of_inet_addr|string_of_int|string_of_num|" + "string_partial_match|string_tag|sub|sub|sub_big_int|sub_left|sub_num|" + "sub_right|subset|subset|substitute_first|substring|succ|succ|" + "succ|succ|succ_big_int|succ_num|symbol_end|symbol_end_pos|symbol_start|" + "symbol_start_pos|symlink|symlink|sync|synchronize|system|system|system|" + "tag|take|tan|tanh|tcdrain|tcdrain|tcflow|tcflow|tcflush|tcflush|" + "tcgetattr|tcgetattr|tcsendbreak|tcsendbreak|tcsetattr|tcsetattr|" + "temp_file|text_size|time|time|time|timed_read|timed_write|times|times|" + "tl|tl|tl|to_buffer|to_channel|to_float|to_hex|to_int|to_int32|to_list|" + "to_list|to_list|to_nativeint|to_string|to_string|to_string|to_string|" + "to_string|top|top|total_size|transfer|transp|truncate|truncate|truncate|" + "truncate|truncate|truncate|try_lock|umask|umask|uncapitalize|uncapitalize|" + "uncapitalize|union|union|unit_big_int|unlink|unlink|unlock|unmarshal|" + "unsafe_blit|unsafe_fill|unsafe_get|unsafe_get|unsafe_set|unsafe_set|" + "update|uppercase|uppercase|uppercase|uppercase|usage|utimes|utimes|wait|" + "wait|wait|wait|wait_next_event|wait_pid|wait_read|wait_signal|" + "wait_timed_read|wait_timed_write|wait_write|waitpid|white|" + "widen|window_id|word_size|wrap|wrap_abort|write|yellow|yield|zero|zero_big_int|" + "Arg|Arith_status|Array|Array1|Array2|Array3|ArrayLabels|Big_int|Bigarray|" + "Buffer|Callback|CamlinternalOO|Char|Complex|Condition|Dbm|Digest|Dynlink|" + "Event|Filename|Format|Gc|Genarray|Genlex|Graphics|GraphicsX11|Hashtbl|" + "Int32|Int64|LargeFile|Lazy|Lexing|List|ListLabels|Make|Map|Marshal|" + "MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|" + "Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" + "Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak" ); var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": keywords, "constant.language": builtinConstants, "support.function": builtinFunctions }, "identifier"); var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; var octInteger = "(?:0[oO]?[0-7]+)"; var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; var binInteger = "(?:0[bB][01]+)"; var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")"; var exponent = "(?:[eE][+-]?\\d+)"; var fraction = "(?:\\.\\d+)"; var intPart = "(?:\\d+)"; var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")"; var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; this.$rules = { "start" : [ { token : "comment", regex : '\\(\\*.*?\\*\\)\\s*?$' }, { token : "comment", regex : '\\(\\*.*', next : "comment" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single char regex : "'.'" }, { token : "string", // " string regex : '"', next : "qstring" }, { token : "constant.numeric", // imaginary regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b" }, { token : "constant.numeric", // float regex : floatNumber }, { token : "constant.numeric", // integer regex : integer + "\\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+" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\)", next : "start" }, { defaultToken : "comment" } ], "qstring" : [ { token : "string", regex : '"', next : "start" }, { token : "string", regex : '.+' } ] }; }; oop.inherits(OcamlHighlightRules, TextHighlightRules); exports.OcamlHighlightRules = OcamlHighlightRules; ================================================ FILE: src/mode/odin.js ================================================ var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var OdinHighlightRules = require("./odin_highlight_rules").OdinHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { this.HighlightRules = OdinHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; 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; }; //end getNextLineIndent 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/odin"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/odin_highlight_rules.js ================================================ var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var OdinHighlightRules = function () { var keywords = "using|transmute|cast|distinct|opaque|where|" + "struct|enum|union|bit_field|bit_set|" + "if|when|else|do|switch|case|break|fallthrough|" + "size_of|offset_of|type_info_if|typeid_of|type_of|align_of|" + "or_return|or_else|inline|no_inline|" + "import|package|foreign|defer|auto_cast|map|matrix|proc|" + "for|continue|not_in|in"; const cartesian = (...a) => a .reduce((a, b) => a.flatMap((d) => b.map((e) => [d, e].flat()))) .map((parts) => parts.join("")); var builtinTypes = [ "int", "uint", "uintptr", "typeid", "rawptr", "string", "cstring", "i8", "u8", "any", "byte", "rune", "bool", "b8", "b16", "b32", "b64", ...cartesian(["i", "u"], ["16", "32", "64", "128"], ["", "le", "be"]), ...cartesian(["f"], ["16", "32", "64"], ["", "le", "be"]), ...cartesian(["complex"], ["32", "64", "128"]), ...cartesian(["quaternion"], ["64", "128", "256"]) ].join("|"); var operators = [ "\\*", "/", "%", "%%", "<<", ">>", "&", "&~", "\\+", "\\-", "~", "\\|", ">", "<", "<=", ">=", "==", "!=" ] .concat(":") .map((operator) => operator + "=") .concat("=", ":=", "::", "->", "\\^", "&", ":") .join("|"); var builtinFunctions = "new|cap|copy|panic|len|make|delete|append|free"; var builtinConstants = "nil|true|false"; var keywordMapper = this.createKeywordMapper( { keyword: keywords, "constant.language": builtinConstants, "support.function": builtinFunctions, "support.type": builtinTypes }, "" ); var stringEscapeRe = "\\\\(?:[0-7]{3}|x\\h{2}|u{4}|U\\h{6}|[abfnrtv'\"\\\\])".replace( /\\h/g, "[a-fA-F\\d]" ); this.$rules = { start: [ { token: "comment", regex: /\/\/.*$/ }, DocCommentHighlightRules.getStartRule("doc-start"), { token: "comment.start", // multi line comment regex: "\\/\\*", next: "comment" }, { token: "string", // single line regex: /"(?:[^"\\]|\\.)*?"/ }, { token: "string", // raw regex: "`", next: "bqstring" }, { token: "support.constant", regex: /#[a-z_]+/ }, { token: "constant.numeric", // rune regex: "'(?:[^\\'\uD800-\uDBFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|" + stringEscapeRe.replace('"', "") + ")'" }, { token: "constant.numeric", // hex regex: "0[xX][0-9a-fA-F]+\\b" }, { token: "constant.numeric", // float regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token: [ "entity.name.function", "text", "keyword.operator", "text", "keyword" ], regex: "([a-zA-Z_$][a-zA-Z0-9_$]*)(\\s+)(::)(\\s+)(proc)\\b" }, { token: function (val) { if (val[val.length - 1] == "(") { return [ { type: keywordMapper(val.slice(0, -1)) || "support.function", value: val.slice(0, -1) }, { type: "paren.lparen", value: val.slice(-1) } ]; } return keywordMapper(val) || "identifier"; }, regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b\\(?" }, { token: "keyword.operator", regex: operators }, { token: "punctuation.operator", regex: "\\?|\\,|\\;|\\." }, { token: "paren.lparen", regex: "[[({]" }, { token: "paren.rparen", regex: "[\\])}]" }, { token: "text", regex: "\\s+" } ], comment: [ { token: "comment.end", regex: "\\*\\/", next: "start" }, { defaultToken: "comment" } ], bqstring: [ { token: "string", regex: "`", next: "start" }, { defaultToken: "string" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; oop.inherits(OdinHighlightRules, TextHighlightRules); exports.OdinHighlightRules = OdinHighlightRules; ================================================ FILE: src/mode/odin_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var OdinMode = require("./odin").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new OdinMode(); }, "test: indent after opening function": function() { assert.equal(" ", this.mode.getNextLineIndent("start", "main :: proc() {", " ")); }, "test: indent after opening block": function() { assert.equal(" ", this.mode.getNextLineIndent("start", "{", " ")); }, "test: indent after opening array": function() { assert.equal(" ", this.mode.getNextLineIndent("start", "foo := [", " ")); }, "test: indent after opening parentheses": function() { assert.equal(" ", this.mode.getNextLineIndent("start", "foo := (", " ")); }, "test: indent after case:": function() { assert.equal(" ", this.mode.getNextLineIndent("start", "case bar:", " ")); }, "test: auto outdent should indent the line with the same indent as the line with the matching opening brace" : function() { var session = new EditSession([" main :: proc() {", " bla", " }"], this.mode); this.mode.autoOutdent("start", session, 2); assert.equal(" }", session.getLine(2)); }, "test: no auto outdent if no matching brace is found" : function() { var session = new EditSession([" main :: proc()", " bla", " }"], this.mode); this.mode.autoOutdent("start", session, 2); assert.equal(" }", session.getLine(2)); } }; require("../test/run")(module); ================================================ FILE: src/mode/partiql.js ================================================ /* THIS FILE WAS GENERATED BY 'ligand' USING 'mode.js' */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HighlightRules = require("./partiql_highlight_rules").PartiqlHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { this.HighlightRules = HighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function () { this.lineCommentStart = "--"; this.blockComment = { start: "/*", end: "*/", nestable: true }; this.getNextLineIndent = function (state, line, tab) { var indent = this.$getIndent(line); 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.$id = "ace/mode/partiql"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/partiql_highlight_rules.js ================================================ /* THIS FILE WAS GENERATED BY 'ligand' USING 'mode_highlight_rules.js' */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var IonHighlightRules = require("./ion_highlight_rules").IonHighlightRules; var PartiqlHighlightRules = function() { // constant.language.partiql var k_partiql_constant = "MISSING"; var k_sql_constant = "FALSE|NULL|TRUE"; var k_constant = k_partiql_constant + "|" + k_sql_constant; // keyword.other.partiql var k_partiql_keyword = "PIVOT|UNPIVOT|LIMIT|TUPLE|REMOVE|INDEX|CONFLICT|DO|NOTHING|RETURNING|" +"MODIFIED|NEW|OLD|LET"; var k_sql_keyword = "ABSOLUTE|ACTION|ADD|ALL|ALLOCATE|ALTER|AND|ANY|ARE|AS|" +"ASC|ASSERTION|AT|AUTHORIZATION|BEGIN|BETWEEN|BIT_LENGTH|BY|CASCADE|CASCADED|" +"CASE|CATALOG|CHAR|CHARACTER_LENGTH|CHAR_LENGTH|CHECK|CLOSE|COLLATE|COLLATION|COLUMN|" +"COMMIT|CONNECT|CONNECTION|CONSTRAINT|CONSTRAINTS|CONTINUE|CONVERT|CORRESPONDING|CREATE|CROSS|" +"CURRENT|CURSOR|DEALLOCATE|DEC|DECLARE|DEFAULT|DEFERRABLE|DEFERRED|DELETE|DESC|" +"DESCRIBE|DESCRIPTOR|DIAGNOSTICS|DISCONNECT|DISTINCT|DOMAIN|DROP|ELSE|END|END-EXEC|" +"ESCAPE|EXCEPT|EXCEPTION|EXEC|EXECUTE|EXTERNAL|EXTRACT|FETCH|FIRST|FOR|" +"FOREIGN|FOUND|FROM|FULL|GET|GLOBAL|GO|GOTO|GRANT|GROUP|" +"HAVING|IDENTITY|IMMEDIATE|IN|INDICATOR|INITIALLY|INNER|INPUT|INSENSITIVE|INSERT|" +"INTERSECT|INTERVAL|INTO|IS|ISOLATION|JOIN|KEY|LANGUAGE|LAST|LEFT|" +"LEVEL|LIKE|LOCAL|LOWER|MATCH|MODULE|NAMES|NATIONAL|NATURAL|NCHAR|" +"NEXT|NO|NOT|OCTET_LENGTH|OF|ON|ONLY|OPEN|OPTION|OR|" +"ORDER|OUTER|OUTPUT|OVERLAPS|PAD|PARTIAL|POSITION|PRECISION|PREPARE|PRESERVE|" +"PRIMARY|PRIOR|PRIVILEGES|PROCEDURE|PUBLIC|READ|REAL|REFERENCES|RELATIVE|RESTRICT|" +"REVOKE|RIGHT|ROLLBACK|ROWS|SCHEMA|SCROLL|SECTION|SELECT|SESSION|SET|" +"SIZE|SOME|SPACE|SQL|SQLCODE|SQLERROR|SQLSTATE|TABLE|TEMPORARY|THEN|" +"TIME|TO|TRANSACTION|TRANSLATE|TRANSLATION|UNION|UNIQUE|UNKNOWN|UPDATE|UPPER|" +"USAGE|USER|USING|VALUE|VALUES|VIEW|WHEN|WHENEVER|WHERE|WITH|" +"WORK|WRITE|ZONE"; var k_keyword = k_partiql_keyword + "|" + k_sql_keyword; // storage.type.partiql var k_partiql_type = "BOOL|BOOLEAN|STRING|SYMBOL|CLOB|BLOB|STRUCT|LIST|SEXP|BAG"; var k_sql_type = "CHARACTER|DATE|DECIMAL|DOUBLE|FLOAT|INT|INTEGER|NUMERIC|SMALLINT|TIMESTAMP|" +"VARCHAR|VARYING"; var k_type = k_partiql_type + "|" + k_sql_type; // support.function.aggregation.partiql var k_sql_aggfn = "AVG|COUNT|MAX|MIN|SUM"; var k_aggfn = k_sql_aggfn; // support.function.partiql var k_sql_fn = "CAST|COALESCE|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|EXISTS|DATE_ADD|DATE_DIFF|NULLIF|" +"SESSION_USER|SUBSTRING|SYSTEM_USER|TRIM"; var k_fn = k_sql_fn; var keywordMapper = this.createKeywordMapper({ "constant.language.partiql": k_constant, "keyword.other.partiql": k_keyword, "storage.type.partiql": k_type, "support.function.aggregation.partiql": k_aggfn, "support.function.partiql": k_fn }, "variable.language.identifier.partiql", true); var keywordMapperRule = { token : keywordMapper, regex : "\\b\\w+\\b" }; this.$rules = { "start": [ { "include": "whitespace" }, { "include": "comment" }, { "include": "value" } ], "value": [ { "include": "whitespace" }, { "include": "comment" }, { "include": "tuple_value" }, { "include": "collection_value" }, { "include": "scalar_value" } ], "scalar_value": [ { "include": "string" }, { "include": "number" }, { "include": "keywords" }, { "include": "identifier" }, { "include": "embed-ion" }, { "include": "operator" }, { "include": "punctuation" } ], "punctuation": [ { "token": "punctuation.partiql", "regex": "[;:()\\[\\]\\{\\},.]" } ], "operator": [ { "token": "keyword.operator.partiql", "regex": "[+*/<>=~!@#%&|?^-]+" } ], "identifier": [ { "token": "variable.language.identifier.quoted.partiql", "regex": "([\"])((?:(?:\\\\.)|(?:[^\"\\\\]))*?)([\"])" }, { "token": "variable.language.identifier.at.partiql", "regex": "@\\w+" }, { "token": "variable.language.identifier.partiql", "regex": "\\b\\w+(?:\\.\\w+)?\\b" } ], "number": [ { "token": "constant.numeric.partiql", "regex": "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" } ], "string": [ { "token": [ "punctuation.definition.string.begin.partiql", "string.quoted.single.partiql", "punctuation.definition.string.end.partiql" ], "regex": "(['])((?:(?:\\\\.)|(?:[^'\\\\]))*?)(['])" } ], "collection_value": [ { "include": "array_value" }, { "include": "bag_value" } ], "bag_value": [ { "token": "punctuation.definition.bag.begin.partiql", "regex": "<<", "push": [ { "token": "punctuation.definition.bag.end.partiql", "regex": ">>", "next": "pop" }, { "include": "comment" }, { "token": "punctuation.definition.bag.separator.partiql", "regex": "," }, { "include": "value" } ] } ], "comment": [ { "token": "comment.line.partiql", "regex": "--.*" }, { "token": "comment.block.partiql", "regex": "/\\*", "push": "comment__1" } ], "comment__1": [ { "token": "comment.block.partiql", "regex": "[*]/", "next": "pop" }, { "token": "comment.block.partiql", "regex": "[^*/]+" }, { "token": "comment.block.partiql", "regex": "/\\*", "push": "comment__1" }, { "token": "comment.block.partiql", "regex": "[*/]+" } ], "array_value": [ { "token": "punctuation.definition.array.begin.partiql", "regex": "\\[", "push": [ { "token": "punctuation.definition.array.end.partiql", "regex": "\\]", "next": "pop" }, { "include": "comment" }, { "token": "punctuation.definition.array.separator.partiql", "regex": "," }, { "include": "value" } ] } ], "tuple_value": [ { "token": "punctuation.definition.tuple.begin.partiql", "regex": "\\{", "push": [ { "token": "punctuation.definition.tuple.end.partiql", "regex": "\\}", "next": "pop" }, { "include": "comment" }, { "token": "punctuation.definition.tuple.separator.partiql", "regex": ",|:" }, { "include": "value" } ] } ], "whitespace": [ { "token": "text.partiql", "regex": "\\s+" } ] } ; this.$rules["keywords"] = [keywordMapperRule]; this.$rules["embed-ion"] = [{token : "punctuation.definition.ion.begin.partiql", regex : "`", next : "ion-start"}]; this.embedRules(IonHighlightRules, "ion-", [{token : "punctuation.definition.ion.end.partiql", regex : "`", next : "start"}]); this.normalizeRules(); }; oop.inherits(PartiqlHighlightRules, TextHighlightRules); exports.PartiqlHighlightRules = PartiqlHighlightRules; ================================================ FILE: src/mode/pascal.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = PascalHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ["--", "//"]; this.blockComment = [ {start: "(*", end: "*)"}, {start: "{", end: "}"} ]; this.$id = "ace/mode/pascal"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/pascal_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PascalHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "keyword.control": "absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class" + "|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization" + "|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is" + "|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private" + "|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr" + "|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor" }, "identifier", true); this.$rules = { start: [{ caseInsensitive: true, token: ['variable', "text", 'storage.type.prototype', 'entity.name.function.prototype' ], regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))' }, { caseInsensitive: true, token: ['variable', "text", 'storage.type.function', 'entity.name.function'], regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?' }, { caseInsensitive: true, token: keywordMapper, regex: /\b[a-z_]+\b/ }, { token: 'constant.numeric', 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|ll|LL|ull|ULL)?\\b' }, { token: 'punctuation.definition.comment', regex: '--.*$' }, { token: 'punctuation.definition.comment', regex: '//.*$' }, { token: 'punctuation.definition.comment', regex: '\\(\\*', push: [{ token: 'punctuation.definition.comment', regex: '\\*\\)', next: 'pop' }, { defaultToken: 'comment.block.one' } ] }, { token: 'punctuation.definition.comment', regex: '\\{', push: [{ token: 'punctuation.definition.comment', regex: '\\}', next: 'pop' }, { defaultToken: 'comment.block.two' } ] }, { token: 'punctuation.definition.string.begin', regex: '"', push: [{ token: 'constant.character.escape', regex: '\\\\.' }, { token: 'punctuation.definition.string.end', regex: '"', next: 'pop' }, { defaultToken: 'string.quoted.double' } ] //Double quoted strings are an extension and (generally) support C-style escape sequences. }, { token: 'punctuation.definition.string.begin', regex: '\'', push: [{ token: 'constant.character.escape.apostrophe', regex: '\'\'' }, { token: 'punctuation.definition.string.end', regex: '\'', next: 'pop' }, { defaultToken: 'string.quoted.single' } ] }, { token: 'keyword.operator', regex: '[+\\-;,/*%]|:=|=' } ] }; this.normalizeRules(); }; oop.inherits(PascalHighlightRules, TextHighlightRules); exports.PascalHighlightRules = PascalHighlightRules; ================================================ FILE: src/mode/perl.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = PerlHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"}); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.blockComment = [ {start: "=begin", end: "=cut", lineStartOnly: true}, {start: "=item", end: "=cut", lineStartOnly: true} ]; 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.$id = "ace/mode/perl"; this.snippetFileId = "ace/snippets/perl"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/perl_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PerlHighlightRules = function() { var keywords = ( "base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" + "no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars" ); var buildinConstants = ("ARGV|ENV|INC|SIG"); var builtinFunctions = ( "getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" + "gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" + "getpeername|setpriority|getprotoent|setprotoent|getpriority|" + "endprotoent|getservent|setservent|endservent|sethostent|socketpair|" + "getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|" + "localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|" + "closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|" + "shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|" + "dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|" + "setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|" + "lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|" + "waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|" + "chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|" + "unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|" + "length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|" + "undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|" + "sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|" + "BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|" + "join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" + "keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" + "eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" + "map|die|uc|lc|do" ); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "constant.language": buildinConstants, "support.function": builtinFunctions }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment.doc", regex : "^=(?:begin|item)\\b", next : "block_comment" }, { token : "string.regexp", regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // multi line string start regex : '["].*\\\\$', next : "qqstring" }, { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "string", // multi line string start regex : "['].*\\\\$", next : "qstring" }, { token : "constant.numeric", // hex regex : "0x[0-9a-fA-F]+\\b" }, { 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 : "%#|\\$#|\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)" }, { token : "comment", regex : "#.*$" }, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "qqstring" : [ { token : "string", regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', next : "start" }, { token : "string", regex : '.+' } ], "qstring" : [ { token : "string", regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next : "start" }, { token : "string", regex : '.+' } ], "block_comment": [ { token: "comment.doc", regex: "^=cut\\b", next: "start" }, { defaultToken: "comment.doc" } ] }; }; oop.inherits(PerlHighlightRules, TextHighlightRules); exports.PerlHighlightRules = PerlHighlightRules; ================================================ FILE: src/mode/pgsql.js ================================================ var oop = require("../lib/oop"); var TextMode = require("../mode/text").Mode; var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules; var Mode = function() { this.HighlightRules = PgsqlHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "/*", end: "*/"}; this.getNextLineIndent = function(state, line, tab) { if (state == "start" || state == "keyword.statementEnd") { return ""; } else { return this.$getIndent(line); // Keep whatever indent the previous line has } }; this.$id = "ace/mode/pgsql"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/pgsql_highlight_rules.js ================================================ var oop = require("../lib/oop"); var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; // Syntax highlighting for pl/languages and json. var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules; var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules; var JsonHighlightRules = require("./json_highlight_rules").JsonHighlightRules; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var PgsqlHighlightRules = function() { // Keywords, functions, operators last updated for pg 9.3. var keywords = ( "abort|absolute|abstime|access|aclitem|action|add|admin|after|aggregate|all|also|alter|always|" + "analyse|analyze|and|any|anyarray|anyelement|anyenum|anynonarray|anyrange|array|as|asc|" + "assertion|assignment|asymmetric|at|attribute|authorization|backward|before|begin|between|" + "bigint|binary|bit|bool|boolean|both|box|bpchar|by|bytea|cache|called|cascade|cascaded|case|cast|" + "catalog|chain|char|character|characteristics|check|checkpoint|cid|cidr|circle|class|close|" + "cluster|coalesce|collate|collation|column|comment|comments|commit|committed|concurrently|" + "configuration|connection|constraint|constraints|content|continue|conversion|copy|cost|" + "create|cross|cstring|csv|current|current_catalog|current_date|current_role|" + "current_schema|current_time|current_timestamp|current_user|cursor|cycle|data|database|" + "date|daterange|day|deallocate|dec|decimal|declare|default|defaults|deferrable|deferred|" + "definer|delete|delimiter|delimiters|desc|dictionary|disable|discard|distinct|do|document|" + "domain|double|drop|each|else|enable|encoding|encrypted|end|enum|escape|event|event_trigger|" + "except|exclude|excluding|exclusive|execute|exists|explain|extension|external|extract|false|" + "family|fdw_handler|fetch|first|float|float4|float8|following|for|force|foreign|forward|" + "freeze|from|full|function|functions|global|grant|granted|greatest|group|gtsvector|handler|" + "having|header|hold|hour|identity|if|ilike|immediate|immutable|implicit|in|including|" + "increment|index|indexes|inet|inherit|inherits|initially|inline|inner|inout|input|" + "insensitive|insert|instead|int|int2|int2vector|int4|int4range|int8|int8range|integer|" + "internal|intersect|interval|into|invoker|is|isnull|isolation|join|json|key|label|language|" + "language_handler|large|last|lateral|lc_collate|lc_ctype|leading|leakproof|least|left|level|" + "like|limit|line|listen|load|local|localtime|localtimestamp|location|lock|lseg|macaddr|" + "mapping|match|materialized|maxvalue|minute|minvalue|mode|money|month|move|name|names|" + "national|natural|nchar|next|no|none|not|nothing|notify|notnull|nowait|null|nullif|nulls|" + "numeric|numrange|object|of|off|offset|oid|oids|oidvector|on|only|opaque|operator|option|" + "options|or|order|out|outer|over|overlaps|overlay|owned|owner|parser|partial|partition|passing|" + "password|path|pg_attribute|pg_auth_members|pg_authid|pg_class|pg_database|pg_node_tree|" + "pg_proc|pg_type|placing|plans|point|polygon|position|preceding|precision|prepare|prepared|" + "preserve|primary|prior|privileges|procedural|procedure|program|quote|range|read|real|" + "reassign|recheck|record|recursive|ref|refcursor|references|refresh|regclass|regconfig|" + "regdictionary|regoper|regoperator|regproc|regprocedure|regtype|reindex|relative|release|" + "reltime|rename|repeatable|replace|replica|reset|restart|restrict|returning|returns|revoke|" + "right|role|rollback|row|rows|rule|savepoint|schema|scroll|search|second|security|select|" + "sequence|sequences|serializable|server|session|session_user|set|setof|share|show|similar|" + "simple|smallint|smgr|snapshot|some|stable|standalone|start|statement|statistics|stdin|" + "stdout|storage|strict|strip|substring|symmetric|sysid|system|table|tables|tablespace|temp|" + "template|temporary|text|then|tid|time|timestamp|timestamptz|timetz|tinterval|to|trailing|" + "transaction|treat|trigger|trim|true|truncate|trusted|tsquery|tsrange|tstzrange|tsvector|" + "txid_snapshot|type|types|unbounded|uncommitted|unencrypted|union|unique|unknown|unlisten|" + "unlogged|until|update|user|using|uuid|vacuum|valid|validate|validator|value|values|varbit|" + "varchar|variadic|varying|verbose|version|view|void|volatile|when|where|whitespace|window|" + "with|without|work|wrapper|write|xid|xml|xmlattributes|xmlconcat|xmlelement|xmlexists|" + "xmlforest|xmlparse|xmlpi|xmlroot|xmlserialize|year|yes|zone|ties" ); var builtinFunctions = ( "RI_FKey_cascade_del|RI_FKey_cascade_upd|RI_FKey_check_ins|RI_FKey_check_upd|" + "RI_FKey_noaction_del|RI_FKey_noaction_upd|RI_FKey_restrict_del|RI_FKey_restrict_upd|" + "RI_FKey_setdefault_del|RI_FKey_setdefault_upd|RI_FKey_setnull_del|" + "RI_FKey_setnull_upd|abbrev|abs|abstime|abstimeeq|abstimege|abstimegt|abstimein|abstimele|" + "abstimelt|abstimene|abstimeout|abstimerecv|abstimesend|aclcontains|acldefault|" + "aclexplode|aclinsert|aclitemeq|aclitemin|aclitemout|aclremove|acos|age|any_in|any_out|" + "anyarray_in|anyarray_out|anyarray_recv|anyarray_send|anyelement_in|anyelement_out|" + "anyenum_in|anyenum_out|anynonarray_in|anynonarray_out|anyrange_in|anyrange_out|" + "anytextcat|area|areajoinsel|areasel|array_agg|array_agg_finalfn|array_agg_transfn|" + "array_append|array_cat|array_dims|array_eq|array_fill|array_ge|array_gt|array_in|" + "array_larger|array_le|array_length|array_lower|array_lt|array_ndims|array_ne|array_out|" + "array_prepend|array_recv|array_remove|array_replace|array_send|array_smaller|" + "array_to_json|array_to_string|array_typanalyze|array_upper|arraycontained|" + "arraycontains|arraycontjoinsel|arraycontsel|arrayoverlap|ascii|ascii_to_mic|" + "ascii_to_utf8|asin|atan|atan2|avg|big5_to_euc_tw|big5_to_mic|big5_to_utf8|bit_and|bit_in|" + "bit_length|bit_or|bit_out|bit_recv|bit_send|bitand|bitcat|bitcmp|biteq|bitge|bitgt|bitle|" + "bitlt|bitne|bitnot|bitor|bitshiftleft|bitshiftright|bittypmodin|bittypmodout|bitxor|bool|" + "bool_and|bool_or|booland_statefunc|booleq|boolge|boolgt|boolin|boolle|boollt|boolne|" + "boolor_statefunc|boolout|boolrecv|boolsend|box|box_above|box_above_eq|box_add|box_below|" + "box_below_eq|box_center|box_contain|box_contain_pt|box_contained|box_distance|box_div|" + "box_eq|box_ge|box_gt|box_in|box_intersect|box_le|box_left|box_lt|box_mul|box_out|" + "box_overabove|box_overbelow|box_overlap|box_overleft|box_overright|box_recv|box_right|" + "box_same|box_send|box_sub|bpchar_larger|bpchar_pattern_ge|bpchar_pattern_gt|" + "bpchar_pattern_le|bpchar_pattern_lt|bpchar_smaller|bpcharcmp|bpchareq|bpcharge|" + "bpchargt|bpchariclike|bpcharicnlike|bpcharicregexeq|bpcharicregexne|bpcharin|bpcharle|" + "bpcharlike|bpcharlt|bpcharne|bpcharnlike|bpcharout|bpcharrecv|bpcharregexeq|" + "bpcharregexne|bpcharsend|bpchartypmodin|bpchartypmodout|broadcast|btabstimecmp|" + "btarraycmp|btbeginscan|btboolcmp|btbpchar_pattern_cmp|btbuild|btbuildempty|" + "btbulkdelete|btcanreturn|btcharcmp|btcostestimate|btendscan|btfloat48cmp|btfloat4cmp|" + "btfloat4sortsupport|btfloat84cmp|btfloat8cmp|btfloat8sortsupport|btgetbitmap|" + "btgettuple|btinsert|btint24cmp|btint28cmp|btint2cmp|btint2sortsupport|btint42cmp|" + "btint48cmp|btint4cmp|btint4sortsupport|btint82cmp|btint84cmp|btint8cmp|" + "btint8sortsupport|btmarkpos|btnamecmp|btnamesortsupport|btoidcmp|btoidsortsupport|" + "btoidvectorcmp|btoptions|btrecordcmp|btreltimecmp|btrescan|btrestrpos|btrim|" + "bttext_pattern_cmp|bttextcmp|bttidcmp|bttintervalcmp|btvacuumcleanup|" + "bytea_string_agg_finalfn|bytea_string_agg_transfn|byteacat|byteacmp|byteaeq|byteage|" + "byteagt|byteain|byteale|bytealike|bytealt|byteane|byteanlike|byteaout|bytearecv|byteasend|" + "cash_cmp|cash_div_cash|cash_div_flt4|cash_div_flt8|cash_div_int2|cash_div_int4|cash_eq|" + "cash_ge|cash_gt|cash_in|cash_le|cash_lt|cash_mi|cash_mul_flt4|cash_mul_flt8|" + "cash_mul_int2|cash_mul_int4|cash_ne|cash_out|cash_pl|cash_recv|cash_send|cash_words|" + "cashlarger|cashsmaller|cbrt|ceil|ceiling|center|char|char_length|character_length|chareq|" + "charge|chargt|charin|charle|charlt|charne|charout|charrecv|charsend|chr|cideq|cidin|cidout|" + "cidr|cidr_in|cidr_out|cidr_recv|cidr_send|cidrecv|cidsend|circle|circle_above|" + "circle_add_pt|circle_below|circle_center|circle_contain|circle_contain_pt|" + "circle_contained|circle_distance|circle_div_pt|circle_eq|circle_ge|circle_gt|circle_in|" + "circle_le|circle_left|circle_lt|circle_mul_pt|circle_ne|circle_out|circle_overabove|" + "circle_overbelow|circle_overlap|circle_overleft|circle_overright|circle_recv|" + "circle_right|circle_same|circle_send|circle_sub_pt|clock_timestamp|close_lb|close_ls|" + "close_lseg|close_pb|close_pl|close_ps|close_sb|close_sl|col_description|concat|concat_ws|" + "contjoinsel|contsel|convert|convert_from|convert_to|corr|cos|cot|count|covar_pop|" + "covar_samp|cstring_in|cstring_out|cstring_recv|cstring_send|cume_dist|current_database|" + "current_query|current_schema|current_schemas|current_setting|current_user|currtid|" + "currtid2|currval|cursor_to_xml|cursor_to_xmlschema|database_to_xml|" + "database_to_xml_and_xmlschema|database_to_xmlschema|date|date_cmp|date_cmp_timestamp|" + "date_cmp_timestamptz|date_eq|date_eq_timestamp|date_eq_timestamptz|date_ge|" + "date_ge_timestamp|date_ge_timestamptz|date_gt|date_gt_timestamp|date_gt_timestamptz|" + "date_in|date_larger|date_le|date_le_timestamp|date_le_timestamptz|date_lt|" + "date_lt_timestamp|date_lt_timestamptz|date_mi|date_mi_interval|date_mii|date_ne|" + "date_ne_timestamp|date_ne_timestamptz|date_out|date_part|date_pl_interval|date_pli|" + "date_recv|date_send|date_smaller|date_sortsupport|date_trunc|daterange|" + "daterange_canonical|daterange_subdiff|datetime_pl|datetimetz_pl|dcbrt|decode|degrees|" + "dense_rank|dexp|diagonal|diameter|dispell_init|dispell_lexize|dist_cpoly|dist_lb|dist_pb|" + "dist_pc|dist_pl|dist_ppath|dist_ps|dist_sb|dist_sl|div|dlog1|dlog10|domain_in|domain_recv|" + "dpow|dround|dsimple_init|dsimple_lexize|dsnowball_init|dsnowball_lexize|dsqrt|" + "dsynonym_init|dsynonym_lexize|dtrunc|elem_contained_by_range|encode|enum_cmp|enum_eq|" + "enum_first|enum_ge|enum_gt|enum_in|enum_larger|enum_last|enum_le|enum_lt|enum_ne|enum_out|" + "enum_range|enum_recv|enum_send|enum_smaller|eqjoinsel|eqsel|euc_cn_to_mic|" + "euc_cn_to_utf8|euc_jis_2004_to_shift_jis_2004|euc_jis_2004_to_utf8|euc_jp_to_mic|" + "euc_jp_to_sjis|euc_jp_to_utf8|euc_kr_to_mic|euc_kr_to_utf8|euc_tw_to_big5|" + "euc_tw_to_mic|euc_tw_to_utf8|event_trigger_in|event_trigger_out|every|exp|factorial|" + "family|fdw_handler_in|fdw_handler_out|first_value|float4|float48div|float48eq|float48ge|" + "float48gt|float48le|float48lt|float48mi|float48mul|float48ne|float48pl|float4_accum|" + "float4abs|float4div|float4eq|float4ge|float4gt|float4in|float4larger|float4le|float4lt|" + "float4mi|float4mul|float4ne|float4out|float4pl|float4recv|float4send|float4smaller|" + "float4um|float4up|float8|float84div|float84eq|float84ge|float84gt|float84le|float84lt|" + "float84mi|float84mul|float84ne|float84pl|float8_accum|float8_avg|float8_corr|" + "float8_covar_pop|float8_covar_samp|float8_regr_accum|float8_regr_avgx|" + "float8_regr_avgy|float8_regr_intercept|float8_regr_r2|float8_regr_slope|" + "float8_regr_sxx|float8_regr_sxy|float8_regr_syy|float8_stddev_pop|float8_stddev_samp|" + "float8_var_pop|float8_var_samp|float8abs|float8div|float8eq|float8ge|float8gt|float8in|" + "float8larger|float8le|float8lt|float8mi|float8mul|float8ne|float8out|float8pl|float8recv|" + "float8send|float8smaller|float8um|float8up|floor|flt4_mul_cash|flt8_mul_cash|" + "fmgr_c_validator|fmgr_internal_validator|fmgr_sql_validator|format|format_type|" + "gb18030_to_utf8|gbk_to_utf8|generate_series|generate_subscripts|get_bit|get_byte|" + "get_current_ts_config|getdatabaseencoding|getpgusername|gin_cmp_prefix|" + "gin_cmp_tslexeme|gin_extract_tsquery|gin_extract_tsvector|gin_tsquery_consistent|" + "ginarrayconsistent|ginarrayextract|ginbeginscan|ginbuild|ginbuildempty|ginbulkdelete|" + "gincostestimate|ginendscan|gingetbitmap|gininsert|ginmarkpos|ginoptions|" + "ginqueryarrayextract|ginrescan|ginrestrpos|ginvacuumcleanup|gist_box_compress|" + "gist_box_consistent|gist_box_decompress|gist_box_penalty|gist_box_picksplit|" + "gist_box_same|gist_box_union|gist_circle_compress|gist_circle_consistent|" + "gist_point_compress|gist_point_consistent|gist_point_distance|gist_poly_compress|" + "gist_poly_consistent|gistbeginscan|gistbuild|gistbuildempty|gistbulkdelete|" + "gistcostestimate|gistendscan|gistgetbitmap|gistgettuple|gistinsert|gistmarkpos|" + "gistoptions|gistrescan|gistrestrpos|gistvacuumcleanup|gtsquery_compress|" + "gtsquery_consistent|gtsquery_decompress|gtsquery_penalty|gtsquery_picksplit|" + "gtsquery_same|gtsquery_union|gtsvector_compress|gtsvector_consistent|" + "gtsvector_decompress|gtsvector_penalty|gtsvector_picksplit|gtsvector_same|" + "gtsvector_union|gtsvectorin|gtsvectorout|has_any_column_privilege|" + "has_column_privilege|has_database_privilege|has_foreign_data_wrapper_privilege|" + "has_function_privilege|has_language_privilege|has_schema_privilege|" + "has_sequence_privilege|has_server_privilege|has_table_privilege|" + "has_tablespace_privilege|has_type_privilege|hash_aclitem|hash_array|hash_numeric|" + "hash_range|hashbeginscan|hashbpchar|hashbuild|hashbuildempty|hashbulkdelete|hashchar|" + "hashcostestimate|hashendscan|hashenum|hashfloat4|hashfloat8|hashgetbitmap|hashgettuple|" + "hashinet|hashinsert|hashint2|hashint2vector|hashint4|hashint8|hashmacaddr|hashmarkpos|" + "hashname|hashoid|hashoidvector|hashoptions|hashrescan|hashrestrpos|hashtext|" + "hashvacuumcleanup|hashvarlena|height|host|hostmask|iclikejoinsel|iclikesel|" + "icnlikejoinsel|icnlikesel|icregexeqjoinsel|icregexeqsel|icregexnejoinsel|icregexnesel|" + "inet_client_addr|inet_client_port|inet_in|inet_out|inet_recv|inet_send|" + "inet_server_addr|inet_server_port|inetand|inetmi|inetmi_int8|inetnot|inetor|inetpl|" + "initcap|int2|int24div|int24eq|int24ge|int24gt|int24le|int24lt|int24mi|int24mul|int24ne|" + "int24pl|int28div|int28eq|int28ge|int28gt|int28le|int28lt|int28mi|int28mul|int28ne|int28pl|" + "int2_accum|int2_avg_accum|int2_mul_cash|int2_sum|int2abs|int2and|int2div|int2eq|int2ge|" + "int2gt|int2in|int2larger|int2le|int2lt|int2mi|int2mod|int2mul|int2ne|int2not|int2or|int2out|" + "int2pl|int2recv|int2send|int2shl|int2shr|int2smaller|int2um|int2up|int2vectoreq|" + "int2vectorin|int2vectorout|int2vectorrecv|int2vectorsend|int2xor|int4|int42div|int42eq|" + "int42ge|int42gt|int42le|int42lt|int42mi|int42mul|int42ne|int42pl|int48div|int48eq|int48ge|" + "int48gt|int48le|int48lt|int48mi|int48mul|int48ne|int48pl|int4_accum|int4_avg_accum|" + "int4_mul_cash|int4_sum|int4abs|int4and|int4div|int4eq|int4ge|int4gt|int4in|int4inc|" + "int4larger|int4le|int4lt|int4mi|int4mod|int4mul|int4ne|int4not|int4or|int4out|int4pl|" + "int4range|int4range_canonical|int4range_subdiff|int4recv|int4send|int4shl|int4shr|" + "int4smaller|int4um|int4up|int4xor|int8|int82div|int82eq|int82ge|int82gt|int82le|int82lt|" + "int82mi|int82mul|int82ne|int82pl|int84div|int84eq|int84ge|int84gt|int84le|int84lt|int84mi|" + "int84mul|int84ne|int84pl|int8_accum|int8_avg|int8_avg_accum|int8_sum|int8abs|int8and|" + "int8div|int8eq|int8ge|int8gt|int8in|int8inc|int8inc_any|int8inc_float8_float8|int8larger|" + "int8le|int8lt|int8mi|int8mod|int8mul|int8ne|int8not|int8or|int8out|int8pl|int8pl_inet|" + "int8range|int8range_canonical|int8range_subdiff|int8recv|int8send|int8shl|int8shr|" + "int8smaller|int8um|int8up|int8xor|integer_pl_date|inter_lb|inter_sb|inter_sl|internal_in|" + "internal_out|interval_accum|interval_avg|interval_cmp|interval_div|interval_eq|" + "interval_ge|interval_gt|interval_hash|interval_in|interval_larger|interval_le|" + "interval_lt|interval_mi|interval_mul|interval_ne|interval_out|interval_pl|" + "interval_pl_date|interval_pl_time|interval_pl_timestamp|interval_pl_timestamptz|" + "interval_pl_timetz|interval_recv|interval_send|interval_smaller|interval_transform|" + "interval_um|intervaltypmodin|intervaltypmodout|intinterval|isclosed|isempty|isfinite|" + "ishorizontal|iso8859_1_to_utf8|iso8859_to_utf8|iso_to_koi8r|iso_to_mic|iso_to_win1251|" + "iso_to_win866|isopen|isparallel|isperp|isvertical|johab_to_utf8|json_agg|" + "json_agg_finalfn|json_agg_transfn|json_array_element|json_array_element_text|" + "json_array_elements|json_array_length|json_each|json_each_text|json_extract_path|" + "json_extract_path_op|json_extract_path_text|json_extract_path_text_op|json_in|" + "json_object_field|json_object_field_text|json_object_keys|json_out|" + "json_populate_record|json_populate_recordset|json_recv|json_send|justify_days|" + "justify_hours|justify_interval|koi8r_to_iso|koi8r_to_mic|koi8r_to_utf8|" + "koi8r_to_win1251|koi8r_to_win866|koi8u_to_utf8|lag|language_handler_in|" + "language_handler_out|last_value|lastval|latin1_to_mic|latin2_to_mic|latin2_to_win1250|" + "latin3_to_mic|latin4_to_mic|lead|left|length|like|like_escape|likejoinsel|likesel|line|" + "line_distance|line_eq|line_horizontal|line_in|line_interpt|line_intersect|line_out|" + "line_parallel|line_perp|line_recv|line_send|line_vertical|ln|lo_close|lo_creat|lo_create|" + "lo_export|lo_import|lo_lseek|lo_lseek64|lo_open|lo_tell|lo_tell64|lo_truncate|" + "lo_truncate64|lo_unlink|log|loread|lower|lower_inc|lower_inf|lowrite|lpad|lseg|lseg_center|" + "lseg_distance|lseg_eq|lseg_ge|lseg_gt|lseg_horizontal|lseg_in|lseg_interpt|" + "lseg_intersect|lseg_le|lseg_length|lseg_lt|lseg_ne|lseg_out|lseg_parallel|lseg_perp|" + "lseg_recv|lseg_send|lseg_vertical|ltrim|macaddr_and|macaddr_cmp|macaddr_eq|macaddr_ge|" + "macaddr_gt|macaddr_in|macaddr_le|macaddr_lt|macaddr_ne|macaddr_not|macaddr_or|" + "macaddr_out|macaddr_recv|macaddr_send|makeaclitem|masklen|max|md5|mic_to_ascii|" + "mic_to_big5|mic_to_euc_cn|mic_to_euc_jp|mic_to_euc_kr|mic_to_euc_tw|mic_to_iso|" + "mic_to_koi8r|mic_to_latin1|mic_to_latin2|mic_to_latin3|mic_to_latin4|mic_to_sjis|" + "mic_to_win1250|mic_to_win1251|mic_to_win866|min|mktinterval|mod|money|mul_d_interval|" + "name|nameeq|namege|namegt|nameiclike|nameicnlike|nameicregexeq|nameicregexne|namein|" + "namele|namelike|namelt|namene|namenlike|nameout|namerecv|nameregexeq|nameregexne|namesend|" + "neqjoinsel|neqsel|netmask|network|network_cmp|network_eq|network_ge|network_gt|" + "network_le|network_lt|network_ne|network_sub|network_subeq|network_sup|network_supeq|" + "nextval|nlikejoinsel|nlikesel|notlike|now|npoints|nth_value|ntile|numeric_abs|" + "numeric_accum|numeric_add|numeric_avg|numeric_avg_accum|numeric_cmp|numeric_div|" + "numeric_div_trunc|numeric_eq|numeric_exp|numeric_fac|numeric_ge|numeric_gt|numeric_in|" + "numeric_inc|numeric_larger|numeric_le|numeric_ln|numeric_log|numeric_lt|numeric_mod|" + "numeric_mul|numeric_ne|numeric_out|numeric_power|numeric_recv|numeric_send|" + "numeric_smaller|numeric_sqrt|numeric_stddev_pop|numeric_stddev_samp|numeric_sub|" + "numeric_transform|numeric_uminus|numeric_uplus|numeric_var_pop|numeric_var_samp|" + "numerictypmodin|numerictypmodout|numnode|numrange|numrange_subdiff|obj_description|" + "octet_length|oid|oideq|oidge|oidgt|oidin|oidlarger|oidle|oidlt|oidne|oidout|oidrecv|oidsend|" + "oidsmaller|oidvectoreq|oidvectorge|oidvectorgt|oidvectorin|oidvectorle|oidvectorlt|" + "oidvectorne|oidvectorout|oidvectorrecv|oidvectorsend|oidvectortypes|on_pb|on_pl|" + "on_ppath|on_ps|on_sb|on_sl|opaque_in|opaque_out|overlaps|overlay|path|path_add|path_add_pt|" + "path_center|path_contain_pt|path_distance|path_div_pt|path_in|path_inter|path_length|" + "path_mul_pt|path_n_eq|path_n_ge|path_n_gt|path_n_le|path_n_lt|path_npoints|path_out|" + "path_recv|path_send|path_sub_pt|pclose|percent_rank|pg_advisory_lock|" + "pg_advisory_lock_shared|pg_advisory_unlock|pg_advisory_unlock_all|" + "pg_advisory_unlock_shared|pg_advisory_xact_lock|pg_advisory_xact_lock_shared|" + "pg_available_extension_versions|pg_available_extensions|pg_backend_pid|" + "pg_backup_start_time|pg_cancel_backend|pg_char_to_encoding|pg_client_encoding|" + "pg_collation_for|pg_collation_is_visible|pg_column_is_updatable|pg_column_size|" + "pg_conf_load_time|pg_conversion_is_visible|pg_create_restore_point|" + "pg_current_xlog_insert_location|pg_current_xlog_location|pg_cursor|pg_database_size|" + "pg_describe_object|pg_encoding_max_length|pg_encoding_to_char|" + "pg_event_trigger_dropped_objects|pg_export_snapshot|pg_extension_config_dump|" + "pg_extension_update_paths|pg_function_is_visible|pg_get_constraintdef|pg_get_expr|" + "pg_get_function_arguments|pg_get_function_identity_arguments|" + "pg_get_function_result|pg_get_functiondef|pg_get_indexdef|pg_get_keywords|" + "pg_get_multixact_members|pg_get_ruledef|pg_get_serial_sequence|pg_get_triggerdef|" + "pg_get_userbyid|pg_get_viewdef|pg_has_role|pg_identify_object|pg_indexes_size|" + "pg_is_in_backup|pg_is_in_recovery|pg_is_other_temp_schema|pg_is_xlog_replay_paused|" + "pg_last_xact_replay_timestamp|pg_last_xlog_receive_location|" + "pg_last_xlog_replay_location|pg_listening_channels|pg_lock_status|pg_ls_dir|" + "pg_my_temp_schema|pg_node_tree_in|pg_node_tree_out|pg_node_tree_recv|" + "pg_node_tree_send|pg_notify|pg_opclass_is_visible|pg_operator_is_visible|" + "pg_opfamily_is_visible|pg_options_to_table|pg_postmaster_start_time|" + "pg_prepared_statement|pg_prepared_xact|pg_read_binary_file|pg_read_file|" + "pg_relation_filenode|pg_relation_filepath|pg_relation_is_updatable|pg_relation_size|" + "pg_reload_conf|pg_rotate_logfile|pg_sequence_parameters|pg_show_all_settings|" + "pg_size_pretty|pg_sleep|pg_start_backup|pg_stat_clear_snapshot|pg_stat_file|" + "pg_stat_get_activity|pg_stat_get_analyze_count|pg_stat_get_autoanalyze_count|" + "pg_stat_get_autovacuum_count|pg_stat_get_backend_activity|" + "pg_stat_get_backend_activity_start|pg_stat_get_backend_client_addr|" + "pg_stat_get_backend_client_port|pg_stat_get_backend_dbid|pg_stat_get_backend_idset|" + "pg_stat_get_backend_pid|pg_stat_get_backend_start|pg_stat_get_backend_userid|" + "pg_stat_get_backend_waiting|pg_stat_get_backend_xact_start|" + "pg_stat_get_bgwriter_buf_written_checkpoints|" + "pg_stat_get_bgwriter_buf_written_clean|pg_stat_get_bgwriter_maxwritten_clean|" + "pg_stat_get_bgwriter_requested_checkpoints|pg_stat_get_bgwriter_stat_reset_time|" + "pg_stat_get_bgwriter_timed_checkpoints|pg_stat_get_blocks_fetched|" + "pg_stat_get_blocks_hit|pg_stat_get_buf_alloc|pg_stat_get_buf_fsync_backend|" + "pg_stat_get_buf_written_backend|pg_stat_get_checkpoint_sync_time|" + "pg_stat_get_checkpoint_write_time|pg_stat_get_db_blk_read_time|" + "pg_stat_get_db_blk_write_time|pg_stat_get_db_blocks_fetched|" + "pg_stat_get_db_blocks_hit|pg_stat_get_db_conflict_all|" + "pg_stat_get_db_conflict_bufferpin|pg_stat_get_db_conflict_lock|" + "pg_stat_get_db_conflict_snapshot|pg_stat_get_db_conflict_startup_deadlock|" + "pg_stat_get_db_conflict_tablespace|pg_stat_get_db_deadlocks|" + "pg_stat_get_db_numbackends|pg_stat_get_db_stat_reset_time|" + "pg_stat_get_db_temp_bytes|pg_stat_get_db_temp_files|pg_stat_get_db_tuples_deleted|" + "pg_stat_get_db_tuples_fetched|pg_stat_get_db_tuples_inserted|" + "pg_stat_get_db_tuples_returned|pg_stat_get_db_tuples_updated|" + "pg_stat_get_db_xact_commit|pg_stat_get_db_xact_rollback|pg_stat_get_dead_tuples|" + "pg_stat_get_function_calls|pg_stat_get_function_self_time|" + "pg_stat_get_function_total_time|pg_stat_get_last_analyze_time|" + "pg_stat_get_last_autoanalyze_time|pg_stat_get_last_autovacuum_time|" + "pg_stat_get_last_vacuum_time|pg_stat_get_live_tuples|pg_stat_get_numscans|" + "pg_stat_get_tuples_deleted|pg_stat_get_tuples_fetched|" + "pg_stat_get_tuples_hot_updated|pg_stat_get_tuples_inserted|" + "pg_stat_get_tuples_returned|pg_stat_get_tuples_updated|pg_stat_get_vacuum_count|" + "pg_stat_get_wal_senders|pg_stat_get_xact_blocks_fetched|" + "pg_stat_get_xact_blocks_hit|pg_stat_get_xact_function_calls|" + "pg_stat_get_xact_function_self_time|pg_stat_get_xact_function_total_time|" + "pg_stat_get_xact_numscans|pg_stat_get_xact_tuples_deleted|" + "pg_stat_get_xact_tuples_fetched|pg_stat_get_xact_tuples_hot_updated|" + "pg_stat_get_xact_tuples_inserted|pg_stat_get_xact_tuples_returned|" + "pg_stat_get_xact_tuples_updated|pg_stat_reset|pg_stat_reset_shared|" + "pg_stat_reset_single_function_counters|pg_stat_reset_single_table_counters|" + "pg_stop_backup|pg_switch_xlog|pg_table_is_visible|pg_table_size|" + "pg_tablespace_databases|pg_tablespace_location|pg_tablespace_size|" + "pg_terminate_backend|pg_timezone_abbrevs|pg_timezone_names|pg_total_relation_size|" + "pg_trigger_depth|pg_try_advisory_lock|pg_try_advisory_lock_shared|" + "pg_try_advisory_xact_lock|pg_try_advisory_xact_lock_shared|pg_ts_config_is_visible|" + "pg_ts_dict_is_visible|pg_ts_parser_is_visible|pg_ts_template_is_visible|" + "pg_type_is_visible|pg_typeof|pg_xlog_location_diff|pg_xlog_replay_pause|" + "pg_xlog_replay_resume|pg_xlogfile_name|pg_xlogfile_name_offset|pi|plainto_tsquery|" + "plpgsql_call_handler|plpgsql_inline_handler|plpgsql_validator|point|point_above|" + "point_add|point_below|point_distance|point_div|point_eq|point_horiz|point_in|point_left|" + "point_mul|point_ne|point_out|point_recv|point_right|point_send|point_sub|point_vert|" + "poly_above|poly_below|poly_center|poly_contain|poly_contain_pt|poly_contained|" + "poly_distance|poly_in|poly_left|poly_npoints|poly_out|poly_overabove|poly_overbelow|" + "poly_overlap|poly_overleft|poly_overright|poly_recv|poly_right|poly_same|poly_send|" + "polygon|popen|position|positionjoinsel|positionsel|postgresql_fdw_validator|pow|power|" + "prsd_end|prsd_headline|prsd_lextype|prsd_nexttoken|prsd_start|pt_contained_circle|" + "pt_contained_poly|query_to_xml|query_to_xml_and_xmlschema|query_to_xmlschema|" + "querytree|quote_ident|quote_literal|quote_nullable|radians|radius|random|range_adjacent|" + "range_after|range_before|range_cmp|range_contained_by|range_contains|" + "range_contains_elem|range_eq|range_ge|range_gist_compress|range_gist_consistent|" + "range_gist_decompress|range_gist_penalty|range_gist_picksplit|range_gist_same|" + "range_gist_union|range_gt|range_in|range_intersect|range_le|range_lt|range_minus|" + "range_ne|range_out|range_overlaps|range_overleft|range_overright|range_recv|range_send|" + "range_typanalyze|range_union|rangesel|rank|record_eq|record_ge|record_gt|record_in|" + "record_le|record_lt|record_ne|record_out|record_recv|record_send|regclass|regclassin|" + "regclassout|regclassrecv|regclasssend|regconfigin|regconfigout|regconfigrecv|" + "regconfigsend|regdictionaryin|regdictionaryout|regdictionaryrecv|regdictionarysend|" + "regexeqjoinsel|regexeqsel|regexnejoinsel|regexnesel|regexp_matches|regexp_replace|" + "regexp_split_to_array|regexp_split_to_table|regoperatorin|regoperatorout|" + "regoperatorrecv|regoperatorsend|regoperin|regoperout|regoperrecv|regopersend|" + "regprocedurein|regprocedureout|regprocedurerecv|regproceduresend|regprocin|regprocout|" + "regprocrecv|regprocsend|regr_avgx|regr_avgy|regr_count|regr_intercept|regr_r2|" + "regr_slope|regr_sxx|regr_sxy|regr_syy|regtypein|regtypeout|regtyperecv|regtypesend|" + "reltime|reltimeeq|reltimege|reltimegt|reltimein|reltimele|reltimelt|reltimene|reltimeout|" + "reltimerecv|reltimesend|repeat|replace|reverse|right|round|row_number|row_to_json|rpad|" + "rtrim|scalargtjoinsel|scalargtsel|scalarltjoinsel|scalarltsel|schema_to_xml|" + "schema_to_xml_and_xmlschema|schema_to_xmlschema|session_user|set_bit|set_byte|" + "set_config|set_masklen|setseed|setval|setweight|shell_in|shell_out|" + "shift_jis_2004_to_euc_jis_2004|shift_jis_2004_to_utf8|shobj_description|sign|" + "similar_escape|sin|sjis_to_euc_jp|sjis_to_mic|sjis_to_utf8|slope|smgreq|smgrin|smgrne|" + "smgrout|spg_kd_choose|spg_kd_config|spg_kd_inner_consistent|spg_kd_picksplit|" + "spg_quad_choose|spg_quad_config|spg_quad_inner_consistent|spg_quad_leaf_consistent|" + "spg_quad_picksplit|spg_range_quad_choose|spg_range_quad_config|" + "spg_range_quad_inner_consistent|spg_range_quad_leaf_consistent|" + "spg_range_quad_picksplit|spg_text_choose|spg_text_config|spg_text_inner_consistent|" + "spg_text_leaf_consistent|spg_text_picksplit|spgbeginscan|spgbuild|spgbuildempty|" + "spgbulkdelete|spgcanreturn|spgcostestimate|spgendscan|spggetbitmap|spggettuple|" + "spginsert|spgmarkpos|spgoptions|spgrescan|spgrestrpos|spgvacuumcleanup|split_part|sqrt|" + "statement_timestamp|stddev|stddev_pop|stddev_samp|string_agg|string_agg_finalfn|" + "string_agg_transfn|string_to_array|strip|strpos|substr|substring|sum|" + "suppress_redundant_updates_trigger|table_to_xml|table_to_xml_and_xmlschema|" + "table_to_xmlschema|tan|text|text_ge|text_gt|text_larger|text_le|text_lt|text_pattern_ge|" + "text_pattern_gt|text_pattern_le|text_pattern_lt|text_smaller|textanycat|textcat|texteq|" + "texticlike|texticnlike|texticregexeq|texticregexne|textin|textlen|textlike|textne|" + "textnlike|textout|textrecv|textregexeq|textregexne|textsend|thesaurus_init|" + "thesaurus_lexize|tideq|tidge|tidgt|tidin|tidlarger|tidle|tidlt|tidne|tidout|tidrecv|tidsend|" + "tidsmaller|time_cmp|time_eq|time_ge|time_gt|time_hash|time_in|time_larger|time_le|time_lt|" + "time_mi_interval|time_mi_time|time_ne|time_out|time_pl_interval|time_recv|time_send|" + "time_smaller|time_transform|timedate_pl|timemi|timenow|timeofday|timepl|timestamp_cmp|" + "timestamp_cmp_date|timestamp_cmp_timestamptz|timestamp_eq|timestamp_eq_date|" + "timestamp_eq_timestamptz|timestamp_ge|timestamp_ge_date|timestamp_ge_timestamptz|" + "timestamp_gt|timestamp_gt_date|timestamp_gt_timestamptz|timestamp_hash|timestamp_in|" + "timestamp_larger|timestamp_le|timestamp_le_date|timestamp_le_timestamptz|" + "timestamp_lt|timestamp_lt_date|timestamp_lt_timestamptz|timestamp_mi|" + "timestamp_mi_interval|timestamp_ne|timestamp_ne_date|timestamp_ne_timestamptz|" + "timestamp_out|timestamp_pl_interval|timestamp_recv|timestamp_send|timestamp_smaller|" + "timestamp_sortsupport|timestamp_transform|timestamptypmodin|timestamptypmodout|" + "timestamptz_cmp|timestamptz_cmp_date|timestamptz_cmp_timestamp|timestamptz_eq|" + "timestamptz_eq_date|timestamptz_eq_timestamp|timestamptz_ge|timestamptz_ge_date|" + "timestamptz_ge_timestamp|timestamptz_gt|timestamptz_gt_date|" + "timestamptz_gt_timestamp|timestamptz_in|timestamptz_larger|timestamptz_le|" + "timestamptz_le_date|timestamptz_le_timestamp|timestamptz_lt|timestamptz_lt_date|" + "timestamptz_lt_timestamp|timestamptz_mi|timestamptz_mi_interval|timestamptz_ne|" + "timestamptz_ne_date|timestamptz_ne_timestamp|timestamptz_out|" + "timestamptz_pl_interval|timestamptz_recv|timestamptz_send|timestamptz_smaller|" + "timestamptztypmodin|timestamptztypmodout|timetypmodin|timetypmodout|timetz_cmp|" + "timetz_eq|timetz_ge|timetz_gt|timetz_hash|timetz_in|timetz_larger|timetz_le|timetz_lt|" + "timetz_mi_interval|timetz_ne|timetz_out|timetz_pl_interval|timetz_recv|timetz_send|" + "timetz_smaller|timetzdate_pl|timetztypmodin|timetztypmodout|timezone|tinterval|" + "tintervalct|tintervalend|tintervaleq|tintervalge|tintervalgt|tintervalin|tintervalle|" + "tintervalleneq|tintervallenge|tintervallengt|tintervallenle|tintervallenlt|" + "tintervallenne|tintervallt|tintervalne|tintervalout|tintervalov|tintervalrecv|" + "tintervalrel|tintervalsame|tintervalsend|tintervalstart|to_ascii|to_char|to_date|to_hex|" + "to_json|to_number|to_timestamp|to_tsquery|to_tsvector|transaction_timestamp|translate|" + "trigger_in|trigger_out|trunc|ts_debug|ts_headline|ts_lexize|ts_match_qv|ts_match_tq|" + "ts_match_tt|ts_match_vq|ts_parse|ts_rank|ts_rank_cd|ts_rewrite|ts_stat|ts_token_type|" + "ts_typanalyze|tsmatchjoinsel|tsmatchsel|tsq_mcontained|tsq_mcontains|tsquery_and|" + "tsquery_cmp|tsquery_eq|tsquery_ge|tsquery_gt|tsquery_le|tsquery_lt|tsquery_ne|" + "tsquery_not|tsquery_or|tsqueryin|tsqueryout|tsqueryrecv|tsquerysend|tsrange|" + "tsrange_subdiff|tstzrange|tstzrange_subdiff|tsvector_cmp|tsvector_concat|tsvector_eq|" + "tsvector_ge|tsvector_gt|tsvector_le|tsvector_lt|tsvector_ne|tsvector_update_trigger|" + "tsvector_update_trigger_column|tsvectorin|tsvectorout|tsvectorrecv|tsvectorsend|" + "txid_current|txid_current_snapshot|txid_snapshot_in|txid_snapshot_out|" + "txid_snapshot_recv|txid_snapshot_send|txid_snapshot_xip|txid_snapshot_xmax|" + "txid_snapshot_xmin|txid_visible_in_snapshot|uhc_to_utf8|unique_key_recheck|unknownin|" + "unknownout|unknownrecv|unknownsend|unnest|upper|upper_inc|upper_inf|utf8_to_ascii|" + "utf8_to_big5|utf8_to_euc_cn|utf8_to_euc_jis_2004|utf8_to_euc_jp|utf8_to_euc_kr|" + "utf8_to_euc_tw|utf8_to_gb18030|utf8_to_gbk|utf8_to_iso8859|utf8_to_iso8859_1|" + "utf8_to_johab|utf8_to_koi8r|utf8_to_koi8u|utf8_to_shift_jis_2004|utf8_to_sjis|" + "utf8_to_uhc|utf8_to_win|uuid_cmp|uuid_eq|uuid_ge|uuid_gt|uuid_hash|uuid_in|uuid_le|" + "uuid_lt|uuid_ne|uuid_out|uuid_recv|uuid_send|var_pop|var_samp|varbit_in|varbit_out|" + "varbit_recv|varbit_send|varbit_transform|varbitcmp|varbiteq|varbitge|varbitgt|varbitle|" + "varbitlt|varbitne|varbittypmodin|varbittypmodout|varchar_transform|varcharin|" + "varcharout|varcharrecv|varcharsend|varchartypmodin|varchartypmodout|variance|version|" + "void_in|void_out|void_recv|void_send|width|width_bucket|win1250_to_latin2|" + "win1250_to_mic|win1251_to_iso|win1251_to_koi8r|win1251_to_mic|win1251_to_win866|" + "win866_to_iso|win866_to_koi8r|win866_to_mic|win866_to_win1251|win_to_utf8|xideq|" + "xideqint4|xidin|xidout|xidrecv|xidsend|xml|xml_in|xml_is_well_formed|" + "xml_is_well_formed_content|xml_is_well_formed_document|xml_out|xml_recv|xml_send|" + "xmlagg|xmlcomment|xmlconcat2|xmlexists|xmlvalidate|xpath|xpath_exists" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords }, "identifier", true); var sqlRules = [{ token : "string", // single line string -- assume dollar strings if multi-line for now regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "variable.language", // pg identifier regex : '".*?"' }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : keywordMapper, regex : "[a-zA-Z_][a-zA-Z0-9_$]*\\b" // TODO - Unicode in identifiers }, { token : "keyword.operator", regex : "!|!!|!~|!~\\*|!~~|!~~\\*|#|##|#<|#<=|#<>|#=|#>|#>=|%|\\&|\\&\\&|\\&<|\\&<\\||\\&>|\\*|\\+|" + "\\-|/|<|<#>|<\\->|<<|<<=|<<\\||<=|<>|<\\?>|<@|<\\^|=|>|>=|>>|>>=|>\\^|\\?#|\\?\\-|\\?\\-\\||" + "\\?\\||\\?\\|\\||@|@\\-@|@>|@@|@@@|\\^|\\||\\|\\&>|\\|/|\\|>>|\\|\\||\\|\\|/|~|~\\*|~<=~|~<~|" + "~=|~>=~|~>~|~~|~~\\*" }, { token : "paren.lparen", regex : "[\\(]" }, { token : "paren.rparen", regex : "[\\)]" }, { token : "text", regex : "\\s+" } ]; this.$rules = { "start" : [{ token : "comment", regex : "--.*$" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi-line comment regex : "\\/\\*", next : "comment" },{ token : "keyword.statementBegin", regex : "[a-zA-Z]+", // Could enumerate starting keywords but this allows things to work when new statements are added. next : "statement" },{ token : "support.buildin", // psql directive regex : "^\\\\[\\S]+.*$" } ], "statement" : [{ token : "comment", regex : "--.*$" }, { token : "comment", // multi-line comment regex : "\\/\\*", next : "commentStatement" }, { token : "statementEnd", regex : ";", next : "start" }, { token : "string", regex : "\\$perl\\$", next : "perl-start" }, { token : "string", regex : "\\$python\\$", next : "python-start" }, { token : "string", regex : "\\$json\\$", next : "json-start" }, { token : "string", regex : "\\$(js|javascript)\\$", next : "javascript-start" }, { token : "string", regex : "\\$\\$$", next : "dollarSql" }, { token : "string", regex : "\\$[\\w_0-9]*\\$", next : "dollarStatementString" } ].concat(sqlRules), "dollarSql" : [{ token : "comment", regex : "--.*$" }, { token : "comment", // multi-line comment regex : "\\/\\*", next : "commentDollarSql" }, { token : ["keyword", "statementEnd", "text", "string"], // end quoting with dollar at the start of a line regex : "(^|END)(;)?(\\s*)(\\$\\$)", next : "statement" }, { token : "string", regex : "\\$[\\w_0-9]*\\$", next : "dollarSqlString" } ].concat(sqlRules), "comment" : [{ token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "commentStatement" : [{ token : "comment", // closing comment regex : "\\*\\/", next : "statement" }, { defaultToken : "comment" } ], "commentDollarSql" : [{ token : "comment", // closing comment regex : "\\*\\/", next : "dollarSql" }, { defaultToken : "comment" } ], "dollarStatementString" : [{ token : "string", // closing dollarstring regex : ".*?\\$[\\w_0-9]*\\$", next : "statement" }, { token : "string", // dollarstring spanning whole line regex : ".+" } ], "dollarSqlString" : [{ token : "string", // closing dollarstring regex : ".*?\\$[\\w_0-9]*\\$", next : "dollarSql" }, { token : "string", // dollarstring spanning whole line regex : ".+" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]); this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]); this.embedRules(JsonHighlightRules, "json-", [{token : "string", regex : "\\$json\\$", next : "statement"}]); this.embedRules(JavaScriptHighlightRules, "javascript-", [{token : "string", regex : "\\$(js|javascript)\\$", next : "statement"}]); }; oop.inherits(PgsqlHighlightRules, TextHighlightRules); exports.PgsqlHighlightRules = PgsqlHighlightRules; ================================================ FILE: src/mode/php.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PhpHighlightRules = require("./php_highlight_rules").PhpHighlightRules; var PhpLangHighlightRules = require("./php_highlight_rules").PhpLangHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var WorkerClient = require("../worker/worker_client").WorkerClient; var PhpCompletions = require("./php_completions").PhpCompletions; var PhpFoldMode = require("./folding/php").FoldMode; var unicode = require("../unicode"); var MixedFoldMode = require("./folding/mixed").FoldMode; var HtmlFoldMode = require("./folding/html").FoldMode; var CstyleFoldMode = require("./folding/cstyle").FoldMode; var HtmlMode = require("./html").Mode; var JavaScriptMode = require("./javascript").Mode; var CssMode = require("./css").Mode; var PhpMode = function(opts) { this.HighlightRules = PhpLangHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.$completer = new PhpCompletions(); this.foldingRules = new MixedFoldMode(new HtmlFoldMode(), { "js-": new CstyleFoldMode(), "css-": new CstyleFoldMode(), "php-": new PhpFoldMode() }); }; oop.inherits(PhpMode, TextMode); (function() { this.tokenRe = new RegExp("^[" + unicode.wordChars + "_]+", "g"); this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "_]|\\s])+", "g"); 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 != "doc-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.getCompletions = function(state, session, pos, prefix) { return this.$completer.getCompletions(state, session, pos, prefix); }; this.$id = "ace/mode/php-inline"; }).call(PhpMode.prototype); var Mode = function(opts) { if (opts && opts.inline) { var mode = new PhpMode(); mode.createWorker = this.createWorker; mode.inlinePhp = true; return mode; } HtmlMode.call(this); this.HighlightRules = PhpHighlightRules; this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode, "php-": PhpMode }); this.foldingRules = new MixedFoldMode(new HtmlFoldMode(), { "js-": new CstyleFoldMode(), "css-": new CstyleFoldMode(), "php-": new PhpFoldMode() }); }; oop.inherits(Mode, HtmlMode); (function() { this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/php_worker", "PhpWorker"); worker.attachToDocument(session.getDocument()); if (this.inlinePhp) worker.call("setOptions", [{inline: true}]); worker.on("annotate", function(e) { session.setAnnotations(e.data); }); worker.on("terminate", function() { session.clearAnnotations(); }); return worker; }; this.$id = "ace/mode/php"; this.snippetFileId = "ace/snippets/php"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/php_completions.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 ***** */ "use strict"; var functionMap = { "abs": [ "int abs(int number)", "Return the absolute value of the number" ], "acos": [ "float acos(float number)", "Return the arc cosine of the number in radians" ], "acosh": [ "float acosh(float number)", "Returns the inverse hyperbolic cosine of the number, i.e. the value whose hyperbolic cosine is number" ], "addGlob": [ "bool addGlob(string pattern[,int flags [, array options]])", "Add files matching the glob pattern. See php's glob for the pattern syntax." ], "addPattern": [ "bool addPattern(string pattern[, string path [, array options]])", "Add files matching the pcre pattern. See php's pcre for the pattern syntax." ], "addcslashes": [ "string addcslashes(string str, string charlist)", "Escapes all chars mentioned in charlist with backslash. It creates octal representations if asked to backslash characters with 8th bit set or with ASCII<32 (except '\\n', '\\r', '\\t' etc...)" ], "addslashes": [ "string addslashes(string str)", "Escapes single quote, double quotes and backslash characters in a string with backslashes" ], "apache_child_terminate": [ "bool apache_child_terminate()", "Terminate apache process after this request" ], "apache_get_modules": [ "array apache_get_modules()", "Get a list of loaded Apache modules" ], "apache_get_version": [ "string apache_get_version()", "Fetch Apache version" ], "apache_getenv": [ "bool apache_getenv(string variable [, bool walk_to_top])", "Get an Apache subprocess_env variable" ], "apache_lookup_uri": [ "object apache_lookup_uri(string URI)", "Perform a partial request of the given URI to obtain information about it" ], "apache_note": [ "string apache_note(string note_name [, string note_value])", "Get and set Apache request notes" ], "apache_request_auth_name": [ "string apache_request_auth_name()", "" ], "apache_request_auth_type": [ "string apache_request_auth_type()", "" ], "apache_request_discard_request_body": [ "long apache_request_discard_request_body()", "" ], "apache_request_err_headers_out": [ "array apache_request_err_headers_out([{string name|array list} [, string value [, bool replace = false]]])", "* fetch all headers that go out in case of an error or a subrequest" ], "apache_request_headers": [ "array apache_request_headers()", "Fetch all HTTP request headers" ], "apache_request_headers_in": [ "array apache_request_headers_in()", "* fetch all incoming request headers" ], "apache_request_headers_out": [ "array apache_request_headers_out([{string name|array list} [, string value [, bool replace = false]]])", "* fetch all outgoing request headers" ], "apache_request_is_initial_req": [ "bool apache_request_is_initial_req()", "" ], "apache_request_log_error": [ "bool apache_request_log_error(string message, [long facility])", "" ], "apache_request_meets_conditions": [ "long apache_request_meets_conditions()", "" ], "apache_request_remote_host": [ "int apache_request_remote_host([int type])", "" ], "apache_request_run": [ "long apache_request_run()", "This is a wrapper for ap_sub_run_req and ap_destory_sub_req. It takes sub_request, runs it, destroys it, and returns it's status." ], "apache_request_satisfies": [ "long apache_request_satisfies()", "" ], "apache_request_server_port": [ "int apache_request_server_port()", "" ], "apache_request_set_etag": [ "void apache_request_set_etag()", "" ], "apache_request_set_last_modified": [ "void apache_request_set_last_modified()", "" ], "apache_request_some_auth_required": [ "bool apache_request_some_auth_required()", "" ], "apache_request_sub_req_lookup_file": [ "object apache_request_sub_req_lookup_file(string file)", "Returns sub-request for the specified file. You would need to run it yourself with run()." ], "apache_request_sub_req_lookup_uri": [ "object apache_request_sub_req_lookup_uri(string uri)", "Returns sub-request for the specified uri. You would need to run it yourself with run()" ], "apache_request_sub_req_method_uri": [ "object apache_request_sub_req_method_uri(string method, string uri)", "Returns sub-request for the specified file. You would need to run it yourself with run()." ], "apache_request_update_mtime": [ "long apache_request_update_mtime([int dependency_mtime])", "" ], "apache_reset_timeout": [ "bool apache_reset_timeout()", "Reset the Apache write timer" ], "apache_response_headers": [ "array apache_response_headers()", "Fetch all HTTP response headers" ], "apache_setenv": [ "bool apache_setenv(string variable, string value [, bool walk_to_top])", "Set an Apache subprocess_env variable" ], "array_change_key_case": [ "array array_change_key_case(array input [, int case=CASE_LOWER])", "Retuns an array with all string keys lowercased [or uppercased]" ], "array_chunk": [ "array array_chunk(array input, int size [, bool preserve_keys])", "Split array into chunks" ], "array_combine": [ "array array_combine(array keys, array values)", "Creates an array by using the elements of the first parameter as keys and the elements of the second as the corresponding values" ], "array_count_values": [ "array array_count_values(array input)", "Return the value as key and the frequency of that value in input as value" ], "array_diff": [ "array array_diff(array arr1, array arr2 [, array ...])", "Returns the entries of arr1 that have values which are not present in any of the others arguments." ], "array_diff_assoc": [ "array array_diff_assoc(array arr1, array arr2 [, array ...])", "Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal" ], "array_diff_key": [ "array array_diff_key(array arr1, array arr2 [, array ...])", "Returns the entries of arr1 that have keys which are not present in any of the others arguments. This function is like array_diff() but works on the keys instead of the values. The associativity is preserved." ], "array_diff_uassoc": [ "array array_diff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func)", "Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Elements are compared by user supplied function." ], "array_diff_ukey": [ "array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)", "Returns the entries of arr1 that have keys which are not present in any of the others arguments. User supplied function is used for comparing the keys. This function is like array_udiff() but works on the keys instead of the values. The associativity is preserved." ], "array_fill": [ "array array_fill(int start_key, int num, mixed val)", "Create an array containing num elements starting with index start_key each initialized to val" ], "array_fill_keys": [ "array array_fill_keys(array keys, mixed val)", "Create an array using the elements of the first parameter as keys each initialized to val" ], "array_filter": [ "array array_filter(array input [, mixed callback])", "Filters elements from the array via the callback." ], "array_flip": [ "array array_flip(array input)", "Return array with key <-> value flipped" ], "array_intersect": [ "array array_intersect(array arr1, array arr2 [, array ...])", "Returns the entries of arr1 that have values which are present in all the other arguments" ], "array_intersect_assoc": [ "array array_intersect_assoc(array arr1, array arr2 [, array ...])", "Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check" ], "array_intersect_key": [ "array array_intersect_key(array arr1, array arr2 [, array ...])", "Returns the entries of arr1 that have keys which are present in all the other arguments. Kind of equivalent to array_diff(array_keys($arr1), array_keys($arr2)[,array_keys(...)]). Equivalent of array_intersect_assoc() but does not do compare of the data." ], "array_intersect_uassoc": [ "array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)", "Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check and they are compared by using an user-supplied callback." ], "array_intersect_ukey": [ "array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)", "Returns the entries of arr1 that have keys which are present in all the other arguments. Kind of equivalent to array_diff(array_keys($arr1), array_keys($arr2)[,array_keys(...)]). The comparison of the keys is performed by a user supplied function. Equivalent of array_intersect_uassoc() but does not do compare of the data." ], "array_key_exists": [ "bool array_key_exists(mixed key, array search)", "Checks if the given key or index exists in the array" ], "array_keys": [ "array array_keys(array input [, mixed search_value[, bool strict]])", "Return just the keys from the input array, optionally only for the specified search_value" ], "array_key_first": [ "mixed array_key_first(array arr)", "Returns the first key of arr if the array is not empty; NULL otherwise" ], "array_key_last": [ "mixed array_key_last(array arr)", "Returns the last key of arr if the array is not empty; NULL otherwise" ], "array_map": [ "array array_map(mixed callback, array input1 [, array input2 ,...])", "Applies the callback to the elements in given arrays." ], "array_merge": [ "array array_merge(array arr1, array arr2 [, array ...])", "Merges elements from passed arrays into one array" ], "array_merge_recursive": [ "array array_merge_recursive(array arr1, array arr2 [, array ...])", "Recursively merges elements from passed arrays into one array" ], "array_multisort": [ "bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]] [, array ar2 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]], ...])", "Sort multiple arrays at once similar to how ORDER BY clause works in SQL" ], "array_pad": [ "array array_pad(array input, int pad_size, mixed pad_value)", "Returns a copy of input array padded with pad_value to size pad_size" ], "array_pop": [ "mixed array_pop(array stack)", "Pops an element off the end of the array" ], "array_product": [ "mixed array_product(array input)", "Returns the product of the array entries" ], "array_push": [ "int array_push(array stack, mixed var [, mixed ...])", "Pushes elements onto the end of the array" ], "array_rand": [ "mixed array_rand(array input [, int num_req])", "Return key/keys for random entry/entries in the array" ], "array_reduce": [ "mixed array_reduce(array input, mixed callback [, mixed initial])", "Iteratively reduce the array to a single value via the callback." ], "array_replace": [ "array array_replace(array arr1, array arr2 [, array ...])", "Replaces elements from passed arrays into one array" ], "array_replace_recursive": [ "array array_replace_recursive(array arr1, array arr2 [, array ...])", "Recursively replaces elements from passed arrays into one array" ], "array_reverse": [ "array array_reverse(array input [, bool preserve keys])", "Return input as a new array with the order of the entries reversed" ], "array_search": [ "mixed array_search(mixed needle, array haystack [, bool strict])", "Searches the array for a given value and returns the corresponding key if successful" ], "array_shift": [ "mixed array_shift(array stack)", "Pops an element off the beginning of the array" ], "array_slice": [ "array array_slice(array input, int offset [, int length [, bool preserve_keys]])", "Returns elements specified by offset and length" ], "array_splice": [ "array array_splice(array input, int offset [, int length [, array replacement]])", "Removes the elements designated by offset and length and replace them with supplied array" ], "array_sum": [ "mixed array_sum(array input)", "Returns the sum of the array entries" ], "array_udiff": [ "array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)", "Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function." ], "array_udiff_assoc": [ "array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)", "Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function." ], "array_udiff_uassoc": [ "array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)", "Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions." ], "array_uintersect": [ "array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)", "Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback." ], "array_uintersect_assoc": [ "array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)", "Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Data is compared by using an user-supplied callback." ], "array_uintersect_uassoc": [ "array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)", "Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks." ], "array_unique": [ "array array_unique(array input [, int sort_flags])", "Removes duplicate values from array" ], "array_unshift": [ "int array_unshift(array stack, mixed var [, mixed ...])", "Pushes elements onto the beginning of the array" ], "array_values": [ "array array_values(array input)", "Return just the values from the input array" ], "array_walk": [ "bool array_walk(array input, string funcname [, mixed userdata])", "Apply a user function to every member of an array" ], "array_walk_recursive": [ "bool array_walk_recursive(array input, string funcname [, mixed userdata])", "Apply a user function recursively to every member of an array" ], "arsort": [ "bool arsort(array &array_arg [, int sort_flags])", "Sort an array in reverse order and maintain index association" ], "asin": [ "float asin(float number)", "Returns the arc sine of the number in radians" ], "asinh": [ "float asinh(float number)", "Returns the inverse hyperbolic sine of the number, i.e. the value whose hyperbolic sine is number" ], "asort": [ "bool asort(array &array_arg [, int sort_flags])", "Sort an array and maintain index association" ], "assert": [ "int assert(string|bool assertion)", "Checks if assertion is false" ], "assert_options": [ "mixed assert_options(int what [, mixed value])", "Set/get the various assert flags" ], "atan": [ "float atan(float number)", "Returns the arc tangent of the number in radians" ], "atan2": [ "float atan2(float y, float x)", "Returns the arc tangent of y/x, with the resulting quadrant determined by the signs of y and x" ], "atanh": [ "float atanh(float number)", "Returns the inverse hyperbolic tangent of the number, i.e. the value whose hyperbolic tangent is number" ], "attachIterator": [ "void attachIterator(Iterator iterator[, mixed info])", "Attach a new iterator" ], "base64_decode": [ "string base64_decode(string str[, bool strict])", "Decodes string using MIME base64 algorithm" ], "base64_encode": [ "string base64_encode(string str)", "Encodes string using MIME base64 algorithm" ], "base_convert": [ "string base_convert(string number, int frombase, int tobase)", "Converts a number in a string from any base <= 36 to any base <= 36" ], "basename": [ "string basename(string path [, string suffix])", "Returns the filename component of the path" ], "bcadd": [ "string bcadd(string left_operand, string right_operand [, int scale])", "Returns the sum of two arbitrary precision numbers" ], "bccomp": [ "int bccomp(string left_operand, string right_operand [, int scale])", "Compares two arbitrary precision numbers" ], "bcdiv": [ "string bcdiv(string left_operand, string right_operand [, int scale])", "Returns the quotient of two arbitrary precision numbers (division)" ], "bcmod": [ "string bcmod(string left_operand, string right_operand)", "Returns the modulus of the two arbitrary precision operands" ], "bcmul": [ "string bcmul(string left_operand, string right_operand [, int scale])", "Returns the multiplication of two arbitrary precision numbers" ], "bcpow": [ "string bcpow(string x, string y [, int scale])", "Returns the value of an arbitrary precision number raised to the power of another" ], "bcpowmod": [ "string bcpowmod(string x, string y, string mod [, int scale])", "Returns the value of an arbitrary precision number raised to the power of another reduced by a modulous" ], "bcscale": [ "bool bcscale(int scale)", "Sets default scale parameter for all bc math functions" ], "bcsqrt": [ "string bcsqrt(string operand [, int scale])", "Returns the square root of an arbitray precision number" ], "bcsub": [ "string bcsub(string left_operand, string right_operand [, int scale])", "Returns the difference between two arbitrary precision numbers" ], "bin2hex": [ "string bin2hex(string data)", "Converts the binary representation of data to hex" ], "bind_textdomain_codeset": [ "string bind_textdomain_codeset (string domain, string codeset)", "Specify the character encoding in which the messages from the DOMAIN message catalog will be returned." ], "bindec": [ "int bindec(string binary_number)", "Returns the decimal equivalent of the binary number" ], "bindtextdomain": [ "string bindtextdomain(string domain_name, string dir)", "Bind to the text domain domain_name, looking for translations in dir. Returns the current domain" ], "birdstep_autocommit": [ "bool birdstep_autocommit(int index)", "" ], "birdstep_close": [ "bool birdstep_close(int id)", "" ], "birdstep_commit": [ "bool birdstep_commit(int index)", "" ], "birdstep_connect": [ "int birdstep_connect(string server, string user, string pass)", "" ], "birdstep_exec": [ "int birdstep_exec(int index, string exec_str)", "" ], "birdstep_fetch": [ "bool birdstep_fetch(int index)", "" ], "birdstep_fieldname": [ "string birdstep_fieldname(int index, int col)", "" ], "birdstep_fieldnum": [ "int birdstep_fieldnum(int index)", "" ], "birdstep_freeresult": [ "bool birdstep_freeresult(int index)", "" ], "birdstep_off_autocommit": [ "bool birdstep_off_autocommit(int index)", "" ], "birdstep_result": [ "mixed birdstep_result(int index, mixed col)", "" ], "birdstep_rollback": [ "bool birdstep_rollback(int index)", "" ], "bzcompress": [ "string bzcompress(string source [, int blocksize100k [, int workfactor]])", "Compresses a string into BZip2 encoded data" ], "bzdecompress": [ "string bzdecompress(string source [, int small])", "Decompresses BZip2 compressed data" ], "bzerrno": [ "int bzerrno(resource bz)", "Returns the error number" ], "bzerror": [ "array bzerror(resource bz)", "Returns the error number and error string in an associative array" ], "bzerrstr": [ "string bzerrstr(resource bz)", "Returns the error string" ], "bzopen": [ "resource bzopen(string|int file|fp, string mode)", "Opens a new BZip2 stream" ], "bzread": [ "string bzread(resource bz[, int length])", "Reads up to length bytes from a BZip2 stream, or 1024 bytes if length is not specified" ], "cal_days_in_month": [ "int cal_days_in_month(int calendar, int month, int year)", "Returns the number of days in a month for a given year and calendar" ], "cal_from_jd": [ "array cal_from_jd(int jd, int calendar)", "Converts from Julian Day Count to a supported calendar and return extended information" ], "cal_info": [ "array cal_info([int calendar])", "Returns information about a particular calendar" ], "cal_to_jd": [ "int cal_to_jd(int calendar, int month, int day, int year)", "Converts from a supported calendar to Julian Day Count" ], "call_user_func": [ "mixed call_user_func(mixed function_name [, mixed parmeter] [, mixed ...])", "Call a user function which is the first parameter" ], "call_user_func_array": [ "mixed call_user_func_array(string function_name, array parameters)", "Call a user function which is the first parameter with the arguments contained in array" ], "call_user_method": [ "mixed call_user_method(string method_name, mixed object [, mixed parameter] [, mixed ...])", "Call a user method on a specific object or class" ], "call_user_method_array": [ "mixed call_user_method_array(string method_name, mixed object, array params)", "Call a user method on a specific object or class using a parameter array" ], "ceil": [ "float ceil(float number)", "Returns the next highest integer value of the number" ], "chdir": [ "bool chdir(string directory)", "Change the current directory" ], "checkdate": [ "bool checkdate(int month, int day, int year)", "Returns true(1) if it is a valid date in gregorian calendar" ], "chgrp": [ "bool chgrp(string filename, mixed group)", "Change file group" ], "chmod": [ "bool chmod(string filename, int mode)", "Change file mode" ], "chown": [ "bool chown(string filename, mixed user)", "Change file owner" ], "chr": [ "string chr(int ascii)", "Converts ASCII code to a character" ], "chroot": [ "bool chroot(string directory)", "Change root directory" ], "chunk_split": [ "string chunk_split(string str [, int chunklen [, string ending]])", "Returns split line" ], "class_alias": [ "bool class_alias(string user_class_name , string alias_name [, bool autoload])", "Creates an alias for user defined class" ], "class_exists": [ "bool class_exists(string classname [, bool autoload])", "Checks if the class exists" ], "class_implements": [ "array class_implements(mixed what [, bool autoload ])", "Return all classes and interfaces implemented by SPL" ], "class_parents": [ "array class_parents(object instance [, bool autoload = true])", "Return an array containing the names of all parent classes" ], "clearstatcache": [ "void clearstatcache([bool clear_realpath_cache[, string filename]])", "Clear file stat cache" ], "closedir": [ "void closedir([resource dir_handle])", "Close directory connection identified by the dir_handle" ], "closelog": [ "bool closelog()", "Close connection to system logger" ], "collator_asort": [ "bool collator_asort( Collator $coll, array(string) $arr )", "* Sort array using specified collator, maintaining index association." ], "collator_compare": [ "int collator_compare( Collator $coll, string $str1, string $str2 )", "* Compare two strings." ], "collator_create": [ "Collator collator_create( string $locale )", "* Create collator." ], "collator_get_attribute": [ "int collator_get_attribute( Collator $coll, int $attr )", "* Get collation attribute value." ], "collator_get_error_code": [ "int collator_get_error_code( Collator $coll )", "* Get collator's last error code." ], "collator_get_error_message": [ "string collator_get_error_message( Collator $coll )", "* Get text description for collator's last error code." ], "collator_get_locale": [ "string collator_get_locale( Collator $coll, int $type )", "* Gets the locale name of the collator." ], "collator_get_sort_key": [ "bool collator_get_sort_key( Collator $coll, string $str )", "* Get a sort key for a string from a Collator. }}}" ], "collator_get_strength": [ "int collator_get_strength(Collator coll)", "* Returns the current collation strength." ], "collator_set_attribute": [ "bool collator_set_attribute( Collator $coll, int $attr, int $val )", "* Set collation attribute." ], "collator_set_strength": [ "bool collator_set_strength(Collator coll, int strength)", "* Set the collation strength." ], "collator_sort": [ "bool collator_sort( Collator $coll, array(string) $arr [, int $sort_flags] )", "* Sort array using specified collator." ], "collator_sort_with_sort_keys": [ "bool collator_sort_with_sort_keys( Collator $coll, array(string) $arr )", "* Equivalent to standard PHP sort using Collator. * Uses ICU ucol_getSortKey for performance." ], "com_create_guid": [ "string com_create_guid()", "Generate a globally unique identifier (GUID)" ], "com_event_sink": [ "bool com_event_sink(object comobject, object sinkobject [, mixed sinkinterface])", "Connect events from a COM object to a PHP object" ], "com_get_active_object": [ "object com_get_active_object(string progid [, int code_page ])", "Returns a handle to an already running instance of a COM object" ], "com_load_typelib": [ "bool com_load_typelib(string typelib_name [, int case_insensitive])", "Loads a Typelibrary and registers its constants" ], "com_message_pump": [ "bool com_message_pump([int timeoutms])", "Process COM messages, sleeping for up to timeoutms milliseconds" ], "com_print_typeinfo": [ "bool com_print_typeinfo(object comobject | string typelib, string dispinterface, bool wantsink)", "Print out a PHP class definition for a dispatchable interface" ], "compact": [ "array compact(mixed var_names [, mixed ...])", "Creates a hash containing variables and their values" ], "compose_locale": [ "static string compose_locale($array)", "* Creates a locale by combining the parts of locale-ID passed * }}}" ], "confirm_extname_compiled": [ "string confirm_extname_compiled(string arg)", "Return a string to confirm that the module is compiled in" ], "connection_aborted": [ "int connection_aborted()", "Returns true if client disconnected" ], "connection_status": [ "int connection_status()", "Returns the connection status bitfield" ], "constant": [ "mixed constant(string const_name)", "Given the name of a constant this function will return the constant's associated value" ], "convert_cyr_string": [ "string convert_cyr_string(string str, string from, string to)", "Convert from one Cyrillic character set to another" ], "convert_uudecode": [ "string convert_uudecode(string data)", "decode a uuencoded string" ], "convert_uuencode": [ "string convert_uuencode(string data)", "uuencode a string" ], "copy": [ "bool copy(string source_file, string destination_file [, resource context])", "Copy a file" ], "cos": [ "float cos(float number)", "Returns the cosine of the number in radians" ], "cosh": [ "float cosh(float number)", "Returns the hyperbolic cosine of the number, defined as (exp(number) + exp(-number))/2" ], "count": [ "int count(mixed var [, int mode])", "Count the number of elements in a variable (usually an array)" ], "count_chars": [ "mixed count_chars(string input [, int mode])", "Returns info about what characters are used in input" ], "crc32": [ "string crc32(string str)", "Calculate the crc32 polynomial of a string" ], "create_function": [ "string create_function(string args, string code)", "Creates an anonymous function, and returns its name" ], "crypt": [ "string crypt(string str [, string salt])", "Hash a string" ], "ctype_alnum": [ "bool ctype_alnum(mixed c)", "Checks for alphanumeric character(s)" ], "ctype_alpha": [ "bool ctype_alpha(mixed c)", "Checks for alphabetic character(s)" ], "ctype_cntrl": [ "bool ctype_cntrl(mixed c)", "Checks for control character(s)" ], "ctype_digit": [ "bool ctype_digit(mixed c)", "Checks for numeric character(s)" ], "ctype_graph": [ "bool ctype_graph(mixed c)", "Checks for any printable character(s) except space" ], "ctype_lower": [ "bool ctype_lower(mixed c)", "Checks for lowercase character(s)" ], "ctype_print": [ "bool ctype_print(mixed c)", "Checks for printable character(s)" ], "ctype_punct": [ "bool ctype_punct(mixed c)", "Checks for any printable character which is not whitespace or an alphanumeric character" ], "ctype_space": [ "bool ctype_space(mixed c)", "Checks for whitespace character(s)" ], "ctype_upper": [ "bool ctype_upper(mixed c)", "Checks for uppercase character(s)" ], "ctype_xdigit": [ "bool ctype_xdigit(mixed c)", "Checks for character(s) representing a hexadecimal digit" ], "curl_close": [ "void curl_close(resource ch)", "Close a cURL session" ], "curl_copy_handle": [ "resource curl_copy_handle(resource ch)", "Copy a cURL handle along with all of it's preferences" ], "curl_errno": [ "int curl_errno(resource ch)", "Return an integer containing the last error number" ], "curl_error": [ "string curl_error(resource ch)", "Return a string contain the last error for the current session" ], "curl_exec": [ "bool curl_exec(resource ch)", "Perform a cURL session" ], "curl_getinfo": [ "mixed curl_getinfo(resource ch [, int option])", "Get information regarding a specific transfer" ], "curl_init": [ "resource curl_init([string url])", "Initialize a cURL session" ], "curl_multi_add_handle": [ "int curl_multi_add_handle(resource mh, resource ch)", "Add a normal cURL handle to a cURL multi handle" ], "curl_multi_close": [ "void curl_multi_close(resource mh)", "Close a set of cURL handles" ], "curl_multi_exec": [ "int curl_multi_exec(resource mh, int &still_running)", "Run the sub-connections of the current cURL handle" ], "curl_multi_getcontent": [ "string curl_multi_getcontent(resource ch)", "Return the content of a cURL handle if CURLOPT_RETURNTRANSFER is set" ], "curl_multi_info_read": [ "array curl_multi_info_read(resource mh [, long msgs_in_queue])", "Get information about the current transfers" ], "curl_multi_init": [ "resource curl_multi_init()", "Returns a new cURL multi handle" ], "curl_multi_remove_handle": [ "int curl_multi_remove_handle(resource mh, resource ch)", "Remove a multi handle from a set of cURL handles" ], "curl_multi_select": [ "int curl_multi_select(resource mh[, double timeout])", "Get all the sockets associated with the cURL extension, which can then be \"selected\"" ], "curl_setopt": [ "bool curl_setopt(resource ch, int option, mixed value)", "Set an option for a cURL transfer" ], "curl_setopt_array": [ "bool curl_setopt_array(resource ch, array options)", "Set an array of option for a cURL transfer" ], "curl_version": [ "array curl_version([int version])", "Return cURL version information." ], "current": [ "mixed current(array array_arg)", "Return the element currently pointed to by the internal array pointer" ], "date": [ "string date(string format [, long timestamp])", "Format a local date/time" ], "date_add": [ "DateTime date_add(DateTime object, DateInterval interval)", "Adds an interval to the current date in object." ], "date_create": [ "DateTime date_create([string time[, DateTimeZone object]])", "Returns new DateTime object" ], "date_create_from_format": [ "DateTime date_create_from_format(string format, string time[, DateTimeZone object])", "Returns new DateTime object formatted according to the specified format" ], "date_date_set": [ "DateTime date_date_set(DateTime object, long year, long month, long day)", "Sets the date." ], "date_default_timezone_get": [ "string date_default_timezone_get()", "Gets the default timezone used by all date/time functions in a script" ], "date_default_timezone_set": [ "bool date_default_timezone_set(string timezone_identifier)", "Sets the default timezone used by all date/time functions in a script" ], "date_diff": [ "DateInterval date_diff(DateTime object [, bool absolute])", "Returns the difference between two DateTime objects." ], "date_format": [ "string date_format(DateTime object, string format)", "Returns date formatted according to given format" ], "date_get_last_errors": [ "array date_get_last_errors()", "Returns the warnings and errors found while parsing a date/time string." ], "date_interval_create_from_date_string": [ "DateInterval date_interval_create_from_date_string(string time)", "Uses the normal date parsers and sets up a DateInterval from the relative parts of the parsed string" ], "date_interval_format": [ "string date_interval_format(DateInterval object, string format)", "Formats the interval." ], "date_isodate_set": [ "DateTime date_isodate_set(DateTime object, long year, long week[, long day])", "Sets the ISO date." ], "date_modify": [ "DateTime date_modify(DateTime object, string modify)", "Alters the timestamp." ], "date_offset_get": [ "long date_offset_get(DateTime object)", "Returns the DST offset." ], "date_parse": [ "array date_parse(string date)", "Returns associative array with detailed info about given date" ], "date_parse_from_format": [ "array date_parse_from_format(string format, string date)", "Returns associative array with detailed info about given date" ], "date_sub": [ "DateTime date_sub(DateTime object, DateInterval interval)", "Subtracts an interval to the current date in object." ], "date_sun_info": [ "array date_sun_info(long time, float latitude, float longitude)", "Returns an array with information about sun set/rise and twilight begin/end" ], "date_sunrise": [ "mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])", "Returns time of sunrise for a given day and location" ], "date_sunset": [ "mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])", "Returns time of sunset for a given day and location" ], "date_time_set": [ "DateTime date_time_set(DateTime object, long hour, long minute[, long second])", "Sets the time." ], "date_timestamp_get": [ "long date_timestamp_get(DateTime object)", "Gets the Unix timestamp." ], "date_timestamp_set": [ "DateTime date_timestamp_set(DateTime object, long unixTimestamp)", "Sets the date and time based on an Unix timestamp." ], "date_timezone_get": [ "DateTimeZone date_timezone_get(DateTime object)", "Return new DateTimeZone object relative to give DateTime" ], "date_timezone_set": [ "DateTime date_timezone_set(DateTime object, DateTimeZone object)", "Sets the timezone for the DateTime object." ], "datefmt_create": [ "IntlDateFormatter datefmt_create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern] )", "* Create formatter." ], "datefmt_format": [ "string datefmt_format( [mixed]int $args or array $args )", "* Format the time value as a string. }}}" ], "datefmt_get_calendar": [ "string datefmt_get_calendar( IntlDateFormatter $mf )", "* Get formatter calendar." ], "datefmt_get_datetype": [ "string datefmt_get_datetype( IntlDateFormatter $mf )", "* Get formatter datetype." ], "datefmt_get_error_code": [ "int datefmt_get_error_code( IntlDateFormatter $nf )", "* Get formatter's last error code." ], "datefmt_get_error_message": [ "string datefmt_get_error_message( IntlDateFormatter $coll )", "* Get text description for formatter's last error code." ], "datefmt_get_locale": [ "string datefmt_get_locale(IntlDateFormatter $mf)", "* Get formatter locale." ], "datefmt_get_pattern": [ "string datefmt_get_pattern( IntlDateFormatter $mf )", "* Get formatter pattern." ], "datefmt_get_timetype": [ "string datefmt_get_timetype( IntlDateFormatter $mf )", "* Get formatter timetype." ], "datefmt_get_timezone_id": [ "string datefmt_get_timezone_id( IntlDateFormatter $mf )", "* Get formatter timezone_id." ], "datefmt_isLenient": [ "string datefmt_isLenient(IntlDateFormatter $mf)", "* Get formatter locale." ], "datefmt_localtime": [ "integer datefmt_localtime( IntlDateFormatter $fmt, string $text_to_parse[, int $parse_pos ])", "* Parse the string $value to a localtime array }}}" ], "datefmt_parse": [ "integer datefmt_parse( IntlDateFormatter $fmt, string $text_to_parse [, int $parse_pos] )", "* Parse the string $value starting at parse_pos to a Unix timestamp -int }}}" ], "datefmt_setLenient": [ "string datefmt_setLenient(IntlDateFormatter $mf)", "* Set formatter lenient." ], "datefmt_set_calendar": [ "bool datefmt_set_calendar( IntlDateFormatter $mf, int $calendar )", "* Set formatter calendar." ], "datefmt_set_pattern": [ "bool datefmt_set_pattern( IntlDateFormatter $mf, string $pattern )", "* Set formatter pattern." ], "datefmt_set_timezone_id": [ "bool datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id)", "* Set formatter timezone_id." ], "dba_close": [ "void dba_close(resource handle)", "Closes database" ], "dba_delete": [ "bool dba_delete(string key, resource handle)", "Deletes the entry associated with key If inifile: remove all other key lines" ], "dba_exists": [ "bool dba_exists(string key, resource handle)", "Checks, if the specified key exists" ], "dba_fetch": [ "string dba_fetch(string key, [int skip ,] resource handle)", "Fetches the data associated with key" ], "dba_firstkey": [ "string dba_firstkey(resource handle)", "Resets the internal key pointer and returns the first key" ], "dba_handlers": [ "array dba_handlers([bool full_info])", "List configured database handlers" ], "dba_insert": [ "bool dba_insert(string key, string value, resource handle)", "If not inifile: Insert value as key, return false, if key exists already If inifile: Add vakue as key (next instance of key)" ], "dba_key_split": [ "array|false dba_key_split(string key)", "Splits an inifile key into an array of the form array(0=>group,1=>value_name) but returns false if input is false or null" ], "dba_list": [ "array dba_list()", "List opened databases" ], "dba_nextkey": [ "string dba_nextkey(resource handle)", "Returns the next key" ], "dba_open": [ "resource dba_open(string path, string mode [, string handlername, string ...])", "Opens path using the specified handler in mode" ], "dba_optimize": [ "bool dba_optimize(resource handle)", "Optimizes (e.g. clean up, vacuum) database" ], "dba_popen": [ "resource dba_popen(string path, string mode [, string handlername, string ...])", "Opens path using the specified handler in mode persistently" ], "dba_replace": [ "bool dba_replace(string key, string value, resource handle)", "Inserts value as key, replaces key, if key exists already If inifile: remove all other key lines" ], "dba_sync": [ "bool dba_sync(resource handle)", "Synchronizes database" ], "dcgettext": [ "string dcgettext(string domain_name, string msgid, long category)", "Return the translation of msgid for domain_name and category, or msgid unaltered if a translation does not exist" ], "dcngettext": [ "string dcngettext(string domain, string msgid1, string msgid2, int n, int category)", "Plural version of dcgettext()" ], "debug_backtrace": [ "array debug_backtrace([bool provide_object])", "Return backtrace as array" ], "debug_print_backtrace": [ "void debug_print_backtrace()", "Prints a PHP backtrace" ], "debug_zval_dump": [ "void debug_zval_dump(mixed var)", "Dumps a string representation of an internal Zend value to output" ], "decbin": [ "string decbin(int decimal_number)", "Returns a string containing a binary representation of the number" ], "dechex": [ "string dechex(int decimal_number)", "Returns a string containing a hexadecimal representation of the given number" ], "decoct": [ "string decoct(int decimal_number)", "Returns a string containing an octal representation of the given number" ], "define": [ "bool define(string constant_name, mixed value, bool case_insensitive=false)", "Define a new constant" ], "define_syslog_variables": [ "void define_syslog_variables()", "Initializes all syslog-related variables" ], "defined": [ "bool defined(string constant_name)", "Check whether a constant exists" ], "deg2rad": [ "float deg2rad(float number)", "Converts the number in degrees to the radian equivalent" ], "dgettext": [ "string dgettext(string domain_name, string msgid)", "Return the translation of msgid for domain_name, or msgid unaltered if a translation does not exist" ], "die": [ "void die([mixed status])", "Output a message and terminate the current script" ], "dir": [ "object dir(string directory[, resource context])", "Directory class with properties, handle and class and methods read, rewind and close" ], "dirname": [ "string dirname(string path)", "Returns the directory name component of the path" ], "disk_free_space": [ "float disk_free_space(string path)", "Get free disk space for filesystem that path is on" ], "disk_total_space": [ "float disk_total_space(string path)", "Get total disk space for filesystem that path is on" ], "display_disabled_function": [ "void display_disabled_function()", "Dummy function which displays an error when a disabled function is called." ], "dl": [ "int dl(string extension_filename)", "Load a PHP extension at runtime" ], "dngettext": [ "string dngettext(string domain, string msgid1, string msgid2, int count)", "Plural version of dgettext()" ], "dns_check_record": [ "bool dns_check_record(string host [, string type])", "Check DNS records corresponding to a given Internet host name or IP address" ], "dns_get_mx": [ "bool dns_get_mx(string hostname, array mxhosts [, array weight])", "Get MX records corresponding to a given Internet host name" ], "dns_get_record": [ "array|false dns_get_record(string hostname [, int type[, array authns, array addtl]])", "Get any Resource Record corresponding to a given Internet host name" ], "dom_attr_is_id": [ "bool dom_attr_is_id()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-isId Since: DOM Level 3" ], "dom_characterdata_append_data": [ "void dom_characterdata_append_data(string arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-32791A2F Since:" ], "dom_characterdata_delete_data": [ "void dom_characterdata_delete_data(int offset, int count)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-7C603781 Since:" ], "dom_characterdata_insert_data": [ "void dom_characterdata_insert_data(int offset, string arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3EDB695F Since:" ], "dom_characterdata_replace_data": [ "void dom_characterdata_replace_data(int offset, int count, string arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-E5CBA7FB Since:" ], "dom_characterdata_substring_data": [ "string dom_characterdata_substring_data(int offset, int count)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6531BCCF Since:" ], "dom_document_adopt_node": [ "DOMNode dom_document_adopt_node(DOMNode source)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-adoptNode Since: DOM Level 3" ], "dom_document_create_attribute": [ "DOMAttr dom_document_create_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198 Since:" ], "dom_document_create_attribute_ns": [ "DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS Since: DOM Level 2" ], "dom_document_create_cdatasection": [ "DOMCdataSection dom_document_create_cdatasection(string data)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8 Since:" ], "dom_document_create_comment": [ "DOMComment dom_document_create_comment(string data)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328 Since:" ], "dom_document_create_document_fragment": [ "DOMDocumentFragment dom_document_create_document_fragment()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5 Since:" ], "dom_document_create_element": [ "DOMElement dom_document_create_element(string tagName [, string value])", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547 Since:" ], "dom_document_create_element_ns": [ "DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value])", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS Since: DOM Level 2" ], "dom_document_create_entity_reference": [ "DOMEntityReference dom_document_create_entity_reference(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE Since:" ], "dom_document_create_processing_instruction": [ "DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439 Since:" ], "dom_document_create_text_node": [ "DOMText dom_document_create_text_node(string data)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127 Since:" ], "dom_document_get_element_by_id": [ "DOMElement dom_document_get_element_by_id(string elementId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId Since: DOM Level 2" ], "dom_document_get_elements_by_tag_name": [ "DOMNodeList dom_document_get_elements_by_tag_name(string tagname)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094 Since:" ], "dom_document_get_elements_by_tag_name_ns": [ "DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS Since: DOM Level 2" ], "dom_document_import_node": [ "DOMNode dom_document_import_node(DOMNode importedNode, bool deep)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode Since: DOM Level 2" ], "dom_document_load": [ "DOMNode dom_document_load(string source [, int options])", "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-load Since: DOM Level 3" ], "dom_document_load_html": [ "DOMNode dom_document_load_html(string source)", "Since: DOM extended" ], "dom_document_load_html_file": [ "DOMNode dom_document_load_html_file(string source)", "Since: DOM extended" ], "dom_document_loadxml": [ "DOMNode dom_document_loadxml(string source [, int options])", "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-loadXML Since: DOM Level 3" ], "dom_document_normalize_document": [ "void dom_document_normalize_document()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument Since: DOM Level 3" ], "dom_document_relaxNG_validate_file": [ "bool dom_document_relaxNG_validate_file(string filename); */", "PHP_FUNCTION(dom_document_relaxNG_validate_file) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_relaxNG_validate_file" ], "dom_document_relaxNG_validate_xml": [ "bool dom_document_relaxNG_validate_xml(string source); */", "PHP_FUNCTION(dom_document_relaxNG_validate_xml) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_relaxNG_validate_xml" ], "dom_document_rename_node": [ "DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode Since: DOM Level 3" ], "dom_document_save": [ "int dom_document_save(string file)", "Convenience method to save to file" ], "dom_document_save_html": [ "string dom_document_save_html()", "Convenience method to output as html" ], "dom_document_save_html_file": [ "int dom_document_save_html_file(string file)", "Convenience method to save to file as html" ], "dom_document_savexml": [ "string dom_document_savexml([node n])", "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-saveXML Since: DOM Level 3" ], "dom_document_schema_validate": [ "bool dom_document_schema_validate(string source); */", "PHP_FUNCTION(dom_document_schema_validate_xml) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_schema_validate" ], "dom_document_schema_validate_file": [ "bool dom_document_schema_validate_file(string filename); */", "PHP_FUNCTION(dom_document_schema_validate_file) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_schema_validate_file" ], "dom_document_validate": [ "bool dom_document_validate()", "Since: DOM extended" ], "dom_document_xinclude": [ "int dom_document_xinclude([int options])", "Substitutues xincludes in a DomDocument" ], "dom_domconfiguration_can_set_parameter": [ "bool dom_domconfiguration_can_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-canSetParameter Since:" ], "dom_domconfiguration_get_parameter": [ "domdomuserdata dom_domconfiguration_get_parameter(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-getParameter Since:" ], "dom_domconfiguration_set_parameter": [ "dom_void dom_domconfiguration_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-property Since:" ], "dom_domerrorhandler_handle_error": [ "dom_bool dom_domerrorhandler_handle_error(domerror error)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-ERRORS-DOMErrorHandler-handleError Since:" ], "dom_domimplementation_create_document": [ "DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocument Since: DOM Level 2" ], "dom_domimplementation_create_document_type": [ "DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocType Since: DOM Level 2" ], "dom_domimplementation_get_feature": [ "DOMNode dom_domimplementation_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementation3-getFeature Since: DOM Level 3" ], "dom_domimplementation_has_feature": [ "bool dom_domimplementation_has_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-5CED94D7 Since:" ], "dom_domimplementationlist_item": [ "domdomimplementation dom_domimplementationlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-item Since:" ], "dom_domimplementationsource_get_domimplementation": [ "domdomimplementation dom_domimplementationsource_get_domimplementation(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpl Since:" ], "dom_domimplementationsource_get_domimplementations": [ "domimplementationlist dom_domimplementationsource_get_domimplementations(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpls Since:" ], "dom_domstringlist_item": [ "domstring dom_domstringlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-item Since:" ], "dom_element_get_attribute": [ "string dom_element_get_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-666EE0F9 Since:" ], "dom_element_get_attribute_node": [ "DOMAttr dom_element_get_attribute_node(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-217A91B8 Since:" ], "dom_element_get_attribute_node_ns": [ "DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAtNodeNS Since: DOM Level 2" ], "dom_element_get_attribute_ns": [ "string dom_element_get_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAttrNS Since: DOM Level 2" ], "dom_element_get_elements_by_tag_name": [ "DOMNodeList dom_element_get_elements_by_tag_name(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1938918D Since:" ], "dom_element_get_elements_by_tag_name_ns": [ "DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C90942 Since: DOM Level 2" ], "dom_element_has_attribute": [ "bool dom_element_has_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttr Since: DOM Level 2" ], "dom_element_has_attribute_ns": [ "bool dom_element_has_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttrNS Since: DOM Level 2" ], "dom_element_remove_attribute": [ "void dom_element_remove_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6D6AC0F9 Since:" ], "dom_element_remove_attribute_node": [ "DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D589198 Since:" ], "dom_element_remove_attribute_ns": [ "void dom_element_remove_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElRemAtNS Since: DOM Level 2" ], "dom_element_set_attribute": [ "void dom_element_set_attribute(string name, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68F082 Since:" ], "dom_element_set_attribute_node": [ "DOMAttr dom_element_set_attribute_node(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-887236154 Since:" ], "dom_element_set_attribute_node_ns": [ "DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAtNodeNS Since: DOM Level 2" ], "dom_element_set_attribute_ns": [ "void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAttrNS Since: DOM Level 2" ], "dom_element_set_id_attribute": [ "void dom_element_set_id_attribute(string name, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttr Since: DOM Level 3" ], "dom_element_set_id_attribute_node": [ "void dom_element_set_id_attribute_node(attr idAttr, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNode Since: DOM Level 3" ], "dom_element_set_id_attribute_ns": [ "void dom_element_set_id_attribute_ns(string namespaceURI, string localName, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNS Since: DOM Level 3" ], "dom_import_simplexml": [ "somNode dom_import_simplexml(sxeobject node)", "Get a simplexml_element object from dom to allow for processing" ], "dom_namednodemap_get_named_item": [ "DOMNode dom_namednodemap_get_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1074577549 Since:" ], "dom_namednodemap_get_named_item_ns": [ "DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_item": [ "DOMNode dom_namednodemap_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-349467F9 Since:" ], "dom_namednodemap_remove_named_item": [ "DOMNode dom_namednodemap_remove_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D58B193 Since:" ], "dom_namednodemap_remove_named_item_ns": [ "DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-removeNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_set_named_item": [ "DOMNode dom_namednodemap_set_named_item(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1025163788 Since:" ], "dom_namednodemap_set_named_item_ns": [ "DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-setNamedItemNS Since: DOM Level 2" ], "dom_namelist_get_name": [ "string dom_namelist_get_name(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getName Since:" ], "dom_namelist_get_namespace_uri": [ "string dom_namelist_get_namespace_uri(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getNamespaceURI Since:" ], "dom_node_append_child": [ "DomNode dom_node_append_child(DomNode newChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-184E7107 Since:" ], "dom_node_clone_node": [ "DomNode dom_node_clone_node(bool deep)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3A0ED0A4 Since:" ], "dom_node_compare_document_position": [ "short dom_node_compare_document_position(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-compareDocumentPosition Since: DOM Level 3" ], "dom_node_get_feature": [ "DomNode dom_node_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getFeature Since: DOM Level 3" ], "dom_node_get_user_data": [ "mixed dom_node_get_user_data(string key)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getUserData Since: DOM Level 3" ], "dom_node_has_attributes": [ "bool dom_node_has_attributes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeHasAttrs Since: DOM Level 2" ], "dom_node_has_child_nodes": [ "bool dom_node_has_child_nodes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-810594187 Since:" ], "dom_node_insert_before": [ "domnode dom_node_insert_before(DomNode newChild, DomNode refChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-952280727 Since:" ], "dom_node_is_default_namespace": [ "bool dom_node_is_default_namespace(string namespaceURI)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace Since: DOM Level 3" ], "dom_node_is_equal_node": [ "bool dom_node_is_equal_node(DomNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isEqualNode Since: DOM Level 3" ], "dom_node_is_same_node": [ "bool dom_node_is_same_node(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isSameNode Since: DOM Level 3" ], "dom_node_is_supported": [ "bool dom_node_is_supported(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Level-2-Core-Node-supports Since: DOM Level 2" ], "dom_node_lookup_namespace_uri": [ "string dom_node_lookup_namespace_uri(string prefix)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI Since: DOM Level 3" ], "dom_node_lookup_prefix": [ "string dom_node_lookup_prefix(string namespaceURI)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-lookupNamespacePrefix Since: DOM Level 3" ], "dom_node_normalize": [ "void dom_node_normalize()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-normalize Since:" ], "dom_node_remove_child": [ "DomNode dom_node_remove_child(DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1734834066 Since:" ], "dom_node_replace_child": [ "DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-785887307 Since:" ], "dom_node_set_user_data": [ "mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-setUserData Since: DOM Level 3" ], "dom_nodelist_item": [ "DOMNode dom_nodelist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-844377136 Since:" ], "dom_string_extend_find_offset16": [ "int dom_string_extend_find_offset16(int offset32)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset16 Since:" ], "dom_string_extend_find_offset32": [ "int dom_string_extend_find_offset32(int offset16)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset32 Since:" ], "dom_text_is_whitespace_in_element_content": [ "bool dom_text_is_whitespace_in_element_content()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent Since: DOM Level 3" ], "dom_text_replace_whole_text": [ "DOMText dom_text_replace_whole_text(string content)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText Since: DOM Level 3" ], "dom_text_split_text": [ "DOMText dom_text_split_text(int offset)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D Since:" ], "dom_userdatahandler_handle": [ "dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-handleUserDataEvent Since:" ], "dom_xpath_evaluate": [ "mixed dom_xpath_evaluate(string expr [,DOMNode context])", "" ], "dom_xpath_query": [ "DOMNodeList dom_xpath_query(string expr [,DOMNode context])", "" ], "dom_xpath_register_ns": [ "bool dom_xpath_register_ns(string prefix, string uri)", "" ], "dom_xpath_register_php_functions": [ "void dom_xpath_register_php_functions()", "" ], "each": [ "array each(array arr)", "Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element" ], "easter_date": [ "int easter_date([int year])", "Return the timestamp of midnight on Easter of a given year (defaults to current year)" ], "easter_days": [ "int easter_days([int year, [int method]])", "Return the number of days after March 21 that Easter falls on for a given year (defaults to current year)" ], "echo": [ "void echo(string arg1 [, string ...])", "Output one or more strings" ], "empty": [ "bool empty(mixed var)", "Determine whether a variable is empty" ], "enchant_broker_describe": [ "array enchant_broker_describe(resource broker)", "Enumerates the Enchant providers and tells you some rudimentary information about them. The same info is provided through phpinfo()" ], "enchant_broker_dict_exists": [ "bool enchant_broker_dict_exists(resource broker, string tag)", "Whether a dictionary exists or not. Using non-empty tag" ], "enchant_broker_free": [ "bool enchant_broker_free(resource broker)", "Destroys the broker object and its dictionnaries" ], "enchant_broker_free_dict": [ "resource enchant_broker_free_dict(resource dict)", "Free the dictionary resource" ], "enchant_broker_get_dict_path": [ "string enchant_broker_get_dict_path(resource broker, int dict_type)", "Get the directory path for a given backend, works with ispell and myspell" ], "enchant_broker_get_error": [ "string enchant_broker_get_error(resource broker)", "Returns the last error of the broker" ], "enchant_broker_init": [ "resource enchant_broker_init()", "create a new broker object capable of requesting" ], "enchant_broker_list_dicts": [ "string enchant_broker_list_dicts(resource broker)", "Lists the dictionaries available for the given broker" ], "enchant_broker_request_dict": [ "resource enchant_broker_request_dict(resource broker, string tag)", "create a new dictionary using tag, the non-empty language tag you wish to request a dictionary for (\"en_US\", \"de_DE\", ...)" ], "enchant_broker_request_pwl_dict": [ "resource enchant_broker_request_pwl_dict(resource broker, string filename)", "creates a dictionary using a PWL file. A PWL file is personal word file one word per line. It must exist before the call." ], "enchant_broker_set_dict_path": [ "bool enchant_broker_set_dict_path(resource broker, int dict_type, string value)", "Set the directory path for a given backend, works with ispell and myspell" ], "enchant_broker_set_ordering": [ "bool enchant_broker_set_ordering(resource broker, string tag, string ordering)", "Declares a preference of dictionaries to use for the language described/referred to by 'tag'. The ordering is a comma delimited list of provider names. As a special exception, the \"*\" tag can be used as a language tag to declare a default ordering for any language that does not explictly declare an ordering." ], "enchant_dict_add_to_personal": [ "void enchant_dict_add_to_personal(resource dict, string word)", "add 'word' to personal word list" ], "enchant_dict_add_to_session": [ "void enchant_dict_add_to_session(resource dict, string word)", "add 'word' to this spell-checking session" ], "enchant_dict_check": [ "bool enchant_dict_check(resource dict, string word)", "If the word is correctly spelled return true, otherwise return false" ], "enchant_dict_describe": [ "array enchant_dict_describe(resource dict)", "Describes an individual dictionary 'dict'" ], "enchant_dict_get_error": [ "string enchant_dict_get_error(resource dict)", "Returns the last error of the current spelling-session" ], "enchant_dict_is_in_session": [ "bool enchant_dict_is_in_session(resource dict, string word)", "whether or not 'word' exists in this spelling-session" ], "enchant_dict_quick_check": [ "bool enchant_dict_quick_check(resource dict, string word [, array &suggestions])", "If the word is correctly spelled return true, otherwise return false, if suggestions variable is provided, fill it with spelling alternatives." ], "enchant_dict_store_replacement": [ "void enchant_dict_store_replacement(resource dict, string mis, string cor)", "add a correction for 'mis' using 'cor'. Notes that you replaced @mis with @cor, so it's possibly more likely that future occurrences of @mis will be replaced with @cor. So it might bump @cor up in the suggestion list." ], "enchant_dict_suggest": [ "array enchant_dict_suggest(resource dict, string word)", "Will return a list of values if any of those pre-conditions are not met." ], "end": [ "mixed end(array array_arg)", "Advances array argument's internal pointer to the last element and return it" ], "ereg": [ "int ereg(string pattern, string string [, array registers])", "Regular expression match" ], "ereg_replace": [ "string ereg_replace(string pattern, string replacement, string string)", "Replace regular expression" ], "eregi": [ "int eregi(string pattern, string string [, array registers])", "Case-insensitive regular expression match" ], "eregi_replace": [ "string eregi_replace(string pattern, string replacement, string string)", "Case insensitive replace regular expression" ], "error_get_last": [ "array error_get_last()", "Get the last occurred error as associative array. Returns NULL if there hasn't been an error yet." ], "error_log": [ "bool error_log(string message [, int message_type [, string destination [, string extra_headers]]])", "Send an error message somewhere" ], "error_reporting": [ "int error_reporting([int new_error_level])", "Return the current error_reporting level, and if an argument was passed - change to the new level" ], "escapeshellarg": [ "string escapeshellarg(string arg)", "Quote and escape an argument for use in a shell command" ], "escapeshellcmd": [ "string escapeshellcmd(string command)", "Escape shell metacharacters" ], "exec": [ "string exec(string command [, array &output [, int &return_value]])", "Execute an external program" ], "exif_imagetype": [ "int exif_imagetype(string imagefile)", "Get the type of an image" ], "exif_read_data": [ "array exif_read_data(string filename [, sections_needed [, sub_arrays[, read_thumbnail]]])", "Reads header data from the JPEG/TIFF image filename and optionally reads the internal thumbnails" ], "exif_tagname": [ "string exif_tagname(index)", "Get headername for index or false if not defined" ], "exif_thumbnail": [ "string exif_thumbnail(string filename [, &width, &height [, &imagetype]])", "Reads the embedded thumbnail" ], "exit": [ "void exit([mixed status])", "Output a message and terminate the current script" ], "exp": [ "float exp(float number)", "Returns e raised to the power of the number" ], "explode": [ "array explode(string separator, string str [, int limit])", "Splits a string on string separator and return array of components. If limit is positive only limit number of components is returned. If limit is negative all components except the last abs(limit) are returned." ], "expm1": [ "float expm1(float number)", "Returns exp(number) - 1, computed in a way that accurate even when the value of number is close to zero" ], "extension_loaded": [ "bool extension_loaded(string extension_name)", "Returns true if the named extension is loaded" ], "extract": [ "int extract(array var_array [, int extract_type [, string prefix]])", "Imports variables into symbol table from an array" ], "ezmlm_hash": [ "int ezmlm_hash(string addr)", "Calculate EZMLM list hash value." ], "fclose": [ "bool fclose(resource fp)", "Close an open file pointer" ], "feof": [ "bool feof(resource fp)", "Test for end-of-file on a file pointer" ], "fflush": [ "bool fflush(resource fp)", "Flushes output" ], "fgetc": [ "string fgetc(resource fp)", "Get a character from file pointer" ], "fgetcsv": [ "array fgetcsv(resource fp [,int length [, string delimiter [, string enclosure [, string escape]]]])", "Get line from file pointer and parse for CSV fields" ], "fgets": [ "string fgets(resource fp[, int length])", "Get a line from file pointer" ], "fgetss": [ "string fgetss(resource fp [, int length [, string allowable_tags]])", "Get a line from file pointer and strip HTML tags" ], "file": [ "array file(string filename [, int flags[, resource context]])", "Read entire file into an array" ], "file_exists": [ "bool file_exists(string filename)", "Returns true if filename exists" ], "file_get_contents": [ "string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])", "Read the entire file into a string" ], "file_put_contents": [ "int file_put_contents(string file, mixed data [, int flags [, resource context]])", "Write/Create a file with contents data and return the number of bytes written" ], "fileatime": [ "int fileatime(string filename)", "Get last access time of file" ], "filectime": [ "int filectime(string filename)", "Get inode modification time of file" ], "filegroup": [ "int filegroup(string filename)", "Get file group" ], "fileinode": [ "int fileinode(string filename)", "Get file inode" ], "filemtime": [ "int filemtime(string filename)", "Get last modification time of file" ], "fileowner": [ "int fileowner(string filename)", "Get file owner" ], "fileperms": [ "int fileperms(string filename)", "Get file permissions" ], "filesize": [ "int filesize(string filename)", "Get file size" ], "filetype": [ "string filetype(string filename)", "Get file type" ], "filter_has_var": [ "mixed filter_has_var(constant type, string variable_name)", "* Returns true if the variable with the name 'name' exists in source." ], "filter_input": [ "mixed filter_input(constant type, string variable_name [, long filter [, mixed options]])", "* Returns the filtered variable 'name'* from source `type`." ], "filter_input_array": [ "mixed filter_input_array(constant type, [, mixed options]])", "* Returns an array with all arguments defined in 'definition'." ], "filter_var": [ "mixed filter_var(mixed variable [, long filter [, mixed options]])", "* Returns the filtered version of the vriable." ], "filter_var_array": [ "mixed filter_var_array(array data, [, mixed options]])", "* Returns an array with all arguments defined in 'definition'." ], "finfo_buffer": [ "string finfo_buffer(resource finfo, char *string [, int options [, resource context]])", "Return infromation about a string buffer." ], "finfo_close": [ "resource finfo_close(resource finfo)", "Close fileinfo resource." ], "finfo_file": [ "string finfo_file(resource finfo, char *file_name [, int options [, resource context]])", "Return information about a file." ], "finfo_open": [ "resource finfo_open([int options [, string arg]])", "Create a new fileinfo resource." ], "finfo_set_flags": [ "bool finfo_set_flags(resource finfo, int options)", "Set libmagic configuration options." ], "floatval": [ "float floatval(mixed var)", "Get the float value of a variable" ], "flock": [ "bool flock(resource fp, int operation [, int &wouldblock])", "Portable file locking" ], "floor": [ "float floor(float number)", "Returns the next lowest integer value from the number" ], "flush": [ "void flush()", "Flush the output buffer" ], "fmod": [ "float fmod(float x, float y)", "Returns the remainder of dividing x by y as a float" ], "fnmatch": [ "bool fnmatch(string pattern, string filename [, int flags])", "Match filename against pattern" ], "fopen": [ "resource fopen(string filename, string mode [, bool use_include_path [, resource context]])", "Open a file or a URL and return a file pointer" ], "forward_static_call": [ "mixed forward_static_call(mixed function_name [, mixed parmeter] [, mixed ...])", "Call a user function which is the first parameter" ], "fpassthru": [ "int fpassthru(resource fp)", "Output all remaining data from a file pointer" ], "fprintf": [ "int fprintf(resource stream, string format [, mixed arg1 [, mixed ...]])", "Output a formatted string into a stream" ], "fputcsv": [ "int fputcsv(resource fp, array fields [, string delimiter [, string enclosure]])", "Format line as CSV and write to file pointer" ], "fread": [ "string fread(resource fp, int length)", "Binary-safe file read" ], "frenchtojd": [ "int frenchtojd(int month, int day, int year)", "Converts a french republic calendar date to julian day count" ], "fscanf": [ "mixed fscanf(resource stream, string format [, string ...])", "Implements a mostly ANSI compatible fscanf()" ], "fseek": [ "int fseek(resource fp, int offset [, int whence])", "Seek on a file pointer" ], "fsockopen": [ "resource fsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]])", "Open Internet or Unix domain socket connection" ], "fstat": [ "array fstat(resource fp)", "Stat() on a filehandle" ], "ftell": [ "int ftell(resource fp)", "Get file pointer's read/write position" ], "ftok": [ "int ftok(string pathname, string proj)", "Convert a pathname and a project identifier to a System V IPC key" ], "ftp_alloc": [ "bool ftp_alloc(resource stream, int size[, &response])", "Attempt to allocate space on the remote FTP server" ], "ftp_cdup": [ "bool ftp_cdup(resource stream)", "Changes to the parent directory" ], "ftp_chdir": [ "bool ftp_chdir(resource stream, string directory)", "Changes directories" ], "ftp_chmod": [ "int ftp_chmod(resource stream, int mode, string filename)", "Sets permissions on a file" ], "ftp_close": [ "bool ftp_close(resource stream)", "Closes the FTP stream" ], "ftp_connect": [ "resource ftp_connect(string host [, int port [, int timeout]])", "Opens a FTP stream" ], "ftp_delete": [ "bool ftp_delete(resource stream, string file)", "Deletes a file" ], "ftp_exec": [ "bool ftp_exec(resource stream, string command)", "Requests execution of a program on the FTP server" ], "ftp_fget": [ "bool ftp_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])", "Retrieves a file from the FTP server and writes it to an open file" ], "ftp_fput": [ "bool ftp_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])", "Stores a file from an open file to the FTP server" ], "ftp_get": [ "bool ftp_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])", "Retrieves a file from the FTP server and writes it to a local file" ], "ftp_get_option": [ "mixed ftp_get_option(resource stream, int option)", "Gets an FTP option" ], "ftp_login": [ "bool ftp_login(resource stream, string username, string password)", "Logs into the FTP server" ], "ftp_mdtm": [ "int ftp_mdtm(resource stream, string filename)", "Returns the last modification time of the file, or -1 on error" ], "ftp_mkdir": [ "string ftp_mkdir(resource stream, string directory)", "Creates a directory and returns the absolute path for the new directory or false on error" ], "ftp_nb_continue": [ "int ftp_nb_continue(resource stream)", "Continues retrieving/sending a file nbronously" ], "ftp_nb_fget": [ "int ftp_nb_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])", "Retrieves a file from the FTP server asynchronly and writes it to an open file" ], "ftp_nb_fput": [ "int ftp_nb_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])", "Stores a file from an open file to the FTP server nbronly" ], "ftp_nb_get": [ "int ftp_nb_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])", "Retrieves a file from the FTP server nbhronly and writes it to a local file" ], "ftp_nb_put": [ "int ftp_nb_put(resource stream, string remote_file, string local_file, int mode[, int startpos])", "Stores a file on the FTP server" ], "ftp_nlist": [ "array ftp_nlist(resource stream, string directory)", "Returns an array of filenames in the given directory" ], "ftp_pasv": [ "bool ftp_pasv(resource stream, bool pasv)", "Turns passive mode on or off" ], "ftp_put": [ "bool ftp_put(resource stream, string remote_file, string local_file, int mode[, int startpos])", "Stores a file on the FTP server" ], "ftp_pwd": [ "string ftp_pwd(resource stream)", "Returns the present working directory" ], "ftp_raw": [ "array ftp_raw(resource stream, string command)", "Sends a literal command to the FTP server" ], "ftp_rawlist": [ "array ftp_rawlist(resource stream, string directory [, bool recursive])", "Returns a detailed listing of a directory as an array of output lines" ], "ftp_rename": [ "bool ftp_rename(resource stream, string src, string dest)", "Renames the given file to a new path" ], "ftp_rmdir": [ "bool ftp_rmdir(resource stream, string directory)", "Removes a directory" ], "ftp_set_option": [ "bool ftp_set_option(resource stream, int option, mixed value)", "Sets an FTP option" ], "ftp_site": [ "bool ftp_site(resource stream, string cmd)", "Sends a SITE command to the server" ], "ftp_size": [ "int ftp_size(resource stream, string filename)", "Returns the size of the file, or -1 on error" ], "ftp_ssl_connect": [ "resource ftp_ssl_connect(string host [, int port [, int timeout]])", "Opens a FTP-SSL stream" ], "ftp_systype": [ "string ftp_systype(resource stream)", "Returns the system type identifier" ], "ftruncate": [ "bool ftruncate(resource fp, int size)", "Truncate file to 'size' length" ], "func_get_arg": [ "mixed func_get_arg(int arg_num)", "Get the $arg_num'th argument that was passed to the function" ], "func_get_args": [ "array func_get_args()", "Get an array of the arguments that were passed to the function" ], "func_num_args": [ "int func_num_args()", "Get the number of arguments that were passed to the function" ], "function ": ["", ""], "foreach ": ["", ""], "function_exists": [ "bool function_exists(string function_name)", "Checks if the function exists" ], "fwrite": [ "int fwrite(resource fp, string str [, int length])", "Binary-safe file write" ], "gc_collect_cycles": [ "int gc_collect_cycles()", "Forces collection of any existing garbage cycles. Returns number of freed zvals" ], "gc_disable": [ "void gc_disable()", "Deactivates the circular reference collector" ], "gc_enable": [ "void gc_enable()", "Activates the circular reference collector" ], "gc_enabled": [ "void gc_enabled()", "Returns status of the circular reference collector" ], "gd_info": [ "array gd_info()", "" ], "getKeywords": [ "static array getKeywords(string $locale) {", "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array * }}}" ], "get_browser": [ "mixed get_browser([string browser_name [, bool return_array]])", "Get information about the capabilities of a browser. If browser_name is omitted or null, HTTP_USER_AGENT is used. Returns an object by default; if return_array is true, returns an array." ], "get_called_class": [ "string get_called_class()", "Retrieves the \"Late Static Binding\" class name" ], "get_cfg_var": [ "mixed get_cfg_var(string option_name)", "Get the value of a PHP configuration option" ], "get_class": [ "string get_class([object object])", "Retrieves the class name" ], "get_class_methods": [ "array get_class_methods(mixed class)", "Returns an array of method names for class or class instance." ], "get_class_vars": [ "array get_class_vars(string class_name)", "Returns an array of default properties of the class." ], "get_current_user": [ "string get_current_user()", "Get the name of the owner of the current PHP script" ], "get_declared_classes": [ "array get_declared_classes()", "Returns an array of all declared classes." ], "get_declared_interfaces": [ "array get_declared_interfaces()", "Returns an array of all declared interfaces." ], "get_defined_constants": [ "array get_defined_constants([bool categorize])", "Return an array containing the names and values of all defined constants" ], "get_defined_functions": [ "array get_defined_functions()", "Returns an array of all defined functions" ], "get_defined_vars": [ "array get_defined_vars()", "Returns an associative array of names and values of all currently defined variable names (variables in the current scope)" ], "get_display_language": [ "static string get_display_language($locale[, $in_locale = null])", "* gets the language for the $locale in $in_locale or default_locale" ], "get_display_name": [ "static string get_display_name($locale[, $in_locale = null])", "* gets the name for the $locale in $in_locale or default_locale" ], "get_display_region": [ "static string get_display_region($locale, $in_locale = null)", "* gets the region for the $locale in $in_locale or default_locale" ], "get_display_script": [ "static string get_display_script($locale, $in_locale = null)", "* gets the script for the $locale in $in_locale or default_locale" ], "get_extension_funcs": [ "array get_extension_funcs(string extension_name)", "Returns an array with the names of functions belonging to the named extension" ], "get_headers": [ "array get_headers(string url[, int format])", "fetches all the headers sent by the server in response to a HTTP request" ], "get_html_translation_table": [ "array get_html_translation_table([int table [, int quote_style]])", "Returns the internal translation table used by htmlspecialchars and htmlentities" ], "get_include_path": [ "string get_include_path()", "Get the current include_path configuration option" ], "get_included_files": [ "array get_included_files()", "Returns an array with the file names that were include_once()'d" ], "get_loaded_extensions": [ "array get_loaded_extensions([bool zend_extensions])", "Return an array containing names of loaded extensions" ], "get_magic_quotes_gpc": [ "int get_magic_quotes_gpc()", "Get the current active configuration setting of magic_quotes_gpc" ], "get_magic_quotes_runtime": [ "int get_magic_quotes_runtime()", "Get the current active configuration setting of magic_quotes_runtime" ], "get_meta_tags": [ "array get_meta_tags(string filename [, bool use_include_path])", "Extracts all meta tag content attributes from a file and returns an array" ], "get_object_vars": [ "array get_object_vars(object obj)", "Returns an array of object properties" ], "get_parent_class": [ "string get_parent_class([mixed object])", "Retrieves the parent class name for object or class or current scope." ], "get_resource_type": [ "string get_resource_type(resource res)", "Get the resource type name for a given resource" ], "getallheaders": [ "array getallheaders()", "" ], "getcwd": [ "mixed getcwd()", "Gets the current directory" ], "getdate": [ "array getdate([int timestamp])", "Get date/time information" ], "getenv": [ "string getenv(string varname)", "Get the value of an environment variable" ], "gethostbyaddr": [ "string gethostbyaddr(string ip_address)", "Get the Internet host name corresponding to a given IP address" ], "gethostbyname": [ "string gethostbyname(string hostname)", "Get the IP address corresponding to a given Internet host name" ], "gethostbynamel": [ "array gethostbynamel(string hostname)", "Return a list of IP addresses that a given hostname resolves to." ], "gethostname": [ "string gethostname()", "Get the host name of the current machine" ], "getimagesize": [ "array getimagesize(string imagefile [, array info])", "Get the size of an image as 4-element array" ], "getlastmod": [ "int getlastmod()", "Get time of last page modification" ], "getmygid": [ "int getmygid()", "Get PHP script owner's GID" ], "getmyinode": [ "int getmyinode()", "Get the inode of the current script being parsed" ], "getmypid": [ "int getmypid()", "Get current process ID" ], "getmyuid": [ "int getmyuid()", "Get PHP script owner's UID" ], "getopt": [ "array getopt(string options [, array longopts])", "Get options from the command line argument list" ], "getprotobyname": [ "int getprotobyname(string name)", "Returns protocol number associated with name as per /etc/protocols" ], "getprotobynumber": [ "string getprotobynumber(int proto)", "Returns protocol name associated with protocol number proto" ], "getrandmax": [ "int getrandmax()", "Returns the maximum value a random number can have" ], "getrusage": [ "array getrusage([int who])", "Returns an array of usage statistics" ], "getservbyname": [ "int getservbyname(string service, string protocol)", "Returns port associated with service. Protocol must be \"tcp\" or \"udp\"" ], "getservbyport": [ "string getservbyport(int port, string protocol)", "Returns service name associated with port. Protocol must be \"tcp\" or \"udp\"" ], "gettext": [ "string gettext(string msgid)", "Return the translation of msgid for the current domain, or msgid unaltered if a translation does not exist" ], "gettimeofday": [ "array gettimeofday([bool get_as_float])", "Returns the current time as array" ], "gettype": [ "string gettype(mixed var)", "Returns the type of the variable" ], "glob": [ "array glob(string pattern [, int flags])", "Find pathnames matching a pattern" ], "gmdate": [ "string gmdate(string format [, long timestamp])", "Format a GMT date/time" ], "gmmktime": [ "int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])", "Get UNIX timestamp for a GMT date" ], "gmp_abs": [ "resource gmp_abs(resource a)", "Calculates absolute value" ], "gmp_add": [ "resource gmp_add(resource a, resource b)", "Add a and b" ], "gmp_and": [ "resource gmp_and(resource a, resource b)", "Calculates logical AND of a and b" ], "gmp_clrbit": [ "void gmp_clrbit(resource &a, int index)", "Clears bit in a" ], "gmp_cmp": [ "int gmp_cmp(resource a, resource b)", "Compares two numbers" ], "gmp_com": [ "resource gmp_com(resource a)", "Calculates one's complement of a" ], "gmp_div_q": [ "resource gmp_div_q(resource a, resource b [, int round])", "Divide a by b, returns quotient only" ], "gmp_div_qr": [ "array gmp_div_qr(resource a, resource b [, int round])", "Divide a by b, returns quotient and reminder" ], "gmp_div_r": [ "resource gmp_div_r(resource a, resource b [, int round])", "Divide a by b, returns reminder only" ], "gmp_divexact": [ "resource gmp_divexact(resource a, resource b)", "Divide a by b using exact division algorithm" ], "gmp_fact": [ "resource gmp_fact(int a)", "Calculates factorial function" ], "gmp_gcd": [ "resource gmp_gcd(resource a, resource b)", "Computes greatest common denominator (gcd) of a and b" ], "gmp_gcdext": [ "array gmp_gcdext(resource a, resource b)", "Computes G, S, and T, such that AS + BT = G = `gcd' (A, B)" ], "gmp_hamdist": [ "int gmp_hamdist(resource a, resource b)", "Calculates hamming distance between a and b" ], "gmp_init": [ "resource gmp_init(mixed number [, int base])", "Initializes GMP number" ], "gmp_intval": [ "int gmp_intval(resource gmpnumber)", "Gets signed long value of GMP number" ], "gmp_invert": [ "resource gmp_invert(resource a, resource b)", "Computes the inverse of a modulo b" ], "gmp_jacobi": [ "int gmp_jacobi(resource a, resource b)", "Computes Jacobi symbol" ], "gmp_legendre": [ "int gmp_legendre(resource a, resource b)", "Computes Legendre symbol" ], "gmp_mod": [ "resource gmp_mod(resource a, resource b)", "Computes a modulo b" ], "gmp_mul": [ "resource gmp_mul(resource a, resource b)", "Multiply a and b" ], "gmp_neg": [ "resource gmp_neg(resource a)", "Negates a number" ], "gmp_nextprime": [ "resource gmp_nextprime(resource a)", "Finds next prime of a" ], "gmp_or": [ "resource gmp_or(resource a, resource b)", "Calculates logical OR of a and b" ], "gmp_perfect_square": [ "bool gmp_perfect_square(resource a)", "Checks if a is an exact square" ], "gmp_popcount": [ "int gmp_popcount(resource a)", "Calculates the population count of a" ], "gmp_pow": [ "resource gmp_pow(resource base, int exp)", "Raise base to power exp" ], "gmp_powm": [ "resource gmp_powm(resource base, resource exp, resource mod)", "Raise base to power exp and take result modulo mod" ], "gmp_prob_prime": [ "int gmp_prob_prime(resource a[, int reps])", "Checks if a is \"probably prime\"" ], "gmp_random": [ "resource gmp_random([int limiter])", "Gets random number" ], "gmp_scan0": [ "int gmp_scan0(resource a, int start)", "Finds first zero bit" ], "gmp_scan1": [ "int gmp_scan1(resource a, int start)", "Finds first non-zero bit" ], "gmp_setbit": [ "void gmp_setbit(resource &a, int index[, bool set_clear])", "Sets or clear bit in a" ], "gmp_sign": [ "int gmp_sign(resource a)", "Gets the sign of the number" ], "gmp_sqrt": [ "resource gmp_sqrt(resource a)", "Takes integer part of square root of a" ], "gmp_sqrtrem": [ "array gmp_sqrtrem(resource a)", "Square root with remainder" ], "gmp_strval": [ "string gmp_strval(resource gmpnumber [, int base])", "Gets string representation of GMP number" ], "gmp_sub": [ "resource gmp_sub(resource a, resource b)", "Subtract b from a" ], "gmp_testbit": [ "bool gmp_testbit(resource a, int index)", "Tests if bit is set in a" ], "gmp_xor": [ "resource gmp_xor(resource a, resource b)", "Calculates logical exclusive OR of a and b" ], "gmstrftime": [ "string gmstrftime(string format [, int timestamp])", "Format a GMT/UCT time/date according to locale settings" ], "grapheme_extract": [ "string grapheme_extract(string str, int size[, int extract_type[, int start[, int next]]])", "Function to extract a sequence of default grapheme clusters" ], "grapheme_stripos": [ "int grapheme_stripos(string haystack, string needle [, int offset ])", "Find position of first occurrence of a string within another, ignoring case differences" ], "grapheme_stristr": [ "string grapheme_stristr(string haystack, string needle[, bool part])", "Finds first occurrence of a string within another" ], "grapheme_strlen": [ "int grapheme_strlen(string str)", "Get number of graphemes in a string" ], "grapheme_strpos": [ "int grapheme_strpos(string haystack, string needle [, int offset ])", "Find position of first occurrence of a string within another" ], "grapheme_strripos": [ "int grapheme_strripos(string haystack, string needle [, int offset])", "Find position of last occurrence of a string within another, ignoring case" ], "grapheme_strrpos": [ "int grapheme_strrpos(string haystack, string needle [, int offset])", "Find position of last occurrence of a string within another" ], "grapheme_strstr": [ "string grapheme_strstr(string haystack, string needle[, bool part])", "Finds first occurrence of a string within another" ], "grapheme_substr": [ "string grapheme_substr(string str, int start [, int length])", "Returns part of a string" ], "gregoriantojd": [ "int gregoriantojd(int month, int day, int year)", "Converts a gregorian calendar date to julian day count" ], "gzcompress": [ "string gzcompress(string data [, int level])", "Gzip-compress a string" ], "gzdeflate": [ "string gzdeflate(string data [, int level])", "Gzip-compress a string" ], "gzencode": [ "string gzencode(string data [, int level [, int encoding_mode]])", "GZ encode a string" ], "gzfile": [ "array gzfile(string filename [, int use_include_path])", "Read und uncompress entire .gz-file into an array" ], "gzinflate": [ "string gzinflate(string data [, int length])", "Unzip a gzip-compressed string" ], "gzopen": [ "resource gzopen(string filename, string mode [, int use_include_path])", "Open a .gz-file and return a .gz-file pointer" ], "gzuncompress": [ "string gzuncompress(string data [, int length])", "Unzip a gzip-compressed string" ], "hash": [ "string hash(string algo, string data[, bool raw_output = false])", "Generate a hash of a given input string Returns lowercase hexits by default" ], "hash_algos": [ "array hash_algos()", "Return a list of registered hashing algorithms" ], "hash_copy": [ "resource hash_copy(resource context)", "Copy hash resource" ], "hash_file": [ "string hash_file(string algo, string filename[, bool raw_output = false])", "Generate a hash of a given file Returns lowercase hexits by default" ], "hash_final": [ "string hash_final(resource context[, bool raw_output=false])", "Output resulting digest" ], "hash_hmac": [ "string hash_hmac(string algo, string data, string key[, bool raw_output = false])", "Generate a hash of a given input string with a key using HMAC Returns lowercase hexits by default" ], "hash_hmac_file": [ "string hash_hmac_file(string algo, string filename, string key[, bool raw_output = false])", "Generate a hash of a given file with a key using HMAC Returns lowercase hexits by default" ], "hash_init": [ "resource hash_init(string algo[, int options, string key])", "Initialize a hashing context" ], "hash_update": [ "bool hash_update(resource context, string data)", "Pump data into the hashing algorithm" ], "hash_update_file": [ "bool hash_update_file(resource context, string filename[, resource context])", "Pump data into the hashing algorithm from a file" ], "hash_update_stream": [ "int hash_update_stream(resource context, resource handle[, integer length])", "Pump data into the hashing algorithm from an open stream" ], "header": [ "void header(string header [, bool replace, [int http_response_code]])", "Sends a raw HTTP header" ], "header_remove": [ "void header_remove([string name])", "Removes an HTTP header previously set using header()" ], "headers_list": [ "array headers_list()", "Return list of headers to be sent / already sent" ], "headers_sent": [ "bool headers_sent([string &$file [, int &$line]])", "Returns true if headers have already been sent, false otherwise" ], "hebrev": [ "string hebrev(string str [, int max_chars_per_line])", "Converts logical Hebrew text to visual text" ], "hebrevc": [ "string hebrevc(string str [, int max_chars_per_line])", "Converts logical Hebrew text to visual text with newline conversion" ], "hexdec": [ "int hexdec(string hexadecimal_number)", "Returns the decimal equivalent of the hexadecimal number" ], "highlight_file": [ "bool highlight_file(string file_name [, bool return] )", "Syntax highlight a source file" ], "highlight_string": [ "bool highlight_string(string string [, bool return] )", "Syntax highlight a string or optionally return it" ], "html_entity_decode": [ "string html_entity_decode(string string [, int quote_style][, string charset])", "Convert all HTML entities to their applicable characters" ], "htmlentities": [ "string htmlentities(string string [, int quote_style[, string charset[, bool double_encode]]])", "Convert all applicable characters to HTML entities" ], "htmlspecialchars": [ "string htmlspecialchars(string string [, int quote_style[, string charset[, bool double_encode]]])", "Convert special characters to HTML entities" ], "htmlspecialchars_decode": [ "string htmlspecialchars_decode(string string [, int quote_style])", "Convert special HTML entities back to characters" ], "http_build_query": [ "string http_build_query(mixed formdata [, string prefix [, string arg_separator]])", "Generates a form-encoded query string from an associative array or object." ], "hypot": [ "float hypot(float num1, float num2)", "Returns sqrt(num1*num1 + num2*num2)" ], "ibase_add_user": [ "bool ibase_add_user(resource service_handle, string user_name, string password [, string first_name [, string middle_name [, string last_name]]])", "Add a user to security database" ], "ibase_affected_rows": [ "int ibase_affected_rows( [ resource link_identifier ] )", "Returns the number of rows affected by the previous INSERT, UPDATE or DELETE statement" ], "ibase_backup": [ "mixed ibase_backup(resource service_handle, string source_db, string dest_file [, int options [, bool verbose]])", "Initiates a backup task in the service manager and returns immediately" ], "ibase_blob_add": [ "bool ibase_blob_add(resource blob_handle, string data)", "Add data into created blob" ], "ibase_blob_cancel": [ "bool ibase_blob_cancel(resource blob_handle)", "Cancel creating blob" ], "ibase_blob_close": [ "string ibase_blob_close(resource blob_handle)", "Close blob" ], "ibase_blob_create": [ "resource ibase_blob_create([resource link_identifier])", "Create blob for adding data" ], "ibase_blob_echo": [ "bool ibase_blob_echo([ resource link_identifier, ] string blob_id)", "Output blob contents to browser" ], "ibase_blob_get": [ "string ibase_blob_get(resource blob_handle, int len)", "Get len bytes data from open blob" ], "ibase_blob_import": [ "string ibase_blob_import([ resource link_identifier, ] resource file)", "Create blob, copy file in it, and close it" ], "ibase_blob_info": [ "array ibase_blob_info([ resource link_identifier, ] string blob_id)", "Return blob length and other useful info" ], "ibase_blob_open": [ "resource ibase_blob_open([ resource link_identifier, ] string blob_id)", "Open blob for retrieving data parts" ], "ibase_close": [ "bool ibase_close([resource link_identifier])", "Close an InterBase connection" ], "ibase_commit": [ "bool ibase_commit( resource link_identifier )", "Commit transaction" ], "ibase_commit_ret": [ "bool ibase_commit_ret( resource link_identifier )", "Commit transaction and retain the transaction context" ], "ibase_connect": [ "resource ibase_connect(string database [, string username [, string password [, string charset [, int buffers [, int dialect [, string role]]]]]])", "Open a connection to an InterBase database" ], "ibase_db_info": [ "string ibase_db_info(resource service_handle, string db, int action [, int argument])", "Request statistics about a database" ], "ibase_delete_user": [ "bool ibase_delete_user(resource service_handle, string user_name, string password [, string first_name [, string middle_name [, string last_name]]])", "Delete a user from security database" ], "ibase_drop_db": [ "bool ibase_drop_db([resource link_identifier])", "Drop an InterBase database" ], "ibase_errcode": [ "int ibase_errcode()", "Return error code" ], "ibase_errmsg": [ "string ibase_errmsg()", "Return error message" ], "ibase_execute": [ "mixed ibase_execute(resource query [, mixed bind_arg [, mixed bind_arg [, ...]]])", "Execute a previously prepared query" ], "ibase_fetch_assoc": [ "array ibase_fetch_assoc(resource result [, int fetch_flags])", "Fetch a row from the results of a query" ], "ibase_fetch_object": [ "object ibase_fetch_object(resource result [, int fetch_flags])", "Fetch a object from the results of a query" ], "ibase_fetch_row": [ "array ibase_fetch_row(resource result [, int fetch_flags])", "Fetch a row from the results of a query" ], "ibase_field_info": [ "array ibase_field_info(resource query_result, int field_number)", "Get information about a field" ], "ibase_free_event_handler": [ "bool ibase_free_event_handler(resource event)", "Frees the event handler set by ibase_set_event_handler()" ], "ibase_free_query": [ "bool ibase_free_query(resource query)", "Free memory used by a query" ], "ibase_free_result": [ "bool ibase_free_result(resource result)", "Free the memory used by a result" ], "ibase_gen_id": [ "int ibase_gen_id(string generator [, int increment [, resource link_identifier ]])", "Increments the named generator and returns its new value" ], "ibase_maintain_db": [ "bool ibase_maintain_db(resource service_handle, string db, int action [, int argument])", "Execute a maintenance command on the database server" ], "ibase_modify_user": [ "bool ibase_modify_user(resource service_handle, string user_name, string password [, string first_name [, string middle_name [, string last_name]]])", "Modify a user in security database" ], "ibase_name_result": [ "bool ibase_name_result(resource result, string name)", "Assign a name to a result for use with ... WHERE CURRENT OF <name> statements" ], "ibase_num_fields": [ "int ibase_num_fields(resource query_result)", "Get the number of fields in result" ], "ibase_num_params": [ "int ibase_num_params(resource query)", "Get the number of params in a prepared query" ], "ibase_num_rows": [ "int ibase_num_rows( resource result_identifier )", "Return the number of rows that are available in a result" ], "ibase_param_info": [ "array ibase_param_info(resource query, int field_number)", "Get information about a parameter" ], "ibase_pconnect": [ "resource ibase_pconnect(string database [, string username [, string password [, string charset [, int buffers [, int dialect [, string role]]]]]])", "Open a persistent connection to an InterBase database" ], "ibase_prepare": [ "resource ibase_prepare(resource link_identifier[, string query [, resource trans_identifier ]])", "Prepare a query for later execution" ], "ibase_query": [ "mixed ibase_query([resource link_identifier, [ resource link_identifier, ]] string query [, mixed bind_arg [, mixed bind_arg [, ...]]])", "Execute a query" ], "ibase_restore": [ "mixed ibase_restore(resource service_handle, string source_file, string dest_db [, int options [, bool verbose]])", "Initiates a restore task in the service manager and returns immediately" ], "ibase_rollback": [ "bool ibase_rollback( resource link_identifier )", "Rollback transaction" ], "ibase_rollback_ret": [ "bool ibase_rollback_ret( resource link_identifier )", "Rollback transaction and retain the transaction context" ], "ibase_server_info": [ "string ibase_server_info(resource service_handle, int action)", "Request information about a database server" ], "ibase_service_attach": [ "resource ibase_service_attach(string host, string dba_username, string dba_password)", "Connect to the service manager" ], "ibase_service_detach": [ "bool ibase_service_detach(resource service_handle)", "Disconnect from the service manager" ], "ibase_set_event_handler": [ "resource ibase_set_event_handler([resource link_identifier,] callback handler, string event [, string event [, ...]])", "Register the callback for handling each of the named events" ], "ibase_trans": [ "resource ibase_trans([int trans_args [, resource link_identifier [, ... ], int trans_args [, resource link_identifier [, ... ]] [, ...]]])", "Start a transaction over one or several databases" ], "ibase_wait_event": [ "string ibase_wait_event([resource link_identifier,] string event [, string event [, ...]])", "Waits for any one of the passed Interbase events to be posted by the database, and returns its name" ], "iconv": [ "string iconv(string in_charset, string out_charset, string str)", "Returns str converted to the out_charset character set" ], "iconv_get_encoding": [ "mixed iconv_get_encoding([string type])", "Get internal encoding and output encoding for ob_iconv_handler()" ], "iconv_mime_decode": [ "string iconv_mime_decode(string encoded_string [, int mode, string charset])", "Decodes a mime header field" ], "iconv_mime_decode_headers": [ "array iconv_mime_decode_headers(string headers [, int mode, string charset])", "Decodes multiple mime header fields" ], "iconv_mime_encode": [ "string iconv_mime_encode(string field_name, string field_value [, array preference])", "Composes a mime header field with field_name and field_value in a specified scheme" ], "iconv_set_encoding": [ "bool iconv_set_encoding(string type, string charset)", "Sets internal encoding and output encoding for ob_iconv_handler()" ], "iconv_strlen": [ "int iconv_strlen(string str [, string charset])", "Returns the character count of str" ], "iconv_strpos": [ "int iconv_strpos(string haystack, string needle [, int offset [, string charset]])", "Finds position of first occurrence of needle within part of haystack beginning with offset" ], "iconv_strrpos": [ "int iconv_strrpos(string haystack, string needle [, string charset])", "Finds position of last occurrence of needle within part of haystack beginning with offset" ], "iconv_substr": [ "string iconv_substr(string str, int offset, [int length, string charset])", "Returns specified part of a string" ], "idate": [ "int idate(string format [, int timestamp])", "Format a local time/date as integer" ], "idn_to_ascii": [ "int idn_to_ascii(string domain[, int options])", "Converts an Unicode domain to ASCII representation, as defined in the IDNA RFC" ], "idn_to_utf8": [ "int idn_to_utf8(string domain[, int options])", "Converts an ASCII representation of the domain to Unicode (UTF-8), as defined in the IDNA RFC" ], "ignore_user_abort": [ "int ignore_user_abort([string value])", "Set whether we want to ignore a user abort event or not" ], "image2wbmp": [ "bool image2wbmp(resource im [, string filename [, int threshold]])", "Output WBMP image to browser or file" ], "image_type_to_extension": [ "string image_type_to_extension(int imagetype [, bool include_dot])", "Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype" ], "image_type_to_mime_type": [ "string image_type_to_mime_type(int imagetype)", "Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype" ], "imagealphablending": [ "bool imagealphablending(resource im, bool on)", "Turn alpha blending mode on or off for the given image" ], "imageantialias": [ "bool imageantialias(resource im, bool on)", "Should antialiased functions used or not" ], "imagearc": [ "bool imagearc(resource im, int cx, int cy, int w, int h, int s, int e, int col)", "Draw a partial ellipse" ], "imagechar": [ "bool imagechar(resource im, int font, int x, int y, string c, int col)", "Draw a character" ], "imagecharup": [ "bool imagecharup(resource im, int font, int x, int y, string c, int col)", "Draw a character rotated 90 degrees counter-clockwise" ], "imagecolorallocate": [ "int imagecolorallocate(resource im, int red, int green, int blue)", "Allocate a color for an image" ], "imagecolorallocatealpha": [ "int imagecolorallocatealpha(resource im, int red, int green, int blue, int alpha)", "Allocate a color with an alpha level. Works for true color and palette based images" ], "imagecolorat": [ "int imagecolorat(resource im, int x, int y)", "Get the index of the color of a pixel" ], "imagecolorclosest": [ "int imagecolorclosest(resource im, int red, int green, int blue)", "Get the index of the closest color to the specified color" ], "imagecolorclosestalpha": [ "int imagecolorclosestalpha(resource im, int red, int green, int blue, int alpha)", "Find the closest matching colour with alpha transparency" ], "imagecolorclosesthwb": [ "int imagecolorclosesthwb(resource im, int red, int green, int blue)", "Get the index of the color which has the hue, white and blackness nearest to the given color" ], "imagecolordeallocate": [ "bool imagecolordeallocate(resource im, int index)", "De-allocate a color for an image" ], "imagecolorexact": [ "int imagecolorexact(resource im, int red, int green, int blue)", "Get the index of the specified color" ], "imagecolorexactalpha": [ "int imagecolorexactalpha(resource im, int red, int green, int blue, int alpha)", "Find exact match for colour with transparency" ], "imagecolormatch": [ "bool imagecolormatch(resource im1, resource im2)", "Makes the colors of the palette version of an image more closely match the true color version" ], "imagecolorresolve": [ "int imagecolorresolve(resource im, int red, int green, int blue)", "Get the index of the specified color or its closest possible alternative" ], "imagecolorresolvealpha": [ "int imagecolorresolvealpha(resource im, int red, int green, int blue, int alpha)", "Resolve/Allocate a colour with an alpha level. Works for true colour and palette based images" ], "imagecolorset": [ "void imagecolorset(resource im, int col, int red, int green, int blue)", "Set the color for the specified palette index" ], "imagecolorsforindex": [ "array imagecolorsforindex(resource im, int col)", "Get the colors for an index" ], "imagecolorstotal": [ "int imagecolorstotal(resource im)", "Find out the number of colors in an image's palette" ], "imagecolortransparent": [ "int imagecolortransparent(resource im [, int col])", "Define a color as transparent" ], "imageconvolution": [ "resource imageconvolution(resource src_im, array matrix3x3, double div, double offset)", "Apply a 3x3 convolution matrix, using coefficient div and offset" ], "imagecopy": [ "bool imagecopy(resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h)", "Copy part of an image" ], "imagecopymerge": [ "bool imagecopymerge(resource src_im, resource dst_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct)", "Merge one part of an image with another" ], "imagecopymergegray": [ "bool imagecopymergegray(resource src_im, resource dst_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct)", "Merge one part of an image with another" ], "imagecopyresampled": [ "bool imagecopyresampled(resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h)", "Copy and resize part of an image using resampling to help ensure clarity" ], "imagecopyresized": [ "bool imagecopyresized(resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h)", "Copy and resize part of an image" ], "imagecreate": [ "resource imagecreate(int x_size, int y_size)", "Create a new image" ], "imagecreatefromgd": [ "resource imagecreatefromgd(string filename)", "Create a new image from GD file or URL" ], "imagecreatefromgd2": [ "resource imagecreatefromgd2(string filename)", "Create a new image from GD2 file or URL" ], "imagecreatefromgd2part": [ "resource imagecreatefromgd2part(string filename, int srcX, int srcY, int width, int height)", "Create a new image from a given part of GD2 file or URL" ], "imagecreatefromgif": [ "resource imagecreatefromgif(string filename)", "Create a new image from GIF file or URL" ], "imagecreatefromjpeg": [ "resource imagecreatefromjpeg(string filename)", "Create a new image from JPEG file or URL" ], "imagecreatefrompng": [ "resource imagecreatefrompng(string filename)", "Create a new image from PNG file or URL" ], "imagecreatefromstring": [ "resource imagecreatefromstring(string image)", "Create a new image from the image stream in the string" ], "imagecreatefromwbmp": [ "resource imagecreatefromwbmp(string filename)", "Create a new image from WBMP file or URL" ], "imagecreatefromxbm": [ "resource imagecreatefromxbm(string filename)", "Create a new image from XBM file or URL" ], "imagecreatefromxpm": [ "resource imagecreatefromxpm(string filename)", "Create a new image from XPM file or URL" ], "imagecreatetruecolor": [ "resource imagecreatetruecolor(int x_size, int y_size)", "Create a new true color image" ], "imagedashedline": [ "bool imagedashedline(resource im, int x1, int y1, int x2, int y2, int col)", "Draw a dashed line" ], "imagedestroy": [ "bool imagedestroy(resource im)", "Destroy an image" ], "imageellipse": [ "bool imageellipse(resource im, int cx, int cy, int w, int h, int color)", "Draw an ellipse" ], "imagefill": [ "bool imagefill(resource im, int x, int y, int col)", "Flood fill" ], "imagefilledarc": [ "bool imagefilledarc(resource im, int cx, int cy, int w, int h, int s, int e, int col, int style)", "Draw a filled partial ellipse" ], "imagefilledellipse": [ "bool imagefilledellipse(resource im, int cx, int cy, int w, int h, int color)", "Draw an ellipse" ], "imagefilledpolygon": [ "bool imagefilledpolygon(resource im, array point, int num_points, int col)", "Draw a filled polygon" ], "imagefilledrectangle": [ "bool imagefilledrectangle(resource im, int x1, int y1, int x2, int y2, int col)", "Draw a filled rectangle" ], "imagefilltoborder": [ "bool imagefilltoborder(resource im, int x, int y, int border, int col)", "Flood fill to specific color" ], "imagefilter": [ "bool imagefilter(resource src_im, int filtertype, [args] )", "Applies Filter an image using a custom angle" ], "imagefontheight": [ "int imagefontheight(int font)", "Get font height" ], "imagefontwidth": [ "int imagefontwidth(int font)", "Get font width" ], "imageftbbox": [ "array imageftbbox(float size, float angle, string font_file, string text [, array extrainfo])", "Give the bounding box of a text using fonts via freetype2" ], "imagefttext": [ "array imagefttext(resource im, float size, float angle, int x, int y, int col, string font_file, string text [, array extrainfo])", "Write text to the image using fonts via freetype2" ], "imagegammacorrect": [ "bool imagegammacorrect(resource im, float inputgamma, float outputgamma)", "Apply a gamma correction to a GD image" ], "imagegd": [ "bool imagegd(resource im [, string filename])", "Output GD image to browser or file" ], "imagegd2": [ "bool imagegd2(resource im [, string filename, [, int chunk_size, [, int type]]])", "Output GD2 image to browser or file" ], "imagegif": [ "bool imagegif(resource im [, string filename])", "Output GIF image to browser or file" ], "imagegrabscreen": [ "resource imagegrabscreen()", "Grab a screenshot" ], "imagegrabwindow": [ "resource imagegrabwindow(int window_handle [, int client_area])", "Grab a window or its client area using a windows handle (HWND property in COM instance)" ], "imageinterlace": [ "int imageinterlace(resource im [, int interlace])", "Enable or disable interlace" ], "imageistruecolor": [ "bool imageistruecolor(resource im)", "return true if the image uses truecolor" ], "imagejpeg": [ "bool imagejpeg(resource im [, string filename [, int quality]])", "Output JPEG image to browser or file" ], "imagelayereffect": [ "bool imagelayereffect(resource im, int effect)", "Set the alpha blending flag to use the bundled libgd layering effects" ], "imageline": [ "bool imageline(resource im, int x1, int y1, int x2, int y2, int col)", "Draw a line" ], "imageloadfont": [ "int imageloadfont(string filename)", "Load a new font" ], "imagepalettecopy": [ "void imagepalettecopy(resource dst, resource src)", "Copy the palette from the src image onto the dst image" ], "imagepng": [ "bool imagepng(resource im [, string filename])", "Output PNG image to browser or file" ], "imagepolygon": [ "bool imagepolygon(resource im, array point, int num_points, int col)", "Draw a polygon" ], "imagepsbbox": [ "array imagepsbbox(string text, resource font, int size [, int space, int tightness, float angle])", "Return the bounding box needed by a string if rasterized" ], "imagepscopyfont": [ "int imagepscopyfont(int font_index)", "Make a copy of a font for purposes like extending or reenconding" ], "imagepsencodefont": [ "bool imagepsencodefont(resource font_index, string filename)", "To change a fonts character encoding vector" ], "imagepsextendfont": [ "bool imagepsextendfont(resource font_index, float extend)", "Extend or or condense if (extend < 1) a font" ], "imagepsfreefont": [ "bool imagepsfreefont(resource font_index)", "Free memory used by a font" ], "imagepsloadfont": [ "resource imagepsloadfont(string pathname)", "Load a new font from specified file" ], "imagepsslantfont": [ "bool imagepsslantfont(resource font_index, float slant)", "Slant a font" ], "imagepstext": [ "array imagepstext(resource image, string text, resource font, int size, int foreground, int background, int xcoord, int ycoord [, int space [, int tightness [, float angle [, int antialias])", "Rasterize a string over an image" ], "imagerectangle": [ "bool imagerectangle(resource im, int x1, int y1, int x2, int y2, int col)", "Draw a rectangle" ], "imagerotate": [ "resource imagerotate(resource src_im, float angle, int bgdcolor [, int ignoretransparent])", "Rotate an image using a custom angle" ], "imagesavealpha": [ "bool imagesavealpha(resource im, bool on)", "Include alpha channel to a saved image" ], "imagesetbrush": [ "bool imagesetbrush(resource image, resource brush)", "Set the brush image to $brush when filling $image with the \"IMG_COLOR_BRUSHED\" color" ], "imagesetpixel": [ "bool imagesetpixel(resource im, int x, int y, int col)", "Set a single pixel" ], "imagesetstyle": [ "bool imagesetstyle(resource im, array styles)", "Set the line drawing styles for use with imageline and IMG_COLOR_STYLED." ], "imagesetthickness": [ "bool imagesetthickness(resource im, int thickness)", "Set line thickness for drawing lines, ellipses, rectangles, polygons etc." ], "imagesettile": [ "bool imagesettile(resource image, resource tile)", "Set the tile image to $tile when filling $image with the \"IMG_COLOR_TILED\" color" ], "imagestring": [ "bool imagestring(resource im, int font, int x, int y, string str, int col)", "Draw a string horizontally" ], "imagestringup": [ "bool imagestringup(resource im, int font, int x, int y, string str, int col)", "Draw a string vertically - rotated 90 degrees counter-clockwise" ], "imagesx": [ "int imagesx(resource im)", "Get image width" ], "imagesy": [ "int imagesy(resource im)", "Get image height" ], "imagetruecolortopalette": [ "void imagetruecolortopalette(resource im, bool ditherFlag, int colorsWanted)", "Convert a true colour image to a palette based image with a number of colours, optionally using dithering." ], "imagettfbbox": [ "array imagettfbbox(float size, float angle, string font_file, string text)", "Give the bounding box of a text using TrueType fonts" ], "imagettftext": [ "array imagettftext(resource im, float size, float angle, int x, int y, int col, string font_file, string text)", "Write text to the image using a TrueType font" ], "imagetypes": [ "int imagetypes()", "Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM" ], "imagewbmp": [ "bool imagewbmp(resource im [, string filename, [, int foreground]])", "Output WBMP image to browser or file" ], "imagexbm": [ "int imagexbm(int im, string filename [, int foreground])", "Output XBM image to browser or file" ], "imap_8bit": [ "string imap_8bit(string text)", "Convert an 8-bit string to a quoted-printable string" ], "imap_alerts": [ "array imap_alerts()", "Returns an array of all IMAP alerts that have been generated since the last page load or since the last imap_alerts() call, whichever came last. The alert stack is cleared after imap_alerts() is called." ], "imap_append": [ "bool imap_append(resource stream_id, string folder, string message [, string options [, string internal_date]])", "Append a new message to a specified mailbox" ], "imap_base64": [ "string imap_base64(string text)", "Decode BASE64 encoded text" ], "imap_binary": [ "string imap_binary(string text)", "Convert an 8bit string to a base64 string" ], "imap_body": [ "string imap_body(resource stream_id, int msg_no [, int options])", "Read the message body" ], "imap_bodystruct": [ "object imap_bodystruct(resource stream_id, int msg_no, string section)", "Read the structure of a specified body section of a specific message" ], "imap_check": [ "object imap_check(resource stream_id)", "Get mailbox properties" ], "imap_clearflag_full": [ "bool imap_clearflag_full(resource stream_id, string sequence, string flag [, int options])", "Clears flags on messages" ], "imap_close": [ "bool imap_close(resource stream_id [, int options])", "Close an IMAP stream" ], "imap_createmailbox": [ "bool imap_createmailbox(resource stream_id, string mailbox)", "Create a new mailbox" ], "imap_delete": [ "bool imap_delete(resource stream_id, int msg_no [, int options])", "Mark a message for deletion" ], "imap_deletemailbox": [ "bool imap_deletemailbox(resource stream_id, string mailbox)", "Delete a mailbox" ], "imap_errors": [ "array imap_errors()", "Returns an array of all IMAP errors generated since the last page load, or since the last imap_errors() call, whichever came last. The error stack is cleared after imap_errors() is called." ], "imap_expunge": [ "bool imap_expunge(resource stream_id)", "Permanently delete all messages marked for deletion" ], "imap_fetch_overview": [ "array imap_fetch_overview(resource stream_id, string sequence [, int options])", "Read an overview of the information in the headers of the given message sequence" ], "imap_fetchbody": [ "string imap_fetchbody(resource stream_id, int msg_no, string section [, int options])", "Get a specific body section" ], "imap_fetchheader": [ "string imap_fetchheader(resource stream_id, int msg_no [, int options])", "Get the full unfiltered header for a message" ], "imap_fetchstructure": [ "object imap_fetchstructure(resource stream_id, int msg_no [, int options])", "Read the full structure of a message" ], "imap_gc": [ "bool imap_gc(resource stream_id, int flags)", "This function garbage collects (purges) the cache of entries of a specific type." ], "imap_get_quota": [ "array imap_get_quota(resource stream_id, string qroot)", "Returns the quota set to the mailbox account qroot" ], "imap_get_quotaroot": [ "array imap_get_quotaroot(resource stream_id, string mbox)", "Returns the quota set to the mailbox account mbox" ], "imap_getacl": [ "array imap_getacl(resource stream_id, string mailbox)", "Gets the ACL for a given mailbox" ], "imap_getmailboxes": [ "array imap_getmailboxes(resource stream_id, string ref, string pattern)", "Reads the list of mailboxes and returns a full array of objects containing name, attributes, and delimiter" ], "imap_getsubscribed": [ "array imap_getsubscribed(resource stream_id, string ref, string pattern)", "Return a list of subscribed mailboxes, in the same format as imap_getmailboxes()" ], "imap_headerinfo": [ "object imap_headerinfo(resource stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])", "Read the headers of the message" ], "imap_headers": [ "array imap_headers(resource stream_id)", "Returns headers for all messages in a mailbox" ], "imap_last_error": [ "string imap_last_error()", "Returns the last error that was generated by an IMAP function. The error stack is NOT cleared after this call." ], "imap_list": [ "array imap_list(resource stream_id, string ref, string pattern)", "Read the list of mailboxes" ], "imap_listscan": [ "array imap_listscan(resource stream_id, string ref, string pattern, string content)", "Read list of mailboxes containing a certain string" ], "imap_lsub": [ "array imap_lsub(resource stream_id, string ref, string pattern)", "Return a list of subscribed mailboxes" ], "imap_mail": [ "bool imap_mail(string to, string subject, string message [, string additional_headers [, string cc [, string bcc [, string rpath]]]])", "Send an email message" ], "imap_mail_compose": [ "string imap_mail_compose(array envelope, array body)", "Create a MIME message based on given envelope and body sections" ], "imap_mail_copy": [ "bool imap_mail_copy(resource stream_id, string msglist, string mailbox [, int options])", "Copy specified message to a mailbox" ], "imap_mail_move": [ "bool imap_mail_move(resource stream_id, string sequence, string mailbox [, int options])", "Move specified message to a mailbox" ], "imap_mailboxmsginfo": [ "object imap_mailboxmsginfo(resource stream_id)", "Returns info about the current mailbox" ], "imap_mime_header_decode": [ "array imap_mime_header_decode(string str)", "Decode mime header element in accordance with RFC 2047 and return array of objects containing 'charset' encoding and decoded 'text'" ], "imap_msgno": [ "int imap_msgno(resource stream_id, int unique_msg_id)", "Get the sequence number associated with a UID" ], "imap_mutf7_to_utf8": [ "string imap_mutf7_to_utf8(string in)", "Decode a modified UTF-7 string to UTF-8" ], "imap_num_msg": [ "int imap_num_msg(resource stream_id)", "Gives the number of messages in the current mailbox" ], "imap_num_recent": [ "int imap_num_recent(resource stream_id)", "Gives the number of recent messages in current mailbox" ], "imap_open": [ "resource imap_open(string mailbox, string user, string password [, int options [, int n_retries]])", "Open an IMAP stream to a mailbox" ], "imap_ping": [ "bool imap_ping(resource stream_id)", "Check if the IMAP stream is still active" ], "imap_qprint": [ "string imap_qprint(string text)", "Convert a quoted-printable string to an 8-bit string" ], "imap_renamemailbox": [ "bool imap_renamemailbox(resource stream_id, string old_name, string new_name)", "Rename a mailbox" ], "imap_reopen": [ "bool imap_reopen(resource stream_id, string mailbox [, int options [, int n_retries]])", "Reopen an IMAP stream to a new mailbox" ], "imap_rfc822_parse_adrlist": [ "array imap_rfc822_parse_adrlist(string address_string, string default_host)", "Parses an address string" ], "imap_rfc822_parse_headers": [ "object imap_rfc822_parse_headers(string headers [, string default_host])", "Parse a set of mail headers contained in a string, and return an object similar to imap_headerinfo()" ], "imap_rfc822_write_address": [ "string imap_rfc822_write_address(string mailbox, string host, string personal)", "Returns a properly formatted email address given the mailbox, host, and personal info" ], "imap_savebody": [ "bool imap_savebody(resource stream_id, string|resource file, int msg_no[, string section = \"\"[, int options = 0]])", "Save a specific body section to a file" ], "imap_search": [ "array imap_search(resource stream_id, string criteria [, int options [, string charset]])", "Return a list of messages matching the given criteria" ], "imap_set_quota": [ "bool imap_set_quota(resource stream_id, string qroot, int mailbox_size)", "Will set the quota for qroot mailbox" ], "imap_setacl": [ "bool imap_setacl(resource stream_id, string mailbox, string id, string rights)", "Sets the ACL for a given mailbox" ], "imap_setflag_full": [ "bool imap_setflag_full(resource stream_id, string sequence, string flag [, int options])", "Sets flags on messages" ], "imap_sort": [ "array imap_sort(resource stream_id, int criteria, int reverse [, int options [, string search_criteria [, string charset]]])", "Sort an array of message headers, optionally including only messages that meet specified criteria." ], "imap_status": [ "object imap_status(resource stream_id, string mailbox, int options)", "Get status info from a mailbox" ], "imap_subscribe": [ "bool imap_subscribe(resource stream_id, string mailbox)", "Subscribe to a mailbox" ], "imap_thread": [ "array imap_thread(resource stream_id [, int options])", "Return threaded by REFERENCES tree" ], "imap_timeout": [ "mixed imap_timeout(int timeout_type [, int timeout])", "Set or fetch imap timeout" ], "imap_uid": [ "int imap_uid(resource stream_id, int msg_no)", "Get the unique message id associated with a standard sequential message number" ], "imap_undelete": [ "bool imap_undelete(resource stream_id, int msg_no [, int flags])", "Remove the delete flag from a message" ], "imap_unsubscribe": [ "bool imap_unsubscribe(resource stream_id, string mailbox)", "Unsubscribe from a mailbox" ], "imap_utf7_decode": [ "string imap_utf7_decode(string buf)", "Decode a modified UTF-7 string" ], "imap_utf7_encode": [ "string imap_utf7_encode(string buf)", "Encode a string in modified UTF-7" ], "imap_utf8": [ "string imap_utf8(string mime_encoded_text)", "Convert a mime-encoded text to UTF-8" ], "imap_utf8_to_mutf7": [ "string imap_utf8_to_mutf7(string in)", "Encode a UTF-8 string to modified UTF-7" ], "implode": [ "string implode([string glue,] array pieces)", "Joins array elements placing glue string between items and return one string" ], "import_request_variables": [ "bool import_request_variables(string types [, string prefix])", "Import GET/POST/Cookie variables into the global scope" ], "in_array": [ "bool in_array(mixed needle, array haystack [, bool strict])", "Checks if the given value exists in the array" ], "include": [ "bool include(string path)", "Includes and evaluates the specified file" ], "include_once": [ "bool include_once(string path)", "Includes and evaluates the specified file" ], "inet_ntop": [ "string inet_ntop(string in_addr)", "Converts a packed inet address to a human readable IP address string" ], "inet_pton": [ "string inet_pton(string ip_address)", "Converts a human readable IP address to a packed binary string" ], "ini_get": [ "string ini_get(string varname)", "Get a configuration option" ], "ini_get_all": [ "array ini_get_all([string extension[, bool details = true]])", "Get all configuration options" ], "ini_restore": [ "void ini_restore(string varname)", "Restore the value of a configuration option specified by varname" ], "ini_set": [ "string ini_set(string varname, string newvalue)", "Set a configuration option, returns false on error and the old value of the configuration option on success" ], "interface_exists": [ "bool interface_exists(string classname [, bool autoload])", "Checks if the class exists" ], "intl_error_name": [ "string intl_error_name()", "* Return a string for a given error code. * The string will be the same as the name of the error code constant." ], "intl_get_error_code": [ "int intl_get_error_code()", "* Get code of the last occured error." ], "intl_get_error_message": [ "string intl_get_error_message()", "* Get text description of the last occured error." ], "intl_is_failure": [ "bool intl_is_failure()", "* Check whether the given error code indicates a failure. * Returns true if it does, and false if the code * indicates success or a warning." ], "intval": [ "int intval(mixed var [, int base])", "Get the integer value of a variable using the optional base for the conversion" ], "ip2long": [ "int ip2long(string ip_address)", "Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address" ], "iptcembed": [ "array iptcembed(string iptcdata, string jpeg_file_name [, int spool])", "Embed binary IPTC data into a JPEG image." ], "iptcparse": [ "array iptcparse(string iptcdata)", "Parse binary IPTC-data into associative array" ], "is_a": [ "bool is_a(object object, string class_name)", "Returns true if the object is of this class or has this class as one of its parents" ], "is_array": [ "bool is_array(mixed var)", "Returns true if variable is an array" ], "is_bool": [ "bool is_bool(mixed var)", "Returns true if variable is a boolean" ], "is_callable": [ "bool is_callable(mixed var [, bool syntax_only [, string callable_name]])", "Returns true if var is callable." ], "is_countable": [ "bool is_countable(mixed var)", "Returns true if var is countable, false otherwise" ], "is_dir": [ "bool is_dir(string filename)", "Returns true if file is directory" ], "is_executable": [ "bool is_executable(string filename)", "Returns true if file is executable" ], "is_file": [ "bool is_file(string filename)", "Returns true if file is a regular file" ], "is_finite": [ "bool is_finite(float val)", "Returns whether argument is finite" ], "is_float": [ "bool is_float(mixed var)", "Returns true if variable is float point" ], "is_infinite": [ "bool is_infinite(float val)", "Returns whether argument is infinite" ], "is_link": [ "bool is_link(string filename)", "Returns true if file is symbolic link" ], "is_long": [ "bool is_long(mixed var)", "Returns true if variable is a long (integer)" ], "is_nan": [ "bool is_nan(float val)", "Returns whether argument is not a number" ], "is_null": [ "bool is_null(mixed var)", "Returns true if variable is null" ], "is_numeric": [ "bool is_numeric(mixed value)", "Returns true if value is a number or a numeric string" ], "is_object": [ "bool is_object(mixed var)", "Returns true if variable is an object" ], "is_readable": [ "bool is_readable(string filename)", "Returns true if file can be read" ], "is_resource": [ "bool is_resource(mixed var)", "Returns true if variable is a resource" ], "is_scalar": [ "bool is_scalar(mixed value)", "Returns true if value is a scalar" ], "is_string": [ "bool is_string(mixed var)", "Returns true if variable is a string" ], "is_subclass_of": [ "bool is_subclass_of(object object, string class_name)", "Returns true if the object has this class as one of its parents" ], "is_uploaded_file": [ "bool is_uploaded_file(string path)", "Check if file was created by rfc1867 upload" ], "is_writable": [ "bool is_writable(string filename)", "Returns true if file can be written" ], "isset": [ "bool isset(mixed var [, mixed var])", "Determine whether a variable is set" ], "iterator_apply": [ "int iterator_apply(Traversable iterator, callable function [, array args = null)", "Calls a function for every element in an iterator" ], "iterator_count": [ "int iterator_count(Traversable iterator)", "Count the elements in an iterator" ], "iterator_to_array": [ "array iterator_to_array(Traversable iterator [, bool use_keys = true])", "Copy the iterator into an array" ], "jddayofweek": [ "mixed jddayofweek(int juliandaycount [, int mode])", "Returns name or number of day of week from julian day count" ], "jdmonthname": [ "string jdmonthname(int juliandaycount, int mode)", "Returns name of month for julian day count" ], "jdtofrench": [ "string jdtofrench(int juliandaycount)", "Converts a julian day count to a french republic calendar date" ], "jdtogregorian": [ "string jdtogregorian(int juliandaycount)", "Converts a julian day count to a gregorian calendar date" ], "jdtojewish": [ "string jdtojewish(int juliandaycount [, bool hebrew [, int fl]])", "Converts a julian day count to a jewish calendar date" ], "jdtojulian": [ "string jdtojulian(int juliandaycount)", "Convert a julian day count to a julian calendar date" ], "jdtounix": [ "int jdtounix(int jday)", "Convert Julian Day to UNIX timestamp" ], "jewishtojd": [ "int jewishtojd(int month, int day, int year)", "Converts a jewish calendar date to a julian day count" ], "join": [ "string join([string glue,] array pieces)", "Returns a string containing a string representation of all the arrayelements in the same order, with the glue string between each element" ], "jpeg2wbmp": [ "bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert JPEG image to WBMP image" ], "json_decode": [ "mixed json_decode(string json [, bool assoc [, long depth]])", "Decodes the JSON representation into a PHP value" ], "json_encode": [ "string json_encode(mixed data [, int options])", "Returns the JSON representation of a value" ], "json_last_error": [ "int json_last_error()", "Returns the error code of the last json_decode()." ], "juliantojd": [ "int juliantojd(int month, int day, int year)", "Converts a julian calendar date to julian day count" ], "key": [ "mixed key(array array_arg)", "Return the key of the element currently pointed to by the internal array pointer" ], "krsort": [ "bool krsort(array &array_arg [, int sort_flags])", "Sort an array by key value in reverse order" ], "ksort": [ "bool ksort(array &array_arg [, int sort_flags])", "Sort an array by key" ], "lcfirst": [ "string lcfirst(string str)", "Make a string's first character lowercase" ], "lcg_value": [ "float lcg_value()", "Returns a value from the combined linear congruential generator" ], "lchgrp": [ "bool lchgrp(string filename, mixed group)", "Change symlink group" ], "ldap_8859_to_t61": [ "string ldap_8859_to_t61(string value)", "Translate 8859 characters to t61 characters" ], "ldap_add": [ "bool ldap_add(resource link, string dn, array entry)", "Add entries to LDAP directory" ], "ldap_bind": [ "bool ldap_bind(resource link [, string dn [, string password]])", "Bind to LDAP directory" ], "ldap_compare": [ "bool ldap_compare(resource link, string dn, string attr, string value)", "Determine if an entry has a specific value for one of its attributes" ], "ldap_connect": [ "resource ldap_connect([string host [, int port [, string wallet [, string wallet_passwd [, int authmode]]]]])", "Connect to an LDAP server" ], "ldap_count_entries": [ "int ldap_count_entries(resource link, resource result)", "Count the number of entries in a search result" ], "ldap_delete": [ "bool ldap_delete(resource link, string dn)", "Delete an entry from a directory" ], "ldap_dn2ufn": [ "string ldap_dn2ufn(string dn)", "Convert DN to User Friendly Naming format" ], "ldap_err2str": [ "string ldap_err2str(int errno)", "Convert error number to error string" ], "ldap_errno": [ "int ldap_errno(resource link)", "Get the current ldap error number" ], "ldap_error": [ "string ldap_error(resource link)", "Get the current ldap error string" ], "ldap_explode_dn": [ "array ldap_explode_dn(string dn, int with_attrib)", "Splits DN into its component parts" ], "ldap_first_attribute": [ "string ldap_first_attribute(resource link, resource result_entry)", "Return first attribute" ], "ldap_first_entry": [ "resource ldap_first_entry(resource link, resource result)", "Return first result id" ], "ldap_first_reference": [ "resource ldap_first_reference(resource link, resource result)", "Return first reference" ], "ldap_free_result": [ "bool ldap_free_result(resource result)", "Free result memory" ], "ldap_get_attributes": [ "array ldap_get_attributes(resource link, resource result_entry)", "Get attributes from a search result entry" ], "ldap_get_dn": [ "string ldap_get_dn(resource link, resource result_entry)", "Get the DN of a result entry" ], "ldap_get_entries": [ "array ldap_get_entries(resource link, resource result)", "Get all result entries" ], "ldap_get_option": [ "bool ldap_get_option(resource link, int option, mixed retval)", "Get the current value of various session-wide parameters" ], "ldap_get_values_len": [ "array ldap_get_values_len(resource link, resource result_entry, string attribute)", "Get all values with lengths from a result entry" ], "ldap_list": [ "resource ldap_list(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]])", "Single-level search" ], "ldap_mod_add": [ "bool ldap_mod_add(resource link, string dn, array entry)", "Add attribute values to current" ], "ldap_mod_del": [ "bool ldap_mod_del(resource link, string dn, array entry)", "Delete attribute values" ], "ldap_mod_replace": [ "bool ldap_mod_replace(resource link, string dn, array entry)", "Replace attribute values with new ones" ], "ldap_next_attribute": [ "string ldap_next_attribute(resource link, resource result_entry)", "Get the next attribute in result" ], "ldap_next_entry": [ "resource ldap_next_entry(resource link, resource result_entry)", "Get next result entry" ], "ldap_next_reference": [ "resource ldap_next_reference(resource link, resource reference_entry)", "Get next reference" ], "ldap_parse_reference": [ "bool ldap_parse_reference(resource link, resource reference_entry, array referrals)", "Extract information from reference entry" ], "ldap_parse_result": [ "bool ldap_parse_result(resource link, resource result, int errcode, string matcheddn, string errmsg, array referrals)", "Extract information from result" ], "ldap_read": [ "resource ldap_read(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]])", "Read an entry" ], "ldap_rename": [ "bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn)", "Modify the name of an entry" ], "ldap_sasl_bind": [ "bool ldap_sasl_bind(resource link [, string binddn [, string password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [, string sasl_authz_id [, string props]]]]]]])", "Bind to LDAP directory using SASL" ], "ldap_search": [ "resource ldap_search(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]])", "Search LDAP tree under base_dn" ], "ldap_set_option": [ "bool ldap_set_option(resource link, int option, mixed newval)", "Set the value of various session-wide parameters" ], "ldap_set_rebind_proc": [ "bool ldap_set_rebind_proc(resource link, string callback)", "Set a callback function to do re-binds on referral chasing." ], "ldap_sort": [ "bool ldap_sort(resource link, resource result, string sortfilter)", "Sort LDAP result entries" ], "ldap_start_tls": [ "bool ldap_start_tls(resource link)", "Start TLS" ], "ldap_t61_to_8859": [ "string ldap_t61_to_8859(string value)", "Translate t61 characters to 8859 characters" ], "ldap_unbind": [ "bool ldap_unbind(resource link)", "Unbind from LDAP directory" ], "leak": [ "void leak(int num_bytes=3)", "Cause an intentional memory leak, for testing/debugging purposes" ], "levenshtein": [ "int levenshtein(string str1, string str2[, int cost_ins, int cost_rep, int cost_del])", "Calculate Levenshtein distance between two strings" ], "libxml_clear_errors": [ "void libxml_clear_errors()", "Clear last error from libxml" ], "libxml_disable_entity_loader": [ "bool libxml_disable_entity_loader([bool disable])", "Disable/Enable ability to load external entities" ], "libxml_get_errors": [ "object libxml_get_errors()", "Retrieve array of errors" ], "libxml_get_last_error": [ "object libxml_get_last_error()", "Retrieve last error from libxml" ], "libxml_set_streams_context": [ "void libxml_set_streams_context(resource streams_context)", "Set the streams context for the next libxml document load or write" ], "libxml_use_internal_errors": [ "bool libxml_use_internal_errors([bool use_errors])", "Disable libxml errors and allow user to fetch error information as needed" ], "link": [ "int link(string target, string link)", "Create a hard link" ], "linkinfo": [ "int linkinfo(string filename)", "Returns the st_dev field of the UNIX C stat structure describing the link" ], "litespeed_request_headers": [ "array litespeed_request_headers()", "Fetch all HTTP request headers" ], "litespeed_response_headers": [ "array litespeed_response_headers()", "Fetch all HTTP response headers" ], "locale_accept_from_http": [ "string locale_accept_from_http(string $http_accept)", null ], "locale_canonicalize": [ "static string locale_canonicalize(Locale $loc, string $locale)", "* @param string $locale The locale string to canonicalize" ], "locale_filter_matches": [ "bool locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])", "* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm" ], "locale_get_all_variants": [ "static array locale_get_all_variants($locale)", "* gets an array containing the list of variants, or null" ], "locale_get_default": [ "static string locale_get_default( )", "Get default locale" ], "locale_get_keywords": [ "static array locale_get_keywords(string $locale) {", "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array" ], "locale_get_primary_language": [ "static string locale_get_primary_language($locale)", "* gets the primary language for the $locale" ], "locale_get_region": [ "static string locale_get_region($locale)", "* gets the region for the $locale" ], "locale_get_script": [ "static string locale_get_script($locale)", "* gets the script for the $locale" ], "locale_lookup": [ "string locale_lookup(array $langtag, string $locale[, bool $canonicalize[, string $default = null]])", "* Searchs the items in $langtag for the best match to the language * range" ], "locale_set_default": [ "static string locale_set_default( string $locale )", "Set default locale" ], "localeconv": [ "array localeconv()", "Returns numeric formatting information based on the current locale" ], "localtime": [ "array localtime([int timestamp [, bool associative_array]])", "Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array" ], "log": [ "float log(float number, [float base])", "Returns the natural logarithm of the number, or the base log if base is specified" ], "log10": [ "float log10(float number)", "Returns the base-10 logarithm of the number" ], "log1p": [ "float log1p(float number)", "Returns log(1 + number), computed in a way that accurate even when the value of number is close to zero" ], "long2ip": [ "string long2ip(int proper_address)", "Converts an (IPv4) Internet network address into a string in Internet standard dotted format" ], "lstat": [ "array lstat(string filename)", "Give information about a file or symbolic link" ], "ltrim": [ "string ltrim(string str [, string character_mask])", "Strips whitespace from the beginning of a string" ], "mail": [ "int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])", "Send an email message" ], "max": [ "mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])", "Return the highest value in an array or a series of arguments" ], "mb_check_encoding": [ "bool mb_check_encoding([string var[, string encoding]])", "Check if the string is valid for the specified encoding" ], "mb_convert_case": [ "string mb_convert_case(string sourcestring, int mode [, string encoding])", "Returns a case-folded version of sourcestring" ], "mb_convert_encoding": [ "string mb_convert_encoding(string str, string to-encoding [, mixed from-encoding])", "Returns converted string in desired encoding" ], "mb_convert_kana": [ "string mb_convert_kana(string str [, string option] [, string encoding])", "Conversion between full-width character and half-width character (Japanese)" ], "mb_convert_variables": [ "string mb_convert_variables(string to-encoding, mixed from-encoding, mixed vars [, ...])", "Converts the string resource in variables to desired encoding" ], "mb_decode_mimeheader": [ "string mb_decode_mimeheader(string string)", "Decodes the MIME \"encoded-word\" in the string" ], "mb_decode_numericentity": [ "string mb_decode_numericentity(string string, array convmap [, string encoding])", "Converts HTML numeric entities to character code" ], "mb_detect_encoding": [ "string mb_detect_encoding(string str [, mixed encoding_list [, bool strict]])", "Encodings of the given string is returned (as a string)" ], "mb_detect_order": [ "bool|array mb_detect_order([mixed encoding-list])", "Sets the current detect_order or Return the current detect_order as a array" ], "mb_encode_mimeheader": [ "string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed [, int indent]]]])", "Converts the string to MIME \"encoded-word\" in the format of =?charset?(B|Q)?encoded_string?=" ], "mb_encode_numericentity": [ "string mb_encode_numericentity(string string, array convmap [, string encoding])", "Converts specified characters to HTML numeric entities" ], "mb_encoding_aliases": [ "array mb_encoding_aliases(string encoding)", "Returns an array of the aliases of a given encoding name" ], "mb_ereg": [ "int mb_ereg(string pattern, string string [, array registers])", "Regular expression match for multibyte string" ], "mb_ereg_match": [ "bool mb_ereg_match(string pattern, string string [,string option])", "Regular expression match for multibyte string" ], "mb_ereg_replace": [ "string mb_ereg_replace(string pattern, string replacement, string string [, string option])", "Replace regular expression for multibyte string" ], "mb_ereg_search": [ "bool mb_ereg_search([string pattern[, string option]])", "Regular expression search for multibyte string" ], "mb_ereg_search_getpos": [ "int mb_ereg_search_getpos()", "Get search start position" ], "mb_ereg_search_getregs": [ "array mb_ereg_search_getregs()", "Get matched substring of the last time" ], "mb_ereg_search_init": [ "bool mb_ereg_search_init(string string [, string pattern[, string option]])", "Initialize string and regular expression for search." ], "mb_ereg_search_pos": [ "array mb_ereg_search_pos([string pattern[, string option]])", "Regular expression search for multibyte string" ], "mb_ereg_search_regs": [ "array mb_ereg_search_regs([string pattern[, string option]])", "Regular expression search for multibyte string" ], "mb_ereg_search_setpos": [ "bool mb_ereg_search_setpos(int position)", "Set search start position" ], "mb_eregi": [ "int mb_eregi(string pattern, string string [, array registers])", "Case-insensitive regular expression match for multibyte string" ], "mb_eregi_replace": [ "string mb_eregi_replace(string pattern, string replacement, string string)", "Case insensitive replace regular expression for multibyte string" ], "mb_get_info": [ "mixed mb_get_info([string type])", "Returns the current settings of mbstring" ], "mb_http_input": [ "mixed mb_http_input([string type])", "Returns the input encoding" ], "mb_http_output": [ "string mb_http_output([string encoding])", "Sets the current output_encoding or returns the current output_encoding as a string" ], "mb_internal_encoding": [ "string mb_internal_encoding([string encoding])", "Sets the current internal encoding or Returns the current internal encoding as a string" ], "mb_language": [ "string mb_language([string language])", "Sets the current language or Returns the current language as a string" ], "mb_list_encodings": [ "mixed mb_list_encodings()", "Returns an array of all supported entity encodings" ], "mb_output_handler": [ "string mb_output_handler(string contents, int status)", "Returns string in output buffer converted to the http_output encoding" ], "mb_parse_str": [ "bool mb_parse_str(string encoded_string [, array result])", "Parses GET/POST/COOKIE data and sets global variables" ], "mb_preferred_mime_name": [ "string mb_preferred_mime_name(string encoding)", "Return the preferred MIME name (charset) as a string" ], "mb_regex_encoding": [ "string mb_regex_encoding([string encoding])", "Returns the current encoding for regex as a string." ], "mb_regex_set_options": [ "string mb_regex_set_options([string options])", "Set or get the default options for mbregex functions" ], "mb_send_mail": [ "int mb_send_mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])", "* Sends an email message with MIME scheme" ], "mb_split": [ "array mb_split(string pattern, string string [, int limit])", "split multibyte string into array by regular expression" ], "mb_strcut": [ "string mb_strcut(string str, int start [, int length [, string encoding]])", "Returns part of a string" ], "mb_strimwidth": [ "string mb_strimwidth(string str, int start, int width [, string trimmarker [, string encoding]])", "Trim the string in terminal width" ], "mb_stripos": [ "int mb_stripos(string haystack, string needle [, int offset [, string encoding]])", "Finds position of first occurrence of a string within another, case insensitive" ], "mb_stristr": [ "string mb_stristr(string haystack, string needle[, bool part[, string encoding]])", "Finds first occurrence of a string within another, case insensitive" ], "mb_strlen": [ "int mb_strlen(string str [, string encoding])", "Get character numbers of a string" ], "mb_strpos": [ "int mb_strpos(string haystack, string needle [, int offset [, string encoding]])", "Find position of first occurrence of a string within another" ], "mb_strrchr": [ "string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])", "Finds the last occurrence of a character in a string within another" ], "mb_strrichr": [ "string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])", "Finds the last occurrence of a character in a string within another, case insensitive" ], "mb_strripos": [ "int mb_strripos(string haystack, string needle [, int offset [, string encoding]])", "Finds position of last occurrence of a string within another, case insensitive" ], "mb_strrpos": [ "int mb_strrpos(string haystack, string needle [, int offset [, string encoding]])", "Find position of last occurrence of a string within another" ], "mb_strstr": [ "string mb_strstr(string haystack, string needle[, bool part[, string encoding]])", "Finds first occurrence of a string within another" ], "mb_strtolower": [ "string mb_strtolower(string sourcestring [, string encoding])", "* Returns a lowercased version of sourcestring" ], "mb_strtoupper": [ "string mb_strtoupper(string sourcestring [, string encoding])", "* Returns a uppercased version of sourcestring" ], "mb_strwidth": [ "int mb_strwidth(string str [, string encoding])", "Gets terminal width of a string" ], "mb_substitute_character": [ "mixed mb_substitute_character([mixed substchar])", "Sets the current substitute_character or returns the current substitute_character" ], "mb_substr": [ "string mb_substr(string str, int start [, int length [, string encoding]])", "Returns part of a string" ], "mb_substr_count": [ "int mb_substr_count(string haystack, string needle [, string encoding])", "Count the number of substring occurrences" ], "mcrypt_cbc": [ "string mcrypt_cbc(int cipher, string key, string data, int mode, string iv)", "CBC crypt/decrypt data using key key with cipher cipher starting with iv" ], "mcrypt_cfb": [ "string mcrypt_cfb(int cipher, string key, string data, int mode, string iv)", "CFB crypt/decrypt data using key key with cipher cipher starting with iv" ], "mcrypt_create_iv": [ "string mcrypt_create_iv(int size, int source)", "Create an initialization vector (IV)" ], "mcrypt_decrypt": [ "string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)", "OFB crypt/decrypt data using key key with cipher cipher starting with iv" ], "mcrypt_ecb": [ "string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)", "ECB crypt/decrypt data using key key with cipher cipher starting with iv" ], "mcrypt_enc_get_algorithms_name": [ "string mcrypt_enc_get_algorithms_name(resource td)", "Returns the name of the algorithm specified by the descriptor td" ], "mcrypt_enc_get_block_size": [ "int mcrypt_enc_get_block_size(resource td)", "Returns the block size of the cipher specified by the descriptor td" ], "mcrypt_enc_get_iv_size": [ "int mcrypt_enc_get_iv_size(resource td)", "Returns the size of the IV in bytes of the algorithm specified by the descriptor td" ], "mcrypt_enc_get_key_size": [ "int mcrypt_enc_get_key_size(resource td)", "Returns the maximum supported key size in bytes of the algorithm specified by the descriptor td" ], "mcrypt_enc_get_modes_name": [ "string mcrypt_enc_get_modes_name(resource td)", "Returns the name of the mode specified by the descriptor td" ], "mcrypt_enc_get_supported_key_sizes": [ "array mcrypt_enc_get_supported_key_sizes(resource td)", "This function decrypts the crypttext" ], "mcrypt_enc_is_block_algorithm": [ "bool mcrypt_enc_is_block_algorithm(resource td)", "Returns TRUE if the alrogithm is a block algorithms" ], "mcrypt_enc_is_block_algorithm_mode": [ "bool mcrypt_enc_is_block_algorithm_mode(resource td)", "Returns TRUE if the mode is for use with block algorithms" ], "mcrypt_enc_is_block_mode": [ "bool mcrypt_enc_is_block_mode(resource td)", "Returns TRUE if the mode outputs blocks" ], "mcrypt_enc_self_test": [ "int mcrypt_enc_self_test(resource td)", "This function runs the self test on the algorithm specified by the descriptor td" ], "mcrypt_encrypt": [ "string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)", "OFB crypt/decrypt data using key key with cipher cipher starting with iv" ], "mcrypt_generic": [ "string mcrypt_generic(resource td, string data)", "This function encrypts the plaintext" ], "mcrypt_generic_deinit": [ "bool mcrypt_generic_deinit(resource td)", "This function terminates encrypt specified by the descriptor td" ], "mcrypt_generic_init": [ "int mcrypt_generic_init(resource td, string key, string iv)", "This function initializes all buffers for the specific module" ], "mcrypt_get_block_size": [ "int mcrypt_get_block_size(string cipher, string module)", "Get the key size of cipher" ], "mcrypt_get_cipher_name": [ "string mcrypt_get_cipher_name(string cipher)", "Get the key size of cipher" ], "mcrypt_get_iv_size": [ "int mcrypt_get_iv_size(string cipher, string module)", "Get the IV size of cipher (Usually the same as the blocksize)" ], "mcrypt_get_key_size": [ "int mcrypt_get_key_size(string cipher, string module)", "Get the key size of cipher" ], "mcrypt_list_algorithms": [ "array mcrypt_list_algorithms([string lib_dir])", "List all algorithms in \"module_dir\"" ], "mcrypt_list_modes": [ "array mcrypt_list_modes([string lib_dir])", "List all modes \"module_dir\"" ], "mcrypt_module_close": [ "bool mcrypt_module_close(resource td)", "Free the descriptor td" ], "mcrypt_module_get_algo_block_size": [ "int mcrypt_module_get_algo_block_size(string algorithm [, string lib_dir])", "Returns the block size of the algorithm" ], "mcrypt_module_get_algo_key_size": [ "int mcrypt_module_get_algo_key_size(string algorithm [, string lib_dir])", "Returns the maximum supported key size of the algorithm" ], "mcrypt_module_get_supported_key_sizes": [ "array mcrypt_module_get_supported_key_sizes(string algorithm [, string lib_dir])", "This function decrypts the crypttext" ], "mcrypt_module_is_block_algorithm": [ "bool mcrypt_module_is_block_algorithm(string algorithm [, string lib_dir])", "Returns TRUE if the algorithm is a block algorithm" ], "mcrypt_module_is_block_algorithm_mode": [ "bool mcrypt_module_is_block_algorithm_mode(string mode [, string lib_dir])", "Returns TRUE if the mode is for use with block algorithms" ], "mcrypt_module_is_block_mode": [ "bool mcrypt_module_is_block_mode(string mode [, string lib_dir])", "Returns TRUE if the mode outputs blocks of bytes" ], "mcrypt_module_open": [ "resource mcrypt_module_open(string cipher, string cipher_directory, string mode, string mode_directory)", "Opens the module of the algorithm and the mode to be used" ], "mcrypt_module_self_test": [ "bool mcrypt_module_self_test(string algorithm [, string lib_dir])", "Does a self test of the module \"module\"" ], "mcrypt_ofb": [ "string mcrypt_ofb(int cipher, string key, string data, int mode, string iv)", "OFB crypt/decrypt data using key key with cipher cipher starting with iv" ], "md5": [ "string md5(string str, [ bool raw_output])", "Calculate the md5 hash of a string" ], "md5_file": [ "string md5_file(string filename [, bool raw_output])", "Calculate the md5 hash of given filename" ], "mdecrypt_generic": [ "string mdecrypt_generic(resource td, string data)", "This function decrypts the plaintext" ], "memory_get_peak_usage": [ "int memory_get_peak_usage([real_usage])", "Returns the peak allocated by PHP memory" ], "memory_get_usage": [ "int memory_get_usage([real_usage])", "Returns the allocated by PHP memory" ], "metaphone": [ "string metaphone(string text[, int phones])", "Break english phrases down into their phonemes" ], "method_exists": [ "bool method_exists(object object, string method)", "Checks if the class method exists" ], "mhash": [ "string mhash(int hash, string data [, string key])", "Hash data with hash" ], "mhash_count": [ "int mhash_count()", "Gets the number of available hashes" ], "mhash_get_block_size": [ "int mhash_get_block_size(int hash)", "Gets the block size of hash" ], "mhash_get_hash_name": [ "string mhash_get_hash_name(int hash)", "Gets the name of hash" ], "mhash_keygen_s2k": [ "string mhash_keygen_s2k(int hash, string input_password, string salt, int bytes)", "Generates a key using hash functions" ], "microtime": [ "mixed microtime([bool get_as_float])", "Returns either a string or a float containing the current time in seconds and microseconds" ], "mime_content_type": [ "string mime_content_type(string filename|resource stream)", "Return content-type for file" ], "min": [ "mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])", "Return the lowest value in an array or a series of arguments" ], "mkdir": [ "bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]])", "Create a directory" ], "mktime": [ "int mktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])", "Get UNIX timestamp for a date" ], "money_format": [ "string money_format(string format , float value)", "Convert monetary value(s) to string" ], "move_uploaded_file": [ "bool move_uploaded_file(string path, string new_path)", "Move a file if and only if it was created by an upload" ], "msg_get_queue": [ "resource msg_get_queue(int key [, int perms])", "Attach to a message queue" ], "msg_queue_exists": [ "bool msg_queue_exists(int key)", "Check whether a message queue exists" ], "msg_receive": [ "mixed msg_receive(resource queue, int desiredmsgtype, int &msgtype, int maxsize, mixed message [, bool unserialize=true [, int flags=0 [, int errorcode]]])", "Send a message of type msgtype (must be > 0) to a message queue" ], "msg_remove_queue": [ "bool msg_remove_queue(resource queue)", "Destroy the queue" ], "msg_send": [ "bool msg_send(resource queue, int msgtype, mixed message [, bool serialize=true [, bool blocking=true [, int errorcode]]])", "Send a message of type msgtype (must be > 0) to a message queue" ], "msg_set_queue": [ "bool msg_set_queue(resource queue, array data)", "Set information for a message queue" ], "msg_stat_queue": [ "array msg_stat_queue(resource queue)", "Returns information about a message queue" ], "msgfmt_create": [ "MessageFormatter msgfmt_create( string $locale, string $pattern )", "* Create formatter." ], "msgfmt_format": [ "mixed msgfmt_format( MessageFormatter $nf, array $args )", "* Format a message." ], "msgfmt_format_message": [ "mixed msgfmt_format_message( string $locale, string $pattern, array $args )", "* Format a message." ], "msgfmt_get_error_code": [ "int msgfmt_get_error_code( MessageFormatter $nf )", "* Get formatter's last error code." ], "msgfmt_get_error_message": [ "string msgfmt_get_error_message( MessageFormatter $coll )", "* Get text description for formatter's last error code." ], "msgfmt_get_locale": [ "string msgfmt_get_locale(MessageFormatter $mf)", "* Get formatter locale." ], "msgfmt_get_pattern": [ "string msgfmt_get_pattern( MessageFormatter $mf )", "* Get formatter pattern." ], "msgfmt_parse": [ "array msgfmt_parse( MessageFormatter $nf, string $source )", "* Parse a message." ], "msgfmt_set_pattern": [ "bool msgfmt_set_pattern( MessageFormatter $mf, string $pattern )", "* Set formatter pattern." ], "mssql_bind": [ "bool mssql_bind(resource stmt, string param_name, mixed var, int type [, bool is_output [, bool is_null [, int maxlen]]])", "Adds a parameter to a stored procedure or a remote stored procedure" ], "mssql_close": [ "bool mssql_close([resource conn_id])", "Closes a connection to a MS-SQL server" ], "mssql_connect": [ "int mssql_connect([string servername [, string username [, string password [, bool new_link]]]])", "Establishes a connection to a MS-SQL server" ], "mssql_data_seek": [ "bool mssql_data_seek(resource result_id, int offset)", "Moves the internal row pointer of the MS-SQL result associated with the specified result identifier to pointer to the specified row number" ], "mssql_execute": [ "mixed mssql_execute(resource stmt [, bool skip_results = false])", "Executes a stored procedure on a MS-SQL server database" ], "mssql_fetch_array": [ "array mssql_fetch_array(resource result_id [, int result_type])", "Returns an associative array of the current row in the result set specified by result_id" ], "mssql_fetch_assoc": [ "array mssql_fetch_assoc(resource result_id)", "Returns an associative array of the current row in the result set specified by result_id" ], "mssql_fetch_batch": [ "int mssql_fetch_batch(resource result_index)", "Returns the next batch of records" ], "mssql_fetch_field": [ "object mssql_fetch_field(resource result_id [, int offset])", "Gets information about certain fields in a query result" ], "mssql_fetch_object": [ "object mssql_fetch_object(resource result_id)", "Returns a pseudo-object of the current row in the result set specified by result_id" ], "mssql_fetch_row": [ "array mssql_fetch_row(resource result_id)", "Returns an array of the current row in the result set specified by result_id" ], "mssql_field_length": [ "int mssql_field_length(resource result_id [, int offset])", "Get the length of a MS-SQL field" ], "mssql_field_name": [ "string mssql_field_name(resource result_id [, int offset])", "Returns the name of the field given by offset in the result set given by result_id" ], "mssql_field_seek": [ "bool mssql_field_seek(resource result_id, int offset)", "Seeks to the specified field offset" ], "mssql_field_type": [ "string mssql_field_type(resource result_id [, int offset])", "Returns the type of a field" ], "mssql_free_result": [ "bool mssql_free_result(resource result_index)", "Free a MS-SQL result index" ], "mssql_free_statement": [ "bool mssql_free_statement(resource result_index)", "Free a MS-SQL statement index" ], "mssql_get_last_message": [ "string mssql_get_last_message()", "Gets the last message from the MS-SQL server" ], "mssql_guid_string": [ "string mssql_guid_string(string binary [,bool short_format])", "Converts a 16 byte binary GUID to a string" ], "mssql_init": [ "int mssql_init(string sp_name [, resource conn_id])", "Initializes a stored procedure or a remote stored procedure" ], "mssql_min_error_severity": [ "void mssql_min_error_severity(int severity)", "Sets the lower error severity" ], "mssql_min_message_severity": [ "void mssql_min_message_severity(int severity)", "Sets the lower message severity" ], "mssql_next_result": [ "bool mssql_next_result(resource result_id)", "Move the internal result pointer to the next result" ], "mssql_num_fields": [ "int mssql_num_fields(resource mssql_result_index)", "Returns the number of fields fetched in from the result id specified" ], "mssql_num_rows": [ "int mssql_num_rows(resource mssql_result_index)", "Returns the number of rows fetched in from the result id specified" ], "mssql_pconnect": [ "int mssql_pconnect([string servername [, string username [, string password [, bool new_link]]]])", "Establishes a persistent connection to a MS-SQL server" ], "mssql_query": [ "resource mssql_query(string query [, resource conn_id [, int batch_size]])", "Perform an SQL query on a MS-SQL server database" ], "mssql_result": [ "string mssql_result(resource result_id, int row, mixed field)", "Returns the contents of one cell from a MS-SQL result set" ], "mssql_rows_affected": [ "int mssql_rows_affected(resource conn_id)", "Returns the number of records affected by the query" ], "mssql_select_db": [ "bool mssql_select_db(string database_name [, resource conn_id])", "Select a MS-SQL database" ], "mt_getrandmax": [ "int mt_getrandmax()", "Returns the maximum value a random number from Mersenne Twister can have" ], "mt_rand": [ "int mt_rand([int min, int max])", "Returns a random number from Mersenne Twister" ], "mt_srand": [ "void mt_srand([int seed])", "Seeds Mersenne Twister random number generator" ], "mysql_affected_rows": [ "int mysql_affected_rows([int link_identifier])", "Gets number of affected rows in previous MySQL operation" ], "mysql_client_encoding": [ "string mysql_client_encoding([int link_identifier])", "Returns the default character set for the current connection" ], "mysql_close": [ "bool mysql_close([int link_identifier])", "Close a MySQL connection" ], "mysql_connect": [ "resource mysql_connect([string hostname[:port][:/path/to/socket] [, string username [, string password [, bool new [, int flags]]]]])", "Opens a connection to a MySQL Server" ], "mysql_create_db": [ "bool mysql_create_db(string database_name [, int link_identifier])", "Create a MySQL database" ], "mysql_data_seek": [ "bool mysql_data_seek(resource result, int row_number)", "Move internal result pointer" ], "mysql_db_query": [ "resource mysql_db_query(string database_name, string query [, int link_identifier])", "Sends an SQL query to MySQL" ], "mysql_drop_db": [ "bool mysql_drop_db(string database_name [, int link_identifier])", "Drops (delete) a MySQL database" ], "mysql_errno": [ "int mysql_errno([int link_identifier])", "Returns the number of the error message from previous MySQL operation" ], "mysql_error": [ "string mysql_error([int link_identifier])", "Returns the text of the error message from previous MySQL operation" ], "mysql_escape_string": [ "string mysql_escape_string(string to_be_escaped)", "Escape string for mysql query" ], "mysql_fetch_array": [ "array mysql_fetch_array(resource result [, int result_type])", "Fetch a result row as an array (associative, numeric or both)" ], "mysql_fetch_assoc": [ "array mysql_fetch_assoc(resource result)", "Fetch a result row as an associative array" ], "mysql_fetch_field": [ "object mysql_fetch_field(resource result [, int field_offset])", "Gets column information from a result and return as an object" ], "mysql_fetch_lengths": [ "array mysql_fetch_lengths(resource result)", "Gets max data size of each column in a result" ], "mysql_fetch_object": [ "object mysql_fetch_object(resource result [, string class_name [, NULL|array ctor_params]])", "Fetch a result row as an object" ], "mysql_fetch_row": [ "array mysql_fetch_row(resource result)", "Gets a result row as an enumerated array" ], "mysql_field_flags": [ "string mysql_field_flags(resource result, int field_offset)", "Gets the flags associated with the specified field in a result" ], "mysql_field_len": [ "int mysql_field_len(resource result, int field_offset)", "Returns the length of the specified field" ], "mysql_field_name": [ "string mysql_field_name(resource result, int field_index)", "Gets the name of the specified field in a result" ], "mysql_field_seek": [ "bool mysql_field_seek(resource result, int field_offset)", "Sets result pointer to a specific field offset" ], "mysql_field_table": [ "string mysql_field_table(resource result, int field_offset)", "Gets name of the table the specified field is in" ], "mysql_field_type": [ "string mysql_field_type(resource result, int field_offset)", "Gets the type of the specified field in a result" ], "mysql_free_result": [ "bool mysql_free_result(resource result)", "Free result memory" ], "mysql_get_client_info": [ "string mysql_get_client_info()", "Returns a string that represents the client library version" ], "mysql_get_host_info": [ "string mysql_get_host_info([int link_identifier])", "Returns a string describing the type of connection in use, including the server host name" ], "mysql_get_proto_info": [ "int mysql_get_proto_info([int link_identifier])", "Returns the protocol version used by current connection" ], "mysql_get_server_info": [ "string mysql_get_server_info([int link_identifier])", "Returns a string that represents the server version number" ], "mysql_info": [ "string mysql_info([int link_identifier])", "Returns a string containing information about the most recent query" ], "mysql_insert_id": [ "int mysql_insert_id([int link_identifier])", "Gets the ID generated from the previous INSERT operation" ], "mysql_list_dbs": [ "resource mysql_list_dbs([int link_identifier])", "List databases available on a MySQL server" ], "mysql_list_fields": [ "resource mysql_list_fields(string database_name, string table_name [, int link_identifier])", "List MySQL result fields" ], "mysql_list_processes": [ "resource mysql_list_processes([int link_identifier])", "Returns a result set describing the current server threads" ], "mysql_list_tables": [ "resource mysql_list_tables(string database_name [, int link_identifier])", "List tables in a MySQL database" ], "mysql_num_fields": [ "int mysql_num_fields(resource result)", "Gets number of fields in a result" ], "mysql_num_rows": [ "int mysql_num_rows(resource result)", "Gets number of rows in a result" ], "mysql_pconnect": [ "resource mysql_pconnect([string hostname[:port][:/path/to/socket] [, string username [, string password [, int flags]]]])", "Opens a persistent connection to a MySQL Server" ], "mysql_ping": [ "bool mysql_ping([int link_identifier])", "Ping a server connection. If no connection then reconnect." ], "mysql_query": [ "resource mysql_query(string query [, int link_identifier])", "Sends an SQL query to MySQL" ], "mysql_real_escape_string": [ "string mysql_real_escape_string(string to_be_escaped [, int link_identifier])", "Escape special characters in a string for use in a SQL statement, taking into account the current charset of the connection" ], "mysql_result": [ "mixed mysql_result(resource result, int row [, mixed field])", "Gets result data" ], "mysql_select_db": [ "bool mysql_select_db(string database_name [, int link_identifier])", "Selects a MySQL database" ], "mysql_set_charset": [ "bool mysql_set_charset(string csname [, int link_identifier])", "sets client character set" ], "mysql_stat": [ "string mysql_stat([int link_identifier])", "Returns a string containing status information" ], "mysql_thread_id": [ "int mysql_thread_id([int link_identifier])", "Returns the thread id of current connection" ], "mysql_unbuffered_query": [ "resource mysql_unbuffered_query(string query [, int link_identifier])", "Sends an SQL query to MySQL, without fetching and buffering the result rows" ], "mysqli_affected_rows": [ "mixed mysqli_affected_rows(object link)", "Get number of affected rows in previous MySQL operation" ], "mysqli_autocommit": [ "bool mysqli_autocommit(object link, bool mode)", "Turn auto commit on or of" ], "mysqli_cache_stats": [ "array mysqli_cache_stats()", "Returns statistics about the zval cache" ], "mysqli_change_user": [ "bool mysqli_change_user(object link, string user, string password, string database)", "Change logged-in user of the active connection" ], "mysqli_character_set_name": [ "string mysqli_character_set_name(object link)", "Returns the name of the character set used for this connection" ], "mysqli_close": [ "bool mysqli_close(object link)", "Close connection" ], "mysqli_commit": [ "bool mysqli_commit(object link)", "Commit outstanding actions and close transaction" ], "mysqli_connect": [ "object mysqli_connect([string hostname [,string username [,string passwd [,string dbname [,int port [,string socket]]]]]])", "Open a connection to a mysql server" ], "mysqli_connect_errno": [ "int mysqli_connect_errno()", "Returns the numerical value of the error message from last connect command" ], "mysqli_connect_error": [ "string mysqli_connect_error()", "Returns the text of the error message from previous MySQL operation" ], "mysqli_data_seek": [ "bool mysqli_data_seek(object result, int offset)", "Move internal result pointer" ], "mysqli_debug": [ "void mysqli_debug(string debug)", "" ], "mysqli_dump_debug_info": [ "bool mysqli_dump_debug_info(object link)", "" ], "mysqli_embedded_server_end": [ "void mysqli_embedded_server_end()", "" ], "mysqli_embedded_server_start": [ "bool mysqli_embedded_server_start(bool start, array arguments, array groups)", "initialize and start embedded server" ], "mysqli_errno": [ "int mysqli_errno(object link)", "Returns the numerical value of the error message from previous MySQL operation" ], "mysqli_error": [ "string mysqli_error(object link)", "Returns the text of the error message from previous MySQL operation" ], "mysqli_fetch_all": [ "mixed mysqli_fetch_all(object result [,int resulttype])", "Fetches all result rows as an associative array, a numeric array, or both" ], "mysqli_fetch_array": [ "mixed mysqli_fetch_array(object result [,int resulttype])", "Fetch a result row as an associative array, a numeric array, or both" ], "mysqli_fetch_assoc": [ "mixed mysqli_fetch_assoc(object result)", "Fetch a result row as an associative array" ], "mysqli_fetch_field": [ "mixed mysqli_fetch_field(object result)", "Get column information from a result and return as an object" ], "mysqli_fetch_field_direct": [ "mixed mysqli_fetch_field_direct(object result, int offset)", "Fetch meta-data for a single field" ], "mysqli_fetch_fields": [ "mixed mysqli_fetch_fields(object result)", "Return array of objects containing field meta-data" ], "mysqli_fetch_lengths": [ "mixed mysqli_fetch_lengths(object result)", "Get the length of each output in a result" ], "mysqli_fetch_object": [ "mixed mysqli_fetch_object(object result [, string class_name [, NULL|array ctor_params]])", "Fetch a result row as an object" ], "mysqli_fetch_row": [ "array mysqli_fetch_row(object result)", "Get a result row as an enumerated array" ], "mysqli_field_count": [ "int mysqli_field_count(object link)", "Fetch the number of fields returned by the last query for the given link" ], "mysqli_field_seek": [ "int mysqli_field_seek(object result, int fieldnr)", "Set result pointer to a specified field offset" ], "mysqli_field_tell": [ "int mysqli_field_tell(object result)", "Get current field offset of result pointer" ], "mysqli_free_result": [ "void mysqli_free_result(object result)", "Free query result memory for the given result handle" ], "mysqli_get_charset": [ "object mysqli_get_charset(object link)", "returns a character set object" ], "mysqli_get_client_info": [ "string mysqli_get_client_info()", "Get MySQL client info" ], "mysqli_get_client_stats": [ "array mysqli_get_client_stats()", "Returns statistics about the zval cache" ], "mysqli_get_client_version": [ "int mysqli_get_client_version()", "Get MySQL client info" ], "mysqli_get_connection_stats": [ "array mysqli_get_connection_stats()", "Returns statistics about the zval cache" ], "mysqli_get_host_info": [ "string mysqli_get_host_info(object link)", "Get MySQL host info" ], "mysqli_get_proto_info": [ "int mysqli_get_proto_info(object link)", "Get MySQL protocol information" ], "mysqli_get_server_info": [ "string mysqli_get_server_info(object link)", "Get MySQL server info" ], "mysqli_get_server_version": [ "int mysqli_get_server_version(object link)", "Return the MySQL version for the server referenced by the given link" ], "mysqli_get_warnings": [ "object mysqli_get_warnings(object link)", "" ], "mysqli_info": [ "string mysqli_info(object link)", "Get information about the most recent query" ], "mysqli_init": [ "resource mysqli_init()", "Initialize mysqli and return a resource for use with mysql_real_connect" ], "mysqli_insert_id": [ "mixed mysqli_insert_id(object link)", "Get the ID generated from the previous INSERT operation" ], "mysqli_kill": [ "bool mysqli_kill(object link, int processid)", "Kill a mysql process on the server" ], "mysqli_link_construct": [ "object mysqli_link_construct()", "" ], "mysqli_more_results": [ "bool mysqli_more_results(object link)", "check if there any more query results from a multi query" ], "mysqli_multi_query": [ "bool mysqli_multi_query(object link, string query)", "allows to execute multiple queries" ], "mysqli_next_result": [ "bool mysqli_next_result(object link)", "read next result from multi_query" ], "mysqli_num_fields": [ "int mysqli_num_fields(object result)", "Get number of fields in result" ], "mysqli_num_rows": [ "mixed mysqli_num_rows(object result)", "Get number of rows in result" ], "mysqli_options": [ "bool mysqli_options(object link, int flags, mixed values)", "Set options" ], "mysqli_ping": [ "bool mysqli_ping(object link)", "Ping a server connection or reconnect if there is no connection" ], "mysqli_poll": [ "int mysqli_poll(array read, array write, array error, long sec [, long usec])", "Poll connections" ], "mysqli_prepare": [ "mixed mysqli_prepare(object link, string query)", "Prepare a SQL statement for execution" ], "mysqli_query": [ "mixed mysqli_query(object link, string query [,int resultmode])", "" ], "mysqli_real_connect": [ "bool mysqli_real_connect(object link [,string hostname [,string username [,string passwd [,string dbname [,int port [,string socket [,int flags]]]]]]])", "Open a connection to a mysql server" ], "mysqli_real_escape_string": [ "string mysqli_real_escape_string(object link, string escapestr)", "Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection" ], "mysqli_real_query": [ "bool mysqli_real_query(object link, string query)", "Binary-safe version of mysql_query()" ], "mysqli_reap_async_query": [ "int mysqli_reap_async_query(object link)", "Poll connections" ], "mysqli_refresh": [ "bool mysqli_refresh(object link, long options)", "Flush tables or caches, or reset replication server information" ], "mysqli_report": [ "bool mysqli_report(int flags)", "sets report level" ], "mysqli_rollback": [ "bool mysqli_rollback(object link)", "Undo actions from current transaction" ], "mysqli_select_db": [ "bool mysqli_select_db(object link, string dbname)", "Select a MySQL database" ], "mysqli_set_charset": [ "bool mysqli_set_charset(object link, string csname)", "sets client character set" ], "mysqli_set_local_infile_default": [ "void mysqli_set_local_infile_default(object link)", "unsets user defined handler for load local infile command" ], "mysqli_set_local_infile_handler": [ "bool mysqli_set_local_infile_handler(object link, callback read_func)", "Set callback functions for LOAD DATA LOCAL INFILE" ], "mysqli_sqlstate": [ "string mysqli_sqlstate(object link)", "Returns the SQLSTATE error from previous MySQL operation" ], "mysqli_ssl_set": [ "bool mysqli_ssl_set(object link ,string key ,string cert ,string ca ,string capath ,string cipher])", "" ], "mysqli_stat": [ "mixed mysqli_stat(object link)", "Get current system status" ], "mysqli_stmt_affected_rows": [ "mixed mysqli_stmt_affected_rows(object stmt)", "Return the number of rows affected in the last query for the given link" ], "mysqli_stmt_attr_get": [ "int mysqli_stmt_attr_get(object stmt, long attr)", "" ], "mysqli_stmt_attr_set": [ "int mysqli_stmt_attr_set(object stmt, long attr, long mode)", "" ], "mysqli_stmt_bind_param": [ "bool mysqli_stmt_bind_param(object stmt, string types, mixed variable [,mixed,....])", "Bind variables to a prepared statement as parameters" ], "mysqli_stmt_bind_result": [ "bool mysqli_stmt_bind_result(object stmt, mixed var, [,mixed, ...])", "Bind variables to a prepared statement for result storage" ], "mysqli_stmt_close": [ "bool mysqli_stmt_close(object stmt)", "Close statement" ], "mysqli_stmt_data_seek": [ "void mysqli_stmt_data_seek(object stmt, int offset)", "Move internal result pointer" ], "mysqli_stmt_errno": [ "int mysqli_stmt_errno(object stmt)", "" ], "mysqli_stmt_error": [ "string mysqli_stmt_error(object stmt)", "" ], "mysqli_stmt_execute": [ "bool mysqli_stmt_execute(object stmt)", "Execute a prepared statement" ], "mysqli_stmt_fetch": [ "mixed mysqli_stmt_fetch(object stmt)", "Fetch results from a prepared statement into the bound variables" ], "mysqli_stmt_field_count": [ "int mysqli_stmt_field_count(object stmt) {", "Return the number of result columns for the given statement" ], "mysqli_stmt_free_result": [ "void mysqli_stmt_free_result(object stmt)", "Free stored result memory for the given statement handle" ], "mysqli_stmt_get_result": [ "object mysqli_stmt_get_result(object link)", "Buffer result set on client" ], "mysqli_stmt_get_warnings": [ "object mysqli_stmt_get_warnings(object link)", "" ], "mysqli_stmt_init": [ "mixed mysqli_stmt_init(object link)", "Initialize statement object" ], "mysqli_stmt_insert_id": [ "mixed mysqli_stmt_insert_id(object stmt)", "Get the ID generated from the previous INSERT operation" ], "mysqli_stmt_next_result": [ "bool mysqli_stmt_next_result(object link)", "read next result from multi_query" ], "mysqli_stmt_num_rows": [ "mixed mysqli_stmt_num_rows(object stmt)", "Return the number of rows in statements result set" ], "mysqli_stmt_param_count": [ "int mysqli_stmt_param_count(object stmt)", "Return the number of parameter for the given statement" ], "mysqli_stmt_prepare": [ "bool mysqli_stmt_prepare(object stmt, string query)", "prepare server side statement with query" ], "mysqli_stmt_reset": [ "bool mysqli_stmt_reset(object stmt)", "reset a prepared statement" ], "mysqli_stmt_result_metadata": [ "mixed mysqli_stmt_result_metadata(object stmt)", "return result set from statement" ], "mysqli_stmt_send_long_data": [ "bool mysqli_stmt_send_long_data(object stmt, int param_nr, string data)", "" ], "mysqli_stmt_sqlstate": [ "string mysqli_stmt_sqlstate(object stmt)", "" ], "mysqli_stmt_store_result": [ "bool mysqli_stmt_store_result(stmt)", "" ], "mysqli_store_result": [ "object mysqli_store_result(object link)", "Buffer result set on client" ], "mysqli_thread_id": [ "int mysqli_thread_id(object link)", "Return the current thread ID" ], "mysqli_thread_safe": [ "bool mysqli_thread_safe()", "Return whether thread safety is given or not" ], "mysqli_use_result": [ "mixed mysqli_use_result(object link)", "Directly retrieve query results - do not buffer results on client side" ], "mysqli_warning_count": [ "int mysqli_warning_count(object link)", "Return number of warnings from the last query for the given link" ], "natcasesort": [ "void natcasesort(array &array_arg)", "Sort an array using case-insensitive natural sort" ], "natsort": [ "void natsort(array &array_arg)", "Sort an array using natural sort" ], "next": [ "mixed next(array array_arg)", "Move array argument's internal pointer to the next element and return it" ], "ngettext": [ "string ngettext(string MSGID1, string MSGID2, int N)", "Plural version of gettext()" ], "nl2br": [ "string nl2br(string str [, bool is_xhtml])", "Converts newlines to HTML line breaks" ], "nl_langinfo": [ "string nl_langinfo(int item)", "Query language and locale information" ], "normalizer_is_normalize": [ "bool normalizer_is_normalize( string $input [, string $form = FORM_C] )", "* Test if a string is in a given normalization form." ], "normalizer_normalize": [ "string normalizer_normalize( string $input [, string $form = FORM_C] )", "* Normalize a string." ], "nsapi_request_headers": [ "array nsapi_request_headers()", "Get all headers from the request" ], "nsapi_response_headers": [ "array nsapi_response_headers()", "Get all headers from the response" ], "nsapi_virtual": [ "bool nsapi_virtual(string uri)", "Perform an NSAPI sub-request" ], "number_format": [ "string number_format(float number [, int num_decimal_places [, string dec_seperator, string thousands_seperator]])", "Formats a number with grouped thousands" ], "numfmt_create": [ "NumberFormatter numfmt_create( string $locale, int style[, string $pattern ] )", "* Create number formatter." ], "numfmt_format": [ "mixed numfmt_format( NumberFormatter $nf, mixed $num[, int type] )", "* Format a number." ], "numfmt_format_currency": [ "mixed numfmt_format_currency( NumberFormatter $nf, double $num, string $currency )", "* Format a number as currency." ], "numfmt_get_attribute": [ "mixed numfmt_get_attribute( NumberFormatter $nf, int $attr )", "* Get formatter attribute value." ], "numfmt_get_error_code": [ "int numfmt_get_error_code( NumberFormatter $nf )", "* Get formatter's last error code." ], "numfmt_get_error_message": [ "string numfmt_get_error_message( NumberFormatter $nf )", "* Get text description for formatter's last error code." ], "numfmt_get_locale": [ "string numfmt_get_locale( NumberFormatter $nf[, int type] )", "* Get formatter locale." ], "numfmt_get_pattern": [ "string numfmt_get_pattern( NumberFormatter $nf )", "* Get formatter pattern." ], "numfmt_get_symbol": [ "string numfmt_get_symbol( NumberFormatter $nf, int $attr )", "* Get formatter symbol value." ], "numfmt_get_text_attribute": [ "string numfmt_get_text_attribute( NumberFormatter $nf, int $attr )", "* Get formatter attribute value." ], "numfmt_parse": [ "mixed numfmt_parse( NumberFormatter $nf, string $str[, int $type, int &$position ])", "* Parse a number." ], "numfmt_parse_currency": [ "double numfmt_parse_currency( NumberFormatter $nf, string $str, string $¤cy[, int $&position] )", "* Parse a number as currency." ], "numfmt_parse_message": [ "array numfmt_parse_message( string $locale, string $pattern, string $source )", "* Parse a message." ], "numfmt_set_attribute": [ "bool numfmt_set_attribute( NumberFormatter $nf, int $attr, mixed $value )", "* Get formatter attribute value." ], "numfmt_set_pattern": [ "bool numfmt_set_pattern( NumberFormatter $nf, string $pattern )", "* Set formatter pattern." ], "numfmt_set_symbol": [ "bool numfmt_set_symbol( NumberFormatter $nf, int $attr, string $symbol )", "* Set formatter symbol value." ], "numfmt_set_text_attribute": [ "bool numfmt_set_text_attribute( NumberFormatter $nf, int $attr, string $value )", "* Get formatter attribute value." ], "ob_clean": [ "bool ob_clean()", "Clean (delete) the current output buffer" ], "ob_end_clean": [ "bool ob_end_clean()", "Clean the output buffer, and delete current output buffer" ], "ob_end_flush": [ "bool ob_end_flush()", "Flush (send) the output buffer, and delete current output buffer" ], "ob_flush": [ "bool ob_flush()", "Flush (send) contents of the output buffer. The last buffer content is sent to next buffer" ], "ob_get_clean": [ "bool ob_get_clean()", "Get current buffer contents and delete current output buffer" ], "ob_get_contents": [ "string ob_get_contents()", "Return the contents of the output buffer" ], "ob_get_flush": [ "bool ob_get_flush()", "Get current buffer contents, flush (send) the output buffer, and delete current output buffer" ], "ob_get_length": [ "int ob_get_length()", "Return the length of the output buffer" ], "ob_get_level": [ "int ob_get_level()", "Return the nesting level of the output buffer" ], "ob_get_status": [ "false|array ob_get_status([bool full_status])", "Return the status of the active or all output buffers" ], "ob_gzhandler": [ "string ob_gzhandler(string str, int mode)", "Encode str based on accept-encoding setting - designed to be called from ob_start()" ], "ob_iconv_handler": [ "string ob_iconv_handler(string contents, int status)", "Returns str in output buffer converted to the iconv.output_encoding character set" ], "ob_implicit_flush": [ "void ob_implicit_flush([int flag])", "Turn implicit flush on/off and is equivalent to calling flush() after every output call" ], "ob_list_handlers": [ "false|array ob_list_handlers()", "* List all output_buffers in an array" ], "ob_start": [ "bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])", "Turn on Output Buffering (specifying an optional output handler)." ], "oci_bind_array_by_name": [ "bool oci_bind_array_by_name(resource stmt, string name, array &var, int max_table_length [, int max_item_length [, int type ]])", "Bind a PHP array to an Oracle PL/SQL type by name" ], "oci_bind_by_name": [ "bool oci_bind_by_name(resource stmt, string name, mixed &var, [, int maxlength [, int type]])", "Bind a PHP variable to an Oracle placeholder by name" ], "oci_cancel": [ "bool oci_cancel(resource stmt)", "Cancel reading from a cursor" ], "oci_close": [ "bool oci_close(resource connection)", "Disconnect from database" ], "oci_collection_append": [ "bool oci_collection_append(string value)", "Append an object to the collection" ], "oci_collection_assign": [ "bool oci_collection_assign(object from)", "Assign a collection from another existing collection" ], "oci_collection_element_assign": [ "bool oci_collection_element_assign(int index, string val)", "Assign element val to collection at index ndx" ], "oci_collection_element_get": [ "string oci_collection_element_get(int ndx)", "Retrieve the value at collection index ndx" ], "oci_collection_max": [ "int oci_collection_max()", "Return the max value of a collection. For a varray this is the maximum length of the array" ], "oci_collection_size": [ "int oci_collection_size()", "Return the size of a collection" ], "oci_collection_trim": [ "bool oci_collection_trim(int num)", "Trim num elements from the end of a collection" ], "oci_commit": [ "bool oci_commit(resource connection)", "Commit the current context" ], "oci_connect": [ "resource oci_connect(string user, string pass [, string db [, string charset [, int session_mode ]])", "Connect to an Oracle database and log on. Returns a new session." ], "oci_define_by_name": [ "bool oci_define_by_name(resource stmt, string name, mixed &var [, int type])", "Define a PHP variable to an Oracle column by name" ], "oci_error": [ "array oci_error([resource stmt|connection|global])", "Return the last error of stmt|connection|global. If no error happened returns false." ], "oci_execute": [ "bool oci_execute(resource stmt [, int mode])", "Execute a parsed statement" ], "oci_fetch": [ "bool oci_fetch(resource stmt)", "Prepare a new row of data for reading" ], "oci_fetch_all": [ "int oci_fetch_all(resource stmt, array &output[, int skip[, int maxrows[, int flags]]])", "Fetch all rows of result data into an array" ], "oci_fetch_array": [ "array oci_fetch_array( resource stmt [, int mode ])", "Fetch a result row as an array" ], "oci_fetch_assoc": [ "array oci_fetch_assoc( resource stmt )", "Fetch a result row as an associative array" ], "oci_fetch_object": [ "object oci_fetch_object( resource stmt )", "Fetch a result row as an object" ], "oci_fetch_row": [ "array oci_fetch_row( resource stmt )", "Fetch a result row as an enumerated array" ], "oci_field_is_null": [ "bool oci_field_is_null(resource stmt, int col)", "Tell whether a column is NULL" ], "oci_field_name": [ "string oci_field_name(resource stmt, int col)", "Tell the name of a column" ], "oci_field_precision": [ "int oci_field_precision(resource stmt, int col)", "Tell the precision of a column" ], "oci_field_scale": [ "int oci_field_scale(resource stmt, int col)", "Tell the scale of a column" ], "oci_field_size": [ "int oci_field_size(resource stmt, int col)", "Tell the maximum data size of a column" ], "oci_field_type": [ "mixed oci_field_type(resource stmt, int col)", "Tell the data type of a column" ], "oci_field_type_raw": [ "int oci_field_type_raw(resource stmt, int col)", "Tell the raw oracle data type of a column" ], "oci_free_collection": [ "bool oci_free_collection()", "Deletes collection object" ], "oci_free_descriptor": [ "bool oci_free_descriptor()", "Deletes large object description" ], "oci_free_statement": [ "bool oci_free_statement(resource stmt)", "Free all resources associated with a statement" ], "oci_internal_debug": [ "void oci_internal_debug(int onoff)", "Toggle internal debugging output for the OCI extension" ], "oci_lob_append": [ "bool oci_lob_append( object lob )", "Appends data from a LOB to another LOB" ], "oci_lob_close": [ "bool oci_lob_close()", "Closes lob descriptor" ], "oci_lob_copy": [ "bool oci_lob_copy( object lob_to, object lob_from [, int length ] )", "Copies data from a LOB to another LOB" ], "oci_lob_eof": [ "bool oci_lob_eof()", "Checks if EOF is reached" ], "oci_lob_erase": [ "int oci_lob_erase( [ int offset [, int length ] ] )", "Erases a specified portion of the internal LOB, starting at a specified offset" ], "oci_lob_export": [ "bool oci_lob_export([string filename [, int start [, int length]]])", "Writes a large object into a file" ], "oci_lob_flush": [ "bool oci_lob_flush( [ int flag ] )", "Flushes the LOB buffer" ], "oci_lob_import": [ "bool oci_lob_import( string filename )", "Loads file into a LOB" ], "oci_lob_is_equal": [ "bool oci_lob_is_equal( object lob1, object lob2 )", "Tests to see if two LOB/FILE locators are equal" ], "oci_lob_load": [ "string oci_lob_load()", "Loads a large object" ], "oci_lob_read": [ "string oci_lob_read( int length )", "Reads particular part of a large object" ], "oci_lob_rewind": [ "bool oci_lob_rewind()", "Rewind pointer of a LOB" ], "oci_lob_save": [ "bool oci_lob_save( string data [, int offset ])", "Saves a large object" ], "oci_lob_seek": [ "bool oci_lob_seek( int offset [, int whence ])", "Moves the pointer of a LOB" ], "oci_lob_size": [ "int oci_lob_size()", "Returns size of a large object" ], "oci_lob_tell": [ "int oci_lob_tell()", "Tells LOB pointer position" ], "oci_lob_truncate": [ "bool oci_lob_truncate( [ int length ])", "Truncates a LOB" ], "oci_lob_write": [ "int oci_lob_write( string string [, int length ])", "Writes data to current position of a LOB" ], "oci_lob_write_temporary": [ "bool oci_lob_write_temporary(string var [, int lob_type])", "Writes temporary blob" ], "oci_new_collection": [ "object oci_new_collection(resource connection, string tdo [, string schema])", "Initialize a new collection" ], "oci_new_connect": [ "resource oci_new_connect(string user, string pass [, string db])", "Connect to an Oracle database and log on. Returns a new session." ], "oci_new_cursor": [ "resource oci_new_cursor(resource connection)", "Return a new cursor (Statement-Handle) - use this to bind ref-cursors!" ], "oci_new_descriptor": [ "object oci_new_descriptor(resource connection [, int type])", "Initialize a new empty descriptor LOB/FILE (LOB is default)" ], "oci_num_fields": [ "int oci_num_fields(resource stmt)", "Return the number of result columns in a statement" ], "oci_num_rows": [ "int oci_num_rows(resource stmt)", "Return the row count of an OCI statement" ], "oci_parse": [ "resource oci_parse(resource connection, string query)", "Parse a query and return a statement" ], "oci_password_change": [ "bool oci_password_change(resource connection, string username, string old_password, string new_password)", "Changes the password of an account" ], "oci_pconnect": [ "resource oci_pconnect(string user, string pass [, string db [, string charset ]])", "Connect to an Oracle database using a persistent connection and log on. Returns a new session." ], "oci_result": [ "string oci_result(resource stmt, mixed column)", "Return a single column of result data" ], "oci_rollback": [ "bool oci_rollback(resource connection)", "Rollback the current context" ], "oci_server_version": [ "string oci_server_version(resource connection)", "Return a string containing server version information" ], "oci_set_action": [ "bool oci_set_action(resource connection, string value)", "Sets the action attribute on the connection" ], "oci_set_client_identifier": [ "bool oci_set_client_identifier(resource connection, string value)", "Sets the client identifier attribute on the connection" ], "oci_set_client_info": [ "bool oci_set_client_info(resource connection, string value)", "Sets the client info attribute on the connection" ], "oci_set_edition": [ "bool oci_set_edition(string value)", "Sets the edition attribute for all subsequent connections created" ], "oci_set_module_name": [ "bool oci_set_module_name(resource connection, string value)", "Sets the module attribute on the connection" ], "oci_set_prefetch": [ "bool oci_set_prefetch(resource stmt, int prefetch_rows)", "Sets the number of rows to be prefetched on execute to prefetch_rows for stmt" ], "oci_statement_type": [ "string oci_statement_type(resource stmt)", "Return the query type of an OCI statement" ], "ocifetchinto": [ "int ocifetchinto(resource stmt, array &output [, int mode])", "Fetch a row of result data into an array" ], "ocigetbufferinglob": [ "bool ocigetbufferinglob()", "Returns current state of buffering for a LOB" ], "ocisetbufferinglob": [ "bool ocisetbufferinglob( bool flag )", "Enables/disables buffering for a LOB" ], "octdec": [ "int octdec(string octal_number)", "Returns the decimal equivalent of an octal string" ], "odbc_autocommit": [ "mixed odbc_autocommit(resource connection_id [, int OnOff])", "Toggle autocommit mode or get status" ], "odbc_binmode": [ "bool odbc_binmode(int result_id, int mode)", "Handle binary column data" ], "odbc_close": [ "void odbc_close(resource connection_id)", "Close an ODBC connection" ], "odbc_close_all": [ "void odbc_close_all()", "Close all ODBC connections" ], "odbc_columnprivileges": [ "resource odbc_columnprivileges(resource connection_id, string catalog, string schema, string table, string column)", "Returns a result identifier that can be used to fetch a list of columns and associated privileges for the specified table" ], "odbc_columns": [ "resource odbc_columns(resource connection_id [, string qualifier [, string owner [, string table_name [, string column_name]]]])", "Returns a result identifier that can be used to fetch a list of column names in specified tables" ], "odbc_commit": [ "bool odbc_commit(resource connection_id)", "Commit an ODBC transaction" ], "odbc_connect": [ "resource odbc_connect(string DSN, string user, string password [, int cursor_option])", "Connect to a datasource" ], "odbc_cursor": [ "string odbc_cursor(resource result_id)", "Get cursor name" ], "odbc_data_source": [ "array odbc_data_source(resource connection_id, int fetch_type)", "Return information about the currently connected data source" ], "odbc_error": [ "string odbc_error([resource connection_id])", "Get the last error code" ], "odbc_errormsg": [ "string odbc_errormsg([resource connection_id])", "Get the last error message" ], "odbc_exec": [ "resource odbc_exec(resource connection_id, string query [, int flags])", "Prepare and execute an SQL statement" ], "odbc_execute": [ "bool odbc_execute(resource result_id [, array parameters_array])", "Execute a prepared statement" ], "odbc_fetch_array": [ "array odbc_fetch_array(int result [, int rownumber])", "Fetch a result row as an associative array" ], "odbc_fetch_into": [ "int odbc_fetch_into(resource result_id, array &result_array, [, int rownumber])", "Fetch one result row into an array" ], "odbc_fetch_object": [ "object odbc_fetch_object(int result [, int rownumber])", "Fetch a result row as an object" ], "odbc_fetch_row": [ "bool odbc_fetch_row(resource result_id [, int row_number])", "Fetch a row" ], "odbc_field_len": [ "int odbc_field_len(resource result_id, int field_number)", "Get the length (precision) of a column" ], "odbc_field_name": [ "string odbc_field_name(resource result_id, int field_number)", "Get a column name" ], "odbc_field_num": [ "int odbc_field_num(resource result_id, string field_name)", "Return column number" ], "odbc_field_scale": [ "int odbc_field_scale(resource result_id, int field_number)", "Get the scale of a column" ], "odbc_field_type": [ "string odbc_field_type(resource result_id, int field_number)", "Get the datatype of a column" ], "odbc_foreignkeys": [ "resource odbc_foreignkeys(resource connection_id, string pk_qualifier, string pk_owner, string pk_table, string fk_qualifier, string fk_owner, string fk_table)", "Returns a result identifier to either a list of foreign keys in the specified table or a list of foreign keys in other tables that refer to the primary key in the specified table" ], "odbc_free_result": [ "bool odbc_free_result(resource result_id)", "Free resources associated with a result" ], "odbc_gettypeinfo": [ "resource odbc_gettypeinfo(resource connection_id [, int data_type])", "Returns a result identifier containing information about data types supported by the data source" ], "odbc_longreadlen": [ "bool odbc_longreadlen(int result_id, int length)", "Handle LONG columns" ], "odbc_next_result": [ "bool odbc_next_result(resource result_id)", "Checks if multiple results are avaiable" ], "odbc_num_fields": [ "int odbc_num_fields(resource result_id)", "Get number of columns in a result" ], "odbc_num_rows": [ "int odbc_num_rows(resource result_id)", "Get number of rows in a result" ], "odbc_pconnect": [ "resource odbc_pconnect(string DSN, string user, string password [, int cursor_option])", "Establish a persistent connection to a datasource" ], "odbc_prepare": [ "resource odbc_prepare(resource connection_id, string query)", "Prepares a statement for execution" ], "odbc_primarykeys": [ "resource odbc_primarykeys(resource connection_id, string qualifier, string owner, string table)", "Returns a result identifier listing the column names that comprise the primary key for a table" ], "odbc_procedurecolumns": [ "resource odbc_procedurecolumns(resource connection_id [, string qualifier, string owner, string proc, string column])", "Returns a result identifier containing the list of input and output parameters, as well as the columns that make up the result set for the specified procedures" ], "odbc_procedures": [ "resource odbc_procedures(resource connection_id [, string qualifier, string owner, string name])", "Returns a result identifier containg the list of procedure names in a datasource" ], "odbc_result": [ "mixed odbc_result(resource result_id, mixed field)", "Get result data" ], "odbc_result_all": [ "int odbc_result_all(resource result_id [, string format])", "Print result as HTML table" ], "odbc_rollback": [ "bool odbc_rollback(resource connection_id)", "Rollback a transaction" ], "odbc_setoption": [ "bool odbc_setoption(resource conn_id|result_id, int which, int option, int value)", "Sets connection or statement options" ], "odbc_specialcolumns": [ "resource odbc_specialcolumns(resource connection_id, int type, string qualifier, string owner, string table, int scope, int nullable)", "Returns a result identifier containing either the optimal set of columns that uniquely identifies a row in the table or columns that are automatically updated when any value in the row is updated by a transaction" ], "odbc_statistics": [ "resource odbc_statistics(resource connection_id, string qualifier, string owner, string name, int unique, int accuracy)", "Returns a result identifier that contains statistics about a single table and the indexes associated with the table" ], "odbc_tableprivileges": [ "resource odbc_tableprivileges(resource connection_id, string qualifier, string owner, string name)", "Returns a result identifier containing a list of tables and the privileges associated with each table" ], "odbc_tables": [ "resource odbc_tables(resource connection_id [, string qualifier [, string owner [, string name [, string table_types]]]])", "Call the SQLTables function" ], "opendir": [ "mixed opendir(string path[, resource context])", "Open a directory and return a dir_handle" ], "openlog": [ "bool openlog(string ident, int option, int facility)", "Open connection to system logger" ], "openssl_csr_export": [ "bool openssl_csr_export(resource csr, string &out [, bool notext=true])", "Exports a CSR to file or a var" ], "openssl_csr_export_to_file": [ "bool openssl_csr_export_to_file(resource csr, string outfilename [, bool notext=true])", "Exports a CSR to file" ], "openssl_csr_get_public_key": [ "mixed openssl_csr_get_public_key(mixed csr)", "Returns the subject of a CERT or FALSE on error" ], "openssl_csr_get_subject": [ "mixed openssl_csr_get_subject(mixed csr)", "Returns the subject of a CERT or FALSE on error" ], "openssl_csr_new": [ "bool openssl_csr_new(array dn, resource &privkey [, array configargs [, array extraattribs]])", "Generates a privkey and CSR" ], "openssl_csr_sign": [ "resource openssl_csr_sign(mixed csr, mixed x509, mixed priv_key, long days [, array config_args [, long serial]])", "Signs a cert with another CERT" ], "openssl_decrypt": [ "string openssl_decrypt(string data, string method, string password [, bool raw_input=false])", "Takes raw or base64 encoded string and dectupt it using given method and key" ], "openssl_dh_compute_key": [ "string openssl_dh_compute_key(string pub_key, resource dh_key)", "Computes shared sicret for public value of remote DH key and local DH key" ], "openssl_digest": [ "string openssl_digest(string data, string method [, bool raw_output=false])", "Computes digest hash value for given data using given method, returns raw or binhex encoded string" ], "openssl_encrypt": [ "string openssl_encrypt(string data, string method, string password [, bool raw_output=false])", "Encrypts given data with given method and key, returns raw or base64 encoded string" ], "openssl_error_string": [ "mixed openssl_error_string()", "Returns a description of the last error, and alters the index of the error messages. Returns false when the are no more messages" ], "openssl_get_cipher_methods": [ "array openssl_get_cipher_methods([bool aliases = false])", "Return array of available cipher methods" ], "openssl_get_md_methods": [ "array openssl_get_md_methods([bool aliases = false])", "Return array of available digest methods" ], "openssl_open": [ "bool openssl_open(string data, &string opendata, string ekey, mixed privkey)", "Opens data" ], "openssl_pkcs12_export": [ "bool openssl_pkcs12_export(mixed x509, string &out, mixed priv_key, string pass[, array args])", "Creates and exports a PKCS12 to a var" ], "openssl_pkcs12_export_to_file": [ "bool openssl_pkcs12_export_to_file(mixed x509, string filename, mixed priv_key, string pass[, array args])", "Creates and exports a PKCS to file" ], "openssl_pkcs12_read": [ "bool openssl_pkcs12_read(string PKCS12, array &certs, string pass)", "Parses a PKCS12 to an array" ], "openssl_pkcs7_decrypt": [ "bool openssl_pkcs7_decrypt(string infilename, string outfilename, mixed recipcert [, mixed recipkey])", "Decrypts the S/MIME message in the file name infilename and output the results to the file name outfilename. recipcert is a CERT for one of the recipients. recipkey specifies the private key matching recipcert, if recipcert does not include the key" ], "openssl_pkcs7_encrypt": [ "bool openssl_pkcs7_encrypt(string infile, string outfile, mixed recipcerts, array headers [, long flags [, long cipher]])", "Encrypts the message in the file named infile with the certificates in recipcerts and output the result to the file named outfile" ], "openssl_pkcs7_sign": [ "bool openssl_pkcs7_sign(string infile, string outfile, mixed signcert, mixed signkey, array headers [, long flags [, string extracertsfilename]])", "Signs the MIME message in the file named infile with signcert/signkey and output the result to file name outfile. headers lists plain text headers to exclude from the signed portion of the message, and should include to, from and subject as a minimum" ], "openssl_pkcs7_verify": [ "bool openssl_pkcs7_verify(string filename, long flags [, string signerscerts [, array cainfo [, string extracerts [, string content]]]])", "Verifys that the data block is intact, the signer is who they say they are, and returns the CERTs of the signers" ], "openssl_pkey_export": [ "bool openssl_pkey_export(mixed key, &mixed out [, string passphrase [, array config_args]])", "Gets an exportable representation of a key into a string or file" ], "openssl_pkey_export_to_file": [ "bool openssl_pkey_export_to_file(mixed key, string outfilename [, string passphrase, array config_args)", "Gets an exportable representation of a key into a file" ], "openssl_pkey_free": [ "void openssl_pkey_free(int key)", "Frees a key" ], "openssl_pkey_get_details": [ "resource openssl_pkey_get_details(resource key)", "returns an array with the key details (bits, pkey, type)" ], "openssl_pkey_get_private": [ "int openssl_pkey_get_private(string key [, string passphrase])", "Gets private keys" ], "openssl_pkey_get_public": [ "int openssl_pkey_get_public(mixed cert)", "Gets public key from X.509 certificate" ], "openssl_pkey_new": [ "resource openssl_pkey_new([array configargs])", "Generates a new private key" ], "openssl_private_decrypt": [ "bool openssl_private_decrypt(string data, string &decrypted, mixed key [, int padding])", "Decrypts data with private key" ], "openssl_private_encrypt": [ "bool openssl_private_encrypt(string data, string &crypted, mixed key [, int padding])", "Encrypts data with private key" ], "openssl_public_decrypt": [ "bool openssl_public_decrypt(string data, string &crypted, resource key [, int padding])", "Decrypts data with public key" ], "openssl_public_encrypt": [ "bool openssl_public_encrypt(string data, string &crypted, mixed key [, int padding])", "Encrypts data with public key" ], "openssl_random_pseudo_bytes": [ "string openssl_random_pseudo_bytes(integer length [, &bool returned_strong_result])", "Returns a string of the length specified filled with random pseudo bytes" ], "openssl_seal": [ "int openssl_seal(string data, &string sealdata, &array ekeys, array pubkeys)", "Seals data" ], "openssl_sign": [ "bool openssl_sign(string data, &string signature, mixed key[, mixed method])", "Signs data" ], "openssl_verify": [ "int openssl_verify(string data, string signature, mixed key[, mixed method])", "Verifys data" ], "openssl_x509_check_private_key": [ "bool openssl_x509_check_private_key(mixed cert, mixed key)", "Checks if a private key corresponds to a CERT" ], "openssl_x509_checkpurpose": [ "int openssl_x509_checkpurpose(mixed x509cert, int purpose, array cainfo [, string untrustedfile])", "Checks the CERT to see if it can be used for the purpose in purpose. cainfo holds information about trusted CAs" ], "openssl_x509_export": [ "bool openssl_x509_export(mixed x509, string &out [, bool notext = true])", "Exports a CERT to file or a var" ], "openssl_x509_export_to_file": [ "bool openssl_x509_export_to_file(mixed x509, string outfilename [, bool notext = true])", "Exports a CERT to file or a var" ], "openssl_x509_free": [ "void openssl_x509_free(resource x509)", "Frees X.509 certificates" ], "openssl_x509_parse": [ "array openssl_x509_parse(mixed x509 [, bool shortnames=true])", "Returns an array of the fields/values of the CERT" ], "openssl_x509_read": [ "resource openssl_x509_read(mixed cert)", "Reads X.509 certificates" ], "ord": [ "int ord(string character)", "Returns ASCII value of character" ], "output_add_rewrite_var": [ "bool output_add_rewrite_var(string name, string value)", "Add URL rewriter values" ], "output_reset_rewrite_vars": [ "bool output_reset_rewrite_vars()", "Reset(clear) URL rewriter values" ], "pack": [ "string pack(string format, mixed arg1 [, mixed arg2 [, mixed ...]])", "Takes one or more arguments and packs them into a binary string according to the format argument" ], "parse_ini_file": [ "array parse_ini_file(string filename [, bool process_sections [, int scanner_mode]])", "Parse configuration file" ], "parse_ini_string": [ "array parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]])", "Parse configuration string" ], "parse_locale": [ "static array parse_locale($locale)", "* parses a locale-id into an array the different parts of it" ], "parse_str": [ "void parse_str(string encoded_string [, array result])", "Parses GET/POST/COOKIE data and sets global variables" ], "parse_url": [ "mixed parse_url(string url, [int url_component])", "Parse a URL and return its components" ], "passthru": [ "void passthru(string command [, int &return_value])", "Execute an external program and display raw output" ], "pathinfo": [ "array pathinfo(string path[, int options])", "Returns information about a certain string" ], "pclose": [ "int pclose(resource fp)", "Close a file pointer opened by popen()" ], "pcnlt_sigwaitinfo": [ "int pcnlt_sigwaitinfo(array set[, array &siginfo])", "Synchronously wait for queued signals" ], "pcntl_alarm": [ "int pcntl_alarm(int seconds)", "Set an alarm clock for delivery of a signal" ], "pcntl_exec": [ "bool pcntl_exec(string path [, array args [, array envs]])", "Executes specified program in current process space as defined by exec(2)" ], "pcntl_fork": [ "int pcntl_fork()", "Forks the currently running process following the same behavior as the UNIX fork() system call" ], "pcntl_getpriority": [ "int pcntl_getpriority([int pid [, int process_identifier]])", "Get the priority of any process" ], "pcntl_setpriority": [ "bool pcntl_setpriority(int priority [, int pid [, int process_identifier]])", "Change the priority of any process" ], "pcntl_signal": [ "bool pcntl_signal(int signo, callback handle [, bool restart_syscalls])", "Assigns a system signal handler to a PHP function" ], "pcntl_signal_dispatch": [ "bool pcntl_signal_dispatch()", "Dispatch signals to signal handlers" ], "pcntl_sigprocmask": [ "bool pcntl_sigprocmask(int how, array set[, array &oldset])", "Examine and change blocked signals" ], "pcntl_sigtimedwait": [ "int pcntl_sigtimedwait(array set[, array &siginfo[, int seconds[, int nanoseconds]]])", "Wait for queued signals" ], "pcntl_wait": [ "int pcntl_wait(int &status)", "Waits on or returns the status of a forked child as defined by the waitpid() system call" ], "pcntl_waitpid": [ "int pcntl_waitpid(int pid, int &status, int options)", "Waits on or returns the status of a forked child as defined by the waitpid() system call" ], "pcntl_wexitstatus": [ "int pcntl_wexitstatus(int status)", "Returns the status code of a child's exit" ], "pcntl_wifexited": [ "bool pcntl_wifexited(int status)", "Returns true if the child status code represents a successful exit" ], "pcntl_wifsignaled": [ "bool pcntl_wifsignaled(int status)", "Returns true if the child status code represents a process that was terminated due to a signal" ], "pcntl_wifstopped": [ "bool pcntl_wifstopped(int status)", "Returns true if the child status code represents a stopped process (WUNTRACED must have been used with waitpid)" ], "pcntl_wstopsig": [ "int pcntl_wstopsig(int status)", "Returns the number of the signal that caused the process to stop who's status code is passed" ], "pcntl_wtermsig": [ "int pcntl_wtermsig(int status)", "Returns the number of the signal that terminated the process who's status code is passed" ], "pdo_drivers": [ "array pdo_drivers()", "Return array of available PDO drivers" ], "pfsockopen": [ "resource pfsockopen(string hostname, int port [, int errno [, string errstr [, float timeout]]])", "Open persistent Internet or Unix domain socket connection" ], "pg_affected_rows": [ "int pg_affected_rows(resource result)", "Returns the number of affected tuples" ], "pg_cancel_query": [ "bool pg_cancel_query(resource connection)", "Cancel request" ], "pg_client_encoding": [ "string pg_client_encoding([resource connection])", "Get the current client encoding" ], "pg_close": [ "bool pg_close([resource connection])", "Close a PostgreSQL connection" ], "pg_connect": [ "resource pg_connect(string connection_string[, int connect_type] | [string host, string port [, string options [, string tty,]]] string database)", "Open a PostgreSQL connection" ], "pg_connection_busy": [ "bool pg_connection_busy(resource connection)", "Get connection is busy or not" ], "pg_connection_reset": [ "bool pg_connection_reset(resource connection)", "Reset connection (reconnect)" ], "pg_connection_status": [ "int pg_connection_status(resource connnection)", "Get connection status" ], "pg_convert": [ "array pg_convert(resource db, string table, array values[, int options])", "Check and convert values for PostgreSQL SQL statement" ], "pg_copy_from": [ "bool pg_copy_from(resource connection, string table_name , array rows [, string delimiter [, string null_as]])", "Copy table from array" ], "pg_copy_to": [ "array pg_copy_to(resource connection, string table_name [, string delimiter [, string null_as]])", "Copy table to array" ], "pg_dbname": [ "string pg_dbname([resource connection])", "Get the database name" ], "pg_delete": [ "mixed pg_delete(resource db, string table, array ids[, int options])", "Delete records has ids (id => value)" ], "pg_end_copy": [ "bool pg_end_copy([resource connection])", "Sync with backend. Completes the Copy command" ], "pg_escape_bytea": [ "string pg_escape_bytea([resource connection,] string data)", "Escape binary for bytea type" ], "pg_escape_string": [ "string pg_escape_string([resource connection,] string data)", "Escape string for text/char type" ], "pg_execute": [ "resource pg_execute([resource connection,] string stmtname, array params)", "Execute a prepared query" ], "pg_fetch_all": [ "array pg_fetch_all(resource result)", "Fetch all rows into array" ], "pg_fetch_all_columns": [ "array pg_fetch_all_columns(resource result [, int column_number])", "Fetch all rows into array" ], "pg_fetch_array": [ "array pg_fetch_array(resource result [, int row [, int result_type]])", "Fetch a row as an array" ], "pg_fetch_assoc": [ "array pg_fetch_assoc(resource result [, int row])", "Fetch a row as an assoc array" ], "pg_fetch_object": [ "object pg_fetch_object(resource result [, int row [, string class_name [, NULL|array ctor_params]]])", "Fetch a row as an object" ], "pg_fetch_result": [ "mixed pg_fetch_result(resource result, [int row_number,] mixed field_name)", "Returns values from a result identifier" ], "pg_fetch_row": [ "array pg_fetch_row(resource result [, int row [, int result_type]])", "Get a row as an enumerated array" ], "pg_field_is_null": [ "int pg_field_is_null(resource result, [int row,] mixed field_name_or_number)", "Test if a field is NULL" ], "pg_field_name": [ "string pg_field_name(resource result, int field_number)", "Returns the name of the field" ], "pg_field_num": [ "int pg_field_num(resource result, string field_name)", "Returns the field number of the named field" ], "pg_field_prtlen": [ "int pg_field_prtlen(resource result, [int row,] mixed field_name_or_number)", "Returns the printed length" ], "pg_field_size": [ "int pg_field_size(resource result, int field_number)", "Returns the internal size of the field" ], "pg_field_table": [ "mixed pg_field_table(resource result, int field_number[, bool oid_only])", "Returns the name of the table field belongs to, or table's oid if oid_only is true" ], "pg_field_type": [ "string pg_field_type(resource result, int field_number)", "Returns the type name for the given field" ], "pg_field_type_oid": [ "string pg_field_type_oid(resource result, int field_number)", "Returns the type oid for the given field" ], "pg_free_result": [ "bool pg_free_result(resource result)", "Free result memory" ], "pg_get_notify": [ "array pg_get_notify([resource connection[, result_type]])", "Get asynchronous notification" ], "pg_get_pid": [ "int pg_get_pid([resource connection)", "Get backend(server) pid" ], "pg_get_result": [ "resource pg_get_result(resource connection)", "Get asynchronous query result" ], "pg_host": [ "string pg_host([resource connection])", "Returns the host name associated with the connection" ], "pg_insert": [ "mixed pg_insert(resource db, string table, array values[, int options])", "Insert values (filed => value) to table" ], "pg_last_error": [ "string pg_last_error([resource connection])", "Get the error message string" ], "pg_last_notice": [ "string pg_last_notice(resource connection)", "Returns the last notice set by the backend" ], "pg_last_oid": [ "string pg_last_oid(resource result)", "Returns the last object identifier" ], "pg_lo_close": [ "bool pg_lo_close(resource large_object)", "Close a large object" ], "pg_lo_create": [ "mixed pg_lo_create([resource connection],[mixed large_object_oid])", "Create a large object" ], "pg_lo_export": [ "bool pg_lo_export([resource connection, ] int objoid, string filename)", "Export large object direct to filesystem" ], "pg_lo_import": [ "int pg_lo_import([resource connection, ] string filename [, mixed oid])", "Import large object direct from filesystem" ], "pg_lo_open": [ "resource pg_lo_open([resource connection,] int large_object_oid, string mode)", "Open a large object and return fd" ], "pg_lo_read": [ "string pg_lo_read(resource large_object [, int len])", "Read a large object" ], "pg_lo_read_all": [ "int pg_lo_read_all(resource large_object)", "Read a large object and send straight to browser" ], "pg_lo_seek": [ "bool pg_lo_seek(resource large_object, int offset [, int whence])", "Seeks position of large object" ], "pg_lo_tell": [ "int pg_lo_tell(resource large_object)", "Returns current position of large object" ], "pg_lo_unlink": [ "bool pg_lo_unlink([resource connection,] string large_object_oid)", "Delete a large object" ], "pg_lo_write": [ "int pg_lo_write(resource large_object, string buf [, int len])", "Write a large object" ], "pg_meta_data": [ "array pg_meta_data(resource db, string table)", "Get meta_data" ], "pg_num_fields": [ "int pg_num_fields(resource result)", "Return the number of fields in the result" ], "pg_num_rows": [ "int pg_num_rows(resource result)", "Return the number of rows in the result" ], "pg_options": [ "string pg_options([resource connection])", "Get the options associated with the connection" ], "pg_parameter_status": [ "string|false pg_parameter_status([resource connection,] string param_name)", "Returns the value of a server parameter" ], "pg_pconnect": [ "resource pg_pconnect(string connection_string | [string host, string port [, string options [, string tty,]]] string database)", "Open a persistent PostgreSQL connection" ], "pg_ping": [ "bool pg_ping([resource connection])", "Ping database. If connection is bad, try to reconnect." ], "pg_port": [ "int pg_port([resource connection])", "Return the port number associated with the connection" ], "pg_prepare": [ "resource pg_prepare([resource connection,] string stmtname, string query)", "Prepare a query for future execution" ], "pg_put_line": [ "bool pg_put_line([resource connection,] string query)", "Send null-terminated string to backend server" ], "pg_query": [ "resource pg_query([resource connection,] string query)", "Execute a query" ], "pg_query_params": [ "resource pg_query_params([resource connection,] string query, array params)", "Execute a query" ], "pg_result_error": [ "string pg_result_error(resource result)", "Get error message associated with result" ], "pg_result_error_field": [ "string pg_result_error_field(resource result, int fieldcode)", "Get error message field associated with result" ], "pg_result_seek": [ "bool pg_result_seek(resource result, int offset)", "Set internal row offset" ], "pg_result_status": [ "mixed pg_result_status(resource result[, long result_type])", "Get status of query result" ], "pg_select": [ "mixed pg_select(resource db, string table, array ids[, int options])", "Select records that has ids (id => value)" ], "pg_send_execute": [ "bool pg_send_execute(resource connection, string stmtname, array params)", "Executes prevriously prepared stmtname asynchronously" ], "pg_send_prepare": [ "bool pg_send_prepare(resource connection, string stmtname, string query)", "Asynchronously prepare a query for future execution" ], "pg_send_query": [ "bool pg_send_query(resource connection, string query)", "Send asynchronous query" ], "pg_send_query_params": [ "bool pg_send_query_params(resource connection, string query, array params)", "Send asynchronous parameterized query" ], "pg_set_client_encoding": [ "int pg_set_client_encoding([resource connection,] string encoding)", "Set client encoding" ], "pg_set_error_verbosity": [ "int pg_set_error_verbosity([resource connection,] int verbosity)", "Set error verbosity" ], "pg_trace": [ "bool pg_trace(string filename [, string mode [, resource connection]])", "Enable tracing a PostgreSQL connection" ], "pg_transaction_status": [ "int pg_transaction_status(resource connnection)", "Get transaction status" ], "pg_tty": [ "string pg_tty([resource connection])", "Return the tty name associated with the connection" ], "pg_unescape_bytea": [ "string pg_unescape_bytea(string data)", "Unescape binary for bytea type" ], "pg_untrace": [ "bool pg_untrace([resource connection])", "Disable tracing of a PostgreSQL connection" ], "pg_update": [ "mixed pg_update(resource db, string table, array fields, array ids[, int options])", "Update table using values (field => value) and ids (id => value)" ], "pg_version": [ "array pg_version([resource connection])", "Returns an array with client, protocol and server version (when available)" ], "php_egg_logo_guid": [ "string php_egg_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_ini_loaded_file": [ "string php_ini_loaded_file()", "Return the actual loaded ini filename" ], "php_ini_scanned_files": [ "string php_ini_scanned_files()", "Return comma-separated string of .ini files parsed from the additional ini dir" ], "php_logo_guid": [ "string php_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_real_logo_guid": [ "string php_real_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_sapi_name": [ "string php_sapi_name()", "Return the current SAPI module name" ], "php_snmpv3": [ "void php_snmpv3(INTERNAL_FUNCTION_PARAMETERS, int st)", "* * Generic SNMPv3 object fetcher * From here is passed on the the common internal object fetcher. * * st=SNMP_CMD_GET snmp3_get() - query an agent and return a single value. * st=SNMP_CMD_GETNEXT snmp3_getnext() - query an agent and return the next single value. * st=SNMP_CMD_WALK snmp3_walk() - walk the mib and return a single dimensional array * containing the values. * st=SNMP_CMD_REALWALK snmp3_real_walk() - walk the mib and return an * array of oid,value pairs. * st=SNMP_CMD_SET snmp3_set() - query an agent and set a single value *" ], "php_strip_whitespace": [ "string php_strip_whitespace(string file_name)", "Return source with stripped comments and whitespace" ], "php_uname": [ "string php_uname()", "Return information about the system PHP was built on" ], "phpcredits": [ "void phpcredits([int flag])", "Prints the list of people who've contributed to the PHP project" ], "phpinfo": [ "void phpinfo([int what])", "Output a page of useful information about PHP and the current request" ], "phpversion": [ "string phpversion([string extension])", "Return the current PHP version" ], "pi": [ "float pi()", "Returns an approximation of pi" ], "png2wbmp": [ "bool png2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert PNG image to WBMP image" ], "popen": [ "resource popen(string command, string mode)", "Execute a command and open either a read or a write pipe to it" ], "posix_access": [ "bool posix_access(string file [, int mode])", "Determine accessibility of a file (POSIX.1 5.6.3)" ], "posix_ctermid": [ "string posix_ctermid()", "Generate terminal path name (POSIX.1, 4.7.1)" ], "posix_get_last_error": [ "int posix_get_last_error()", "Retrieve the error number set by the last posix function which failed." ], "posix_getcwd": [ "string posix_getcwd()", "Get working directory pathname (POSIX.1, 5.2.2)" ], "posix_getegid": [ "int posix_getegid()", "Get the current effective group id (POSIX.1, 4.2.1)" ], "posix_geteuid": [ "int posix_geteuid()", "Get the current effective user id (POSIX.1, 4.2.1)" ], "posix_getgid": [ "int posix_getgid()", "Get the current group id (POSIX.1, 4.2.1)" ], "posix_getgrgid": [ "array posix_getgrgid(long gid)", "Group database access (POSIX.1, 9.2.1)" ], "posix_getgrnam": [ "array posix_getgrnam(string groupname)", "Group database access (POSIX.1, 9.2.1)" ], "posix_getgroups": [ "array posix_getgroups()", "Get supplementary group id's (POSIX.1, 4.2.3)" ], "posix_getlogin": [ "string posix_getlogin()", "Get user name (POSIX.1, 4.2.4)" ], "posix_getpgid": [ "int posix_getpgid()", "Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)" ], "posix_getpgrp": [ "int posix_getpgrp()", "Get current process group id (POSIX.1, 4.3.1)" ], "posix_getpid": [ "int posix_getpid()", "Get the current process id (POSIX.1, 4.1.1)" ], "posix_getppid": [ "int posix_getppid()", "Get the parent process id (POSIX.1, 4.1.1)" ], "posix_getpwnam": [ "array posix_getpwnam(string groupname)", "User database access (POSIX.1, 9.2.2)" ], "posix_getpwuid": [ "array posix_getpwuid(long uid)", "User database access (POSIX.1, 9.2.2)" ], "posix_getrlimit": [ "array posix_getrlimit()", "Get system resource consumption limits (This is not a POSIX function, but a BSDism and a SVR4ism. We compile conditionally)" ], "posix_getsid": [ "int posix_getsid()", "Get process group id of session leader (This is not a POSIX function, but a SVR4ism, so be compile conditionally)" ], "posix_getuid": [ "int posix_getuid()", "Get the current user id (POSIX.1, 4.2.1)" ], "posix_initgroups": [ "bool posix_initgroups(string name, int base_group_id)", "Calculate the group access list for the user specified in name." ], "posix_isatty": [ "bool posix_isatty(int fd)", "Determine if filedesc is a tty (POSIX.1, 4.7.1)" ], "posix_kill": [ "bool posix_kill(int pid, int sig)", "Send a signal to a process (POSIX.1, 3.3.2)" ], "posix_mkfifo": [ "bool posix_mkfifo(string pathname, int mode)", "Make a FIFO special file (POSIX.1, 5.4.2)" ], "posix_mknod": [ "bool posix_mknod(string pathname, int mode [, int major [, int minor]])", "Make a special or ordinary file (POSIX.1)" ], "posix_setegid": [ "bool posix_setegid(long uid)", "Set effective group id" ], "posix_seteuid": [ "bool posix_seteuid(long uid)", "Set effective user id" ], "posix_setgid": [ "bool posix_setgid(int uid)", "Set group id (POSIX.1, 4.2.2)" ], "posix_setpgid": [ "bool posix_setpgid(int pid, int pgid)", "Set process group id for job control (POSIX.1, 4.3.3)" ], "posix_setsid": [ "int posix_setsid()", "Create session and set process group id (POSIX.1, 4.3.2)" ], "posix_setuid": [ "bool posix_setuid(long uid)", "Set user id (POSIX.1, 4.2.2)" ], "posix_strerror": [ "string posix_strerror(int errno)", "Retrieve the system error message associated with the given errno." ], "posix_times": [ "array posix_times()", "Get process times (POSIX.1, 4.5.2)" ], "posix_ttyname": [ "string posix_ttyname(int fd)", "Determine terminal device name (POSIX.1, 4.7.2)" ], "posix_uname": [ "array posix_uname()", "Get system name (POSIX.1, 4.4.1)" ], "pow": [ "number pow(number base, number exponent)", "Returns base raised to the power of exponent. Returns integer result when possible" ], "preg_filter": [ "mixed preg_filter(mixed regex, mixed replace, mixed subject [, int limit [, int &count]])", "Perform Perl-style regular expression replacement and only return matches." ], "preg_grep": [ "array preg_grep(string regex, array input [, int flags])", "Searches array and returns entries which match regex" ], "preg_last_error": [ "int preg_last_error()", "Returns the error code of the last regexp execution." ], "preg_match": [ "int preg_match(string pattern, string subject [, array &subpatterns [, int flags [, int offset]]])", "Perform a Perl-style regular expression match" ], "preg_match_all": [ "int preg_match_all(string pattern, string subject, array &subpatterns [, int flags [, int offset]])", "Perform a Perl-style global regular expression match" ], "preg_quote": [ "string preg_quote(string str [, string delim_char])", "Quote regular expression characters plus an optional character" ], "preg_replace": [ "mixed preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, int &count]])", "Perform Perl-style regular expression replacement." ], "preg_replace_callback": [ "mixed preg_replace_callback(mixed regex, mixed callback, mixed subject [, int limit [, int &count]])", "Perform Perl-style regular expression replacement using replacement callback." ], "preg_split": [ "array preg_split(string pattern, string subject [, int limit [, int flags]])", "Split string into an array using a perl-style regular expression as a delimiter" ], "prev": [ "mixed prev(array array_arg)", "Move array argument's internal pointer to the previous element and return it" ], "print": [ "int print(string arg)", "Output a string" ], "print_r": [ "mixed print_r(mixed var [, bool return])", "Prints out or returns information about the specified variable" ], "printf": [ "int printf(string format [, mixed arg1 [, mixed ...]])", "Output a formatted string" ], "proc_close": [ "int proc_close(resource process)", "close a process opened by proc_open" ], "proc_get_status": [ "array proc_get_status(resource process)", "get information about a process opened by proc_open" ], "proc_nice": [ "bool proc_nice(int priority)", "Change the priority of the current process" ], "proc_open": [ "resource proc_open(string command, array descriptorspec, array &pipes [, string cwd [, array env [, array other_options]]])", "Run a process with more control over it's file descriptors" ], "proc_terminate": [ "bool proc_terminate(resource process [, long signal])", "kill a process opened by proc_open" ], "property_exists": [ "bool property_exists(mixed object_or_class, string property_name)", "Checks if the object or class has a property" ], "pspell_add_to_personal": [ "bool pspell_add_to_personal(int pspell, string word)", "Adds a word to a personal list" ], "pspell_add_to_session": [ "bool pspell_add_to_session(int pspell, string word)", "Adds a word to the current session" ], "pspell_check": [ "bool pspell_check(int pspell, string word)", "Returns true if word is valid" ], "pspell_clear_session": [ "bool pspell_clear_session(int pspell)", "Clears the current session" ], "pspell_config_create": [ "int pspell_config_create(string language [, string spelling [, string jargon [, string encoding]]])", "Create a new config to be used later to create a manager" ], "pspell_config_data_dir": [ "bool pspell_config_data_dir(int conf, string directory)", "location of language data files" ], "pspell_config_dict_dir": [ "bool pspell_config_dict_dir(int conf, string directory)", "location of the main word list" ], "pspell_config_ignore": [ "bool pspell_config_ignore(int conf, int ignore)", "Ignore words <= n chars" ], "pspell_config_mode": [ "bool pspell_config_mode(int conf, long mode)", "Select mode for config (PSPELL_FAST, PSPELL_NORMAL or PSPELL_BAD_SPELLERS)" ], "pspell_config_personal": [ "bool pspell_config_personal(int conf, string personal)", "Use a personal dictionary for this config" ], "pspell_config_repl": [ "bool pspell_config_repl(int conf, string repl)", "Use a personal dictionary with replacement pairs for this config" ], "pspell_config_runtogether": [ "bool pspell_config_runtogether(int conf, bool runtogether)", "Consider run-together words as valid components" ], "pspell_config_save_repl": [ "bool pspell_config_save_repl(int conf, bool save)", "Save replacement pairs when personal list is saved for this config" ], "pspell_new": [ "int pspell_new(string language [, string spelling [, string jargon [, string encoding [, int mode]]]])", "Load a dictionary" ], "pspell_new_config": [ "int pspell_new_config(int config)", "Load a dictionary based on the given config" ], "pspell_new_personal": [ "int pspell_new_personal(string personal, string language [, string spelling [, string jargon [, string encoding [, int mode]]]])", "Load a dictionary with a personal wordlist" ], "pspell_save_wordlist": [ "bool pspell_save_wordlist(int pspell)", "Saves the current (personal) wordlist" ], "pspell_store_replacement": [ "bool pspell_store_replacement(int pspell, string misspell, string correct)", "Notify the dictionary of a user-selected replacement" ], "pspell_suggest": [ "array pspell_suggest(int pspell, string word)", "Returns array of suggestions" ], "putenv": [ "bool putenv(string setting)", "Set the value of an environment variable" ], "quoted_printable_decode": [ "string quoted_printable_decode(string str)", "Convert a quoted-printable string to an 8 bit string" ], "quoted_printable_encode": [ "string quoted_printable_encode(string str)", "" ], "quotemeta": [ "string quotemeta(string str)", "Quotes meta characters" ], "rad2deg": [ "float rad2deg(float number)", "Converts the radian number to the equivalent number in degrees" ], "rand": [ "int rand([int min, int max])", "Returns a random number" ], "range": [ "array range(mixed low, mixed high[, int step])", "Create an array containing the range of integers or characters from low to high (inclusive)" ], "rawurldecode": [ "string rawurldecode(string str)", "Decodes URL-encodes string" ], "rawurlencode": [ "string rawurlencode(string str)", "URL-encodes string" ], "readdir": [ "string readdir([resource dir_handle])", "Read directory entry from dir_handle" ], "readfile": [ "int readfile(string filename [, bool use_include_path[, resource context]])", "Output a file or a URL" ], "readgzfile": [ "int readgzfile(string filename [, int use_include_path])", "Output a .gz-file" ], "readline": [ "string readline([string prompt])", "Reads a line" ], "readline_add_history": [ "bool readline_add_history(string prompt)", "Adds a line to the history" ], "readline_callback_handler_install": [ "void readline_callback_handler_install(string prompt, mixed callback)", "Initializes the readline callback interface and terminal, prints the prompt and returns immediately" ], "readline_callback_handler_remove": [ "bool readline_callback_handler_remove()", "Removes a previously installed callback handler and restores terminal settings" ], "readline_callback_read_char": [ "void readline_callback_read_char()", "Informs the readline callback interface that a character is ready for input" ], "readline_clear_history": [ "bool readline_clear_history()", "Clears the history" ], "readline_completion_function": [ "bool readline_completion_function(string funcname)", "Readline completion function?" ], "readline_info": [ "mixed readline_info([string varname [, string newvalue]])", "Gets/sets various internal readline variables." ], "readline_list_history": [ "array readline_list_history()", "Lists the history" ], "readline_on_new_line": [ "void readline_on_new_line()", "Inform readline that the cursor has moved to a new line" ], "readline_read_history": [ "bool readline_read_history([string filename])", "Reads the history" ], "readline_redisplay": [ "void readline_redisplay()", "Ask readline to redraw the display" ], "readline_write_history": [ "bool readline_write_history([string filename])", "Writes the history" ], "readlink": [ "string readlink(string filename)", "Return the target of a symbolic link" ], "realpath": [ "string realpath(string path)", "Return the resolved path" ], "realpath_cache_get": [ "bool realpath_cache_get()", "Get current size of realpath cache" ], "realpath_cache_size": [ "bool realpath_cache_size()", "Get current size of realpath cache" ], "recode_file": [ "bool recode_file(string request, resource input, resource output)", "Recode file input into file output according to request" ], "recode_string": [ "string recode_string(string request, string str)", "Recode string str according to request string" ], "register_shutdown_function": [ "void register_shutdown_function(string function_name)", "Register a user-level function to be called on request termination" ], "register_tick_function": [ "bool register_tick_function(string function_name [, mixed arg [, mixed ... ]])", "Registers a tick callback function" ], "rename": [ "bool rename(string old_name, string new_name[, resource context])", "Rename a file" ], "require": [ "bool require(string path)", "Includes and evaluates the specified file, erroring if the file cannot be included" ], "require_once": [ "bool require_once(string path)", "Includes and evaluates the specified file, erroring if the file cannot be included" ], "reset": [ "mixed reset(array array_arg)", "Set array argument's internal pointer to the first element and return it" ], "restore_error_handler": [ "void restore_error_handler()", "Restores the previously defined error handler function" ], "restore_exception_handler": [ "void restore_exception_handler()", "Restores the previously defined exception handler function" ], "restore_include_path": [ "void restore_include_path()", "Restore the value of the include_path configuration option" ], "rewind": [ "bool rewind(resource fp)", "Rewind the position of a file pointer" ], "rewinddir": [ "void rewinddir([resource dir_handle])", "Rewind dir_handle back to the start" ], "rmdir": [ "bool rmdir(string dirname[, resource context])", "Remove a directory" ], "round": [ "float round(float number [, int precision [, int mode]])", "Returns the number rounded to specified precision" ], "rsort": [ "bool rsort(array &array_arg [, int sort_flags])", "Sort an array in reverse order" ], "rtrim": [ "string rtrim(string str [, string character_mask])", "Removes trailing whitespace" ], "scandir": [ "array scandir(string dir [, int sorting_order [, resource context]])", "List files & directories inside the specified path" ], "sem_acquire": [ "bool sem_acquire(resource id)", "Acquires the semaphore with the given id, blocking if necessary" ], "sem_get": [ "resource sem_get(int key [, int max_acquire [, int perm [, int auto_release]])", "Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously" ], "sem_release": [ "bool sem_release(resource id)", "Releases the semaphore with the given id" ], "sem_remove": [ "bool sem_remove(resource id)", "Removes semaphore from Unix systems" ], "serialize": [ "string serialize(mixed variable)", "Returns a string representation of variable (which can later be unserialized)" ], "session_cache_expire": [ "int session_cache_expire([int new_cache_expire])", "Return the current cache expire. If new_cache_expire is given, the current cache_expire is replaced with new_cache_expire" ], "session_cache_limiter": [ "string session_cache_limiter([string new_cache_limiter])", "Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter" ], "session_decode": [ "bool session_decode(string data)", "Deserializes data and reinitializes the variables" ], "session_destroy": [ "bool session_destroy()", "Destroy the current session and all data associated with it" ], "session_encode": [ "string session_encode()", "Serializes the current setup and returns the serialized representation" ], "session_get_cookie_params": [ "array session_get_cookie_params()", "Return the session cookie parameters" ], "session_id": [ "string session_id([string newid])", "Return the current session id. If newid is given, the session id is replaced with newid" ], "session_is_registered": [ "bool session_is_registered(string varname)", "Checks if a variable is registered in session" ], "session_module_name": [ "string session_module_name([string newname])", "Return the current module name used for accessing session data. If newname is given, the module name is replaced with newname" ], "session_name": [ "string session_name([string newname])", "Return the current session name. If newname is given, the session name is replaced with newname" ], "session_regenerate_id": [ "bool session_regenerate_id([bool delete_old_session])", "Update the current session id with a newly generated one. If delete_old_session is set to true, remove the old session." ], "session_register": [ "bool session_register(mixed var_names [, mixed ...])", "Adds varname(s) to the list of variables which are freezed at the session end" ], "session_save_path": [ "string session_save_path([string newname])", "Return the current save path passed to module_name. If newname is given, the save path is replaced with newname" ], "session_set_cookie_params": [ "void session_set_cookie_params(int lifetime [, string path [, string domain [, bool secure[, bool httponly]]]])", "Set session cookie parameters" ], "session_set_save_handler": [ "void session_set_save_handler(string open, string close, string read, string write, string destroy, string gc)", "Sets user-level functions" ], "session_start": [ "bool session_start()", "Begin session - reinitializes freezed variables, registers browsers etc" ], "session_unregister": [ "bool session_unregister(string varname)", "Removes varname from the list of variables which are freezed at the session end" ], "session_unset": [ "void session_unset()", "Unset all registered variables" ], "session_write_close": [ "void session_write_close()", "Write session data and end session" ], "set_error_handler": [ "string set_error_handler(string error_handler [, int error_types])", "Sets a user-defined error handler function. Returns the previously defined error handler, or false on error" ], "set_exception_handler": [ "string set_exception_handler(callable exception_handler)", "Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error" ], "set_include_path": [ "string set_include_path(string new_include_path)", "Sets the include_path configuration option" ], "set_magic_quotes_runtime": [ "bool set_magic_quotes_runtime(int new_setting)", "Set the current active configuration setting of magic_quotes_runtime and return previous" ], "set_time_limit": [ "bool set_time_limit(int seconds)", "Sets the maximum time a script can run" ], "setcookie": [ "bool setcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly]]]]]])", "Send a cookie" ], "setlocale": [ "string setlocale(mixed category, string locale [, string ...])", "Set locale information" ], "setrawcookie": [ "bool setrawcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure[, bool httponly]]]]]])", "Send a cookie with no url encoding of the value" ], "settype": [ "bool settype(mixed var, string type)", "Set the type of the variable" ], "sha1": [ "string sha1(string str [, bool raw_output])", "Calculate the sha1 hash of a string" ], "sha1_file": [ "string sha1_file(string filename [, bool raw_output])", "Calculate the sha1 hash of given filename" ], "shell_exec": [ "string shell_exec(string cmd)", "Execute command via shell and return complete output as string" ], "shm_attach": [ "int shm_attach(int key [, int memsize [, int perm]])", "Creates or open a shared memory segment" ], "shm_detach": [ "bool shm_detach(resource shm_identifier)", "Disconnects from shared memory segment" ], "shm_get_var": [ "mixed shm_get_var(resource id, int variable_key)", "Returns a variable from shared memory" ], "shm_has_var": [ "bool shm_has_var(resource id, int variable_key)", "Checks whether a specific entry exists" ], "shm_put_var": [ "bool shm_put_var(resource shm_identifier, int variable_key, mixed variable)", "Inserts or updates a variable in shared memory" ], "shm_remove": [ "bool shm_remove(resource shm_identifier)", "Removes shared memory from Unix systems" ], "shm_remove_var": [ "bool shm_remove_var(resource id, int variable_key)", "Removes variable from shared memory" ], "shmop_close": [ "void shmop_close(int shmid)", "closes a shared memory segment" ], "shmop_delete": [ "bool shmop_delete(int shmid)", "mark segment for deletion" ], "shmop_open": [ "int shmop_open(int key, string flags, int mode, int size)", "gets and attaches a shared memory segment" ], "shmop_read": [ "string shmop_read(int shmid, int start, int count)", "reads from a shm segment" ], "shmop_size": [ "int shmop_size(int shmid)", "returns the shm size" ], "shmop_write": [ "int shmop_write(int shmid, string data, int offset)", "writes to a shared memory segment" ], "shuffle": [ "bool shuffle(array array_arg)", "Randomly shuffle the contents of an array" ], "similar_text": [ "int similar_text(string str1, string str2 [, float percent])", "Calculates the similarity between two strings" ], "simplexml_import_dom": [ "simplemxml_element simplexml_import_dom(domNode node [, string class_name])", "Get a simplexml_element object from dom to allow for processing" ], "simplexml_load_file": [ "simplemxml_element simplexml_load_file(string filename [, string class_name [, int options [, string ns [, bool is_prefix]]]])", "Load a filename and return a simplexml_element object to allow for processing" ], "simplexml_load_string": [ "simplemxml_element simplexml_load_string(string data [, string class_name [, int options [, string ns [, bool is_prefix]]]])", "Load a string and return a simplexml_element object to allow for processing" ], "sin": [ "float sin(float number)", "Returns the sine of the number in radians" ], "sinh": [ "float sinh(float number)", "Returns the hyperbolic sine of the number, defined as (exp(number) - exp(-number))/2" ], "sleep": [ "void sleep(int seconds)", "Delay for a given number of seconds" ], "smfi_addheader": [ "bool smfi_addheader(string headerf, string headerv)", "Adds a header to the current message." ], "smfi_addrcpt": [ "bool smfi_addrcpt(string rcpt)", "Add a recipient to the message envelope." ], "smfi_chgheader": [ "bool smfi_chgheader(string headerf, string headerv)", "Changes a header's value for the current message." ], "smfi_delrcpt": [ "bool smfi_delrcpt(string rcpt)", "Removes the named recipient from the current message's envelope." ], "smfi_getsymval": [ "string smfi_getsymval(string macro)", "Returns the value of the given macro or NULL if the macro is not defined." ], "smfi_replacebody": [ "bool smfi_replacebody(string body)", "Replaces the body of the current message. If called more than once, subsequent calls result in data being appended to the new body." ], "smfi_setflags": [ "void smfi_setflags(long flags)", "Sets the flags describing the actions the filter may take." ], "smfi_setreply": [ "bool smfi_setreply(string rcode, string xcode, string message)", "Directly set the SMTP error reply code for this connection. This code will be used on subsequent error replies resulting from actions taken by this filter." ], "smfi_settimeout": [ "void smfi_settimeout(long timeout)", "Sets the number of seconds libmilter will wait for an MTA connection before timing out a socket." ], "snmp2_get": [ "string snmp2_get(string host, string community, string object_id [, int timeout [, int retries]])", "Fetch a SNMP object" ], "snmp2_getnext": [ "string snmp2_getnext(string host, string community, string object_id [, int timeout [, int retries]])", "Fetch a SNMP object" ], "snmp2_real_walk": [ "array snmp2_real_walk(string host, string community, string object_id [, int timeout [, int retries]])", "Return all objects including their respective object id withing the specified one" ], "snmp2_set": [ "int snmp2_set(string host, string community, string object_id, string type, mixed value [, int timeout [, int retries]])", "Set the value of a SNMP object" ], "snmp2_walk": [ "array snmp2_walk(string host, string community, string object_id [, int timeout [, int retries]])", "Return all objects under the specified object id" ], "snmp3_get": [ "int snmp3_get(string host, string sec_name, string sec_level, string auth_protocol, string auth_passphrase, string priv_protocol, string priv_passphrase, string object_id [, int timeout [, int retries]])", "Fetch the value of a SNMP object" ], "snmp3_getnext": [ "int snmp3_getnext(string host, string sec_name, string sec_level, string auth_protocol, string auth_passphrase, string priv_protocol, string priv_passphrase, string object_id [, int timeout [, int retries]])", "Fetch the value of a SNMP object" ], "snmp3_real_walk": [ "int snmp3_real_walk(string host, string sec_name, string sec_level, string auth_protocol, string auth_passphrase, string priv_protocol, string priv_passphrase, string object_id [, int timeout [, int retries]])", "Fetch the value of a SNMP object" ], "snmp3_set": [ "int snmp3_set(string host, string sec_name, string sec_level, string auth_protocol, string auth_passphrase, string priv_protocol, string priv_passphrase, string object_id, string type, mixed value [, int timeout [, int retries]])", "Fetch the value of a SNMP object" ], "snmp3_walk": [ "int snmp3_walk(string host, string sec_name, string sec_level, string auth_protocol, string auth_passphrase, string priv_protocol, string priv_passphrase, string object_id [, int timeout [, int retries]])", "Fetch the value of a SNMP object" ], "snmp_get_quick_print": [ "bool snmp_get_quick_print()", "Return the current status of quick_print" ], "snmp_get_valueretrieval": [ "int snmp_get_valueretrieval()", "Return the method how the SNMP values will be returned" ], "snmp_read_mib": [ "int snmp_read_mib(string filename)", "Reads and parses a MIB file into the active MIB tree." ], "snmp_set_enum_print": [ "void snmp_set_enum_print(int enum_print)", "Return all values that are enums with their enum value instead of the raw integer" ], "snmp_set_oid_output_format": [ "void snmp_set_oid_output_format(int oid_format)", "Set the OID output format." ], "snmp_set_quick_print": [ "void snmp_set_quick_print(int quick_print)", "Return all objects including their respective object id withing the specified one" ], "snmp_set_valueretrieval": [ "void snmp_set_valueretrieval(int method)", "Specify the method how the SNMP values will be returned" ], "snmpget": [ "string snmpget(string host, string community, string object_id [, int timeout [, int retries]])", "Fetch a SNMP object" ], "snmpgetnext": [ "string snmpgetnext(string host, string community, string object_id [, int timeout [, int retries]])", "Fetch a SNMP object" ], "snmprealwalk": [ "array snmprealwalk(string host, string community, string object_id [, int timeout [, int retries]])", "Return all objects including their respective object id withing the specified one" ], "snmpset": [ "int snmpset(string host, string community, string object_id, string type, mixed value [, int timeout [, int retries]])", "Set the value of a SNMP object" ], "snmpwalk": [ "array snmpwalk(string host, string community, string object_id [, int timeout [, int retries]])", "Return all objects under the specified object id" ], "socket_accept": [ "resource socket_accept(resource socket)", "Accepts a connection on the listening socket fd" ], "socket_bind": [ "bool socket_bind(resource socket, string addr [, int port])", "Binds an open socket to a listening port, port is only specified in AF_INET family." ], "socket_clear_error": [ "void socket_clear_error([resource socket])", "Clears the error on the socket or the last error code." ], "socket_close": [ "void socket_close(resource socket)", "Closes a file descriptor" ], "socket_connect": [ "bool socket_connect(resource socket, string addr [, int port])", "Opens a connection to addr:port on the socket specified by socket" ], "socket_create": [ "resource socket_create(int domain, int type, int protocol)", "Creates an endpoint for communication in the domain specified by domain, of type specified by type" ], "socket_create_listen": [ "resource socket_create_listen(int port[, int backlog])", "Opens a socket on port to accept connections" ], "socket_create_pair": [ "bool socket_create_pair(int domain, int type, int protocol, array &fd)", "Creates a pair of indistinguishable sockets and stores them in fds." ], "socket_get_option": [ "mixed socket_get_option(resource socket, int level, int optname)", "Gets socket options for the socket" ], "socket_getpeername": [ "bool socket_getpeername(resource socket, string &addr[, int &port])", "Queries the remote side of the given socket which may either result in host/port or in a UNIX filesystem path, dependent on its type." ], "socket_getsockname": [ "bool socket_getsockname(resource socket, string &addr[, int &port])", "Queries the remote side of the given socket which may either result in host/port or in a UNIX filesystem path, dependent on its type." ], "socket_last_error": [ "int socket_last_error([resource socket])", "Returns the last socket error (either the last used or the provided socket resource)" ], "socket_listen": [ "bool socket_listen(resource socket[, int backlog])", "Sets the maximum number of connections allowed to be waited for on the socket specified by fd" ], "socket_read": [ "string socket_read(resource socket, int length [, int type])", "Reads a maximum of length bytes from socket" ], "socket_recv": [ "int socket_recv(resource socket, string &buf, int len, int flags)", "Receives data from a connected socket" ], "socket_recvfrom": [ "int socket_recvfrom(resource socket, string &buf, int len, int flags, string &name [, int &port])", "Receives data from a socket, connected or not" ], "socket_select": [ "int socket_select(array &read_fds, array &write_fds, array &except_fds, int tv_sec[, int tv_usec])", "Runs the select() system call on the sets mentioned with a timeout specified by tv_sec and tv_usec" ], "socket_send": [ "int socket_send(resource socket, string buf, int len, int flags)", "Sends data to a connected socket" ], "socket_sendto": [ "int socket_sendto(resource socket, string buf, int len, int flags, string addr [, int port])", "Sends a message to a socket, whether it is connected or not" ], "socket_set_block": [ "bool socket_set_block(resource socket)", "Sets blocking mode on a socket resource" ], "socket_set_nonblock": [ "bool socket_set_nonblock(resource socket)", "Sets nonblocking mode on a socket resource" ], "socket_set_option": [ "bool socket_set_option(resource socket, int level, int optname, int|array optval)", "Sets socket options for the socket" ], "socket_shutdown": [ "bool socket_shutdown(resource socket[, int how])", "Shuts down a socket for receiving, sending, or both." ], "socket_strerror": [ "string socket_strerror(int errno)", "Returns a string describing an error" ], "socket_write": [ "int socket_write(resource socket, string buf[, int length])", "Writes the buffer to the socket resource, length is optional" ], "solid_fetch_prev": [ "bool solid_fetch_prev(resource result_id)", "" ], "sort": [ "bool sort(array &array_arg [, int sort_flags])", "Sort an array" ], "soundex": [ "string soundex(string str)", "Calculate the soundex key of a string" ], "spl_autoload": [ "void spl_autoload(string class_name [, string file_extensions])", "Default implementation for __autoload()" ], "spl_autoload_call": [ "void spl_autoload_call(string class_name)", "Try all registerd autoload function to load the requested class" ], "spl_autoload_extensions": [ "string spl_autoload_extensions([string file_extensions])", "Register and return default file extensions for spl_autoload" ], "spl_autoload_functions": [ "false|array spl_autoload_functions()", "Return all registered __autoload() functionns" ], "spl_autoload_register": [ "bool spl_autoload_register([mixed autoload_function = \"spl_autoload\" [, throw = true [, prepend]]])", "Register given function as __autoload() implementation" ], "spl_autoload_unregister": [ "bool spl_autoload_unregister(mixed autoload_function)", "Unregister given function as __autoload() implementation" ], "spl_classes": [ "array spl_classes()", "Return an array containing the names of all clsses and interfaces defined in SPL" ], "spl_object_hash": [ "string spl_object_hash(object obj)", "Return hash id for given object" ], "split": [ "array split(string pattern, string string [, int limit])", "Split string into array by regular expression" ], "spliti": [ "array spliti(string pattern, string string [, int limit])", "Split string into array by regular expression case-insensitive" ], "sprintf": [ "string sprintf(string format [, mixed arg1 [, mixed ...]])", "Return a formatted string" ], "sql_regcase": [ "string sql_regcase(string string)", "Make regular expression for case insensitive match" ], "sqlite_array_query": [ "array sqlite_array_query(resource db, string query [ , int result_type [, bool decode_binary]])", "Executes a query against a given database and returns an array of arrays." ], "sqlite_busy_timeout": [ "void sqlite_busy_timeout(resource db, int ms)", "Set busy timeout duration. If ms <= 0, all busy handlers are disabled." ], "sqlite_changes": [ "int sqlite_changes(resource db)", "Returns the number of rows that were changed by the most recent SQL statement." ], "sqlite_close": [ "void sqlite_close(resource db)", "Closes an open sqlite database." ], "sqlite_column": [ "mixed sqlite_column(resource result, mixed index_or_name [, bool decode_binary])", "Fetches a column from the current row of a result set." ], "sqlite_create_aggregate": [ "bool sqlite_create_aggregate(resource db, string funcname, mixed step_func, mixed finalize_func[, long num_args])", "Registers an aggregate function for queries." ], "sqlite_create_function": [ "bool sqlite_create_function(resource db, string funcname, mixed callback[, long num_args])", "Registers a \"regular\" function for queries." ], "sqlite_current": [ "array sqlite_current(resource result [, int result_type [, bool decode_binary]])", "Fetches the current row from a result set as an array." ], "sqlite_error_string": [ "string sqlite_error_string(int error_code)", "Returns the textual description of an error code." ], "sqlite_escape_string": [ "string sqlite_escape_string(string item)", "Escapes a string for use as a query parameter." ], "sqlite_exec": [ "bool sqlite_exec(string query, resource db[, string &error_message])", "Executes a result-less query against a given database" ], "sqlite_factory": [ "object sqlite_factory(string filename [, int mode [, string &error_message]])", "Opens a SQLite database and creates an object for it. Will create the database if it does not exist." ], "sqlite_fetch_all": [ "array sqlite_fetch_all(resource result [, int result_type [, bool decode_binary]])", "Fetches all rows from a result set as an array of arrays." ], "sqlite_fetch_array": [ "array sqlite_fetch_array(resource result [, int result_type [, bool decode_binary]])", "Fetches the next row from a result set as an array." ], "sqlite_fetch_column_types": [ "resource sqlite_fetch_column_types(string table_name, resource db [, int result_type])", "Return an array of column types from a particular table." ], "sqlite_fetch_object": [ "object sqlite_fetch_object(resource result [, string class_name [, NULL|array ctor_params [, bool decode_binary]]])", "Fetches the next row from a result set as an object." ], "sqlite_fetch_single": [ "string sqlite_fetch_single(resource result [, bool decode_binary])", "Fetches the first column of a result set as a string." ], "sqlite_field_name": [ "string sqlite_field_name(resource result, int field_index)", "Returns the name of a particular field of a result set." ], "sqlite_has_prev": [ "bool sqlite_has_prev(resource result)", "* Returns whether a previous row is available." ], "sqlite_key": [ "int sqlite_key(resource result)", "Return the current row index of a buffered result." ], "sqlite_last_error": [ "int sqlite_last_error(resource db)", "Returns the error code of the last error for a database." ], "sqlite_last_insert_rowid": [ "int sqlite_last_insert_rowid(resource db)", "Returns the rowid of the most recently inserted row." ], "sqlite_libencoding": [ "string sqlite_libencoding()", "Returns the encoding (iso8859 or UTF-8) of the linked SQLite library." ], "sqlite_libversion": [ "string sqlite_libversion()", "Returns the version of the linked SQLite library." ], "sqlite_next": [ "bool sqlite_next(resource result)", "Seek to the next row number of a result set." ], "sqlite_num_fields": [ "int sqlite_num_fields(resource result)", "Returns the number of fields in a result set." ], "sqlite_num_rows": [ "int sqlite_num_rows(resource result)", "Returns the number of rows in a buffered result set." ], "sqlite_open": [ "resource sqlite_open(string filename [, int mode [, string &error_message]])", "Opens a SQLite database. Will create the database if it does not exist." ], "sqlite_popen": [ "resource sqlite_popen(string filename [, int mode [, string &error_message]])", "Opens a persistent handle to a SQLite database. Will create the database if it does not exist." ], "sqlite_prev": [ "bool sqlite_prev(resource result)", "* Seek to the previous row number of a result set." ], "sqlite_query": [ "resource sqlite_query(string query, resource db [, int result_type [, string &error_message]])", "Executes a query against a given database and returns a result handle." ], "sqlite_rewind": [ "bool sqlite_rewind(resource result)", "Seek to the first row number of a buffered result set." ], "sqlite_seek": [ "bool sqlite_seek(resource result, int row)", "Seek to a particular row number of a buffered result set." ], "sqlite_single_query": [ "array sqlite_single_query(resource db, string query [, bool first_row_only [, bool decode_binary]])", "Executes a query and returns either an array for one single column or the value of the first row." ], "sqlite_udf_decode_binary": [ "string sqlite_udf_decode_binary(string data)", "Decode binary encoding on a string parameter passed to an UDF." ], "sqlite_udf_encode_binary": [ "string sqlite_udf_encode_binary(string data)", "Apply binary encoding (if required) to a string to return from an UDF." ], "sqlite_unbuffered_query": [ "resource sqlite_unbuffered_query(string query, resource db [ , int result_type [, string &error_message]])", "Executes a query that does not prefetch and buffer all data." ], "sqlite_valid": [ "bool sqlite_valid(resource result)", "Returns whether more rows are available." ], "sqrt": [ "float sqrt(float number)", "Returns the square root of the number" ], "srand": [ "void srand([int seed])", "Seeds random number generator" ], "sscanf": [ "mixed sscanf(string str, string format [, string ...])", "Implements an ANSI C compatible sscanf" ], "stat": [ "array stat(string filename)", "Give information about a file" ], "str_getcsv": [ "array str_getcsv(string input[, string delimiter[, string enclosure[, string escape]]])", "Parse a CSV string into an array" ], "str_ireplace": [ "mixed str_ireplace(mixed search, mixed replace, mixed subject [, int &replace_count])", "Replaces all occurrences of search in haystack with replace / case-insensitive" ], "str_pad": [ "string str_pad(string input, int pad_length [, string pad_string [, int pad_type]])", "Returns input string padded on the left or right to specified length with pad_string" ], "str_repeat": [ "string str_repeat(string input, int mult)", "Returns the input string repeat mult times" ], "str_replace": [ "mixed str_replace(mixed search, mixed replace, mixed subject [, int &replace_count])", "Replaces all occurrences of search in haystack with replace" ], "str_rot13": [ "string str_rot13(string str)", "Perform the rot13 transform on a string" ], "str_shuffle": [ "void str_shuffle(string str)", "Shuffles string. One permutation of all possible is created" ], "str_split": [ "array str_split(string str [, int split_length])", "Convert a string to an array. If split_length is specified, break the string down into chunks each split_length characters long." ], "str_word_count": [ "mixed str_word_count(string str, [int format [, string charlist]])", "Counts the number of words inside a string. If format of 1 is specified, then the function will return an array containing all the words found inside the string. If format of 2 is specified, then the function will return an associated array where the position of the word is the key and the word itself is the value. For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with \"'\" and \"-\" characters." ], "strcasecmp": [ "int strcasecmp(string str1, string str2)", "Binary safe case-insensitive string comparison" ], "strchr": [ "string strchr(string haystack, string needle)", "An alias for strstr" ], "strcmp": [ "int strcmp(string str1, string str2)", "Binary safe string comparison" ], "strcoll": [ "int strcoll(string str1, string str2)", "Compares two strings using the current locale" ], "strcspn": [ "int strcspn(string str, string mask [, start [, len]])", "Finds length of initial segment consisting entirely of characters not found in mask. If start or/and length is provide works like strcspn(substr($s,$start,$len),$bad_chars)" ], "stream_bucket_append": [ "void stream_bucket_append(resource brigade, resource bucket)", "Append bucket to brigade" ], "stream_bucket_make_writeable": [ "object stream_bucket_make_writeable(resource brigade)", "Return a bucket object from the brigade for operating on" ], "stream_bucket_new": [ "resource stream_bucket_new(resource stream, string buffer)", "Create a new bucket for use on the current stream" ], "stream_bucket_prepend": [ "void stream_bucket_prepend(resource brigade, resource bucket)", "Prepend bucket to brigade" ], "stream_context_create": [ "resource stream_context_create([array options[, array params]])", "Create a file context and optionally set parameters" ], "stream_context_get_default": [ "resource stream_context_get_default([array options])", "Get a handle on the default file/stream context and optionally set parameters" ], "stream_context_get_options": [ "array stream_context_get_options(resource context|resource stream)", "Retrieve options for a stream/wrapper/context" ], "stream_context_get_params": [ "array stream_context_get_params(resource context|resource stream)", "Get parameters of a file context" ], "stream_context_set_default": [ "resource stream_context_set_default(array options)", "Set default file/stream context, returns the context as a resource" ], "stream_context_set_option": [ "bool stream_context_set_option(resource context|resource stream, string wrappername, string optionname, mixed value)", "Set an option for a wrapper" ], "stream_context_set_params": [ "bool stream_context_set_params(resource context|resource stream, array options)", "Set parameters for a file context" ], "stream_copy_to_stream": [ "long stream_copy_to_stream(resource source, resource dest [, long maxlen [, long pos]])", "Reads up to maxlen bytes from source stream and writes them to dest stream." ], "stream_filter_append": [ "resource stream_filter_append(resource stream, string filtername[, int read_write[, string filterparams]])", "Append a filter to a stream" ], "stream_filter_prepend": [ "resource stream_filter_prepend(resource stream, string filtername[, int read_write[, string filterparams]])", "Prepend a filter to a stream" ], "stream_filter_register": [ "bool stream_filter_register(string filtername, string classname)", "Registers a custom filter handler class" ], "stream_filter_remove": [ "bool stream_filter_remove(resource stream_filter)", "Flushes any data in the filter's internal buffer, removes it from the chain, and frees the resource" ], "stream_get_contents": [ "string stream_get_contents(resource source [, long maxlen [, long offset]])", "Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string." ], "stream_get_filters": [ "array stream_get_filters()", "Returns a list of registered filters" ], "stream_get_line": [ "string stream_get_line(resource stream, int maxlen [, string ending])", "Read up to maxlen bytes from a stream or until the ending string is found" ], "stream_get_meta_data": [ "array stream_get_meta_data(resource fp)", "Retrieves header/meta data from streams/file pointers" ], "stream_get_transports": [ "array stream_get_transports()", "Retrieves list of registered socket transports" ], "stream_get_wrappers": [ "array stream_get_wrappers()", "Retrieves list of registered stream wrappers" ], "stream_is_local": [ "bool stream_is_local(resource stream|string url)", "" ], "stream_resolve_include_path": [ "string stream_resolve_include_path(string filename)", "Determine what file will be opened by calls to fopen() with a relative path" ], "stream_select": [ "int stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec])", "Runs the select() system call on the sets of streams with a timeout specified by tv_sec and tv_usec" ], "stream_set_blocking": [ "bool stream_set_blocking(resource socket, int mode)", "Set blocking/non-blocking mode on a socket or stream" ], "stream_set_timeout": [ "bool stream_set_timeout(resource stream, int seconds [, int microseconds])", "Set timeout on stream read to seconds + microseonds" ], "stream_set_write_buffer": [ "int stream_set_write_buffer(resource fp, int buffer)", "Set file write buffer" ], "stream_socket_accept": [ "resource stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]])", "Accept a client connection from a server socket" ], "stream_socket_client": [ "resource stream_socket_client(string remoteaddress [, long &errcode [, string &errstring [, double timeout [, long flags [, resource context]]]]])", "Open a client connection to a remote address" ], "stream_socket_enable_crypto": [ "int stream_socket_enable_crypto(resource stream, bool enable [, int cryptokind [, resource sessionstream]])", "Enable or disable a specific kind of crypto on the stream" ], "stream_socket_get_name": [ "string stream_socket_get_name(resource stream, bool want_peer)", "Returns either the locally bound or remote name for a socket stream" ], "stream_socket_pair": [ "array stream_socket_pair(int domain, int type, int protocol)", "Creates a pair of connected, indistinguishable socket streams" ], "stream_socket_recvfrom": [ "string stream_socket_recvfrom(resource stream, long amount [, long flags [, string &remote_addr]])", "Receives data from a socket stream" ], "stream_socket_sendto": [ "long stream_socket_sendto(resouce stream, string data [, long flags [, string target_addr]])", "Send data to a socket stream. If target_addr is specified it must be in dotted quad (or [ipv6]) format" ], "stream_socket_server": [ "resource stream_socket_server(string localaddress [, long &errcode [, string &errstring [, long flags [, resource context]]]])", "Create a server socket bound to localaddress" ], "stream_socket_shutdown": [ "int stream_socket_shutdown(resource stream, int how)", "causes all or part of a full-duplex connection on the socket associated with stream to be shut down. If how is SHUT_RD, further receptions will be disallowed. If how is SHUT_WR, further transmissions will be disallowed. If how is SHUT_RDWR, further receptions and transmissions will be disallowed." ], "stream_supports_lock": [ "bool stream_supports_lock(resource stream)", "Tells whether the stream supports locking through flock()." ], "stream_wrapper_register": [ "bool stream_wrapper_register(string protocol, string classname[, integer flags])", "Registers a custom URL protocol handler class" ], "stream_wrapper_restore": [ "bool stream_wrapper_restore(string protocol)", "Restore the original protocol handler, overriding if necessary" ], "stream_wrapper_unregister": [ "bool stream_wrapper_unregister(string protocol)", "Unregister a wrapper for the life of the current request." ], "strftime": [ "string strftime(string format [, int timestamp])", "Format a local time/date according to locale settings" ], "strip_tags": [ "string strip_tags(string str [, string allowable_tags])", "Strips HTML and PHP tags from a string" ], "stripcslashes": [ "string stripcslashes(string str)", "Strips backslashes from a string. Uses C-style conventions" ], "stripos": [ "int stripos(string haystack, string needle [, int offset])", "Finds position of first occurrence of a string within another, case insensitive" ], "stripslashes": [ "string stripslashes(string str)", "Strips backslashes from a string" ], "stristr": [ "string stristr(string haystack, string needle[, bool part])", "Finds first occurrence of a string within another, case insensitive" ], "strlen": [ "int strlen(string str)", "Get string length" ], "strnatcasecmp": [ "int strnatcasecmp(string s1, string s2)", "Returns the result of case-insensitive string comparison using 'natural' algorithm" ], "strnatcmp": [ "int strnatcmp(string s1, string s2)", "Returns the result of string comparison using 'natural' algorithm" ], "strncasecmp": [ "int strncasecmp(string str1, string str2, int len)", "Binary safe string comparison" ], "strncmp": [ "int strncmp(string str1, string str2, int len)", "Binary safe string comparison" ], "strpbrk": [ "array strpbrk(string haystack, string char_list)", "Search a string for any of a set of characters" ], "strpos": [ "int strpos(string haystack, string needle [, int offset])", "Finds position of first occurrence of a string within another" ], "strptime": [ "string strptime(string timestamp, string format)", "Parse a time/date generated with strftime()" ], "strrchr": [ "string strrchr(string haystack, string needle)", "Finds the last occurrence of a character in a string within another" ], "strrev": [ "string strrev(string str)", "Reverse a string" ], "strripos": [ "int strripos(string haystack, string needle [, int offset])", "Finds position of last occurrence of a string within another string" ], "strrpos": [ "int strrpos(string haystack, string needle [, int offset])", "Finds position of last occurrence of a string within another string" ], "strspn": [ "int strspn(string str, string mask [, start [, len]])", "Finds length of initial segment consisting entirely of characters found in mask. If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)" ], "strstr": [ "string strstr(string haystack, string needle[, bool part])", "Finds first occurrence of a string within another" ], "strtok": [ "string strtok([string str,] string token)", "Tokenize a string" ], "strtolower": [ "string strtolower(string str)", "Makes a string lowercase" ], "strtotime": [ "int strtotime(string time [, int now ])", "Convert string representation of date and time to a timestamp" ], "strtoupper": [ "string strtoupper(string str)", "Makes a string uppercase" ], "strtr": [ "string strtr(string str, string from[, string to])", "Translates characters in str using given translation tables" ], "strval": [ "string strval(mixed var)", "Get the string value of a variable" ], "substr": [ "string substr(string str, int start [, int length])", "Returns part of a string" ], "substr_compare": [ "int substr_compare(string main_str, string str, int offset [, int length [, bool case_sensitivity]])", "Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters" ], "substr_count": [ "int substr_count(string haystack, string needle [, int offset [, int length]])", "Returns the number of times a substring occurs in the string" ], "substr_replace": [ "mixed substr_replace(mixed str, mixed repl, mixed start [, mixed length])", "Replaces part of a string with another string" ], "sybase_affected_rows": [ "int sybase_affected_rows([resource link_id])", "Get number of affected rows in last query" ], "sybase_close": [ "bool sybase_close([resource link_id])", "Close Sybase connection" ], "sybase_connect": [ "int sybase_connect([string host [, string user [, string password [, string charset [, string appname [, bool new]]]]]])", "Open Sybase server connection" ], "sybase_data_seek": [ "bool sybase_data_seek(resource result, int offset)", "Move internal row pointer" ], "sybase_deadlock_retry_count": [ "void sybase_deadlock_retry_count(int retry_count)", "Sets deadlock retry count" ], "sybase_fetch_array": [ "array sybase_fetch_array(resource result)", "Fetch row as array" ], "sybase_fetch_assoc": [ "array sybase_fetch_assoc(resource result)", "Fetch row as array without numberic indices" ], "sybase_fetch_field": [ "object sybase_fetch_field(resource result [, int offset])", "Get field information" ], "sybase_fetch_object": [ "object sybase_fetch_object(resource result [, mixed object])", "Fetch row as object" ], "sybase_fetch_row": [ "array sybase_fetch_row(resource result)", "Get row as enumerated array" ], "sybase_field_seek": [ "bool sybase_field_seek(resource result, int offset)", "Set field offset" ], "sybase_free_result": [ "bool sybase_free_result(resource result)", "Free result memory" ], "sybase_get_last_message": [ "string sybase_get_last_message()", "Returns the last message from server (over min_message_severity)" ], "sybase_min_client_severity": [ "void sybase_min_client_severity(int severity)", "Sets minimum client severity" ], "sybase_min_server_severity": [ "void sybase_min_server_severity(int severity)", "Sets minimum server severity" ], "sybase_num_fields": [ "int sybase_num_fields(resource result)", "Get number of fields in result" ], "sybase_num_rows": [ "int sybase_num_rows(resource result)", "Get number of rows in result" ], "sybase_pconnect": [ "int sybase_pconnect([string host [, string user [, string password [, string charset [, string appname]]]]])", "Open persistent Sybase connection" ], "sybase_query": [ "int sybase_query(string query [, resource link_id])", "Send Sybase query" ], "sybase_result": [ "string sybase_result(resource result, int row, mixed field)", "Get result data" ], "sybase_select_db": [ "bool sybase_select_db(string database [, resource link_id])", "Select Sybase database" ], "sybase_set_message_handler": [ "bool sybase_set_message_handler(mixed error_func [, resource connection])", "Set the error handler, to be called when a server message is raised. If error_func is NULL the handler will be deleted" ], "sybase_unbuffered_query": [ "int sybase_unbuffered_query(string query [, resource link_id])", "Send Sybase query" ], "symlink": [ "int symlink(string target, string link)", "Create a symbolic link" ], "sys_get_temp_dir": [ "string sys_get_temp_dir()", "Returns directory path used for temporary files" ], "sys_getloadavg": [ "array sys_getloadavg()", "" ], "syslog": [ "bool syslog(int priority, string message)", "Generate a system log message" ], "system": [ "int system(string command [, int &return_value])", "Execute an external program and display output" ], "tan": [ "float tan(float number)", "Returns the tangent of the number in radians" ], "tanh": [ "float tanh(float number)", "Returns the hyperbolic tangent of the number, defined as sinh(number)/cosh(number)" ], "tempnam": [ "string tempnam(string dir, string prefix)", "Create a unique filename in a directory" ], "textdomain": [ "string textdomain(string domain)", "Set the textdomain to \"domain\". Returns the current domain" ], "tidy_access_count": [ "int tidy_access_count()", "Returns the Number of Tidy accessibility warnings encountered for specified document." ], "tidy_clean_repair": [ "bool tidy_clean_repair()", "Execute configured cleanup and repair operations on parsed markup" ], "tidy_config_count": [ "int tidy_config_count()", "Returns the Number of Tidy configuration errors encountered for specified document." ], "tidy_diagnose": [ "bool tidy_diagnose()", "Run configured diagnostics on parsed and repaired markup." ], "tidy_error_count": [ "int tidy_error_count()", "Returns the Number of Tidy errors encountered for specified document." ], "tidy_get_body": [ "TidyNode tidy_get_body(resource tidy)", "Returns a TidyNode Object starting from the <BODY> tag of the tidy parse tree" ], "tidy_get_config": [ "array tidy_get_config()", "Get current Tidy configuarion" ], "tidy_get_error_buffer": [ "string tidy_get_error_buffer([bool detailed])", "Return warnings and errors which occured parsing the specified document" ], "tidy_get_head": [ "TidyNode tidy_get_head()", "Returns a TidyNode Object starting from the <HEAD> tag of the tidy parse tree" ], "tidy_get_html": [ "TidyNode tidy_get_html()", "Returns a TidyNode Object starting from the <HTML> tag of the tidy parse tree" ], "tidy_get_html_ver": [ "int tidy_get_html_ver()", "Get the Detected HTML version for the specified document." ], "tidy_get_opt_doc": [ "string tidy_get_opt_doc(tidy resource, string optname)", "Returns the documentation for the given option name" ], "tidy_get_output": [ "string tidy_get_output()", "Return a string representing the parsed tidy markup" ], "tidy_get_release": [ "string tidy_get_release()", "Get release date (version) for Tidy library" ], "tidy_get_root": [ "TidyNode tidy_get_root()", "Returns a TidyNode Object representing the root of the tidy parse tree" ], "tidy_get_status": [ "int tidy_get_status()", "Get status of specfied document." ], "tidy_getopt": [ "mixed tidy_getopt(string option)", "Returns the value of the specified configuration option for the tidy document." ], "tidy_is_xhtml": [ "bool tidy_is_xhtml()", "Indicates if the document is a XHTML document." ], "tidy_is_xml": [ "bool tidy_is_xml()", "Indicates if the document is a generic (non HTML/XHTML) XML document." ], "tidy_parse_file": [ "bool tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])", "Parse markup in file or URI" ], "tidy_parse_string": [ "bool tidy_parse_string(string input [, mixed config_options [, string encoding]])", "Parse a document stored in a string" ], "tidy_repair_file": [ "bool tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])", "Repair a file using an optionally provided configuration file" ], "tidy_repair_string": [ "bool tidy_repair_string(string data [, mixed config_file [, string encoding]])", "Repair a string using an optionally provided configuration file" ], "tidy_warning_count": [ "int tidy_warning_count()", "Returns the Number of Tidy warnings encountered for specified document." ], "time": [ "int time()", "Return current UNIX timestamp" ], "time_nanosleep": [ "mixed time_nanosleep(long seconds, long nanoseconds)", "Delay for a number of seconds and nano seconds" ], "time_sleep_until": [ "mixed time_sleep_until(float timestamp)", "Make the script sleep until the specified time" ], "timezone_abbreviations_list": [ "array timezone_abbreviations_list()", "Returns associative array containing dst, offset and the timezone name" ], "timezone_identifiers_list": [ "array timezone_identifiers_list([long what[, string country]])", "Returns numerically index array with all timezone identifiers." ], "timezone_location_get": [ "array timezone_location_get()", "Returns location information for a timezone, including country code, latitude/longitude and comments" ], "timezone_name_from_abbr": [ "string timezone_name_from_abbr(string abbr[, long gmtOffset[, long isdst]])", "Returns the timezone name from abbrevation" ], "timezone_name_get": [ "string timezone_name_get(DateTimeZone object)", "Returns the name of the timezone." ], "timezone_offset_get": [ "long timezone_offset_get(DateTimeZone object, DateTime object)", "Returns the timezone offset." ], "timezone_open": [ "DateTimeZone timezone_open(string timezone)", "Returns new DateTimeZone object" ], "timezone_transitions_get": [ "array timezone_transitions_get(DateTimeZone object [, long timestamp_begin [, long timestamp_end ]])", "Returns numerically indexed array containing associative array for all transitions in the specified range for the timezone." ], "timezone_version_get": [ "array timezone_version_get()", "Returns the Olson database version number." ], "tmpfile": [ "resource tmpfile()", "Create a temporary file that will be deleted automatically after use" ], "token_get_all": [ "array token_get_all(string source)", "" ], "token_name": [ "string token_name(int type)", "" ], "touch": [ "bool touch(string filename [, int time [, int atime]])", "Set modification time of file" ], "trigger_error": [ "void trigger_error(string messsage [, int error_type])", "Generates a user-level error/warning/notice message" ], "trim": [ "string trim(string str [, string character_mask])", "Strips whitespace from the beginning and end of a string" ], "uasort": [ "bool uasort(array array_arg, string cmp_function)", "Sort an array with a user-defined comparison function and maintain index association" ], "ucfirst": [ "string ucfirst(string str)", "Make a string's first character lowercase" ], "ucwords": [ "string ucwords(string str)", "Uppercase the first character of every word in a string" ], "uksort": [ "bool uksort(array array_arg, string cmp_function)", "Sort an array by keys using a user-defined comparison function" ], "umask": [ "int umask([int mask])", "Return or change the umask" ], "uniqid": [ "string uniqid([string prefix [, bool more_entropy]])", "Generates a unique ID" ], "unixtojd": [ "int unixtojd([int timestamp])", "Convert UNIX timestamp to Julian Day" ], "unlink": [ "bool unlink(string filename[, context context])", "Delete a file" ], "unpack": [ "array unpack(string format, string input)", "Unpack binary string into named array elements according to format argument" ], "unregister_tick_function": [ "void unregister_tick_function(string function_name)", "Unregisters a tick callback function" ], "unserialize": [ "mixed unserialize(string variable_representation)", "Takes a string representation of variable and recreates it" ], "unset": [ "void unset(mixed var [, mixed var])", "Unset a given variable" ], "urldecode": [ "string urldecode(string str)", "Decodes URL-encoded string" ], "urlencode": [ "string urlencode(string str)", "URL-encodes string" ], "usleep": [ "void usleep(int micro_seconds)", "Delay for a given number of micro seconds" ], "usort": [ "bool usort(array array_arg, string cmp_function)", "Sort an array by values using a user-defined comparison function" ], "utf8_decode": [ "string utf8_decode(string data)", "Converts a UTF-8 encoded string to ISO-8859-1" ], "utf8_encode": [ "string utf8_encode(string data)", "Encodes an ISO-8859-1 string to UTF-8" ], "var_dump": [ "void var_dump(mixed var)", "Dumps a string representation of variable to output" ], "var_export": [ "string var_export(mixed var [, bool return])", "Outputs or returns a string representation of a variable" ], "variant_abs": [ "mixed variant_abs(mixed left)", "Returns the absolute value of a variant" ], "variant_add": [ "mixed variant_add(mixed left, mixed right)", "\"Adds\" two variant values together and returns the result" ], "variant_and": [ "mixed variant_and(mixed left, mixed right)", "performs a bitwise AND operation between two variants and returns the result" ], "variant_cast": [ "object variant_cast(object variant, int type)", "Convert a variant into a new variant object of another type" ], "variant_cat": [ "mixed variant_cat(mixed left, mixed right)", "concatenates two variant values together and returns the result" ], "variant_cmp": [ "int variant_cmp(mixed left, mixed right [, int lcid [, int flags]])", "Compares two variants" ], "variant_date_from_timestamp": [ "object variant_date_from_timestamp(int timestamp)", "Returns a variant date representation of a unix timestamp" ], "variant_date_to_timestamp": [ "int variant_date_to_timestamp(object variant)", "Converts a variant date/time value to unix timestamp" ], "variant_div": [ "mixed variant_div(mixed left, mixed right)", "Returns the result from dividing two variants" ], "variant_eqv": [ "mixed variant_eqv(mixed left, mixed right)", "Performs a bitwise equivalence on two variants" ], "variant_fix": [ "mixed variant_fix(mixed left)", "Returns the integer part ? of a variant" ], "variant_get_type": [ "int variant_get_type(object variant)", "Returns the VT_XXX type code for a variant" ], "variant_idiv": [ "mixed variant_idiv(mixed left, mixed right)", "Converts variants to integers and then returns the result from dividing them" ], "variant_imp": [ "mixed variant_imp(mixed left, mixed right)", "Performs a bitwise implication on two variants" ], "variant_int": [ "mixed variant_int(mixed left)", "Returns the integer portion of a variant" ], "variant_mod": [ "mixed variant_mod(mixed left, mixed right)", "Divides two variants and returns only the remainder" ], "variant_mul": [ "mixed variant_mul(mixed left, mixed right)", "multiplies the values of the two variants and returns the result" ], "variant_neg": [ "mixed variant_neg(mixed left)", "Performs logical negation on a variant" ], "variant_not": [ "mixed variant_not(mixed left)", "Performs bitwise not negation on a variant" ], "variant_or": [ "mixed variant_or(mixed left, mixed right)", "Performs a logical disjunction on two variants" ], "variant_pow": [ "mixed variant_pow(mixed left, mixed right)", "Returns the result of performing the power function with two variants" ], "variant_round": [ "mixed variant_round(mixed left, int decimals)", "Rounds a variant to the specified number of decimal places" ], "variant_set": [ "void variant_set(object variant, mixed value)", "Assigns a new value for a variant object" ], "variant_set_type": [ "void variant_set_type(object variant, int type)", "Convert a variant into another type. Variant is modified \"in-place\"" ], "variant_sub": [ "mixed variant_sub(mixed left, mixed right)", "subtracts the value of the right variant from the left variant value and returns the result" ], "variant_xor": [ "mixed variant_xor(mixed left, mixed right)", "Performs a logical exclusion on two variants" ], "version_compare": [ "int version_compare(string ver1, string ver2 [, string oper])", "Compares two \"PHP-standardized\" version number strings" ], "vfprintf": [ "int vfprintf(resource stream, string format, array args)", "Output a formatted string into a stream" ], "virtual": [ "bool virtual(string filename)", "Perform an Apache sub-request" ], "vprintf": [ "int vprintf(string format, array args)", "Output a formatted string" ], "vsprintf": [ "string vsprintf(string format, array args)", "Return a formatted string" ], "wddx_add_vars": [ "int wddx_add_vars(resource packet_id, mixed var_names [, mixed ...])", "Serializes given variables and adds them to packet given by packet_id" ], "wddx_deserialize": [ "mixed wddx_deserialize(mixed packet)", "Deserializes given packet and returns a PHP value" ], "wddx_packet_end": [ "string wddx_packet_end(resource packet_id)", "Ends specified WDDX packet and returns the string containing the packet" ], "wddx_packet_start": [ "resource wddx_packet_start([string comment])", "Starts a WDDX packet with optional comment and returns the packet id" ], "wddx_serialize_value": [ "string wddx_serialize_value(mixed var [, string comment])", "Creates a new packet and serializes the given value" ], "wddx_serialize_vars": [ "string wddx_serialize_vars(mixed var_name [, mixed ...])", "Creates a new packet and serializes given variables into a struct" ], "wordwrap": [ "string wordwrap(string str [, int width [, string break [, bool cut]]])", "Wraps buffer to selected number of characters using string break char" ], "xml_error_string": [ "string xml_error_string(int code)", "Get XML parser error string" ], "xml_get_current_byte_index": [ "int xml_get_current_byte_index(resource parser)", "Get current byte index for an XML parser" ], "xml_get_current_column_number": [ "int xml_get_current_column_number(resource parser)", "Get current column number for an XML parser" ], "xml_get_current_line_number": [ "int xml_get_current_line_number(resource parser)", "Get current line number for an XML parser" ], "xml_get_error_code": [ "int xml_get_error_code(resource parser)", "Get XML parser error code" ], "xml_parse": [ "int xml_parse(resource parser, string data [, int isFinal])", "Start parsing an XML document" ], "xml_parse_into_struct": [ "int xml_parse_into_struct(resource parser, string data, array &values [, array &index ])", "Parsing a XML document" ], "xml_parser_create": [ "resource xml_parser_create([string encoding])", "Create an XML parser" ], "xml_parser_create_ns": [ "resource xml_parser_create_ns([string encoding [, string sep]])", "Create an XML parser" ], "xml_parser_free": [ "int xml_parser_free(resource parser)", "Free an XML parser" ], "xml_parser_get_option": [ "int xml_parser_get_option(resource parser, int option)", "Get options from an XML parser" ], "xml_parser_set_option": [ "int xml_parser_set_option(resource parser, int option, mixed value)", "Set options in an XML parser" ], "xml_set_character_data_handler": [ "int xml_set_character_data_handler(resource parser, string hdl)", "Set up character data handler" ], "xml_set_default_handler": [ "int xml_set_default_handler(resource parser, string hdl)", "Set up default handler" ], "xml_set_element_handler": [ "int xml_set_element_handler(resource parser, string shdl, string ehdl)", "Set up start and end element handlers" ], "xml_set_end_namespace_decl_handler": [ "int xml_set_end_namespace_decl_handler(resource parser, string hdl)", "Set up character data handler" ], "xml_set_external_entity_ref_handler": [ "int xml_set_external_entity_ref_handler(resource parser, string hdl)", "Set up external entity reference handler" ], "xml_set_notation_decl_handler": [ "int xml_set_notation_decl_handler(resource parser, string hdl)", "Set up notation declaration handler" ], "xml_set_object": [ "int xml_set_object(resource parser, object &obj)", "Set up object which should be used for callbacks" ], "xml_set_processing_instruction_handler": [ "int xml_set_processing_instruction_handler(resource parser, string hdl)", "Set up processing instruction (PI) handler" ], "xml_set_start_namespace_decl_handler": [ "int xml_set_start_namespace_decl_handler(resource parser, string hdl)", "Set up character data handler" ], "xml_set_unparsed_entity_decl_handler": [ "int xml_set_unparsed_entity_decl_handler(resource parser, string hdl)", "Set up unparsed entity declaration handler" ], "xmlrpc_decode": [ "array xmlrpc_decode(string xml [, string encoding])", "Decodes XML into native PHP types" ], "xmlrpc_decode_request": [ "array xmlrpc_decode_request(string xml, string& method [, string encoding])", "Decodes XML into native PHP types" ], "xmlrpc_encode": [ "string xmlrpc_encode(mixed value)", "Generates XML for a PHP value" ], "xmlrpc_encode_request": [ "string xmlrpc_encode_request(string method, mixed params [, array output_options])", "Generates XML for a method request" ], "xmlrpc_get_type": [ "string xmlrpc_get_type(mixed value)", "Gets xmlrpc type for a PHP value. Especially useful for base64 and datetime strings" ], "xmlrpc_is_fault": [ "bool xmlrpc_is_fault(array)", "Determines if an array value represents an XMLRPC fault." ], "xmlrpc_parse_method_descriptions": [ "array xmlrpc_parse_method_descriptions(string xml)", "Decodes XML into a list of method descriptions" ], "xmlrpc_server_add_introspection_data": [ "int xmlrpc_server_add_introspection_data(resource server, array desc)", "Adds introspection documentation" ], "xmlrpc_server_call_method": [ "mixed xmlrpc_server_call_method(resource server, string xml, mixed user_data [, array output_options])", "Parses XML requests and call methods" ], "xmlrpc_server_create": [ "resource xmlrpc_server_create()", "Creates an xmlrpc server" ], "xmlrpc_server_destroy": [ "int xmlrpc_server_destroy(resource server)", "Destroys server resources" ], "xmlrpc_server_register_introspection_callback": [ "bool xmlrpc_server_register_introspection_callback(resource server, string function)", "Register a PHP function to generate documentation" ], "xmlrpc_server_register_method": [ "bool xmlrpc_server_register_method(resource server, string method_name, string function)", "Register a PHP function to handle method matching method_name" ], "xmlrpc_set_type": [ "bool xmlrpc_set_type(string value, string type)", "Sets xmlrpc type, base64 or datetime, for a PHP string value" ], "xmlwriter_end_attribute": [ "bool xmlwriter_end_attribute(resource xmlwriter)", "End attribute - returns FALSE on error" ], "xmlwriter_end_cdata": [ "bool xmlwriter_end_cdata(resource xmlwriter)", "End current CDATA - returns FALSE on error" ], "xmlwriter_end_comment": [ "bool xmlwriter_end_comment(resource xmlwriter)", "Create end comment - returns FALSE on error" ], "xmlwriter_end_document": [ "bool xmlwriter_end_document(resource xmlwriter)", "End current document - returns FALSE on error" ], "xmlwriter_end_dtd": [ "bool xmlwriter_end_dtd(resource xmlwriter)", "End current DTD - returns FALSE on error" ], "xmlwriter_end_dtd_attlist": [ "bool xmlwriter_end_dtd_attlist(resource xmlwriter)", "End current DTD AttList - returns FALSE on error" ], "xmlwriter_end_dtd_element": [ "bool xmlwriter_end_dtd_element(resource xmlwriter)", "End current DTD element - returns FALSE on error" ], "xmlwriter_end_dtd_entity": [ "bool xmlwriter_end_dtd_entity(resource xmlwriter)", "End current DTD Entity - returns FALSE on error" ], "xmlwriter_end_element": [ "bool xmlwriter_end_element(resource xmlwriter)", "End current element - returns FALSE on error" ], "xmlwriter_end_pi": [ "bool xmlwriter_end_pi(resource xmlwriter)", "End current PI - returns FALSE on error" ], "xmlwriter_flush": [ "mixed xmlwriter_flush(resource xmlwriter [,bool empty])", "Output current buffer" ], "xmlwriter_full_end_element": [ "bool xmlwriter_full_end_element(resource xmlwriter)", "End current element - returns FALSE on error" ], "xmlwriter_open_memory": [ "resource xmlwriter_open_memory()", "Create new xmlwriter using memory for string output" ], "xmlwriter_open_uri": [ "resource xmlwriter_open_uri(resource xmlwriter, string source)", "Create new xmlwriter using source uri for output" ], "xmlwriter_output_memory": [ "string xmlwriter_output_memory(resource xmlwriter [,bool flush])", "Output current buffer as string" ], "xmlwriter_set_indent": [ "bool xmlwriter_set_indent(resource xmlwriter, bool indent)", "Toggle indentation on/off - returns FALSE on error" ], "xmlwriter_set_indent_string": [ "bool xmlwriter_set_indent_string(resource xmlwriter, string indentString)", "Set string used for indenting - returns FALSE on error" ], "xmlwriter_start_attribute": [ "bool xmlwriter_start_attribute(resource xmlwriter, string name)", "Create start attribute - returns FALSE on error" ], "xmlwriter_start_attribute_ns": [ "bool xmlwriter_start_attribute_ns(resource xmlwriter, string prefix, string name, string uri)", "Create start namespaced attribute - returns FALSE on error" ], "xmlwriter_start_cdata": [ "bool xmlwriter_start_cdata(resource xmlwriter)", "Create start CDATA tag - returns FALSE on error" ], "xmlwriter_start_comment": [ "bool xmlwriter_start_comment(resource xmlwriter)", "Create start comment - returns FALSE on error" ], "xmlwriter_start_document": [ "bool xmlwriter_start_document(resource xmlwriter, string version, string encoding, string standalone)", "Create document tag - returns FALSE on error" ], "xmlwriter_start_dtd": [ "bool xmlwriter_start_dtd(resource xmlwriter, string name, string pubid, string sysid)", "Create start DTD tag - returns FALSE on error" ], "xmlwriter_start_dtd_attlist": [ "bool xmlwriter_start_dtd_attlist(resource xmlwriter, string name)", "Create start DTD AttList - returns FALSE on error" ], "xmlwriter_start_dtd_element": [ "bool xmlwriter_start_dtd_element(resource xmlwriter, string name)", "Create start DTD element - returns FALSE on error" ], "xmlwriter_start_dtd_entity": [ "bool xmlwriter_start_dtd_entity(resource xmlwriter, string name, bool isparam)", "Create start DTD Entity - returns FALSE on error" ], "xmlwriter_start_element": [ "bool xmlwriter_start_element(resource xmlwriter, string name)", "Create start element tag - returns FALSE on error" ], "xmlwriter_start_element_ns": [ "bool xmlwriter_start_element_ns(resource xmlwriter, string prefix, string name, string uri)", "Create start namespaced element tag - returns FALSE on error" ], "xmlwriter_start_pi": [ "bool xmlwriter_start_pi(resource xmlwriter, string target)", "Create start PI tag - returns FALSE on error" ], "xmlwriter_text": [ "bool xmlwriter_text(resource xmlwriter, string content)", "Write text - returns FALSE on error" ], "xmlwriter_write_attribute": [ "bool xmlwriter_write_attribute(resource xmlwriter, string name, string content)", "Write full attribute - returns FALSE on error" ], "xmlwriter_write_attribute_ns": [ "bool xmlwriter_write_attribute_ns(resource xmlwriter, string prefix, string name, string uri, string content)", "Write full namespaced attribute - returns FALSE on error" ], "xmlwriter_write_cdata": [ "bool xmlwriter_write_cdata(resource xmlwriter, string content)", "Write full CDATA tag - returns FALSE on error" ], "xmlwriter_write_comment": [ "bool xmlwriter_write_comment(resource xmlwriter, string content)", "Write full comment tag - returns FALSE on error" ], "xmlwriter_write_dtd": [ "bool xmlwriter_write_dtd(resource xmlwriter, string name, string pubid, string sysid, string subset)", "Write full DTD tag - returns FALSE on error" ], "xmlwriter_write_dtd_attlist": [ "bool xmlwriter_write_dtd_attlist(resource xmlwriter, string name, string content)", "Write full DTD AttList tag - returns FALSE on error" ], "xmlwriter_write_dtd_element": [ "bool xmlwriter_write_dtd_element(resource xmlwriter, string name, string content)", "Write full DTD element tag - returns FALSE on error" ], "xmlwriter_write_dtd_entity": [ "bool xmlwriter_write_dtd_entity(resource xmlwriter, string name, string content [, int pe [, string pubid [, string sysid [, string ndataid]]]])", "Write full DTD Entity tag - returns FALSE on error" ], "xmlwriter_write_element": [ "bool xmlwriter_write_element(resource xmlwriter, string name[, string content])", "Write full element tag - returns FALSE on error" ], "xmlwriter_write_element_ns": [ "bool xmlwriter_write_element_ns(resource xmlwriter, string prefix, string name, string uri[, string content])", "Write full namespaced element tag - returns FALSE on error" ], "xmlwriter_write_pi": [ "bool xmlwriter_write_pi(resource xmlwriter, string target, string content)", "Write full PI tag - returns FALSE on error" ], "xmlwriter_write_raw": [ "bool xmlwriter_write_raw(resource xmlwriter, string content)", "Write text - returns FALSE on error" ], "xsl_xsltprocessor_get_parameter": [ "string xsl_xsltprocessor_get_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_has_exslt_support": [ "bool xsl_xsltprocessor_has_exslt_support()", "" ], "xsl_xsltprocessor_import_stylesheet": [ "void xsl_xsltprocessor_import_stylesheet(domdocument doc)", "" ], "xsl_xsltprocessor_register_php_functions": [ "void xsl_xsltprocessor_register_php_functions([mixed $restrict])", "" ], "xsl_xsltprocessor_remove_parameter": [ "bool xsl_xsltprocessor_remove_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_set_parameter": [ "bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value])", "" ], "xsl_xsltprocessor_set_profiling": [ "bool xsl_xsltprocessor_set_profiling(string filename)", "" ], "xsl_xsltprocessor_transform_to_doc": [ "domdocument xsl_xsltprocessor_transform_to_doc(domnode doc)", "" ], "xsl_xsltprocessor_transform_to_uri": [ "int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri)", "" ], "xsl_xsltprocessor_transform_to_xml": [ "string xsl_xsltprocessor_transform_to_xml(domdocument doc)", "" ], "zend_logo_guid": [ "string zend_logo_guid()", "Return the special ID used to request the Zend logo in phpinfo screens" ], "zend_version": [ "string zend_version()", "Get the version of the Zend Engine" ], "zip_close": [ "void zip_close(resource zip)", "Close a Zip archive" ], "zip_entry_close": [ "void zip_entry_close(resource zip_ent)", "Close a zip entry" ], "zip_entry_compressedsize": [ "int zip_entry_compressedsize(resource zip_entry)", "Return the compressed size of a ZZip entry" ], "zip_entry_compressionmethod": [ "string zip_entry_compressionmethod(resource zip_entry)", "Return a string containing the compression method used on a particular entry" ], "zip_entry_filesize": [ "int zip_entry_filesize(resource zip_entry)", "Return the actual filesize of a ZZip entry" ], "zip_entry_name": [ "string zip_entry_name(resource zip_entry)", "Return the name given a ZZip entry" ], "zip_entry_open": [ "bool zip_entry_open(resource zip_dp, resource zip_entry [, string mode])", "Open a Zip File, pointed by the resource entry" ], "zip_entry_read": [ "mixed zip_entry_read(resource zip_entry [, int len])", "Read from an open directory entry" ], "zip_open": [ "resource zip_open(string filename)", "Create new zip using source uri for output" ], "zip_read": [ "resource zip_read(resource zip)", "Returns the next file in the archive" ], "zlib_get_coding_type": [ "string zlib_get_coding_type()", "Returns the coding type used for output compression" ], "array_column": [ "array_column(array $array, int|string|null $column_key, int|string|null $index_key = null): array", "Return the values from a single column in the input array" ], "boolval": [ "boolval(mixed $value): bool", "Get the boolean value of a variable" ], "bzclose": [ "bzclose(resource $bz): bool", "Close a bzip2 file" ], "bzflush": [ "bzflush(resource $bz): bool", "Do nothing" ], "bzwrite": [ "bzwrite(resource $bz, string $data, ?int $length = null): int|false", "Binary safe bzip2 file write" ], "checkdnsrr": [ "checkdnsrr(string $hostname, string $type = "MX"): bool", "Check DNS records corresponding to a given Internet host name or IP address" ], "chop": [ "chop()", "Alias of rtrim()" ], "class_uses": [ "class_uses(object|string $object_or_class, bool $autoload = true): array|false", "" ], "curl_escape": [ "curl_escape(CurlHandle $handle, string $string): string|false", "URL encodes the given string" ], "curl_file_create": [ "curl_file_create()", "Create a CURLFile object" ], "curl_multi_errno": [ "curl_multi_errno(CurlMultiHandle $multi_handle): int", "Return the last multi curl error number" ], "curl_multi_setopt": [ "curl_multi_setopt(CurlMultiHandle $multi_handle, int $option, mixed $value): bool", "Set an option for the cURL multi handle" ], "curl_multi_strerror": [ "curl_multi_strerror(int $error_code): ?string", "Return string describing error code" ], "curl_pause": [ "curl_pause(CurlHandle $handle, int $flags): int", "Pause and unpause a connection" ], "curl_reset": [ "curl_reset(CurlHandle $handle): void", "Reset all options of a libcurl session handle" ], "curl_share_close": [ "curl_share_close(CurlShareHandle $share_handle): void", "Close a cURL share handle" ], "curl_share_errno": [ "curl_share_errno(CurlShareHandle $share_handle): int", "Return the last share curl error number" ], "curl_share_init": [ "curl_share_init(): CurlShareHandle", "Initialize a cURL share handle" ], "curl_share_setopt": [ "curl_share_setopt(CurlShareHandle $share_handle, int $option, mixed $value): bool", "Set an option for a cURL share handle" ], "curl_share_strerror": [ "curl_share_strerror(int $error_code): ?string", "Return string describing the given error code" ], "curl_strerror": [ "curl_strerror(int $error_code): ?string", "Return string describing the given error code" ], "curl_unescape": [ "curl_unescape(CurlHandle $handle, string $string): string|false", "Decodes the given URL encoded string" ], "date_create_immutable_from_format": [ "date_create_immutable_from_format()", "Alias of DateTimeImmutable::createFromFormat()" ], "date_create_immutable": [ "date_create_immutable()", "Alias of DateTimeImmutable::__construct()" ], "deflate_add": [ "deflate_add(DeflateContext $context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH): string|false", "Incrementally deflate data" ], "deflate_init": [ "deflate_init(int $encoding, array $options = []): DeflateContext|false", "Initialize an incremental deflate context" ], "delete": [ "delete()", "See unlink()" ], "diskfreespace": [ "diskfreespace()", "Alias of disk_free_space()" ], "doubleval": [ "doubleval()", "Alias of floatval()" ], "enchant_dict_add": [ "enchant_dict_add(EnchantDictionary $dictionary, string $word): void", "Add a word to personal word list" ], "enchant_dict_is_added": [ "enchant_dict_is_added(EnchantDictionary $dictionary, string $word): bool", "Whether or not 'word' exists in this spelling-session" ], "error_clear_last": [ "error_clear_last(): void", "Clear the most recent error" ], "eval": [ "eval(string $code): mixed", "Evaluate a string as PHP code" ], "expect_expectl": [ "expect_expectl(resource $expect, array $cases, array &$match = ?): int", "" ], "expect_popen": [ "expect_popen(string $command): resource", "" ], "fdiv": [ "fdiv(float $num1, float $num2): float", "Divides two numbers, according to IEEE 754" ], "filter_id": [ "filter_id(string $name): int|false", "Returns the filter ID belonging to a named filter" ], "filter_list": [ "filter_list(): array", "Returns a list of all supported filters" ], "forward_static_call_array": [ "forward_static_call_array(callable $callback, array $args): mixed", "Call a static method and pass the arguments as array" ], "fputs": [ "fputs()", "Alias of fwrite()" ], "ftp_append": [ "ftp_append(FTP\\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): bool", "Append the contents of a file to another file on the FTP server" ], "ftp_mlsd": [ "ftp_mlsd(FTP\\Connection $ftp, string $directory): array|false", "Returns a list of files in the given directory" ], "ftp_quit": [ "ftp_quit()", "Alias of ftp_close()" ], "gc_mem_caches": [ "gc_mem_caches(): int", "" ], "gc_status": [ "gc_status(): array", "Gets information about the garbage collector" ], "get_debug_type": [ "get_debug_type(mixed $value): string", "Gets the type name of a variable in a way that is suitable for debugging" ], "get_declared_traits": [ "get_declared_traits(): array", "Returns an array of all declared traits" ], "get_required_files": [ "get_required_files()", "Alias of get_included_files()" ], "get_resource_id": [ "get_resource_id(resource $resource): int", "" ], "get_resources": [ "get_resources(?string $type = null): array", "Returns active resources" ], "getimagesizefromstring": [ "getimagesizefromstring(string $string, array &$image_info = null): array|false", "Get the size of an image from a string" ], "getmxrr": [ "getmxrr(string $hostname, array &$hosts, array &$weights = null): bool", "Get MX records corresponding to a given Internet host name" ], "gmp_binomial": [ "gmp_binomial(GMP|int|string $n, int $k): GMP", "Calculates binomial coefficient" ], "gmp_div": [ "gmp_div()", "Alias of gmp_div_q()" ], "gmp_export": [ "gmp_export(GMP|int|string $num, int $word_size = 1, int $flags = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string", "Export to a binary string" ], "gmp_import": [ "gmp_import(string $data, int $word_size = 1, int $flags = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): GMP", "Import from a binary string" ], "gmp_kronecker": [ "gmp_kronecker(GMP|int|string $num1, GMP|int|string $num2): int", "Kronecker symbol" ], "gmp_lcm": [ "gmp_lcm(GMP|int|string $num1, GMP|int|string $num2): GMP", "Calculate LCM" ], "gmp_perfect_power": [ "gmp_perfect_power(GMP|int|string $num): bool", "Perfect power check" ], "gmp_random_bits": [ "gmp_random_bits(int $bits): GMP", "Random number" ], "gmp_random_range": [ "gmp_random_range(GMP|int|string $min, GMP|int|string $max): GMP", "Random number" ], "gmp_random_seed": [ "gmp_random_seed(GMP|int|string $seed): void", "Sets the RNG seed" ], "gmp_root": [ "gmp_root(GMP|int|string $num, int $nth): GMP", "Take the integer part of nth root" ], "gmp_rootrem": [ "gmp_rootrem(GMP|int|string $num, int $nth): array", "Take the integer part and remainder of nth root" ], "gzclose": [ "gzclose(resource $stream): bool", "Close an open gz-file pointer" ], "gzdecode": [ "gzdecode(string $data, int $max_length = 0): string|false", "Decodes a gzip compressed string" ], "gzeof": [ "gzeof(resource $stream): bool", "Test for EOF on a gz-file pointer" ], "gzgetc": [ "gzgetc(resource $stream): string|false", "Get character from gz-file pointer" ], "gzgets": [ "gzgets(resource $stream, ?int $length = null): string|false", "Get line from file pointer" ], "gzgetss": [ "gzgetss(resource $zp, int $length, string $allowable_tags = ?): string", "" ], "gzpassthru": [ "gzpassthru(resource $stream): int", "" ], "gzputs": [ "gzputs()", "Alias of gzwrite()" ], "gzread": [ "gzread(resource $stream, int $length): string|false", "Binary-safe gz-file read" ], "gzrewind": [ "gzrewind(resource $stream): bool", "Rewind the position of a gz-file pointer" ], "gzseek": [ "gzseek(resource $stream, int $offset, int $whence = SEEK_SET): int", "Seek on a gz-file pointer" ], "gztell": [ "gztell(resource $stream): int|false", "Tell gz-file pointer read/write position" ], "gzwrite": [ "gzwrite(resource $stream, string $data, ?int $length = null): int|false", "Binary-safe gz-file write" ], "halt_compiler": [ "__halt_compiler(): void", "" ], "hash_equals": [ "hash_equals(string $known_string, string $user_string): bool", "Timing attack safe string comparison" ], "hash_hkdf": [ "hash_hkdf(string $algo, string $key, int $length = 0, string $info = \"\", string $salt = \"\"): string", "Generate a HKDF key derivation of a supplied key input" ], "hash_hmac_algos": [ "hash_hmac_algos(): array", "Return a list of registered hashing algorithms suitable for hash_hmac" ], "hash_pbkdf2": [ "hash_pbkdf2(string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $binary = false): string", "Generate a PBKDF2 key derivation of a supplied password" ], "header_register_callback": [ "header_register_callback(callable $callback): bool", "Call a header function" ], "hex2bin": [ "hex2bin(string $string): string|false", "Decodes a hexadecimally encoded binary string" ], "hrtime": [ "hrtime(bool $as_number = false): array|int|float|false", "Get the system's high resolution time" ], "http_response_code": [ "http_response_code(int $response_code = 0): int|bool", "Get or Set the HTTP response code" ], "imageaffine": [ "imageaffine(GdImage $image, array $affine, ?array $clip = null): GdImage|false", "Return an image containing the affine transformed src image, using an optional clipping area" ], "imageaffinematrixconcat": [ "imageaffinematrixconcat(array $matrix1, array $matrix2): array|false", "Concatenate two affine transformation matrices" ], "imageaffinematrixget": [ "imageaffinematrixget(int $type, array|float $options): array|false", "Get an affine transformation matrix" ], "imagebmp": [ "imagebmp(GdImage $image, resource|string|null $file = null, bool $compressed = true): bool", "Output a BMP image to browser or file" ], "imagecreatefrombmp": [ "imagecreatefrombmp(string $filename): GdImage|false", "Create a new image from file or URL" ], "imagecreatefromwebp": [ "imagecreatefromwebp(string $filename): GdImage|false", "Create a new image from file or URL" ], "imagecrop": [ "imagecrop(GdImage $image, array $rectangle): GdImage|false", "Crop an image to the given rectangle" ], "imagecropauto": [ "imagecropauto(GdImage $image, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1): GdImage|false", "Crop an image automatically using one of the available modes" ], "imageflip": [ "imageflip(GdImage $image, int $mode): bool", "Flips an image using a given mode" ], "imagegetclip": [ "imagegetclip(GdImage $image): array", "Get the clipping rectangle" ], "imagegetinterpolation": [ "imagegetinterpolation(GdImage $image): int", "Get the interpolation method" ], "imageopenpolygon": [ "imageopenpolygon(GdImage $image, array $points, int $color): bool", "Draws an open polygon" ], "imagepalettetotruecolor": [ "imagepalettetotruecolor(GdImage $image): bool", "Converts a palette based image to true color" ], "imageresolution": [ "imageresolution(GdImage $image, ?int $resolution_x = null, ?int $resolution_y = null): array|bool", "Get or set the resolution of the image" ], "imagescale": [ "imagescale(GdImage $image, int $width, int $height = -1, int $mode = IMG_BILINEAR_FIXED): GdImage|false", "Scale an image using the given new width and height" ], "imagesetclip": [ "imagesetclip(GdImage $image, int $x1, int $y1, int $x2, int $y2): bool", "Set the clipping rectangle" ], "imagesetinterpolation": [ "imagesetinterpolation(GdImage $image, int $method = IMG_BILINEAR_FIXED): bool", "Set the interpolation method" ], "imagewebp": [ "imagewebp(GdImage $image, resource|string|null $file = null, int $quality = -1): bool", "Output a WebP image to browser or file" ], "imap_create": [ "", "Alias of imap_createmailbox()" ], "imap_fetchmime": [ "imap_fetchmime(IMAP\\Connection $imap, int $message_num, string $section, int $flags = 0): string|false", "Fetch MIME headers for a particular section of the message" ], "imap_fetchtext": [ "imap_fetchtext()", "Alias of imap_body()" ], "imap_header": [ "imap_header()", "Alias of imap_headerinfo()" ], "imap_listmailbox": [ "imap_listmailbox()", "Alias of imap_list()" ], "imap_listsubscribed": [ "imap_listsubscribed()", "Alias of imap_lsub()" ], "imap_rename": [ "imap_rename()", "Alias of imap_renamemailbox()" ], "imap_scan": [ "imap_scan()", "Alias of imap_listscan()" ], "imap_scanmailbox": [ "imap_scanmailbox()", "Alias of imap_listscan()" ], "ini_alter": [ "ini_alter()", "Alias of ini_set()" ], "intdiv": [ "intdiv(int $num1, int $num2): int", "Integer division" ], "is_double": [ "is_double()", "Alias of is_float()" ], "is_int": [ "is_int(mixed $value): bool", "Find whether the type of a variable is integer" ], "is_integer": [ "is_integer()", "Alias of is_int()" ], "is_iterable": [ "is_iterable(mixed $value): bool", "" ], "is_real": [ "is_real()", "Alias of is_float()" ], "is_soap_fault": [ "is_soap_fault(mixed $object): bool", "Checks if a SOAP call has failed" ], "is_tainted": [ "is_tainted(string $string): bool", "Checks whether a string is tainted" ], "is_writeable": [ "is_writeable()", "Alias of is_writable()" ], "json_last_error_msg": [ "json_last_error_msg(): string", "Returns the error string of the last json_encode() or json_decode() call" ], "key_exists": [ "key_exists()", "Alias of array_key_exists()" ], "lchown": [ "lchown(string $filename, string|int $user): bool", "Changes user ownership of symlink" ], "libxml_set_external_entity_loader": [ "libxml_set_external_entity_loader(?callable $resolver_function): bool", "Changes the default external entity loader" ], "mb_chr": [ "mb_chr(int $codepoint, ?string $encoding = null): string|false", "Return character by Unicode code point value" ], "mb_ereg_replace_callback": [ "mb_ereg_replace_callback(string $pattern, callable $callback, string $string, ?string $options = null): string|false|null", "" ], "mb_ord": [ "mb_ord(string $string, ?string $encoding = null): int|false", "Get Unicode code point of character" ], "mb_scrub": [ "mb_scrub(string $string, ?string $encoding = null): string", "Description" ], "mb_str_split": [ "mb_str_split(string $string, int $length = 1, ?string $encoding = null): array", "Given a multibyte string, return an array of its characters" ], "memcache_debug": [ "memcache_debug(bool $on_off): bool", "Turn debug output on/off" ], "mysql_db_name": [ "mysql_db_name(resource $result, int $row, mixed $field = NULL): string", "Retrieves database name from the call to mysql_list_dbs()" ], "mysql_tablename": [ "mysql_tablename(resource $result, int $i): string|false", "Get table name of field" ], "mysql_xdevapi_expression": [ "mysql_xdevapi\\expression(string $expression): object", "Bind prepared statement variables as parameters" ], "mysql_xdevapi_getsession": [ "mysql_xdevapi\\getSession(string $uri): mysql_xdevapi\\Session", "Connect to a MySQL server" ], "mysqli_escape_string": [ "mysqli_escape_string()", "Alias of mysqli_real_escape_string()" ], "mysqli_execute": [ "mysqli_execute()", "Alias for mysqli_stmt_execute()" ], "mysqli_get_links_stats": [ "mysqli_get_links_stats(): array", "Return information about open and cached links" ], "mysqli_set_opt": [ "mysqli_set_opt()", "Alias of mysqli_options()" ], "ob_tidyhandler": [ "ob_tidyhandler(string $input, int $mode = ?): string", "ob_start callback function to repair the buffer" ], "odbc_do": [ "odbc_do()", "Alias of odbc_exec()" ], "odbc_field_precision": [ "odbc_field_precision()", "Alias of odbc_field_len()" ], "opcache_compile_file": [ "opcache_compile_file(string $filename): bool", "Compiles and caches a PHP script without executing it" ], "opcache_get_configuration": [ "opcache_get_configuration(): array|false", "Get configuration information about the cache" ], "opcache_get_status": [ "opcache_get_status(bool $include_scripts = true): array|false", "Get status information about the cache" ], "opcache_invalidate": [ "opcache_invalidate(string $filename, bool $force = false): bool", "Invalidates a cached script" ], "opcache_is_script_cached": [ "opcache_is_script_cached(string $filename): bool", "Tells whether a script is cached in OPCache" ], "opcache_reset": [ "opcache_reset(): bool", "Resets the contents of the opcode cache" ], "password_algos": [ "password_algos(): array", "Get available password hashing algorithm IDs" ], "password_get_info": [ "password_get_info(string $hash): array", "Returns information about the given hash" ], "password_hash": [ "password_hash(string $password, string|int|null $algo, array $options = []): string", "Creates a password hash" ], "password_needs_rehash": [ "password_needs_rehash(string $hash, string|int|null $algo, array $options = []): bool", "Checks if the given hash matches the given options" ], "password_verify": [ "password_verify(string $password, string $hash): bool", "Verifies that a password matches a hash" ], "pcntl_async_signals": [ "pcntl_async_signals(?bool $enable = null): bool", "Enable/disable asynchronous signal handling or return the old setting" ], "pcntl_errno": [ "pcntl_errno()", "Alias of pcntl_get_last_error()" ], "pcntl_get_last_error": [ "pcntl_get_last_error(): int", "Retrieve the error number set by the last pcntl function which failed" ], "pcntl_signal_get_handler": [ "pcntl_signal_get_handler(int $signal): callable|int", "Get the current handler for specified signal" ], "pcntl_sigwaitinfo": [ "pcntl_sigwaitinfo(array $signals, array &$info = []): int|false", "Waits for signals" ], "pcntl_strerror": [ "pcntl_strerror(int $error_code): string", "Retrieve the system error message associated with the given errno" ], "pg_connect_poll": [ "pg_connect_poll(PgSql\\Connection $connection): int", "" ], "pg_consume_input": [ "pg_consume_input(PgSql\\Connection $connection): bool", "Reads input on the connection" ], "pg_escape_identifier": [ "pg_escape_identifier(PgSql\\Connection $connection = ?, string $data): string", "" ], "pg_escape_literal": [ "pg_escape_literal(PgSql\\Connection $connection = ?, string $data): string", "" ], "pg_flush": [ "pg_flush(PgSql\\Connection $connection): int|bool", "Flush outbound query data on the connection" ], "pg_lo_truncate": [ "pg_lo_truncate(PgSql\\Lob $lob, int $size): bool", "" ], "pg_socket": [ "pg_socket(PgSql\\Connection $connection): resource|false", "" ], "pos": [ "pos()", "Alias of current()" ], "posix_errno": [ "posix_errno()", "Alias of posix_get_last_error()" ], "posix_setrlimit": [ "posix_setrlimit(int $resource, int $soft_limit, int $hard_limit): bool", "Set system resource limits" ], "preg_last_error_msg": [ "preg_last_error_msg(): string", "Returns the error message of the last PCRE regex execution" ], "preg_replace_callback_array": [ "preg_replace_callback_array(array $pattern, string|array $subject, int $limit = -1, int &$count = null, int $flags = 0): string|array|null", "Perform a regular expression search and replace using callbacks" ], "ps_translate": [ "ps_translate(resource $psdoc, float $x, float $y): bool", "Sets translation" ], "random_bytes": [ "random_bytes(int $length): string", "Generates cryptographically secure pseudo-random bytes" ], "random_int": [ "random_int(int $min, int $max): int", "Generates cryptographically secure pseudo-random integers" ], "read_exif_data": [ "read_exif_data()", "Alias of exif_read_data()" ], "recode": [ "recode()", "Alias of recode_string()" ], "session_abort": [ "session_abort(): bool", "Discard session array changes and finish session" ], "session_commit": [ "session_commit()", "Alias of session_write_close()" ], "session_create_id": [ "session_create_id(string $prefix = \"\"): string|false", "Create new session id" ], "session_gc": [ "session_gc(): int|false", "Perform session data garbage collection" ], "session_register_shutdown": [ "session_register_shutdown(): void", "Session shutdown function" ], "session_reset": [ "session_reset(): bool", "Re-initialize session array with original values" ], "session_status": [ "session_status(): int", "Returns the current session status" ], "set_file_buffer": [ "set_file_buffer()", "Alias of stream_set_write_buffer()" ], "show_source": [ "show_source()", "Alias of highlight_file()" ], "sizeof": [ "sizeof()", "Alias of count()" ], "snmp_set_oid_numeric_print": [ "snmp_set_oid_numeric_print(int $format): bool", "" ], "snmpwalkoid": [ "snmpwalkoid(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false", "" ], "socket_addrinfo_bind": [ "socket_addrinfo_bind(AddressInfo $address): Socket|false", "Create and bind to a socket from a given addrinfo" ], "socket_addrinfo_connect": [ "socket_addrinfo_connect(AddressInfo $address): Socket|false", "Create and connect to a socket from a given addrinfo" ], "socket_addrinfo_explain": [ "socket_addrinfo_explain(AddressInfo $address): array", "Get information about addrinfo" ], "socket_addrinfo_lookup": [ "socket_addrinfo_lookup(string $host, ?string $service = null, array $hints = []): array|false", "Get array with contents of getaddrinfo about the given hostname" ], "socket_cmsg_space": [ "socket_cmsg_space(int $level, int $type, int $num = 0): ?int", "Calculate message buffer size" ], "socket_export_stream": [ "socket_export_stream(Socket $socket): resource|false", "Export a socket into a stream that encapsulates a socket" ], "socket_get_status": [ "socket_get_status()", "Alias of stream_get_meta_data()" ], "socket_getopt": [ "socket_getopt()", "Alias of socket_get_option()" ], "socket_import_stream": [ "socket_import_stream(resource $stream): Socket|false", "Import a stream" ], "socket_recvmsg": [ "socket_recvmsg(Socket $socket, array &$message, int $flags = 0): int|false", "Read a message" ], "socket_sendmsg": [ "socket_sendmsg(Socket $socket, array $message, int $flags = 0): int|false", "Send a message" ], "socket_set_blocking": [ "socket_set_blocking()", "Alias of stream_set_blocking()" ], "socket_set_timeout": [ "socket_set_timeout()", "Alias of stream_set_timeout()" ], "socket_setopt": [ "socket_setopt()", "Alias of socket_set_option()" ], "socket_wsaprotocol_info_export": [ "socket_wsaprotocol_info_export(Socket $socket, int $process_id): string|false", "Exports the WSAPROTOCOL_INFO Structure" ], "socket_wsaprotocol_info_import": [ "socket_wsaprotocol_info_import(string $info_id): Socket|false", "Imports a Socket from another Process" ], "socket_wsaprotocol_info_release": [ "socket_wsaprotocol_info_release(string $info_id): bool", "Releases an exported WSAPROTOCOL_INFO Structure" ], "spl_object_id": [ "spl_object_id(object $object): int", "" ], "sqlsrv_begin_transaction": [ "sqlsrv_begin_transaction(resource $conn): bool", "Begins a database transaction" ], "sqlsrv_cancel": [ "sqlsrv_cancel(resource $stmt): bool", "Cancels a statement" ], "sqlsrv_client_info": [ "sqlsrv_client_info(resource $conn): array", "Returns information about the client and specified connection" ], "sqlsrv_close": [ "sqlsrv_close(resource $conn): bool", "Closes an open connection and releases resourses associated with the connection" ], "sqlsrv_commit": [ "sqlsrv_commit(resource $conn): bool", "Commits a transaction that was begun with sqlsrv_begin_transaction()" ], "sqlsrv_configure": [ "sqlsrv_configure(string $setting, mixed $value): bool", "Changes the driver error handling and logging configurations" ], "sqlsrv_connect": [ "sqlsrv_connect(string $serverName, array $connectionInfo = ?): resource", "Opens a connection to a Microsoft SQL Server database" ], "sqlsrv_errors": [ "sqlsrv_errors(int $errorsOrWarnings = ?): mixed", "Returns error and warning information about the last SQLSRV operation performed" ], "sqlsrv_execute": [ "sqlsrv_execute(resource $stmt): bool", "Executes a statement prepared with sqlsrv_prepare()" ], "sqlsrv_fetch_array": [ "sqlsrv_fetch_array(resource $stmt, int $fetchType = ?, int $row = ?, int $offset = ?): array", "Returns a row as an array" ], "sqlsrv_fetch_object": [ "sqlsrv_fetch_object(resource $stmt, string $className = ?, array $ctorParams = ?, int $row = ?, int $offset = ?): mixed", "Retrieves the next row of data in a result set as an object" ], "sqlsrv_fetch": [ "sqlsrv_fetch(resource $stmt, int $row = ?, int $offset = ?): mixed", "Makes the next row in a result set available for reading" ], "sqlsrv_field_metadata": [ "sqlsrv_field_metadata(resource $stmt): mixed", "" ], "sqlsrv_free_stmt": [ "sqlsrv_free_stmt(resource $stmt): bool", "Frees all resources for the specified statement" ], "sqlsrv_get_config": [ "sqlsrv_get_config(string $setting): mixed", "Returns the value of the specified configuration setting" ], "sqlsrv_get_field": [ "sqlsrv_get_field(resource $stmt, int $fieldIndex, int $getAsType = ?): mixed", "Gets field data from the currently selected row" ], "sqlsrv_has_rows": [ "sqlsrv_has_rows(resource $stmt): bool", "Indicates whether the specified statement has rows" ], "sqlsrv_next_result": [ "sqlsrv_next_result(resource $stmt): mixed", "Makes the next result of the specified statement active" ], "sqlsrv_num_fields": [ "sqlsrv_num_fields(resource $stmt): mixed", "Retrieves the number of fields (columns) on a statement" ], "sqlsrv_num_rows": [ "sqlsrv_num_rows(resource $stmt): mixed", "Retrieves the number of rows in a result set" ], "sqlsrv_prepare": [ "sqlsrv_prepare(resource $conn, string $sql, array $params = ?, array $options = ?): mixed", "Prepares a query for execution" ], "sqlsrv_query": [ "sqlsrv_query(resource $conn, string $sql, array $params = ?, array $options = ?): mixed", "Prepares and executes a query" ], "sqlsrv_rollback": [ "sqlsrv_rollback(resource $conn): bool", "" ], "sqlsrv_rows_affected": [ "sqlsrv_rows_affected(resource $stmt): int|false", "" ], "sqlsrv_send_stream_data": [ "sqlsrv_send_stream_data(resource $stmt): bool", "Sends data from parameter streams to the server" ], "sqlsrv_server_info": [ "sqlsrv_server_info(resource $conn): array", "Returns information about the server" ], "str_contains": [ "str_contains(string $haystack, string $needle): bool", "Determine if a string contains a given substring" ], "str_ends_with": [ "str_ends_with(string $haystack, string $needle): bool", "Checks if a string ends with a given substring" ], "str_starts_with": [ "str_starts_with(string $haystack, string $needle): bool", "Checks if a string starts with a given substring" ], "stream_isatty": [ "stream_isatty(resource $stream): bool", "Check if a stream is a TTY" ], "stream_notification_callback": [ "stream_notification_callback(int $notification_code, int $severity, string $message, int $message_code, int $bytes_transferred, int $bytes_max): void", "A callback function for the notification context parameter" ], "stream_register_wrapper": [ "stream_register_wrapper()", "Alias of stream_wrapper_register()" ], "stream_set_chunk_size": [ "stream_set_chunk_size(resource $stream, int $size): int", "Set the stream chunk size" ], "stream_set_read_buffer": [ "stream_set_read_buffer(resource $stream, int $size): int", "Set read file buffering on the given stream" ], "tcpwrap_check": [ "tcpwrap_check(string $daemon, string $address, string $user = ?, bool $nodns = false): bool", "Performs a tcpwrap check" ], "trait_exists": [ "trait_exists(string $trait, bool $autoload = true): bool", "Checks if the trait exists" ], "use_soap_error_handler": [ "use_soap_error_handler(bool $enable = true): bool", "Set whether to use the SOAP error handler" ], "user_error": [ "user_error()", "Alias of trigger_error()" ], "yaml_emit_file": [ "yaml_emit_file(string $filename, mixed $data, int $encoding = YAML_ANY_ENCODING, int $linebreak = YAML_ANY_BREAK, array $callbacks = null): bool", "Send the YAML representation of a value to a file" ], "yaml_emit": [ "yaml_emit(mixed $data, int $encoding = YAML_ANY_ENCODING, int $linebreak = YAML_ANY_BREAK, array $callbacks = null): string", "Returns the YAML representation of a value" ], "yaml_parse_file": [ "yaml_parse_file(string $filename, int $pos = 0, int &$ndocs = ?, array $callbacks = null): mixed", "Parse a YAML stream from a file" ], "yaml_parse_url": [ "yaml_parse_url(string $url, int $pos = 0, int &$ndocs = ?, array $callbacks = null): mixed", "Parse a Yaml stream from a URL" ], "yaml_parse": [ "yaml_parse(string $input, int $pos = 0, int &$ndocs = ?, array $callbacks = null): mixed", "Parse a YAML stream" ], "zlib_decode": [ "zlib_decode(string $data, int $max_length = 0): string|false", "Uncompress any raw/gzip/zlib encoded data" ], "zlib_encode": [ "zlib_encode(string $data, int $encoding, int $level = -1): string|false", "Compress data with the specified encoding" ] }; var variableMap = { "$_COOKIE": { type: "array" }, "$_ENV": { type: "array" }, "$_FILES": { type: "array" }, "$_GET": { type: "array" }, "$_POST": { type: "array" }, "$_REQUEST": { type: "array" }, "$_SERVER": { type: "array", value: { "DOCUMENT_ROOT": 1, "GATEWAY_INTERFACE": 1, "HTTP_ACCEPT": 1, "HTTP_ACCEPT_CHARSET": 1, "HTTP_ACCEPT_ENCODING": 1 , "HTTP_ACCEPT_LANGUAGE": 1, "HTTP_CONNECTION": 1, "HTTP_HOST": 1, "HTTP_REFERER": 1, "HTTP_USER_AGENT": 1, "PATH_TRANSLATED": 1, "PHP_SELF": 1, "QUERY_STRING": 1, "REMOTE_ADDR": 1, "REMOTE_PORT": 1, "REQUEST_METHOD": 1, "REQUEST_URI": 1, "SCRIPT_FILENAME": 1, "SCRIPT_NAME": 1, "SERVER_ADMIN": 1, "SERVER_NAME": 1, "SERVER_PORT": 1, "SERVER_PROTOCOL": 1, "SERVER_SIGNATURE": 1, "SERVER_SOFTWARE": 1, "argv": 1, "argc": 1 } }, "$_SESSION": { type: "array" }, "$GLOBALS": { type: "array" }, '$argv': { type: "array" }, '$argc': { type: "int" } }; function is(token, type) { return token.type.lastIndexOf(type) > -1; } var PhpCompletions = function() { }; (function() { this.getCompletions = function(state, session, pos, prefix) { var token = session.getTokenAt(pos.row, pos.column); if (!token) return []; if (token.type==='support.php_tag' && token.value==='<?') return this.getTagCompletions(state, session, pos, prefix); // php function if (token.type==='identifier') { if (token.index > 0) { var prevToken = session.getTokenAt(pos.row, token.start); if (prevToken.type==='support.php_tag') { return this.getTagCompletions(state, session, pos, prefix); } } return this.getFunctionCompletions(state, session, pos, prefix); } // php variable if (is(token, "variable")) return this.getVariableCompletions(state, session, pos, prefix); // php array key var line = session.getLine(pos.row).substr(0, pos.column); if (token.type==='string' && /(\$[\w]*)\[["']([^'"]*)$/i.test(line)) return this.getArrayKeyCompletions(state, session, pos, prefix); return []; }; this.getTagCompletions = function(state, session, pos, prefix) { return [{ caption: 'php', value: 'php', meta: "php tag", score: 1000000 }, { caption: '=', value: '=', meta: "php tag", score: 1000000 }]; }; this.getFunctionCompletions = function(state, session, pos, prefix) { var functions = Object.keys(functionMap); return functions.map(function(func){ return { caption: func, snippet: func + '($0)', meta: "php function", score: 1000000, docHTML: functionMap[func][1] }; }); }; this.getVariableCompletions = function(state, session, pos, prefix) { var variables = Object.keys(variableMap); return variables.map(function(variable){ return { caption: variable, value: variable, meta: "php variable", score: 1000000 }; }); }; this.getArrayKeyCompletions = function(state, session, pos, prefix) { var line = session.getLine(pos.row).substr(0, pos.column); var variable = line.match(/(\$[\w]*)\[["']([^'"]*)$/i)[1]; if (!variableMap[variable]) { return []; } var keys = []; if (variableMap[variable].type==='array' && variableMap[variable].value) keys = Object.keys(variableMap[variable].value); return keys.map(function(key) { return { caption: key, value: key, meta: "php array key", score: 1000000 }; }); }; }).call(PhpCompletions.prototype); exports.PhpCompletions = PhpCompletions; ================================================ FILE: src/mode/php_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var PhpLangHighlightRules = function() { var docComment = DocCommentHighlightRules; // http://php.net/quickref.php var builtinFunctions = lang.arrayToMap( 'abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|\ aggregate_properties|aggregate_properties_by_list|aggregate_properties_by_regexp|aggregation_info|amqpconnection|amqpexchange|amqpqueue|\ apache_child_terminate|apache_get_modules|apache_get_version|apache_getenv|apache_lookup_uri|apache_note|apache_request_headers|\ apache_reset_timeout|apache_response_headers|apache_setenv|apc_add|apc_bin_dump|apc_bin_dumpfile|apc_bin_load|apc_bin_loadfile|\ apc_cache_info|apc_cas|apc_clear_cache|apc_compile_file|apc_dec|apc_define_constants|apc_delete|apc_delete_file|apc_exists|apc_fetch|\ apc_inc|apc_load_constants|apc_sma_info|apc_store|apciterator|apd_breakpoint|apd_callstack|apd_clunk|apd_continue|apd_croak|\ apd_dump_function_table|apd_dump_persistent_resources|apd_dump_regular_resources|apd_echo|apd_get_active_symbols|apd_set_pprof_trace|\ apd_set_session|apd_set_session_trace|apd_set_session_trace_socket|appenditerator|array|array_change_key_case|array_chunk|array_column|array_combine|\ array_count_values|array_diff|array_diff_assoc|array_diff_key|array_diff_uassoc|array_diff_ukey|array_fill|array_fill_keys|array_filter|\ array_flip|array_intersect|array_intersect_assoc|array_intersect_key|array_intersect_uassoc|array_intersect_ukey|array_key_exists|\ array_keys|array_map|array_merge|array_merge_recursive|array_multisort|array_pad|array_pop|array_product|array_push|array_rand|\ array_reduce|array_replace|array_replace_recursive|array_reverse|array_search|array_shift|array_slice|array_splice|array_sum|array_udiff|\ array_udiff_assoc|array_udiff_uassoc|array_uintersect|array_uintersect_assoc|array_uintersect_uassoc|array_unique|array_unshift|\ array_values|array_walk|array_walk_recursive|arrayaccess|arrayiterator|arrayobject|arsort|asin|asinh|asort|assert|assert_options|atan|\ atan2|atanh|audioproperties|badfunctioncallexception|badmethodcallexception|base64_decode|base64_encode|base_convert|basename|\ bbcode_add_element|bbcode_add_smiley|bbcode_create|bbcode_destroy|bbcode_parse|bbcode_set_arg_parser|bbcode_set_flags|bcadd|bccomp|bcdiv|\ bcmod|bcmul|bcompiler_load|bcompiler_load_exe|bcompiler_parse_class|bcompiler_read|bcompiler_write_class|bcompiler_write_constant|\ bcompiler_write_exe_footer|bcompiler_write_file|bcompiler_write_footer|bcompiler_write_function|bcompiler_write_functions_from_file|\ bcompiler_write_header|bcompiler_write_included_filename|bcpow|bcpowmod|bcscale|bcsqrt|bcsub|bin2hex|bind_textdomain_codeset|bindec|\ bindtextdomain|bson_decode|bson_encode|bumpValue|bzclose|bzcompress|bzdecompress|bzerrno|bzerror|bzerrstr|bzflush|bzopen|bzread|bzwrite|\ cachingiterator|cairo|cairo_create|cairo_font_face_get_type|cairo_font_face_status|cairo_font_options_create|cairo_font_options_equal|\ cairo_font_options_get_antialias|cairo_font_options_get_hint_metrics|cairo_font_options_get_hint_style|\ cairo_font_options_get_subpixel_order|cairo_font_options_hash|cairo_font_options_merge|cairo_font_options_set_antialias|\ cairo_font_options_set_hint_metrics|cairo_font_options_set_hint_style|cairo_font_options_set_subpixel_order|cairo_font_options_status|\ cairo_format_stride_for_width|cairo_image_surface_create|cairo_image_surface_create_for_data|cairo_image_surface_create_from_png|\ cairo_image_surface_get_data|cairo_image_surface_get_format|cairo_image_surface_get_height|cairo_image_surface_get_stride|\ cairo_image_surface_get_width|cairo_matrix_create_scale|cairo_matrix_create_translate|cairo_matrix_invert|cairo_matrix_multiply|\ cairo_matrix_rotate|cairo_matrix_transform_distance|cairo_matrix_transform_point|cairo_matrix_translate|cairo_pattern_add_color_stop_rgb|\ cairo_pattern_add_color_stop_rgba|cairo_pattern_create_for_surface|cairo_pattern_create_linear|cairo_pattern_create_radial|\ cairo_pattern_create_rgb|cairo_pattern_create_rgba|cairo_pattern_get_color_stop_count|cairo_pattern_get_color_stop_rgba|\ cairo_pattern_get_extend|cairo_pattern_get_filter|cairo_pattern_get_linear_points|cairo_pattern_get_matrix|\ cairo_pattern_get_radial_circles|cairo_pattern_get_rgba|cairo_pattern_get_surface|cairo_pattern_get_type|cairo_pattern_set_extend|\ cairo_pattern_set_filter|cairo_pattern_set_matrix|cairo_pattern_status|cairo_pdf_surface_create|cairo_pdf_surface_set_size|\ cairo_ps_get_levels|cairo_ps_level_to_string|cairo_ps_surface_create|cairo_ps_surface_dsc_begin_page_setup|\ cairo_ps_surface_dsc_begin_setup|cairo_ps_surface_dsc_comment|cairo_ps_surface_get_eps|cairo_ps_surface_restrict_to_level|\ cairo_ps_surface_set_eps|cairo_ps_surface_set_size|cairo_scaled_font_create|cairo_scaled_font_extents|cairo_scaled_font_get_ctm|\ cairo_scaled_font_get_font_face|cairo_scaled_font_get_font_matrix|cairo_scaled_font_get_font_options|cairo_scaled_font_get_scale_matrix|\ cairo_scaled_font_get_type|cairo_scaled_font_glyph_extents|cairo_scaled_font_status|cairo_scaled_font_text_extents|\ cairo_surface_copy_page|cairo_surface_create_similar|cairo_surface_finish|cairo_surface_flush|cairo_surface_get_content|\ cairo_surface_get_device_offset|cairo_surface_get_font_options|cairo_surface_get_type|cairo_surface_mark_dirty|\ cairo_surface_mark_dirty_rectangle|cairo_surface_set_device_offset|cairo_surface_set_fallback_resolution|cairo_surface_show_page|\ cairo_surface_status|cairo_surface_write_to_png|cairo_svg_surface_create|cairo_svg_surface_restrict_to_version|\ cairo_svg_version_to_string|cairoantialias|cairocontent|cairocontext|cairoexception|cairoextend|cairofillrule|cairofilter|cairofontface|\ cairofontoptions|cairofontslant|cairofonttype|cairofontweight|cairoformat|cairogradientpattern|cairohintmetrics|cairohintstyle|\ cairoimagesurface|cairolineargradient|cairolinecap|cairolinejoin|cairomatrix|cairooperator|cairopath|cairopattern|cairopatterntype|\ cairopdfsurface|cairopslevel|cairopssurface|cairoradialgradient|cairoscaledfont|cairosolidpattern|cairostatus|cairosubpixelorder|\ cairosurface|cairosurfacepattern|cairosurfacetype|cairosvgsurface|cairosvgversion|cairotoyfontface|cal_days_in_month|cal_from_jd|cal_info|\ cal_to_jd|calcul_hmac|calculhmac|call_user_func|call_user_func_array|call_user_method|call_user_method_array|callbackfilteriterator|ceil|\ chdb|chdb_create|chdir|checkdate|checkdnsrr|chgrp|chmod|chop|chown|chr|chroot|chunk_split|class_alias|class_exists|class_implements|\ class_parents|class_uses|classkit_import|classkit_method_add|classkit_method_copy|classkit_method_redefine|classkit_method_remove|\ classkit_method_rename|clearstatcache|clone|closedir|closelog|collator|com|com_addref|com_create_guid|com_event_sink|com_get|\ com_get_active_object|com_invoke|com_isenum|com_load|com_load_typelib|com_message_pump|com_print_typeinfo|com_propget|com_propput|\ com_propset|com_release|com_set|compact|connection_aborted|connection_status|connection_timeout|constant|construct|construct|construct|\ convert_cyr_string|convert_uudecode|convert_uuencode|copy|cos|cosh|count|count_chars|countable|counter_bump|counter_bump_value|\ counter_create|counter_get|counter_get_meta|counter_get_named|counter_get_value|counter_reset|counter_reset_value|crack_check|\ crack_closedict|crack_getlastmessage|crack_opendict|crc32|create_function|crypt|ctype_alnum|ctype_alpha|ctype_cntrl|ctype_digit|\ ctype_graph|ctype_lower|ctype_print|ctype_punct|ctype_space|ctype_upper|ctype_xdigit|cubrid_affected_rows|cubrid_bind|\ cubrid_client_encoding|cubrid_close|cubrid_close_prepare|cubrid_close_request|cubrid_col_get|cubrid_col_size|cubrid_column_names|\ cubrid_column_types|cubrid_commit|cubrid_connect|cubrid_connect_with_url|cubrid_current_oid|cubrid_data_seek|cubrid_db_name|\ cubrid_disconnect|cubrid_drop|cubrid_errno|cubrid_error|cubrid_error_code|cubrid_error_code_facility|cubrid_error_msg|cubrid_execute|\ cubrid_fetch|cubrid_fetch_array|cubrid_fetch_assoc|cubrid_fetch_field|cubrid_fetch_lengths|cubrid_fetch_object|cubrid_fetch_row|\ cubrid_field_flags|cubrid_field_len|cubrid_field_name|cubrid_field_seek|cubrid_field_table|cubrid_field_type|cubrid_free_result|\ cubrid_get|cubrid_get_autocommit|cubrid_get_charset|cubrid_get_class_name|cubrid_get_client_info|cubrid_get_db_parameter|\ cubrid_get_server_info|cubrid_insert_id|cubrid_is_instance|cubrid_list_dbs|cubrid_load_from_glo|cubrid_lob_close|cubrid_lob_export|\ cubrid_lob_get|cubrid_lob_send|cubrid_lob_size|cubrid_lock_read|cubrid_lock_write|cubrid_move_cursor|cubrid_new_glo|cubrid_next_result|\ cubrid_num_cols|cubrid_num_fields|cubrid_num_rows|cubrid_ping|cubrid_prepare|cubrid_put|cubrid_query|cubrid_real_escape_string|\ cubrid_result|cubrid_rollback|cubrid_save_to_glo|cubrid_schema|cubrid_send_glo|cubrid_seq_drop|cubrid_seq_insert|cubrid_seq_put|\ cubrid_set_add|cubrid_set_autocommit|cubrid_set_db_parameter|cubrid_set_drop|cubrid_unbuffered_query|cubrid_version|curl_close|\ curl_copy_handle|curl_errno|curl_error|curl_exec|curl_getinfo|curl_init|curl_multi_add_handle|curl_multi_close|curl_multi_exec|\ curl_multi_getcontent|curl_multi_info_read|curl_multi_init|curl_multi_remove_handle|curl_multi_select|curl_setopt|curl_setopt_array|\ curl_version|current|cyrus_authenticate|cyrus_bind|cyrus_close|cyrus_connect|cyrus_query|cyrus_unbind|date|date_add|date_create|\ date_create_from_format|date_date_set|date_default_timezone_get|date_default_timezone_set|date_diff|date_format|date_get_last_errors|\ date_interval_create_from_date_string|date_interval_format|date_isodate_set|date_modify|date_offset_get|date_parse|date_parse_from_format|\ date_sub|date_sun_info|date_sunrise|date_sunset|date_time_set|date_timestamp_get|date_timestamp_set|date_timezone_get|date_timezone_set|\ dateinterval|dateperiod|datetime|datetimezone|db2_autocommit|db2_bind_param|db2_client_info|db2_close|db2_column_privileges|db2_columns|\ db2_commit|db2_conn_error|db2_conn_errormsg|db2_connect|db2_cursor_type|db2_escape_string|db2_exec|db2_execute|db2_fetch_array|\ db2_fetch_assoc|db2_fetch_both|db2_fetch_object|db2_fetch_row|db2_field_display_size|db2_field_name|db2_field_num|db2_field_precision|\ db2_field_scale|db2_field_type|db2_field_width|db2_foreign_keys|db2_free_result|db2_free_stmt|db2_get_option|db2_last_insert_id|\ db2_lob_read|db2_next_result|db2_num_fields|db2_num_rows|db2_pclose|db2_pconnect|db2_prepare|db2_primary_keys|db2_procedure_columns|\ db2_procedures|db2_result|db2_rollback|db2_server_info|db2_set_option|db2_special_columns|db2_statistics|db2_stmt_error|db2_stmt_errormsg|\ db2_table_privileges|db2_tables|dba_close|dba_delete|dba_exists|dba_fetch|dba_firstkey|dba_handlers|dba_insert|dba_key_split|dba_list|\ dba_nextkey|dba_open|dba_optimize|dba_popen|dba_replace|dba_sync|dbase_add_record|dbase_close|dbase_create|dbase_delete_record|\ dbase_get_header_info|dbase_get_record|dbase_get_record_with_names|dbase_numfields|dbase_numrecords|dbase_open|dbase_pack|\ dbase_replace_record|dbplus_add|dbplus_aql|dbplus_chdir|dbplus_close|dbplus_curr|dbplus_errcode|dbplus_errno|dbplus_find|dbplus_first|\ dbplus_flush|dbplus_freealllocks|dbplus_freelock|dbplus_freerlocks|dbplus_getlock|dbplus_getunique|dbplus_info|dbplus_last|dbplus_lockrel|\ dbplus_next|dbplus_open|dbplus_prev|dbplus_rchperm|dbplus_rcreate|dbplus_rcrtexact|dbplus_rcrtlike|dbplus_resolve|dbplus_restorepos|\ dbplus_rkeys|dbplus_ropen|dbplus_rquery|dbplus_rrename|dbplus_rsecindex|dbplus_runlink|dbplus_rzap|dbplus_savepos|dbplus_setindex|\ dbplus_setindexbynumber|dbplus_sql|dbplus_tcl|dbplus_tremove|dbplus_undo|dbplus_undoprepare|dbplus_unlockrel|dbplus_unselect|\ dbplus_update|dbplus_xlockrel|dbplus_xunlockrel|dbx_close|dbx_compare|dbx_connect|dbx_error|dbx_escape_string|dbx_fetch_row|dbx_query|\ dbx_sort|dcgettext|dcngettext|deaggregate|debug_backtrace|debug_print_backtrace|debug_zval_dump|decbin|dechex|decoct|define|\ define_syslog_variables|defined|deg2rad|delete|dgettext|die|dio_close|dio_fcntl|dio_open|dio_read|dio_seek|dio_stat|dio_tcsetattr|\ dio_truncate|dio_write|dir|directoryiterator|dirname|disk_free_space|disk_total_space|diskfreespace|dl|dngettext|dns_check_record|\ dns_get_mx|dns_get_record|dom_import_simplexml|domainexception|domattr|domattribute_name|domattribute_set_value|domattribute_specified|\ domattribute_value|domcharacterdata|domcomment|domdocument|domdocument_add_root|domdocument_create_attribute|\ domdocument_create_cdata_section|domdocument_create_comment|domdocument_create_element|domdocument_create_element_ns|\ domdocument_create_entity_reference|domdocument_create_processing_instruction|domdocument_create_text_node|domdocument_doctype|\ domdocument_document_element|domdocument_dump_file|domdocument_dump_mem|domdocument_get_element_by_id|domdocument_get_elements_by_tagname|\ domdocument_html_dump_mem|domdocument_xinclude|domdocumentfragment|domdocumenttype|domdocumenttype_entities|\ domdocumenttype_internal_subset|domdocumenttype_name|domdocumenttype_notations|domdocumenttype_public_id|domdocumenttype_system_id|\ domelement|domelement_get_attribute|domelement_get_attribute_node|domelement_get_elements_by_tagname|domelement_has_attribute|\ domelement_remove_attribute|domelement_set_attribute|domelement_set_attribute_node|domelement_tagname|domentity|domentityreference|\ domexception|domimplementation|domnamednodemap|domnode|domnode_add_namespace|domnode_append_child|domnode_append_sibling|\ domnode_attributes|domnode_child_nodes|domnode_clone_node|domnode_dump_node|domnode_first_child|domnode_get_content|\ domnode_has_attributes|domnode_has_child_nodes|domnode_insert_before|domnode_is_blank_node|domnode_last_child|domnode_next_sibling|\ domnode_node_name|domnode_node_type|domnode_node_value|domnode_owner_document|domnode_parent_node|domnode_prefix|domnode_previous_sibling|\ domnode_remove_child|domnode_replace_child|domnode_replace_node|domnode_set_content|domnode_set_name|domnode_set_namespace|\ domnode_unlink_node|domnodelist|domnotation|domprocessinginstruction|domprocessinginstruction_data|domprocessinginstruction_target|\ domtext|domxml_new_doc|domxml_open_file|domxml_open_mem|domxml_version|domxml_xmltree|domxml_xslt_stylesheet|domxml_xslt_stylesheet_doc|\ domxml_xslt_stylesheet_file|domxml_xslt_version|domxpath|domxsltstylesheet_process|domxsltstylesheet_result_dump_file|\ domxsltstylesheet_result_dump_mem|dotnet|dotnet_load|doubleval|each|easter_date|easter_days|echo|empty|emptyiterator|\ enchant_broker_describe|enchant_broker_dict_exists|enchant_broker_free|enchant_broker_free_dict|enchant_broker_get_error|\ enchant_broker_init|enchant_broker_list_dicts|enchant_broker_request_dict|enchant_broker_request_pwl_dict|enchant_broker_set_ordering|\ enchant_dict_add_to_personal|enchant_dict_add_to_session|enchant_dict_check|enchant_dict_describe|enchant_dict_get_error|\ enchant_dict_is_in_session|enchant_dict_quick_check|enchant_dict_store_replacement|enchant_dict_suggest|end|ereg|ereg_replace|eregi|\ eregi_replace|error_get_last|error_log|error_reporting|errorexception|escapeshellarg|escapeshellcmd|eval|event_add|event_base_free|\ event_base_loop|event_base_loopbreak|event_base_loopexit|event_base_new|event_base_priority_init|event_base_set|event_buffer_base_set|\ event_buffer_disable|event_buffer_enable|event_buffer_fd_set|event_buffer_free|event_buffer_new|event_buffer_priority_set|\ event_buffer_read|event_buffer_set_callback|event_buffer_timeout_set|event_buffer_watermark_set|event_buffer_write|event_del|event_free|\ event_new|event_set|exception|exec|exif_imagetype|exif_read_data|exif_tagname|exif_thumbnail|exit|exp|expect_expectl|expect_popen|explode|\ expm1|export|export|extension_loaded|extract|ezmlm_hash|fam_cancel_monitor|fam_close|fam_monitor_collection|fam_monitor_directory|\ fam_monitor_file|fam_next_event|fam_open|fam_pending|fam_resume_monitor|fam_suspend_monitor|fbsql_affected_rows|fbsql_autocommit|\ fbsql_blob_size|fbsql_change_user|fbsql_clob_size|fbsql_close|fbsql_commit|fbsql_connect|fbsql_create_blob|fbsql_create_clob|\ fbsql_create_db|fbsql_data_seek|fbsql_database|fbsql_database_password|fbsql_db_query|fbsql_db_status|fbsql_drop_db|fbsql_errno|\ fbsql_error|fbsql_fetch_array|fbsql_fetch_assoc|fbsql_fetch_field|fbsql_fetch_lengths|fbsql_fetch_object|fbsql_fetch_row|\ fbsql_field_flags|fbsql_field_len|fbsql_field_name|fbsql_field_seek|fbsql_field_table|fbsql_field_type|fbsql_free_result|\ fbsql_get_autostart_info|fbsql_hostname|fbsql_insert_id|fbsql_list_dbs|fbsql_list_fields|fbsql_list_tables|fbsql_next_result|\ fbsql_num_fields|fbsql_num_rows|fbsql_password|fbsql_pconnect|fbsql_query|fbsql_read_blob|fbsql_read_clob|fbsql_result|fbsql_rollback|\ fbsql_rows_fetched|fbsql_select_db|fbsql_set_characterset|fbsql_set_lob_mode|fbsql_set_password|fbsql_set_transaction|fbsql_start_db|\ fbsql_stop_db|fbsql_table_name|fbsql_tablename|fbsql_username|fbsql_warnings|fclose|fdf_add_doc_javascript|fdf_add_template|fdf_close|\ fdf_create|fdf_enum_values|fdf_errno|fdf_error|fdf_get_ap|fdf_get_attachment|fdf_get_encoding|fdf_get_file|fdf_get_flags|fdf_get_opt|\ fdf_get_status|fdf_get_value|fdf_get_version|fdf_header|fdf_next_field_name|fdf_open|fdf_open_string|fdf_remove_item|fdf_save|\ fdf_save_string|fdf_set_ap|fdf_set_encoding|fdf_set_file|fdf_set_flags|fdf_set_javascript_action|fdf_set_on_import_javascript|fdf_set_opt|\ fdf_set_status|fdf_set_submit_form_action|fdf_set_target_frame|fdf_set_value|fdf_set_version|feof|fflush|fgetc|fgetcsv|fgets|fgetss|file|\ file_exists|file_get_contents|file_put_contents|fileatime|filectime|filegroup|fileinode|filemtime|fileowner|fileperms|filepro|\ filepro_fieldcount|filepro_fieldname|filepro_fieldtype|filepro_fieldwidth|filepro_retrieve|filepro_rowcount|filesize|filesystemiterator|\ filetype|filter_has_var|filter_id|filter_input|filter_input_array|filter_list|filter_var|filter_var_array|filteriterator|finfo_buffer|\ finfo_close|finfo_file|finfo_open|finfo_set_flags|floatval|flock|floor|flush|fmod|fnmatch|fopen|forward_static_call|\ forward_static_call_array|fpassthru|fprintf|fputcsv|fputs|fread|frenchtojd|fribidi_log2vis|fscanf|fseek|fsockopen|fstat|ftell|ftok|\ ftp_alloc|ftp_cdup|ftp_chdir|ftp_chmod|ftp_close|ftp_connect|ftp_delete|ftp_exec|ftp_fget|ftp_fput|ftp_get|ftp_get_option|ftp_login|\ ftp_mdtm|ftp_mkdir|ftp_nb_continue|ftp_nb_fget|ftp_nb_fput|ftp_nb_get|ftp_nb_put|ftp_nlist|ftp_pasv|ftp_put|ftp_pwd|ftp_quit|ftp_raw|\ ftp_rawlist|ftp_rename|ftp_rmdir|ftp_set_option|ftp_site|ftp_size|ftp_ssl_connect|ftp_systype|ftruncate|func_get_arg|func_get_args|\ func_num_args|function_exists|fwrite|gc_collect_cycles|gc_disable|gc_enable|gc_enabled|gd_info|gearmanclient|gearmanjob|gearmantask|\ gearmanworker|geoip_continent_code_by_name|geoip_country_code3_by_name|geoip_country_code_by_name|geoip_country_name_by_name|\ geoip_database_info|geoip_db_avail|geoip_db_filename|geoip_db_get_all_info|geoip_id_by_name|geoip_isp_by_name|geoip_org_by_name|\ geoip_record_by_name|geoip_region_by_name|geoip_region_name_by_code|geoip_time_zone_by_country_and_region|getMeta|getNamed|getValue|\ get_browser|get_called_class|get_cfg_var|get_class|get_class_methods|get_class_vars|get_current_user|get_declared_classes|\ get_declared_interfaces|get_declared_traits|get_defined_constants|get_defined_functions|get_defined_vars|get_extension_funcs|get_headers|\ get_html_translation_table|get_include_path|get_included_files|get_loaded_extensions|get_magic_quotes_gpc|get_magic_quotes_runtime|\ get_meta_tags|get_object_vars|get_parent_class|get_required_files|get_resource_type|getallheaders|getconstant|getconstants|getconstructor|\ getcwd|getdate|getdefaultproperties|getdoccomment|getendline|getenv|getextension|getextensionname|getfilename|gethostbyaddr|gethostbyname|\ gethostbynamel|gethostname|getimagesize|getinterfacenames|getinterfaces|getlastmod|getmethod|getmethods|getmodifiers|getmxrr|getmygid|\ getmyinode|getmypid|getmyuid|getname|getnamespacename|getopt|getparentclass|getproperties|getproperty|getprotobyname|getprotobynumber|\ getrandmax|getrusage|getservbyname|getservbyport|getshortname|getstartline|getstaticproperties|getstaticpropertyvalue|gettext|\ gettimeofday|gettype|glob|globiterator|gmagick|gmagickdraw|gmagickpixel|gmdate|gmmktime|gmp_abs|gmp_add|gmp_and|gmp_clrbit|gmp_cmp|\ gmp_com|gmp_div|gmp_div_q|gmp_div_qr|gmp_div_r|gmp_divexact|gmp_fact|gmp_gcd|gmp_gcdext|gmp_hamdist|gmp_init|gmp_intval|gmp_invert|\ gmp_jacobi|gmp_legendre|gmp_mod|gmp_mul|gmp_neg|gmp_nextprime|gmp_or|gmp_perfect_square|gmp_popcount|gmp_pow|gmp_powm|gmp_prob_prime|\ gmp_random|gmp_scan0|gmp_scan1|gmp_setbit|gmp_sign|gmp_sqrt|gmp_sqrtrem|gmp_strval|gmp_sub|gmp_testbit|gmp_xor|gmstrftime|\ gnupg_adddecryptkey|gnupg_addencryptkey|gnupg_addsignkey|gnupg_cleardecryptkeys|gnupg_clearencryptkeys|gnupg_clearsignkeys|gnupg_decrypt|\ gnupg_decryptverify|gnupg_encrypt|gnupg_encryptsign|gnupg_export|gnupg_geterror|gnupg_getprotocol|gnupg_import|gnupg_init|gnupg_keyinfo|\ gnupg_setarmor|gnupg_seterrormode|gnupg_setsignmode|gnupg_sign|gnupg_verify|gopher_parsedir|grapheme_extract|grapheme_stripos|\ grapheme_stristr|grapheme_strlen|grapheme_strpos|grapheme_strripos|grapheme_strrpos|grapheme_strstr|grapheme_substr|gregoriantojd|\ gupnp_context_get_host_ip|gupnp_context_get_port|gupnp_context_get_subscription_timeout|gupnp_context_host_path|gupnp_context_new|\ gupnp_context_set_subscription_timeout|gupnp_context_timeout_add|gupnp_context_unhost_path|gupnp_control_point_browse_start|\ gupnp_control_point_browse_stop|gupnp_control_point_callback_set|gupnp_control_point_new|gupnp_device_action_callback_set|\ gupnp_device_info_get|gupnp_device_info_get_service|gupnp_root_device_get_available|gupnp_root_device_get_relative_location|\ gupnp_root_device_new|gupnp_root_device_set_available|gupnp_root_device_start|gupnp_root_device_stop|gupnp_service_action_get|\ gupnp_service_action_return|gupnp_service_action_return_error|gupnp_service_action_set|gupnp_service_freeze_notify|gupnp_service_info_get|\ gupnp_service_info_get_introspection|gupnp_service_introspection_get_state_variable|gupnp_service_notify|gupnp_service_proxy_action_get|\ gupnp_service_proxy_action_set|gupnp_service_proxy_add_notify|gupnp_service_proxy_callback_set|gupnp_service_proxy_get_subscribed|\ gupnp_service_proxy_remove_notify|gupnp_service_proxy_set_subscribed|gupnp_service_thaw_notify|gzclose|gzcompress|gzdecode|gzdeflate|\ gzencode|gzeof|gzfile|gzgetc|gzgets|gzgetss|gzinflate|gzopen|gzpassthru|gzputs|gzread|gzrewind|gzseek|gztell|gzuncompress|gzwrite|\ halt_compiler|haruannotation|haruannotation_setborderstyle|haruannotation_sethighlightmode|haruannotation_seticon|\ haruannotation_setopened|harudestination|harudestination_setfit|harudestination_setfitb|harudestination_setfitbh|harudestination_setfitbv|\ harudestination_setfith|harudestination_setfitr|harudestination_setfitv|harudestination_setxyz|harudoc|harudoc_addpage|\ harudoc_addpagelabel|harudoc_construct|harudoc_createoutline|harudoc_getcurrentencoder|harudoc_getcurrentpage|harudoc_getencoder|\ harudoc_getfont|harudoc_getinfoattr|harudoc_getpagelayout|harudoc_getpagemode|harudoc_getstreamsize|harudoc_insertpage|harudoc_loadjpeg|\ harudoc_loadpng|harudoc_loadraw|harudoc_loadttc|harudoc_loadttf|harudoc_loadtype1|harudoc_output|harudoc_readfromstream|\ harudoc_reseterror|harudoc_resetstream|harudoc_save|harudoc_savetostream|harudoc_setcompressionmode|harudoc_setcurrentencoder|\ harudoc_setencryptionmode|harudoc_setinfoattr|harudoc_setinfodateattr|harudoc_setopenaction|harudoc_setpagelayout|harudoc_setpagemode|\ harudoc_setpagesconfiguration|harudoc_setpassword|harudoc_setpermission|harudoc_usecnsencodings|harudoc_usecnsfonts|\ harudoc_usecntencodings|harudoc_usecntfonts|harudoc_usejpencodings|harudoc_usejpfonts|harudoc_usekrencodings|harudoc_usekrfonts|\ haruencoder|haruencoder_getbytetype|haruencoder_gettype|haruencoder_getunicode|haruencoder_getwritingmode|haruexception|harufont|\ harufont_getascent|harufont_getcapheight|harufont_getdescent|harufont_getencodingname|harufont_getfontname|harufont_gettextwidth|\ harufont_getunicodewidth|harufont_getxheight|harufont_measuretext|haruimage|haruimage_getbitspercomponent|haruimage_getcolorspace|\ haruimage_getheight|haruimage_getsize|haruimage_getwidth|haruimage_setcolormask|haruimage_setmaskimage|haruoutline|\ haruoutline_setdestination|haruoutline_setopened|harupage|harupage_arc|harupage_begintext|harupage_circle|harupage_closepath|\ harupage_concat|harupage_createdestination|harupage_createlinkannotation|harupage_createtextannotation|harupage_createurlannotation|\ harupage_curveto|harupage_curveto2|harupage_curveto3|harupage_drawimage|harupage_ellipse|harupage_endpath|harupage_endtext|\ harupage_eofill|harupage_eofillstroke|harupage_fill|harupage_fillstroke|harupage_getcharspace|harupage_getcmykfill|harupage_getcmykstroke|\ harupage_getcurrentfont|harupage_getcurrentfontsize|harupage_getcurrentpos|harupage_getcurrenttextpos|harupage_getdash|\ harupage_getfillingcolorspace|harupage_getflatness|harupage_getgmode|harupage_getgrayfill|harupage_getgraystroke|harupage_getheight|\ harupage_gethorizontalscaling|harupage_getlinecap|harupage_getlinejoin|harupage_getlinewidth|harupage_getmiterlimit|harupage_getrgbfill|\ harupage_getrgbstroke|harupage_getstrokingcolorspace|harupage_gettextleading|harupage_gettextmatrix|harupage_gettextrenderingmode|\ harupage_gettextrise|harupage_gettextwidth|harupage_gettransmatrix|harupage_getwidth|harupage_getwordspace|harupage_lineto|\ harupage_measuretext|harupage_movetextpos|harupage_moveto|harupage_movetonextline|harupage_rectangle|harupage_setcharspace|\ harupage_setcmykfill|harupage_setcmykstroke|harupage_setdash|harupage_setflatness|harupage_setfontandsize|harupage_setgrayfill|\ harupage_setgraystroke|harupage_setheight|harupage_sethorizontalscaling|harupage_setlinecap|harupage_setlinejoin|harupage_setlinewidth|\ harupage_setmiterlimit|harupage_setrgbfill|harupage_setrgbstroke|harupage_setrotate|harupage_setsize|harupage_setslideshow|\ harupage_settextleading|harupage_settextmatrix|harupage_settextrenderingmode|harupage_settextrise|harupage_setwidth|harupage_setwordspace|\ harupage_showtext|harupage_showtextnextline|harupage_stroke|harupage_textout|harupage_textrect|hasconstant|hash|hash_algos|hash_copy|\ hash_file|hash_final|hash_hmac|hash_hmac_file|hash_init|hash_update|hash_update_file|hash_update_stream|hasmethod|hasproperty|header|\ header_register_callback|header_remove|headers_list|headers_sent|hebrev|hebrevc|hex2bin|hexdec|highlight_file|highlight_string|\ html_entity_decode|htmlentities|htmlspecialchars|htmlspecialchars_decode|http_build_cookie|http_build_query|http_build_str|http_build_url|\ http_cache_etag|http_cache_last_modified|http_chunked_decode|http_date|http_deflate|http_get|http_get_request_body|\ http_get_request_body_stream|http_get_request_headers|http_head|http_inflate|http_match_etag|http_match_modified|\ http_match_request_header|http_negotiate_charset|http_negotiate_content_type|http_negotiate_language|http_parse_cookie|http_parse_headers|\ http_parse_message|http_parse_params|http_persistent_handles_clean|http_persistent_handles_count|http_persistent_handles_ident|\ http_post_data|http_post_fields|http_put_data|http_put_file|http_put_stream|http_redirect|http_request|http_request_body_encode|\ http_request_method_exists|http_request_method_name|http_request_method_register|http_request_method_unregister|http_response_code|\ http_send_content_disposition|http_send_content_type|http_send_data|http_send_file|http_send_last_modified|http_send_status|\ http_send_stream|http_support|http_throttle|httpdeflatestream|httpdeflatestream_construct|httpdeflatestream_factory|\ httpdeflatestream_finish|httpdeflatestream_flush|httpdeflatestream_update|httpinflatestream|httpinflatestream_construct|\ httpinflatestream_factory|httpinflatestream_finish|httpinflatestream_flush|httpinflatestream_update|httpmessage|httpmessage_addheaders|\ httpmessage_construct|httpmessage_detach|httpmessage_factory|httpmessage_fromenv|httpmessage_fromstring|httpmessage_getbody|\ httpmessage_getheader|httpmessage_getheaders|httpmessage_gethttpversion|httpmessage_getparentmessage|httpmessage_getrequestmethod|\ httpmessage_getrequesturl|httpmessage_getresponsecode|httpmessage_getresponsestatus|httpmessage_gettype|httpmessage_guesscontenttype|\ httpmessage_prepend|httpmessage_reverse|httpmessage_send|httpmessage_setbody|httpmessage_setheaders|httpmessage_sethttpversion|\ httpmessage_setrequestmethod|httpmessage_setrequesturl|httpmessage_setresponsecode|httpmessage_setresponsestatus|httpmessage_settype|\ httpmessage_tomessagetypeobject|httpmessage_tostring|httpquerystring|httpquerystring_construct|httpquerystring_get|httpquerystring_mod|\ httpquerystring_set|httpquerystring_singleton|httpquerystring_toarray|httpquerystring_tostring|httpquerystring_xlate|httprequest|\ httprequest_addcookies|httprequest_addheaders|httprequest_addpostfields|httprequest_addpostfile|httprequest_addputdata|\ httprequest_addquerydata|httprequest_addrawpostdata|httprequest_addssloptions|httprequest_clearhistory|httprequest_construct|\ httprequest_enablecookies|httprequest_getcontenttype|httprequest_getcookies|httprequest_getheaders|httprequest_gethistory|\ httprequest_getmethod|httprequest_getoptions|httprequest_getpostfields|httprequest_getpostfiles|httprequest_getputdata|\ httprequest_getputfile|httprequest_getquerydata|httprequest_getrawpostdata|httprequest_getrawrequestmessage|\ httprequest_getrawresponsemessage|httprequest_getrequestmessage|httprequest_getresponsebody|httprequest_getresponsecode|\ httprequest_getresponsecookies|httprequest_getresponsedata|httprequest_getresponseheader|httprequest_getresponseinfo|\ httprequest_getresponsemessage|httprequest_getresponsestatus|httprequest_getssloptions|httprequest_geturl|httprequest_resetcookies|\ httprequest_send|httprequest_setcontenttype|httprequest_setcookies|httprequest_setheaders|httprequest_setmethod|httprequest_setoptions|\ httprequest_setpostfields|httprequest_setpostfiles|httprequest_setputdata|httprequest_setputfile|httprequest_setquerydata|\ httprequest_setrawpostdata|httprequest_setssloptions|httprequest_seturl|httprequestpool|httprequestpool_attach|httprequestpool_construct|\ httprequestpool_destruct|httprequestpool_detach|httprequestpool_getattachedrequests|httprequestpool_getfinishedrequests|\ httprequestpool_reset|httprequestpool_send|httprequestpool_socketperform|httprequestpool_socketselect|httpresponse|httpresponse_capture|\ httpresponse_getbuffersize|httpresponse_getcache|httpresponse_getcachecontrol|httpresponse_getcontentdisposition|\ httpresponse_getcontenttype|httpresponse_getdata|httpresponse_getetag|httpresponse_getfile|httpresponse_getgzip|httpresponse_getheader|\ httpresponse_getlastmodified|httpresponse_getrequestbody|httpresponse_getrequestbodystream|httpresponse_getrequestheaders|\ httpresponse_getstream|httpresponse_getthrottledelay|httpresponse_guesscontenttype|httpresponse_redirect|httpresponse_send|\ httpresponse_setbuffersize|httpresponse_setcache|httpresponse_setcachecontrol|httpresponse_setcontentdisposition|\ httpresponse_setcontenttype|httpresponse_setdata|httpresponse_setetag|httpresponse_setfile|httpresponse_setgzip|httpresponse_setheader|\ httpresponse_setlastmodified|httpresponse_setstream|httpresponse_setthrottledelay|httpresponse_status|hw_array2objrec|hw_changeobject|\ hw_children|hw_childrenobj|hw_close|hw_connect|hw_connection_info|hw_cp|hw_deleteobject|hw_docbyanchor|hw_docbyanchorobj|\ hw_document_attributes|hw_document_bodytag|hw_document_content|hw_document_setcontent|hw_document_size|hw_dummy|hw_edittext|hw_error|\ hw_errormsg|hw_free_document|hw_getanchors|hw_getanchorsobj|hw_getandlock|hw_getchildcoll|hw_getchildcollobj|hw_getchilddoccoll|\ hw_getchilddoccollobj|hw_getobject|hw_getobjectbyquery|hw_getobjectbyquerycoll|hw_getobjectbyquerycollobj|hw_getobjectbyqueryobj|\ hw_getparents|hw_getparentsobj|hw_getrellink|hw_getremote|hw_getremotechildren|hw_getsrcbydestobj|hw_gettext|hw_getusername|hw_identify|\ hw_incollections|hw_info|hw_inscoll|hw_insdoc|hw_insertanchors|hw_insertdocument|hw_insertobject|hw_mapid|hw_modifyobject|hw_mv|\ hw_new_document|hw_objrec2array|hw_output_document|hw_pconnect|hw_pipedocument|hw_root|hw_setlinkroot|hw_stat|hw_unlock|hw_who|\ hwapi_attribute|hwapi_attribute_key|hwapi_attribute_langdepvalue|hwapi_attribute_value|hwapi_attribute_values|hwapi_checkin|\ hwapi_checkout|hwapi_children|hwapi_content|hwapi_content_mimetype|hwapi_content_read|hwapi_copy|hwapi_dbstat|hwapi_dcstat|\ hwapi_dstanchors|hwapi_dstofsrcanchor|hwapi_error_count|hwapi_error_reason|hwapi_find|hwapi_ftstat|hwapi_hgcsp|hwapi_hwstat|\ hwapi_identify|hwapi_info|hwapi_insert|hwapi_insertanchor|hwapi_insertcollection|hwapi_insertdocument|hwapi_link|hwapi_lock|hwapi_move|\ hwapi_new_content|hwapi_object|hwapi_object_assign|hwapi_object_attreditable|hwapi_object_count|hwapi_object_insert|hwapi_object_new|\ hwapi_object_remove|hwapi_object_title|hwapi_object_value|hwapi_objectbyanchor|hwapi_parents|hwapi_reason_description|hwapi_reason_type|\ hwapi_remove|hwapi_replace|hwapi_setcommittedversion|hwapi_srcanchors|hwapi_srcsofdst|hwapi_unlock|hwapi_user|hwapi_userlist|hypot|\ ibase_add_user|ibase_affected_rows|ibase_backup|ibase_blob_add|ibase_blob_cancel|ibase_blob_close|ibase_blob_create|ibase_blob_echo|\ ibase_blob_get|ibase_blob_import|ibase_blob_info|ibase_blob_open|ibase_close|ibase_commit|ibase_commit_ret|ibase_connect|ibase_db_info|\ ibase_delete_user|ibase_drop_db|ibase_errcode|ibase_errmsg|ibase_execute|ibase_fetch_assoc|ibase_fetch_object|ibase_fetch_row|\ ibase_field_info|ibase_free_event_handler|ibase_free_query|ibase_free_result|ibase_gen_id|ibase_maintain_db|ibase_modify_user|\ ibase_name_result|ibase_num_fields|ibase_num_params|ibase_param_info|ibase_pconnect|ibase_prepare|ibase_query|ibase_restore|\ ibase_rollback|ibase_rollback_ret|ibase_server_info|ibase_service_attach|ibase_service_detach|ibase_set_event_handler|ibase_timefmt|\ ibase_trans|ibase_wait_event|iconv|iconv_get_encoding|iconv_mime_decode|iconv_mime_decode_headers|iconv_mime_encode|iconv_set_encoding|\ iconv_strlen|iconv_strpos|iconv_strrpos|iconv_substr|id3_get_frame_long_name|id3_get_frame_short_name|id3_get_genre_id|id3_get_genre_list|\ id3_get_genre_name|id3_get_tag|id3_get_version|id3_remove_tag|id3_set_tag|id3v2attachedpictureframe|id3v2frame|id3v2tag|idate|\ idn_to_ascii|idn_to_unicode|idn_to_utf8|ifx_affected_rows|ifx_blobinfile_mode|ifx_byteasvarchar|ifx_close|ifx_connect|ifx_copy_blob|\ ifx_create_blob|ifx_create_char|ifx_do|ifx_error|ifx_errormsg|ifx_fetch_row|ifx_fieldproperties|ifx_fieldtypes|ifx_free_blob|\ ifx_free_char|ifx_free_result|ifx_get_blob|ifx_get_char|ifx_getsqlca|ifx_htmltbl_result|ifx_nullformat|ifx_num_fields|ifx_num_rows|\ ifx_pconnect|ifx_prepare|ifx_query|ifx_textasvarchar|ifx_update_blob|ifx_update_char|ifxus_close_slob|ifxus_create_slob|ifxus_free_slob|\ ifxus_open_slob|ifxus_read_slob|ifxus_seek_slob|ifxus_tell_slob|ifxus_write_slob|ignore_user_abort|iis_add_server|iis_get_dir_security|\ iis_get_script_map|iis_get_server_by_comment|iis_get_server_by_path|iis_get_server_rights|iis_get_service_state|iis_remove_server|\ iis_set_app_settings|iis_set_dir_security|iis_set_script_map|iis_set_server_rights|iis_start_server|iis_start_service|iis_stop_server|\ iis_stop_service|image2wbmp|image_type_to_extension|image_type_to_mime_type|imagealphablending|imageantialias|imagearc|imagechar|\ imagecharup|imagecolorallocate|imagecolorallocatealpha|imagecolorat|imagecolorclosest|imagecolorclosestalpha|imagecolorclosesthwb|\ imagecolordeallocate|imagecolorexact|imagecolorexactalpha|imagecolormatch|imagecolorresolve|imagecolorresolvealpha|imagecolorset|\ imagecolorsforindex|imagecolorstotal|imagecolortransparent|imageconvolution|imagecopy|imagecopymerge|imagecopymergegray|\ imagecopyresampled|imagecopyresized|imagecreate|imagecreatefromgd|imagecreatefromgd2|imagecreatefromgd2part|imagecreatefromgif|\ imagecreatefromjpeg|imagecreatefrompng|imagecreatefromstring|imagecreatefromwbmp|imagecreatefromxbm|imagecreatefromxpm|\ imagecreatetruecolor|imagedashedline|imagedestroy|imageellipse|imagefill|imagefilledarc|imagefilledellipse|imagefilledpolygon|\ imagefilledrectangle|imagefilltoborder|imagefilter|imagefontheight|imagefontwidth|imageftbbox|imagefttext|imagegammacorrect|imagegd|\ imagegd2|imagegif|imagegrabscreen|imagegrabwindow|imageinterlace|imageistruecolor|imagejpeg|imagelayereffect|imageline|imageloadfont|\ imagepalettecopy|imagepng|imagepolygon|imagepsbbox|imagepsencodefont|imagepsextendfont|imagepsfreefont|imagepsloadfont|imagepsslantfont|\ imagepstext|imagerectangle|imagerotate|imagesavealpha|imagesetbrush|imagesetpixel|imagesetstyle|imagesetthickness|imagesettile|\ imagestring|imagestringup|imagesx|imagesy|imagetruecolortopalette|imagettfbbox|imagettftext|imagetypes|imagewbmp|imagexbm|imagick|\ imagick_adaptiveblurimage|imagick_adaptiveresizeimage|imagick_adaptivesharpenimage|imagick_adaptivethresholdimage|imagick_addimage|\ imagick_addnoiseimage|imagick_affinetransformimage|imagick_animateimages|imagick_annotateimage|imagick_appendimages|imagick_averageimages|\ imagick_blackthresholdimage|imagick_blurimage|imagick_borderimage|imagick_charcoalimage|imagick_chopimage|imagick_clear|imagick_clipimage|\ imagick_clippathimage|imagick_clone|imagick_clutimage|imagick_coalesceimages|imagick_colorfloodfillimage|imagick_colorizeimage|\ imagick_combineimages|imagick_commentimage|imagick_compareimagechannels|imagick_compareimagelayers|imagick_compareimages|\ imagick_compositeimage|imagick_construct|imagick_contrastimage|imagick_contraststretchimage|imagick_convolveimage|imagick_cropimage|\ imagick_cropthumbnailimage|imagick_current|imagick_cyclecolormapimage|imagick_decipherimage|imagick_deconstructimages|\ imagick_deleteimageartifact|imagick_despeckleimage|imagick_destroy|imagick_displayimage|imagick_displayimages|imagick_distortimage|\ imagick_drawimage|imagick_edgeimage|imagick_embossimage|imagick_encipherimage|imagick_enhanceimage|imagick_equalizeimage|\ imagick_evaluateimage|imagick_extentimage|imagick_flattenimages|imagick_flipimage|imagick_floodfillpaintimage|imagick_flopimage|\ imagick_frameimage|imagick_fximage|imagick_gammaimage|imagick_gaussianblurimage|imagick_getcolorspace|imagick_getcompression|\ imagick_getcompressionquality|imagick_getcopyright|imagick_getfilename|imagick_getfont|imagick_getformat|imagick_getgravity|\ imagick_gethomeurl|imagick_getimage|imagick_getimagealphachannel|imagick_getimageartifact|imagick_getimagebackgroundcolor|\ imagick_getimageblob|imagick_getimageblueprimary|imagick_getimagebordercolor|imagick_getimagechanneldepth|\ imagick_getimagechanneldistortion|imagick_getimagechanneldistortions|imagick_getimagechannelextrema|imagick_getimagechannelmean|\ imagick_getimagechannelrange|imagick_getimagechannelstatistics|imagick_getimageclipmask|imagick_getimagecolormapcolor|\ imagick_getimagecolors|imagick_getimagecolorspace|imagick_getimagecompose|imagick_getimagecompression|imagick_getimagecompressionquality|\ imagick_getimagedelay|imagick_getimagedepth|imagick_getimagedispose|imagick_getimagedistortion|imagick_getimageextrema|\ imagick_getimagefilename|imagick_getimageformat|imagick_getimagegamma|imagick_getimagegeometry|imagick_getimagegravity|\ imagick_getimagegreenprimary|imagick_getimageheight|imagick_getimagehistogram|imagick_getimageindex|imagick_getimageinterlacescheme|\ imagick_getimageinterpolatemethod|imagick_getimageiterations|imagick_getimagelength|imagick_getimagemagicklicense|imagick_getimagematte|\ imagick_getimagemattecolor|imagick_getimageorientation|imagick_getimagepage|imagick_getimagepixelcolor|imagick_getimageprofile|\ imagick_getimageprofiles|imagick_getimageproperties|imagick_getimageproperty|imagick_getimageredprimary|imagick_getimageregion|\ imagick_getimagerenderingintent|imagick_getimageresolution|imagick_getimagesblob|imagick_getimagescene|imagick_getimagesignature|\ imagick_getimagesize|imagick_getimagetickspersecond|imagick_getimagetotalinkdensity|imagick_getimagetype|imagick_getimageunits|\ imagick_getimagevirtualpixelmethod|imagick_getimagewhitepoint|imagick_getimagewidth|imagick_getinterlacescheme|imagick_getiteratorindex|\ imagick_getnumberimages|imagick_getoption|imagick_getpackagename|imagick_getpage|imagick_getpixeliterator|imagick_getpixelregioniterator|\ imagick_getpointsize|imagick_getquantumdepth|imagick_getquantumrange|imagick_getreleasedate|imagick_getresource|imagick_getresourcelimit|\ imagick_getsamplingfactors|imagick_getsize|imagick_getsizeoffset|imagick_getversion|imagick_hasnextimage|imagick_haspreviousimage|\ imagick_identifyimage|imagick_implodeimage|imagick_labelimage|imagick_levelimage|imagick_linearstretchimage|imagick_liquidrescaleimage|\ imagick_magnifyimage|imagick_mapimage|imagick_mattefloodfillimage|imagick_medianfilterimage|imagick_mergeimagelayers|imagick_minifyimage|\ imagick_modulateimage|imagick_montageimage|imagick_morphimages|imagick_mosaicimages|imagick_motionblurimage|imagick_negateimage|\ imagick_newimage|imagick_newpseudoimage|imagick_nextimage|imagick_normalizeimage|imagick_oilpaintimage|imagick_opaquepaintimage|\ imagick_optimizeimagelayers|imagick_orderedposterizeimage|imagick_paintfloodfillimage|imagick_paintopaqueimage|\ imagick_painttransparentimage|imagick_pingimage|imagick_pingimageblob|imagick_pingimagefile|imagick_polaroidimage|imagick_posterizeimage|\ imagick_previewimages|imagick_previousimage|imagick_profileimage|imagick_quantizeimage|imagick_quantizeimages|imagick_queryfontmetrics|\ imagick_queryfonts|imagick_queryformats|imagick_radialblurimage|imagick_raiseimage|imagick_randomthresholdimage|imagick_readimage|\ imagick_readimageblob|imagick_readimagefile|imagick_recolorimage|imagick_reducenoiseimage|imagick_removeimage|imagick_removeimageprofile|\ imagick_render|imagick_resampleimage|imagick_resetimagepage|imagick_resizeimage|imagick_rollimage|imagick_rotateimage|\ imagick_roundcorners|imagick_sampleimage|imagick_scaleimage|imagick_separateimagechannel|imagick_sepiatoneimage|\ imagick_setbackgroundcolor|imagick_setcolorspace|imagick_setcompression|imagick_setcompressionquality|imagick_setfilename|\ imagick_setfirstiterator|imagick_setfont|imagick_setformat|imagick_setgravity|imagick_setimage|imagick_setimagealphachannel|\ imagick_setimageartifact|imagick_setimagebackgroundcolor|imagick_setimagebias|imagick_setimageblueprimary|imagick_setimagebordercolor|\ imagick_setimagechanneldepth|imagick_setimageclipmask|imagick_setimagecolormapcolor|imagick_setimagecolorspace|imagick_setimagecompose|\ imagick_setimagecompression|imagick_setimagecompressionquality|imagick_setimagedelay|imagick_setimagedepth|imagick_setimagedispose|\ imagick_setimageextent|imagick_setimagefilename|imagick_setimageformat|imagick_setimagegamma|imagick_setimagegravity|\ imagick_setimagegreenprimary|imagick_setimageindex|imagick_setimageinterlacescheme|imagick_setimageinterpolatemethod|\ imagick_setimageiterations|imagick_setimagematte|imagick_setimagemattecolor|imagick_setimageopacity|imagick_setimageorientation|\ imagick_setimagepage|imagick_setimageprofile|imagick_setimageproperty|imagick_setimageredprimary|imagick_setimagerenderingintent|\ imagick_setimageresolution|imagick_setimagescene|imagick_setimagetickspersecond|imagick_setimagetype|imagick_setimageunits|\ imagick_setimagevirtualpixelmethod|imagick_setimagewhitepoint|imagick_setinterlacescheme|imagick_setiteratorindex|imagick_setlastiterator|\ imagick_setoption|imagick_setpage|imagick_setpointsize|imagick_setresolution|imagick_setresourcelimit|imagick_setsamplingfactors|\ imagick_setsize|imagick_setsizeoffset|imagick_settype|imagick_shadeimage|imagick_shadowimage|imagick_sharpenimage|imagick_shaveimage|\ imagick_shearimage|imagick_sigmoidalcontrastimage|imagick_sketchimage|imagick_solarizeimage|imagick_spliceimage|imagick_spreadimage|\ imagick_steganoimage|imagick_stereoimage|imagick_stripimage|imagick_swirlimage|imagick_textureimage|imagick_thresholdimage|\ imagick_thumbnailimage|imagick_tintimage|imagick_transformimage|imagick_transparentpaintimage|imagick_transposeimage|\ imagick_transverseimage|imagick_trimimage|imagick_uniqueimagecolors|imagick_unsharpmaskimage|imagick_valid|imagick_vignetteimage|\ imagick_waveimage|imagick_whitethresholdimage|imagick_writeimage|imagick_writeimagefile|imagick_writeimages|imagick_writeimagesfile|\ imagickdraw|imagickdraw_affine|imagickdraw_annotation|imagickdraw_arc|imagickdraw_bezier|imagickdraw_circle|imagickdraw_clear|\ imagickdraw_clone|imagickdraw_color|imagickdraw_comment|imagickdraw_composite|imagickdraw_construct|imagickdraw_destroy|\ imagickdraw_ellipse|imagickdraw_getclippath|imagickdraw_getcliprule|imagickdraw_getclipunits|imagickdraw_getfillcolor|\ imagickdraw_getfillopacity|imagickdraw_getfillrule|imagickdraw_getfont|imagickdraw_getfontfamily|imagickdraw_getfontsize|\ imagickdraw_getfontstyle|imagickdraw_getfontweight|imagickdraw_getgravity|imagickdraw_getstrokeantialias|imagickdraw_getstrokecolor|\ imagickdraw_getstrokedasharray|imagickdraw_getstrokedashoffset|imagickdraw_getstrokelinecap|imagickdraw_getstrokelinejoin|\ imagickdraw_getstrokemiterlimit|imagickdraw_getstrokeopacity|imagickdraw_getstrokewidth|imagickdraw_gettextalignment|\ imagickdraw_gettextantialias|imagickdraw_gettextdecoration|imagickdraw_gettextencoding|imagickdraw_gettextundercolor|\ imagickdraw_getvectorgraphics|imagickdraw_line|imagickdraw_matte|imagickdraw_pathclose|imagickdraw_pathcurvetoabsolute|\ imagickdraw_pathcurvetoquadraticbezierabsolute|imagickdraw_pathcurvetoquadraticbezierrelative|\ imagickdraw_pathcurvetoquadraticbeziersmoothabsolute|imagickdraw_pathcurvetoquadraticbeziersmoothrelative|imagickdraw_pathcurvetorelative|\ imagickdraw_pathcurvetosmoothabsolute|imagickdraw_pathcurvetosmoothrelative|imagickdraw_pathellipticarcabsolute|\ imagickdraw_pathellipticarcrelative|imagickdraw_pathfinish|imagickdraw_pathlinetoabsolute|imagickdraw_pathlinetohorizontalabsolute|\ imagickdraw_pathlinetohorizontalrelative|imagickdraw_pathlinetorelative|imagickdraw_pathlinetoverticalabsolute|\ imagickdraw_pathlinetoverticalrelative|imagickdraw_pathmovetoabsolute|imagickdraw_pathmovetorelative|imagickdraw_pathstart|\ imagickdraw_point|imagickdraw_polygon|imagickdraw_polyline|imagickdraw_pop|imagickdraw_popclippath|imagickdraw_popdefs|\ imagickdraw_poppattern|imagickdraw_push|imagickdraw_pushclippath|imagickdraw_pushdefs|imagickdraw_pushpattern|imagickdraw_rectangle|\ imagickdraw_render|imagickdraw_rotate|imagickdraw_roundrectangle|imagickdraw_scale|imagickdraw_setclippath|imagickdraw_setcliprule|\ imagickdraw_setclipunits|imagickdraw_setfillalpha|imagickdraw_setfillcolor|imagickdraw_setfillopacity|imagickdraw_setfillpatternurl|\ imagickdraw_setfillrule|imagickdraw_setfont|imagickdraw_setfontfamily|imagickdraw_setfontsize|imagickdraw_setfontstretch|\ imagickdraw_setfontstyle|imagickdraw_setfontweight|imagickdraw_setgravity|imagickdraw_setstrokealpha|imagickdraw_setstrokeantialias|\ imagickdraw_setstrokecolor|imagickdraw_setstrokedasharray|imagickdraw_setstrokedashoffset|imagickdraw_setstrokelinecap|\ imagickdraw_setstrokelinejoin|imagickdraw_setstrokemiterlimit|imagickdraw_setstrokeopacity|imagickdraw_setstrokepatternurl|\ imagickdraw_setstrokewidth|imagickdraw_settextalignment|imagickdraw_settextantialias|imagickdraw_settextdecoration|\ imagickdraw_settextencoding|imagickdraw_settextundercolor|imagickdraw_setvectorgraphics|imagickdraw_setviewbox|imagickdraw_skewx|\ imagickdraw_skewy|imagickdraw_translate|imagickpixel|imagickpixel_clear|imagickpixel_construct|imagickpixel_destroy|imagickpixel_getcolor|\ imagickpixel_getcolorasstring|imagickpixel_getcolorcount|imagickpixel_getcolorvalue|imagickpixel_gethsl|imagickpixel_issimilar|\ imagickpixel_setcolor|imagickpixel_setcolorvalue|imagickpixel_sethsl|imagickpixeliterator|imagickpixeliterator_clear|\ imagickpixeliterator_construct|imagickpixeliterator_destroy|imagickpixeliterator_getcurrentiteratorrow|\ imagickpixeliterator_getiteratorrow|imagickpixeliterator_getnextiteratorrow|imagickpixeliterator_getpreviousiteratorrow|\ imagickpixeliterator_newpixeliterator|imagickpixeliterator_newpixelregioniterator|imagickpixeliterator_resetiterator|\ imagickpixeliterator_setiteratorfirstrow|imagickpixeliterator_setiteratorlastrow|imagickpixeliterator_setiteratorrow|\ imagickpixeliterator_synciterator|imap_8bit|imap_alerts|imap_append|imap_base64|imap_binary|imap_body|imap_bodystruct|imap_check|\ imap_clearflag_full|imap_close|imap_create|imap_createmailbox|imap_delete|imap_deletemailbox|imap_errors|imap_expunge|imap_fetch_overview|\ imap_fetchbody|imap_fetchheader|imap_fetchmime|imap_fetchstructure|imap_fetchtext|imap_gc|imap_get_quota|imap_get_quotaroot|imap_getacl|\ imap_getmailboxes|imap_getsubscribed|imap_header|imap_headerinfo|imap_headers|imap_last_error|imap_list|imap_listmailbox|imap_listscan|\ imap_listsubscribed|imap_lsub|imap_mail|imap_mail_compose|imap_mail_copy|imap_mail_move|imap_mailboxmsginfo|imap_mime_header_decode|\ imap_msgno|imap_num_msg|imap_num_recent|imap_open|imap_ping|imap_qprint|imap_rename|imap_renamemailbox|imap_reopen|\ imap_rfc822_parse_adrlist|imap_rfc822_parse_headers|imap_rfc822_write_address|imap_savebody|imap_scan|imap_scanmailbox|imap_search|\ imap_set_quota|imap_setacl|imap_setflag_full|imap_sort|imap_status|imap_subscribe|imap_thread|imap_timeout|imap_uid|imap_undelete|\ imap_unsubscribe|imap_utf7_decode|imap_utf7_encode|imap_utf8|implementsinterface|implode|import_request_variables|in_array|include|\ include_once|inclued_get_data|inet_ntop|inet_pton|infiniteiterator|ingres_autocommit|ingres_autocommit_state|ingres_charset|ingres_close|\ ingres_commit|ingres_connect|ingres_cursor|ingres_errno|ingres_error|ingres_errsqlstate|ingres_escape_string|ingres_execute|\ ingres_fetch_array|ingres_fetch_assoc|ingres_fetch_object|ingres_fetch_proc_return|ingres_fetch_row|ingres_field_length|ingres_field_name|\ ingres_field_nullable|ingres_field_precision|ingres_field_scale|ingres_field_type|ingres_free_result|ingres_next_error|ingres_num_fields|\ ingres_num_rows|ingres_pconnect|ingres_prepare|ingres_query|ingres_result_seek|ingres_rollback|ingres_set_environment|\ ingres_unbuffered_query|ini_alter|ini_get|ini_get_all|ini_restore|ini_set|innamespace|inotify_add_watch|inotify_init|inotify_queue_len|\ inotify_read|inotify_rm_watch|interface_exists|intl_error_name|intl_get_error_code|intl_get_error_message|intl_is_failure|\ intldateformatter|intval|invalidargumentexception|invoke|invokeargs|ip2long|iptcembed|iptcparse|is_a|is_array|is_bool|is_callable|is_dir|\ is_double|is_executable|is_file|is_finite|is_float|is_infinite|is_int|is_integer|is_link|is_long|is_nan|is_null|is_numeric|is_object|\ is_readable|is_real|is_resource|is_scalar|is_soap_fault|is_string|is_subclass_of|is_uploaded_file|is_writable|is_writeable|isabstract|\ iscloneable|isdisabled|isfinal|isinstance|isinstantiable|isinterface|isinternal|isiterateable|isset|issubclassof|isuserdefined|iterator|\ iterator_apply|iterator_count|iterator_to_array|iteratoraggregate|iteratoriterator|java_last_exception_clear|java_last_exception_get|\ jddayofweek|jdmonthname|jdtofrench|jdtogregorian|jdtojewish|jdtojulian|jdtounix|jewishtojd|join|jpeg2wbmp|json_decode|json_encode|\ json_last_error|jsonserializable|judy|judy_type|judy_version|juliantojd|kadm5_chpass_principal|kadm5_create_principal|\ kadm5_delete_principal|kadm5_destroy|kadm5_flush|kadm5_get_policies|kadm5_get_principal|kadm5_get_principals|kadm5_init_with_password|\ kadm5_modify_principal|key|krsort|ksort|lcfirst|lcg_value|lchgrp|lchown|ldap_8859_to_t61|ldap_add|ldap_bind|ldap_close|ldap_compare|\ ldap_connect|ldap_count_entries|ldap_delete|ldap_dn2ufn|ldap_err2str|ldap_errno|ldap_error|ldap_explode_dn|ldap_first_attribute|\ ldap_first_entry|ldap_first_reference|ldap_free_result|ldap_get_attributes|ldap_get_dn|ldap_get_entries|ldap_get_option|ldap_get_values|\ ldap_get_values_len|ldap_list|ldap_mod_add|ldap_mod_del|ldap_mod_replace|ldap_modify|ldap_next_attribute|ldap_next_entry|\ ldap_next_reference|ldap_parse_reference|ldap_parse_result|ldap_read|ldap_rename|ldap_sasl_bind|ldap_search|ldap_set_option|\ ldap_set_rebind_proc|ldap_sort|ldap_start_tls|ldap_t61_to_8859|ldap_unbind|lengthexception|levenshtein|libxml_clear_errors|\ libxml_disable_entity_loader|libxml_get_errors|libxml_get_last_error|libxml_set_streams_context|libxml_use_internal_errors|libxmlerror|\ limititerator|link|linkinfo|list|locale|localeconv|localtime|log|log10|log1p|logicexception|long2ip|lstat|ltrim|lzf_compress|\ lzf_decompress|lzf_optimized_for|m_checkstatus|m_completeauthorizations|m_connect|m_connectionerror|m_deletetrans|m_destroyconn|\ m_destroyengine|m_getcell|m_getcellbynum|m_getcommadelimited|m_getheader|m_initconn|m_initengine|m_iscommadelimited|m_maxconntimeout|\ m_monitor|m_numcolumns|m_numrows|m_parsecommadelimited|m_responsekeys|m_responseparam|m_returnstatus|m_setblocking|m_setdropfile|m_setip|\ m_setssl|m_setssl_cafile|m_setssl_files|m_settimeout|m_sslcert_gen_hash|m_transactionssent|m_transinqueue|m_transkeyval|m_transnew|\ m_transsend|m_uwait|m_validateidentifier|m_verifyconnection|m_verifysslcert|magic_quotes_runtime|mail|\ mailparse_determine_best_xfer_encoding|mailparse_msg_create|mailparse_msg_extract_part|mailparse_msg_extract_part_file|\ mailparse_msg_extract_whole_part_file|mailparse_msg_free|mailparse_msg_get_part|mailparse_msg_get_part_data|mailparse_msg_get_structure|\ mailparse_msg_parse|mailparse_msg_parse_file|mailparse_rfc822_parse_addresses|mailparse_stream_encode|mailparse_uudecode_all|main|max|\ maxdb_affected_rows|maxdb_autocommit|maxdb_bind_param|maxdb_bind_result|maxdb_change_user|maxdb_character_set_name|maxdb_client_encoding|\ maxdb_close|maxdb_close_long_data|maxdb_commit|maxdb_connect|maxdb_connect_errno|maxdb_connect_error|maxdb_data_seek|maxdb_debug|\ maxdb_disable_reads_from_master|maxdb_disable_rpl_parse|maxdb_dump_debug_info|maxdb_embedded_connect|maxdb_enable_reads_from_master|\ maxdb_enable_rpl_parse|maxdb_errno|maxdb_error|maxdb_escape_string|maxdb_execute|maxdb_fetch|maxdb_fetch_array|maxdb_fetch_assoc|\ maxdb_fetch_field|maxdb_fetch_field_direct|maxdb_fetch_fields|maxdb_fetch_lengths|maxdb_fetch_object|maxdb_fetch_row|maxdb_field_count|\ maxdb_field_seek|maxdb_field_tell|maxdb_free_result|maxdb_get_client_info|maxdb_get_client_version|maxdb_get_host_info|maxdb_get_metadata|\ maxdb_get_proto_info|maxdb_get_server_info|maxdb_get_server_version|maxdb_info|maxdb_init|maxdb_insert_id|maxdb_kill|maxdb_master_query|\ maxdb_more_results|maxdb_multi_query|maxdb_next_result|maxdb_num_fields|maxdb_num_rows|maxdb_options|maxdb_param_count|maxdb_ping|\ maxdb_prepare|maxdb_query|maxdb_real_connect|maxdb_real_escape_string|maxdb_real_query|maxdb_report|maxdb_rollback|\ maxdb_rpl_parse_enabled|maxdb_rpl_probe|maxdb_rpl_query_type|maxdb_select_db|maxdb_send_long_data|maxdb_send_query|maxdb_server_end|\ maxdb_server_init|maxdb_set_opt|maxdb_sqlstate|maxdb_ssl_set|maxdb_stat|maxdb_stmt_affected_rows|maxdb_stmt_bind_param|\ maxdb_stmt_bind_result|maxdb_stmt_close|maxdb_stmt_close_long_data|maxdb_stmt_data_seek|maxdb_stmt_errno|maxdb_stmt_error|\ maxdb_stmt_execute|maxdb_stmt_fetch|maxdb_stmt_free_result|maxdb_stmt_init|maxdb_stmt_num_rows|maxdb_stmt_param_count|maxdb_stmt_prepare|\ maxdb_stmt_reset|maxdb_stmt_result_metadata|maxdb_stmt_send_long_data|maxdb_stmt_sqlstate|maxdb_stmt_store_result|maxdb_store_result|\ maxdb_thread_id|maxdb_thread_safe|maxdb_use_result|maxdb_warning_count|mb_check_encoding|mb_convert_case|mb_convert_encoding|\ mb_convert_kana|mb_convert_variables|mb_decode_mimeheader|mb_decode_numericentity|mb_detect_encoding|mb_detect_order|mb_encode_mimeheader|\ mb_encode_numericentity|mb_encoding_aliases|mb_ereg|mb_ereg_match|mb_ereg_replace|mb_ereg_search|mb_ereg_search_getpos|\ mb_ereg_search_getregs|mb_ereg_search_init|mb_ereg_search_pos|mb_ereg_search_regs|mb_ereg_search_setpos|mb_eregi|mb_eregi_replace|\ mb_get_info|mb_http_input|mb_http_output|mb_internal_encoding|mb_language|mb_list_encodings|mb_output_handler|mb_parse_str|\ mb_preferred_mime_name|mb_regex_encoding|mb_regex_set_options|mb_send_mail|mb_split|mb_strcut|mb_strimwidth|mb_stripos|mb_stristr|\ mb_strlen|mb_strpos|mb_strrchr|mb_strrichr|mb_strripos|mb_strrpos|mb_strstr|mb_strtolower|mb_strtoupper|mb_strwidth|\ mb_substitute_character|mb_substr|mb_substr_count|mcrypt_cbc|mcrypt_cfb|mcrypt_create_iv|mcrypt_decrypt|mcrypt_ecb|\ mcrypt_enc_get_algorithms_name|mcrypt_enc_get_block_size|mcrypt_enc_get_iv_size|mcrypt_enc_get_key_size|mcrypt_enc_get_modes_name|\ mcrypt_enc_get_supported_key_sizes|mcrypt_enc_is_block_algorithm|mcrypt_enc_is_block_algorithm_mode|mcrypt_enc_is_block_mode|\ mcrypt_enc_self_test|mcrypt_encrypt|mcrypt_generic|mcrypt_generic_deinit|mcrypt_generic_end|mcrypt_generic_init|mcrypt_get_block_size|\ mcrypt_get_cipher_name|mcrypt_get_iv_size|mcrypt_get_key_size|mcrypt_list_algorithms|mcrypt_list_modes|mcrypt_module_close|\ mcrypt_module_get_algo_block_size|mcrypt_module_get_algo_key_size|mcrypt_module_get_supported_key_sizes|mcrypt_module_is_block_algorithm|\ mcrypt_module_is_block_algorithm_mode|mcrypt_module_is_block_mode|mcrypt_module_open|mcrypt_module_self_test|mcrypt_ofb|md5|md5_file|\ mdecrypt_generic|memcache|memcache_debug|memcached|memory_get_peak_usage|memory_get_usage|messageformatter|metaphone|method_exists|mhash|\ mhash_count|mhash_get_block_size|mhash_get_hash_name|mhash_keygen_s2k|microtime|mime_content_type|min|ming_keypress|\ ming_setcubicthreshold|ming_setscale|ming_setswfcompression|ming_useconstants|ming_useswfversion|mkdir|mktime|money_format|mongo|\ mongobindata|mongocode|mongocollection|mongoconnectionexception|mongocursor|mongocursorexception|mongocursortimeoutexception|mongodate|\ mongodb|mongodbref|mongoexception|mongogridfs|mongogridfscursor|mongogridfsexception|mongogridfsfile|mongoid|mongoint32|mongoint64|\ mongomaxkey|mongominkey|mongoregex|mongotimestamp|move_uploaded_file|mpegfile|mqseries_back|mqseries_begin|mqseries_close|mqseries_cmit|\ mqseries_conn|mqseries_connx|mqseries_disc|mqseries_get|mqseries_inq|mqseries_open|mqseries_put|mqseries_put1|mqseries_set|\ mqseries_strerror|msession_connect|msession_count|msession_create|msession_destroy|msession_disconnect|msession_find|msession_get|\ msession_get_array|msession_get_data|msession_inc|msession_list|msession_listvar|msession_lock|msession_plugin|msession_randstr|\ msession_set|msession_set_array|msession_set_data|msession_timeout|msession_uniq|msession_unlock|msg_get_queue|msg_queue_exists|\ msg_receive|msg_remove_queue|msg_send|msg_set_queue|msg_stat_queue|msql|msql_affected_rows|msql_close|msql_connect|msql_create_db|\ msql_createdb|msql_data_seek|msql_db_query|msql_dbname|msql_drop_db|msql_error|msql_fetch_array|msql_fetch_field|msql_fetch_object|\ msql_fetch_row|msql_field_flags|msql_field_len|msql_field_name|msql_field_seek|msql_field_table|msql_field_type|msql_fieldflags|\ msql_fieldlen|msql_fieldname|msql_fieldtable|msql_fieldtype|msql_free_result|msql_list_dbs|msql_list_fields|msql_list_tables|\ msql_num_fields|msql_num_rows|msql_numfields|msql_numrows|msql_pconnect|msql_query|msql_regcase|msql_result|msql_select_db|msql_tablename|\ mssql_bind|mssql_close|mssql_connect|mssql_data_seek|mssql_execute|mssql_fetch_array|mssql_fetch_assoc|mssql_fetch_batch|\ mssql_fetch_field|mssql_fetch_object|mssql_fetch_row|mssql_field_length|mssql_field_name|mssql_field_seek|mssql_field_type|\ mssql_free_result|mssql_free_statement|mssql_get_last_message|mssql_guid_string|mssql_init|mssql_min_error_severity|\ mssql_min_message_severity|mssql_next_result|mssql_num_fields|mssql_num_rows|mssql_pconnect|mssql_query|mssql_result|mssql_rows_affected|\ mssql_select_db|mt_getrandmax|mt_rand|mt_srand|multipleiterator|mysql_affected_rows|mysql_client_encoding|mysql_close|mysql_connect|\ mysql_create_db|mysql_data_seek|mysql_db_name|mysql_db_query|mysql_drop_db|mysql_errno|mysql_error|mysql_escape_string|mysql_fetch_array|\ mysql_fetch_assoc|mysql_fetch_field|mysql_fetch_lengths|mysql_fetch_object|mysql_fetch_row|mysql_field_flags|mysql_field_len|\ mysql_field_name|mysql_field_seek|mysql_field_table|mysql_field_type|mysql_free_result|mysql_get_client_info|mysql_get_host_info|\ mysql_get_proto_info|mysql_get_server_info|mysql_info|mysql_insert_id|mysql_list_dbs|mysql_list_fields|mysql_list_processes|\ mysql_list_tables|mysql_num_fields|mysql_num_rows|mysql_pconnect|mysql_ping|mysql_query|mysql_real_escape_string|mysql_result|\ mysql_select_db|mysql_set_charset|mysql_stat|mysql_tablename|mysql_thread_id|mysql_unbuffered_query|mysqli|mysqli_affected_rows|\ mysqli_autocommit|mysqli_bind_param|mysqli_bind_result|mysqli_cache_stats|mysqli_change_user|mysqli_character_set_name|\ mysqli_client_encoding|mysqli_close|mysqli_commit|mysqli_connect|mysqli_connect_errno|mysqli_connect_error|mysqli_data_seek|\ mysqli_debug|mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_driver|mysqli_dump_debug_info|mysqli_embedded_server_end|\ mysqli_embedded_server_start|mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_errno|mysqli_error|mysqli_escape_string|\ mysqli_execute|mysqli_fetch|mysqli_fetch_all|mysqli_fetch_array|mysqli_fetch_assoc|mysqli_fetch_field|mysqli_fetch_field_direct|\ mysqli_fetch_fields|mysqli_fetch_lengths|mysqli_fetch_object|mysqli_fetch_row|mysqli_field_count|mysqli_field_seek|mysqli_field_tell|\ mysqli_free_result|mysqli_get_charset|mysqli_get_client_info|mysqli_get_client_stats|mysqli_get_client_version|mysqli_get_connection_stats|\ mysqli_get_host_info|mysqli_get_metadata|mysqli_get_proto_info|mysqli_get_server_info|mysqli_get_server_version|mysqli_get_warnings|\ mysqli_info|mysqli_init|mysqli_insert_id|mysqli_kill|mysqli_link_construct|mysqli_master_query|mysqli_more_results|mysqli_multi_query|\ mysqli_next_result|mysqli_num_fields|mysqli_num_rows|mysqli_options|mysqli_param_count|mysqli_ping|mysqli_poll|mysqli_prepare|\ mysqli_query|mysqli_real_connect|mysqli_real_escape_string|mysqli_real_query|mysqli_reap_async_query|mysqli_refresh|mysqli_report|\ mysqli_result|mysqli_rollback|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|mysqli_select_db|mysqli_send_long_data|\ mysqli_send_query|mysqli_set_charset|mysqli_set_local_infile_default|mysqli_set_local_infile_handler|mysqli_set_opt|mysqli_slave_query|\ mysqli_sqlstate|mysqli_ssl_set|mysqli_stat|mysqli_stmt|mysqli_stmt_affected_rows|mysqli_stmt_attr_get|mysqli_stmt_attr_set|\ mysqli_stmt_bind_param|mysqli_stmt_bind_result|mysqli_stmt_close|mysqli_stmt_data_seek|mysqli_stmt_errno|mysqli_stmt_error|\ mysqli_stmt_execute|mysqli_stmt_fetch|mysqli_stmt_field_count|mysqli_stmt_free_result|mysqli_stmt_get_result|mysqli_stmt_get_warnings|\ mysqli_stmt_init|mysqli_stmt_insert_id|mysqli_stmt_next_result|mysqli_stmt_num_rows|mysqli_stmt_param_count|mysqli_stmt_prepare|\ mysqli_stmt_reset|mysqli_stmt_result_metadata|mysqli_stmt_send_long_data|mysqli_stmt_sqlstate|mysqli_stmt_store_result|mysqli_store_result|\ mysqli_thread_id|mysqli_thread_safe|mysqli_use_result|mysqli_warning|mysqli_warning_count|mysqlnd_ms_get_stats|\ mysqlnd_ms_query_is_select|mysqlnd_ms_set_user_pick_server|mysqlnd_qc_change_handler|mysqlnd_qc_clear_cache|mysqlnd_qc_get_cache_info|\ mysqlnd_qc_get_core_stats|mysqlnd_qc_get_handler|mysqlnd_qc_get_query_trace_log|mysqlnd_qc_set_user_handlers|natcasesort|natsort|\ ncurses_addch|ncurses_addchnstr|ncurses_addchstr|ncurses_addnstr|ncurses_addstr|ncurses_assume_default_colors|ncurses_attroff|\ ncurses_attron|ncurses_attrset|ncurses_baudrate|ncurses_beep|ncurses_bkgd|ncurses_bkgdset|ncurses_border|ncurses_bottom_panel|\ ncurses_can_change_color|ncurses_cbreak|ncurses_clear|ncurses_clrtobot|ncurses_clrtoeol|ncurses_color_content|ncurses_color_set|\ ncurses_curs_set|ncurses_def_prog_mode|ncurses_def_shell_mode|ncurses_define_key|ncurses_del_panel|ncurses_delay_output|ncurses_delch|\ ncurses_deleteln|ncurses_delwin|ncurses_doupdate|ncurses_echo|ncurses_echochar|ncurses_end|ncurses_erase|ncurses_erasechar|ncurses_filter|\ ncurses_flash|ncurses_flushinp|ncurses_getch|ncurses_getmaxyx|ncurses_getmouse|ncurses_getyx|ncurses_halfdelay|ncurses_has_colors|\ ncurses_has_ic|ncurses_has_il|ncurses_has_key|ncurses_hide_panel|ncurses_hline|ncurses_inch|ncurses_init|ncurses_init_color|\ ncurses_init_pair|ncurses_insch|ncurses_insdelln|ncurses_insertln|ncurses_insstr|ncurses_instr|ncurses_isendwin|ncurses_keyok|\ ncurses_keypad|ncurses_killchar|ncurses_longname|ncurses_meta|ncurses_mouse_trafo|ncurses_mouseinterval|ncurses_mousemask|ncurses_move|\ ncurses_move_panel|ncurses_mvaddch|ncurses_mvaddchnstr|ncurses_mvaddchstr|ncurses_mvaddnstr|ncurses_mvaddstr|ncurses_mvcur|\ ncurses_mvdelch|ncurses_mvgetch|ncurses_mvhline|ncurses_mvinch|ncurses_mvvline|ncurses_mvwaddstr|ncurses_napms|ncurses_new_panel|\ ncurses_newpad|ncurses_newwin|ncurses_nl|ncurses_nocbreak|ncurses_noecho|ncurses_nonl|ncurses_noqiflush|ncurses_noraw|\ ncurses_pair_content|ncurses_panel_above|ncurses_panel_below|ncurses_panel_window|ncurses_pnoutrefresh|ncurses_prefresh|ncurses_putp|\ ncurses_qiflush|ncurses_raw|ncurses_refresh|ncurses_replace_panel|ncurses_reset_prog_mode|ncurses_reset_shell_mode|ncurses_resetty|\ ncurses_savetty|ncurses_scr_dump|ncurses_scr_init|ncurses_scr_restore|ncurses_scr_set|ncurses_scrl|ncurses_show_panel|ncurses_slk_attr|\ ncurses_slk_attroff|ncurses_slk_attron|ncurses_slk_attrset|ncurses_slk_clear|ncurses_slk_color|ncurses_slk_init|ncurses_slk_noutrefresh|\ ncurses_slk_refresh|ncurses_slk_restore|ncurses_slk_set|ncurses_slk_touch|ncurses_standend|ncurses_standout|ncurses_start_color|\ ncurses_termattrs|ncurses_termname|ncurses_timeout|ncurses_top_panel|ncurses_typeahead|ncurses_ungetch|ncurses_ungetmouse|\ ncurses_update_panels|ncurses_use_default_colors|ncurses_use_env|ncurses_use_extended_names|ncurses_vidattr|ncurses_vline|ncurses_waddch|\ ncurses_waddstr|ncurses_wattroff|ncurses_wattron|ncurses_wattrset|ncurses_wborder|ncurses_wclear|ncurses_wcolor_set|ncurses_werase|\ ncurses_wgetch|ncurses_whline|ncurses_wmouse_trafo|ncurses_wmove|ncurses_wnoutrefresh|ncurses_wrefresh|ncurses_wstandend|\ ncurses_wstandout|ncurses_wvline|newinstance|newinstanceargs|newt_bell|newt_button|newt_button_bar|newt_centered_window|newt_checkbox|\ newt_checkbox_get_value|newt_checkbox_set_flags|newt_checkbox_set_value|newt_checkbox_tree|newt_checkbox_tree_add_item|\ newt_checkbox_tree_find_item|newt_checkbox_tree_get_current|newt_checkbox_tree_get_entry_value|newt_checkbox_tree_get_multi_selection|\ newt_checkbox_tree_get_selection|newt_checkbox_tree_multi|newt_checkbox_tree_set_current|newt_checkbox_tree_set_entry|\ newt_checkbox_tree_set_entry_value|newt_checkbox_tree_set_width|newt_clear_key_buffer|newt_cls|newt_compact_button|\ newt_component_add_callback|newt_component_takes_focus|newt_create_grid|newt_cursor_off|newt_cursor_on|newt_delay|newt_draw_form|\ newt_draw_root_text|newt_entry|newt_entry_get_value|newt_entry_set|newt_entry_set_filter|newt_entry_set_flags|newt_finished|newt_form|\ newt_form_add_component|newt_form_add_components|newt_form_add_hot_key|newt_form_destroy|newt_form_get_current|newt_form_run|\ newt_form_set_background|newt_form_set_height|newt_form_set_size|newt_form_set_timer|newt_form_set_width|newt_form_watch_fd|\ newt_get_screen_size|newt_grid_add_components_to_form|newt_grid_basic_window|newt_grid_free|newt_grid_get_size|newt_grid_h_close_stacked|\ newt_grid_h_stacked|newt_grid_place|newt_grid_set_field|newt_grid_simple_window|newt_grid_v_close_stacked|newt_grid_v_stacked|\ newt_grid_wrapped_window|newt_grid_wrapped_window_at|newt_init|newt_label|newt_label_set_text|newt_listbox|newt_listbox_append_entry|\ newt_listbox_clear|newt_listbox_clear_selection|newt_listbox_delete_entry|newt_listbox_get_current|newt_listbox_get_selection|\ newt_listbox_insert_entry|newt_listbox_item_count|newt_listbox_select_item|newt_listbox_set_current|newt_listbox_set_current_by_key|\ newt_listbox_set_data|newt_listbox_set_entry|newt_listbox_set_width|newt_listitem|newt_listitem_get_data|newt_listitem_set|\ newt_open_window|newt_pop_help_line|newt_pop_window|newt_push_help_line|newt_radio_get_current|newt_radiobutton|newt_redraw_help_line|\ newt_reflow_text|newt_refresh|newt_resize_screen|newt_resume|newt_run_form|newt_scale|newt_scale_set|newt_scrollbar_set|\ newt_set_help_callback|newt_set_suspend_callback|newt_suspend|newt_textbox|newt_textbox_get_num_lines|newt_textbox_reflowed|\ newt_textbox_set_height|newt_textbox_set_text|newt_vertical_scrollbar|newt_wait_for_key|newt_win_choice|newt_win_entries|newt_win_menu|\ newt_win_message|newt_win_messagev|newt_win_ternary|next|ngettext|nl2br|nl_langinfo|norewinditerator|normalizer|notes_body|notes_copy_db|\ notes_create_db|notes_create_note|notes_drop_db|notes_find_note|notes_header_info|notes_list_msgs|notes_mark_read|notes_mark_unread|\ notes_nav_create|notes_search|notes_unread|notes_version|nsapi_request_headers|nsapi_response_headers|nsapi_virtual|nthmac|number_format|\ numberformatter|oauth|oauth_get_sbs|oauth_urlencode|oauthexception|oauthprovider|ob_clean|ob_deflatehandler|ob_end_clean|ob_end_flush|\ ob_etaghandler|ob_flush|ob_get_clean|ob_get_contents|ob_get_flush|ob_get_length|ob_get_level|ob_get_status|ob_gzhandler|ob_iconv_handler|\ ob_implicit_flush|ob_inflatehandler|ob_list_handlers|ob_start|ob_tidyhandler|oci_bind_array_by_name|oci_bind_by_name|oci_cancel|\ oci_client_version|oci_close|oci_collection_append|oci_collection_assign|oci_collection_element_assign|oci_collection_element_get|\ oci_collection_free|oci_collection_max|oci_collection_size|oci_collection_trim|oci_commit|oci_connect|oci_define_by_name|oci_error|\ oci_execute|oci_fetch|oci_fetch_all|oci_fetch_array|oci_fetch_assoc|oci_fetch_object|oci_fetch_row|oci_field_is_null|oci_field_name|\ oci_field_precision|oci_field_scale|oci_field_size|oci_field_type|oci_field_type_raw|oci_free_statement|oci_internal_debug|oci_lob_append|\ oci_lob_close|oci_lob_copy|oci_lob_eof|oci_lob_erase|oci_lob_export|oci_lob_flush|oci_lob_free|oci_lob_getbuffering|oci_lob_import|\ oci_lob_is_equal|oci_lob_load|oci_lob_read|oci_lob_rewind|oci_lob_save|oci_lob_savefile|oci_lob_seek|oci_lob_setbuffering|oci_lob_size|\ oci_lob_tell|oci_lob_truncate|oci_lob_write|oci_lob_writetemporary|oci_lob_writetofile|oci_new_collection|oci_new_connect|oci_new_cursor|\ oci_new_descriptor|oci_num_fields|oci_num_rows|oci_parse|oci_password_change|oci_pconnect|oci_result|oci_rollback|oci_server_version|\ oci_set_action|oci_set_client_identifier|oci_set_client_info|oci_set_edition|oci_set_module_name|oci_set_prefetch|oci_statement_type|\ ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|\ ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|\ ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|\ ociloadlob|ocilogoff|ocilogon|ocinewcollection|ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|\ ocirollback|ocirowcount|ocisavelob|ocisavelobfile|ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|\ octdec|odbc_autocommit|odbc_binmode|odbc_close|odbc_close_all|odbc_columnprivileges|odbc_columns|odbc_commit|odbc_connect|odbc_cursor|\ odbc_data_source|odbc_do|odbc_error|odbc_errormsg|odbc_exec|odbc_execute|odbc_fetch_array|odbc_fetch_into|odbc_fetch_object|\ odbc_fetch_row|odbc_field_len|odbc_field_name|odbc_field_num|odbc_field_precision|odbc_field_scale|odbc_field_type|odbc_foreignkeys|\ odbc_free_result|odbc_gettypeinfo|odbc_longreadlen|odbc_next_result|odbc_num_fields|odbc_num_rows|odbc_pconnect|odbc_prepare|\ odbc_primarykeys|odbc_procedurecolumns|odbc_procedures|odbc_result|odbc_result_all|odbc_rollback|odbc_setoption|odbc_specialcolumns|\ odbc_statistics|odbc_tableprivileges|odbc_tables|openal_buffer_create|openal_buffer_data|openal_buffer_destroy|openal_buffer_get|\ openal_buffer_loadwav|openal_context_create|openal_context_current|openal_context_destroy|openal_context_process|openal_context_suspend|\ openal_device_close|openal_device_open|openal_listener_get|openal_listener_set|openal_source_create|openal_source_destroy|\ openal_source_get|openal_source_pause|openal_source_play|openal_source_rewind|openal_source_set|openal_source_stop|openal_stream|opendir|\ openlog|openssl_cipher_iv_length|openssl_csr_export|openssl_csr_export_to_file|openssl_csr_get_public_key|openssl_csr_get_subject|\ openssl_csr_new|openssl_csr_sign|openssl_decrypt|openssl_dh_compute_key|openssl_digest|openssl_encrypt|openssl_error_string|\ openssl_free_key|openssl_get_cipher_methods|openssl_get_md_methods|openssl_get_privatekey|openssl_get_publickey|openssl_open|\ openssl_pkcs12_export|openssl_pkcs12_export_to_file|openssl_pkcs12_read|openssl_pkcs7_decrypt|openssl_pkcs7_encrypt|openssl_pkcs7_sign|\ openssl_pkcs7_verify|openssl_pkey_export|openssl_pkey_export_to_file|openssl_pkey_free|openssl_pkey_get_details|openssl_pkey_get_private|\ openssl_pkey_get_public|openssl_pkey_new|openssl_private_decrypt|openssl_private_encrypt|openssl_public_decrypt|openssl_public_encrypt|\ openssl_random_pseudo_bytes|openssl_seal|openssl_sign|openssl_verify|openssl_x509_check_private_key|openssl_x509_checkpurpose|\ openssl_x509_export|openssl_x509_export_to_file|openssl_x509_free|openssl_x509_parse|openssl_x509_read|ord|outeriterator|\ outofboundsexception|outofrangeexception|output_add_rewrite_var|output_reset_rewrite_vars|overflowexception|overload|override_function|\ ovrimos_close|ovrimos_commit|ovrimos_connect|ovrimos_cursor|ovrimos_exec|ovrimos_execute|ovrimos_fetch_into|ovrimos_fetch_row|\ ovrimos_field_len|ovrimos_field_name|ovrimos_field_num|ovrimos_field_type|ovrimos_free_result|ovrimos_longreadlen|ovrimos_num_fields|\ ovrimos_num_rows|ovrimos_prepare|ovrimos_result|ovrimos_result_all|ovrimos_rollback|pack|parentiterator|parse_ini_file|parse_ini_string|\ parse_str|parse_url|parsekit_compile_file|parsekit_compile_string|parsekit_func_arginfo|passthru|pathinfo|pclose|pcntl_alarm|pcntl_exec|\ pcntl_fork|pcntl_getpriority|pcntl_setpriority|pcntl_signal|pcntl_signal_dispatch|pcntl_sigprocmask|pcntl_sigtimedwait|pcntl_sigwaitinfo|\ pcntl_wait|pcntl_waitpid|pcntl_wexitstatus|pcntl_wifexited|pcntl_wifsignaled|pcntl_wifstopped|pcntl_wstopsig|pcntl_wtermsig|\ pdf_activate_item|pdf_add_annotation|pdf_add_bookmark|pdf_add_launchlink|pdf_add_locallink|pdf_add_nameddest|pdf_add_note|pdf_add_outline|\ pdf_add_pdflink|pdf_add_table_cell|pdf_add_textflow|pdf_add_thumbnail|pdf_add_weblink|pdf_arc|pdf_arcn|pdf_attach_file|pdf_begin_document|\ pdf_begin_font|pdf_begin_glyph|pdf_begin_item|pdf_begin_layer|pdf_begin_page|pdf_begin_page_ext|pdf_begin_pattern|pdf_begin_template|\ pdf_begin_template_ext|pdf_circle|pdf_clip|pdf_close|pdf_close_image|pdf_close_pdi|pdf_close_pdi_page|pdf_closepath|\ pdf_closepath_fill_stroke|pdf_closepath_stroke|pdf_concat|pdf_continue_text|pdf_create_3dview|pdf_create_action|pdf_create_annotation|\ pdf_create_bookmark|pdf_create_field|pdf_create_fieldgroup|pdf_create_gstate|pdf_create_pvf|pdf_create_textflow|pdf_curveto|\ pdf_define_layer|pdf_delete|pdf_delete_pvf|pdf_delete_table|pdf_delete_textflow|pdf_encoding_set_char|pdf_end_document|pdf_end_font|\ pdf_end_glyph|pdf_end_item|pdf_end_layer|pdf_end_page|pdf_end_page_ext|pdf_end_pattern|pdf_end_template|pdf_endpath|pdf_fill|\ pdf_fill_imageblock|pdf_fill_pdfblock|pdf_fill_stroke|pdf_fill_textblock|pdf_findfont|pdf_fit_image|pdf_fit_pdi_page|pdf_fit_table|\ pdf_fit_textflow|pdf_fit_textline|pdf_get_apiname|pdf_get_buffer|pdf_get_errmsg|pdf_get_errnum|pdf_get_font|pdf_get_fontname|\ pdf_get_fontsize|pdf_get_image_height|pdf_get_image_width|pdf_get_majorversion|pdf_get_minorversion|pdf_get_parameter|\ pdf_get_pdi_parameter|pdf_get_pdi_value|pdf_get_value|pdf_info_font|pdf_info_matchbox|pdf_info_table|pdf_info_textflow|pdf_info_textline|\ pdf_initgraphics|pdf_lineto|pdf_load_3ddata|pdf_load_font|pdf_load_iccprofile|pdf_load_image|pdf_makespotcolor|pdf_moveto|pdf_new|\ pdf_open_ccitt|pdf_open_file|pdf_open_gif|pdf_open_image|pdf_open_image_file|pdf_open_jpeg|pdf_open_memory_image|pdf_open_pdi|\ pdf_open_pdi_document|pdf_open_pdi_page|pdf_open_tiff|pdf_pcos_get_number|pdf_pcos_get_stream|pdf_pcos_get_string|pdf_place_image|\ pdf_place_pdi_page|pdf_process_pdi|pdf_rect|pdf_restore|pdf_resume_page|pdf_rotate|pdf_save|pdf_scale|pdf_set_border_color|\ pdf_set_border_dash|pdf_set_border_style|pdf_set_char_spacing|pdf_set_duration|pdf_set_gstate|pdf_set_horiz_scaling|pdf_set_info|\ pdf_set_info_author|pdf_set_info_creator|pdf_set_info_keywords|pdf_set_info_subject|pdf_set_info_title|pdf_set_layer_dependency|\ pdf_set_leading|pdf_set_parameter|pdf_set_text_matrix|pdf_set_text_pos|pdf_set_text_rendering|pdf_set_text_rise|pdf_set_value|\ pdf_set_word_spacing|pdf_setcolor|pdf_setdash|pdf_setdashpattern|pdf_setflat|pdf_setfont|pdf_setgray|pdf_setgray_fill|pdf_setgray_stroke|\ pdf_setlinecap|pdf_setlinejoin|pdf_setlinewidth|pdf_setmatrix|pdf_setmiterlimit|pdf_setpolydash|pdf_setrgbcolor|pdf_setrgbcolor_fill|\ pdf_setrgbcolor_stroke|pdf_shading|pdf_shading_pattern|pdf_shfill|pdf_show|pdf_show_boxed|pdf_show_xy|pdf_skew|pdf_stringwidth|pdf_stroke|\ pdf_suspend_page|pdf_translate|pdf_utf16_to_utf8|pdf_utf32_to_utf16|pdf_utf8_to_utf16|pdo|pdo_cubrid_schema|pdo_pgsqllobcreate|\ pdo_pgsqllobopen|pdo_pgsqllobunlink|pdo_sqlitecreateaggregate|pdo_sqlitecreatefunction|pdoexception|pdostatement|pfsockopen|\ pg_affected_rows|pg_cancel_query|pg_client_encoding|pg_close|pg_connect|pg_connection_busy|pg_connection_reset|pg_connection_status|\ pg_convert|pg_copy_from|pg_copy_to|pg_dbname|pg_delete|pg_end_copy|pg_escape_bytea|pg_escape_string|pg_execute|pg_fetch_all|\ pg_fetch_all_columns|pg_fetch_array|pg_fetch_assoc|pg_fetch_object|pg_fetch_result|pg_fetch_row|pg_field_is_null|pg_field_name|\ pg_field_num|pg_field_prtlen|pg_field_size|pg_field_table|pg_field_type|pg_field_type_oid|pg_free_result|pg_get_notify|pg_get_pid|\ pg_get_result|pg_host|pg_insert|pg_last_error|pg_last_notice|pg_last_oid|pg_lo_close|pg_lo_create|pg_lo_export|pg_lo_import|pg_lo_open|\ pg_lo_read|pg_lo_read_all|pg_lo_seek|pg_lo_tell|pg_lo_unlink|pg_lo_write|pg_meta_data|pg_num_fields|pg_num_rows|pg_options|\ pg_parameter_status|pg_pconnect|pg_ping|pg_port|pg_prepare|pg_put_line|pg_query|pg_query_params|pg_result_error|pg_result_error_field|\ pg_result_seek|pg_result_status|pg_select|pg_send_execute|pg_send_prepare|pg_send_query|pg_send_query_params|pg_set_client_encoding|\ pg_set_error_verbosity|pg_trace|pg_transaction_status|pg_tty|pg_unescape_bytea|pg_untrace|pg_update|pg_version|php_check_syntax|\ php_ini_loaded_file|php_ini_scanned_files|php_logo_guid|php_sapi_name|php_strip_whitespace|php_uname|phpcredits|phpinfo|phpversion|pi|\ png2wbmp|popen|pos|posix_access|posix_ctermid|posix_errno|posix_get_last_error|posix_getcwd|posix_getegid|posix_geteuid|posix_getgid|\ posix_getgrgid|posix_getgrnam|posix_getgroups|posix_getlogin|posix_getpgid|posix_getpgrp|posix_getpid|posix_getppid|posix_getpwnam|\ posix_getpwuid|posix_getrlimit|posix_getsid|posix_getuid|posix_initgroups|posix_isatty|posix_kill|posix_mkfifo|posix_mknod|posix_setegid|\ posix_seteuid|posix_setgid|posix_setpgid|posix_setsid|posix_setuid|posix_strerror|posix_times|posix_ttyname|posix_uname|pow|preg_filter|\ preg_grep|preg_last_error|preg_match|preg_match_all|preg_quote|preg_replace|preg_replace_callback|preg_split|prev|print|print_r|\ printer_abort|printer_close|printer_create_brush|printer_create_dc|printer_create_font|printer_create_pen|printer_delete_brush|\ printer_delete_dc|printer_delete_font|printer_delete_pen|printer_draw_bmp|printer_draw_chord|printer_draw_elipse|printer_draw_line|\ printer_draw_pie|printer_draw_rectangle|printer_draw_roundrect|printer_draw_text|printer_end_doc|printer_end_page|printer_get_option|\ printer_list|printer_logical_fontheight|printer_open|printer_select_brush|printer_select_font|printer_select_pen|printer_set_option|\ printer_start_doc|printer_start_page|printer_write|printf|proc_close|proc_get_status|proc_nice|proc_open|proc_terminate|property_exists|\ ps_add_bookmark|ps_add_launchlink|ps_add_locallink|ps_add_note|ps_add_pdflink|ps_add_weblink|ps_arc|ps_arcn|ps_begin_page|\ ps_begin_pattern|ps_begin_template|ps_circle|ps_clip|ps_close|ps_close_image|ps_closepath|ps_closepath_stroke|ps_continue_text|ps_curveto|\ ps_delete|ps_end_page|ps_end_pattern|ps_end_template|ps_fill|ps_fill_stroke|ps_findfont|ps_get_buffer|ps_get_parameter|ps_get_value|\ ps_hyphenate|ps_include_file|ps_lineto|ps_makespotcolor|ps_moveto|ps_new|ps_open_file|ps_open_image|ps_open_image_file|\ ps_open_memory_image|ps_place_image|ps_rect|ps_restore|ps_rotate|ps_save|ps_scale|ps_set_border_color|ps_set_border_dash|\ ps_set_border_style|ps_set_info|ps_set_parameter|ps_set_text_pos|ps_set_value|ps_setcolor|ps_setdash|ps_setflat|ps_setfont|ps_setgray|\ ps_setlinecap|ps_setlinejoin|ps_setlinewidth|ps_setmiterlimit|ps_setoverprintmode|ps_setpolydash|ps_shading|ps_shading_pattern|ps_shfill|\ ps_show|ps_show2|ps_show_boxed|ps_show_xy|ps_show_xy2|ps_string_geometry|ps_stringwidth|ps_stroke|ps_symbol|ps_symbol_name|\ ps_symbol_width|ps_translate|pspell_add_to_personal|pspell_add_to_session|pspell_check|pspell_clear_session|pspell_config_create|\ pspell_config_data_dir|pspell_config_dict_dir|pspell_config_ignore|pspell_config_mode|pspell_config_personal|pspell_config_repl|\ pspell_config_runtogether|pspell_config_save_repl|pspell_new|pspell_new_config|pspell_new_personal|pspell_save_wordlist|\ pspell_store_replacement|pspell_suggest|putenv|px_close|px_create_fp|px_date2string|px_delete|px_delete_record|px_get_field|px_get_info|\ px_get_parameter|px_get_record|px_get_schema|px_get_value|px_insert_record|px_new|px_numfields|px_numrecords|px_open_fp|px_put_record|\ px_retrieve_record|px_set_blob_file|px_set_parameter|px_set_tablename|px_set_targetencoding|px_set_value|px_timestamp2string|\ px_update_record|qdom_error|qdom_tree|quoted_printable_decode|quoted_printable_encode|quotemeta|rad2deg|radius_acct_open|\ radius_add_server|radius_auth_open|radius_close|radius_config|radius_create_request|radius_cvt_addr|radius_cvt_int|radius_cvt_string|\ radius_demangle|radius_demangle_mppe_key|radius_get_attr|radius_get_vendor_attr|radius_put_addr|radius_put_attr|radius_put_int|\ radius_put_string|radius_put_vendor_addr|radius_put_vendor_attr|radius_put_vendor_int|radius_put_vendor_string|\ radius_request_authenticator|radius_send_request|radius_server_secret|radius_strerror|rand|range|rangeexception|rar_wrapper_cache_stats|\ rararchive|rarentry|rarexception|rawurldecode|rawurlencode|read_exif_data|readdir|readfile|readgzfile|readline|readline_add_history|\ readline_callback_handler_install|readline_callback_handler_remove|readline_callback_read_char|readline_clear_history|\ readline_completion_function|readline_info|readline_list_history|readline_on_new_line|readline_read_history|readline_redisplay|\ readline_write_history|readlink|realpath|realpath_cache_get|realpath_cache_size|recode|recode_file|recode_string|recursivearrayiterator|\ recursivecachingiterator|recursivecallbackfilteriterator|recursivedirectoryiterator|recursivefilteriterator|recursiveiterator|\ recursiveiteratoriterator|recursiveregexiterator|recursivetreeiterator|reflection|reflectionclass|reflectionexception|reflectionextension|\ reflectionfunction|reflectionfunctionabstract|reflectionmethod|reflectionobject|reflectionparameter|reflectionproperty|reflector|\ regexiterator|register_shutdown_function|register_tick_function|rename|rename_function|require|require_once|reset|resetValue|\ resourcebundle|restore_error_handler|restore_exception_handler|restore_include_path|return|rewind|rewinddir|rmdir|round|rpm_close|\ rpm_get_tag|rpm_is_valid|rpm_open|rpm_version|rrd_create|rrd_error|rrd_fetch|rrd_first|rrd_graph|rrd_info|rrd_last|rrd_lastupdate|\ rrd_restore|rrd_tune|rrd_update|rrd_xport|rrdcreator|rrdgraph|rrdupdater|rsort|rtrim|runkit_class_adopt|runkit_class_emancipate|\ runkit_constant_add|runkit_constant_redefine|runkit_constant_remove|runkit_function_add|runkit_function_copy|runkit_function_redefine|\ runkit_function_remove|runkit_function_rename|runkit_import|runkit_lint|runkit_lint_file|runkit_method_add|runkit_method_copy|\ runkit_method_redefine|runkit_method_remove|runkit_method_rename|runkit_return_value_used|runkit_sandbox_output_handler|\ runkit_superglobals|runtimeexception|samconnection_commit|samconnection_connect|samconnection_constructor|samconnection_disconnect|\ samconnection_errno|samconnection_error|samconnection_isconnected|samconnection_peek|samconnection_peekall|samconnection_receive|\ samconnection_remove|samconnection_rollback|samconnection_send|samconnection_setDebug|samconnection_subscribe|samconnection_unsubscribe|\ sammessage_body|sammessage_constructor|sammessage_header|sca_createdataobject|sca_getservice|sca_localproxy_createdataobject|\ sca_soapproxy_createdataobject|scandir|sdo_das_changesummary_beginlogging|sdo_das_changesummary_endlogging|\ sdo_das_changesummary_getchangeddataobjects|sdo_das_changesummary_getchangetype|sdo_das_changesummary_getoldcontainer|\ sdo_das_changesummary_getoldvalues|sdo_das_changesummary_islogging|sdo_das_datafactory_addpropertytotype|sdo_das_datafactory_addtype|\ sdo_das_datafactory_getdatafactory|sdo_das_dataobject_getchangesummary|sdo_das_relational_applychanges|sdo_das_relational_construct|\ sdo_das_relational_createrootdataobject|sdo_das_relational_executepreparedquery|sdo_das_relational_executequery|\ sdo_das_setting_getlistindex|sdo_das_setting_getpropertyindex|sdo_das_setting_getpropertyname|sdo_das_setting_getvalue|\ sdo_das_setting_isset|sdo_das_xml_addtypes|sdo_das_xml_create|sdo_das_xml_createdataobject|sdo_das_xml_createdocument|\ sdo_das_xml_document_getrootdataobject|sdo_das_xml_document_getrootelementname|sdo_das_xml_document_getrootelementuri|\ sdo_das_xml_document_setencoding|sdo_das_xml_document_setxmldeclaration|sdo_das_xml_document_setxmlversion|sdo_das_xml_loadfile|\ sdo_das_xml_loadstring|sdo_das_xml_savefile|sdo_das_xml_savestring|sdo_datafactory_create|sdo_dataobject_clear|\ sdo_dataobject_createdataobject|sdo_dataobject_getcontainer|sdo_dataobject_getsequence|sdo_dataobject_gettypename|\ sdo_dataobject_gettypenamespaceuri|sdo_exception_getcause|sdo_list_insert|sdo_model_property_getcontainingtype|\ sdo_model_property_getdefault|sdo_model_property_getname|sdo_model_property_gettype|sdo_model_property_iscontainment|\ sdo_model_property_ismany|sdo_model_reflectiondataobject_construct|sdo_model_reflectiondataobject_export|\ sdo_model_reflectiondataobject_getcontainmentproperty|sdo_model_reflectiondataobject_getinstanceproperties|\ sdo_model_reflectiondataobject_gettype|sdo_model_type_getbasetype|sdo_model_type_getname|sdo_model_type_getnamespaceuri|\ sdo_model_type_getproperties|sdo_model_type_getproperty|sdo_model_type_isabstracttype|sdo_model_type_isdatatype|sdo_model_type_isinstance|\ sdo_model_type_isopentype|sdo_model_type_issequencedtype|sdo_sequence_getproperty|sdo_sequence_insert|sdo_sequence_move|seekableiterator|\ sem_acquire|sem_get|sem_release|sem_remove|serializable|serialize|session_cache_expire|session_cache_limiter|session_commit|\ session_decode|session_destroy|session_encode|session_get_cookie_params|session_id|session_is_registered|session_module_name|session_name|\ session_pgsql_add_error|session_pgsql_get_error|session_pgsql_get_field|session_pgsql_reset|session_pgsql_set_field|session_pgsql_status|\ session_regenerate_id|session_register|session_save_path|session_set_cookie_params|session_set_save_handler|session_start|\ session_unregister|session_unset|session_write_close|setCounterClass|set_error_handler|set_exception_handler|set_file_buffer|\ set_include_path|set_magic_quotes_runtime|set_socket_blocking|set_time_limit|setcookie|setlocale|setproctitle|setrawcookie|\ setstaticpropertyvalue|setthreadtitle|settype|sha1|sha1_file|shell_exec|shm_attach|shm_detach|shm_get_var|shm_has_var|shm_put_var|\ shm_remove|shm_remove_var|shmop_close|shmop_delete|shmop_open|shmop_read|shmop_size|shmop_write|show_source|shuffle|signeurlpaiement|\ similar_text|simplexml_import_dom|simplexml_load_file|simplexml_load_string|simplexmlelement|simplexmliterator|sin|sinh|sizeof|sleep|snmp|\ snmp2_get|snmp2_getnext|snmp2_real_walk|snmp2_set|snmp2_walk|snmp3_get|snmp3_getnext|snmp3_real_walk|snmp3_set|snmp3_walk|\ snmp_get_quick_print|snmp_get_valueretrieval|snmp_read_mib|snmp_set_enum_print|snmp_set_oid_numeric_print|snmp_set_oid_output_format|\ snmp_set_quick_print|snmp_set_valueretrieval|snmpget|snmpgetnext|snmprealwalk|snmpset|snmpwalk|snmpwalkoid|soapclient|soapfault|\ soapheader|soapparam|soapserver|soapvar|socket_accept|socket_bind|socket_clear_error|socket_close|socket_connect|socket_create|\ socket_create_listen|socket_create_pair|socket_get_option|socket_get_status|socket_getpeername|socket_getsockname|socket_last_error|\ socket_listen|socket_read|socket_recv|socket_recvfrom|socket_select|socket_send|socket_sendto|socket_set_block|socket_set_blocking|\ socket_set_nonblock|socket_set_option|socket_set_timeout|socket_shutdown|socket_strerror|socket_write|solr_get_version|solrclient|\ solrclientexception|solrdocument|solrdocumentfield|solrexception|solrgenericresponse|solrillegalargumentexception|\ solrillegaloperationexception|solrinputdocument|solrmodifiableparams|solrobject|solrparams|solrpingresponse|solrquery|solrqueryresponse|\ solrresponse|solrupdateresponse|solrutils|sort|soundex|sphinxclient|spl_autoload|spl_autoload_call|spl_autoload_extensions|\ spl_autoload_functions|spl_autoload_register|spl_autoload_unregister|spl_classes|spl_object_hash|splbool|spldoublylinkedlist|splenum|\ splfileinfo|splfileobject|splfixedarray|splfloat|splheap|splint|split|spliti|splmaxheap|splminheap|splobjectstorage|splobserver|\ splpriorityqueue|splqueue|splstack|splstring|splsubject|spltempfileobject|spoofchecker|sprintf|sql_regcase|sqlite3|sqlite3result|\ sqlite3stmt|sqlite_array_query|sqlite_busy_timeout|sqlite_changes|sqlite_close|sqlite_column|sqlite_create_aggregate|\ sqlite_create_function|sqlite_current|sqlite_error_string|sqlite_escape_string|sqlite_exec|sqlite_factory|sqlite_fetch_all|\ sqlite_fetch_array|sqlite_fetch_column_types|sqlite_fetch_object|sqlite_fetch_single|sqlite_fetch_string|sqlite_field_name|\ sqlite_has_more|sqlite_has_prev|sqlite_key|sqlite_last_error|sqlite_last_insert_rowid|sqlite_libencoding|sqlite_libversion|sqlite_next|\ sqlite_num_fields|sqlite_num_rows|sqlite_open|sqlite_popen|sqlite_prev|sqlite_query|sqlite_rewind|sqlite_seek|sqlite_single_query|\ sqlite_udf_decode_binary|sqlite_udf_encode_binary|sqlite_unbuffered_query|sqlite_valid|sqrt|srand|sscanf|ssdeep_fuzzy_compare|\ ssdeep_fuzzy_hash|ssdeep_fuzzy_hash_filename|ssh2_auth_hostbased_file|ssh2_auth_none|ssh2_auth_password|ssh2_auth_pubkey_file|\ ssh2_connect|ssh2_exec|ssh2_fetch_stream|ssh2_fingerprint|ssh2_methods_negotiated|ssh2_publickey_add|ssh2_publickey_init|\ ssh2_publickey_list|ssh2_publickey_remove|ssh2_scp_recv|ssh2_scp_send|ssh2_sftp|ssh2_sftp_lstat|ssh2_sftp_mkdir|ssh2_sftp_readlink|\ ssh2_sftp_realpath|ssh2_sftp_rename|ssh2_sftp_rmdir|ssh2_sftp_stat|ssh2_sftp_symlink|ssh2_sftp_unlink|ssh2_shell|ssh2_tunnel|stat|\ stats_absolute_deviation|stats_cdf_beta|stats_cdf_binomial|stats_cdf_cauchy|stats_cdf_chisquare|stats_cdf_exponential|stats_cdf_f|\ stats_cdf_gamma|stats_cdf_laplace|stats_cdf_logistic|stats_cdf_negative_binomial|stats_cdf_noncentral_chisquare|stats_cdf_noncentral_f|\ stats_cdf_poisson|stats_cdf_t|stats_cdf_uniform|stats_cdf_weibull|stats_covariance|stats_den_uniform|stats_dens_beta|stats_dens_cauchy|\ stats_dens_chisquare|stats_dens_exponential|stats_dens_f|stats_dens_gamma|stats_dens_laplace|stats_dens_logistic|\ stats_dens_negative_binomial|stats_dens_normal|stats_dens_pmf_binomial|stats_dens_pmf_hypergeometric|stats_dens_pmf_poisson|stats_dens_t|\ stats_dens_weibull|stats_harmonic_mean|stats_kurtosis|stats_rand_gen_beta|stats_rand_gen_chisquare|stats_rand_gen_exponential|\ stats_rand_gen_f|stats_rand_gen_funiform|stats_rand_gen_gamma|stats_rand_gen_ibinomial|stats_rand_gen_ibinomial_negative|\ stats_rand_gen_int|stats_rand_gen_ipoisson|stats_rand_gen_iuniform|stats_rand_gen_noncenral_chisquare|stats_rand_gen_noncentral_f|\ stats_rand_gen_noncentral_t|stats_rand_gen_normal|stats_rand_gen_t|stats_rand_get_seeds|stats_rand_phrase_to_seeds|stats_rand_ranf|\ stats_rand_setall|stats_skew|stats_standard_deviation|stats_stat_binomial_coef|stats_stat_correlation|stats_stat_gennch|\ stats_stat_independent_t|stats_stat_innerproduct|stats_stat_noncentral_t|stats_stat_paired_t|stats_stat_percentile|stats_stat_powersum|\ stats_variance|stomp|stomp_connect_error|stomp_version|stompexception|stompframe|str_getcsv|str_ireplace|str_pad|str_repeat|str_replace|\ str_rot13|str_shuffle|str_split|str_word_count|strcasecmp|strchr|strcmp|strcoll|strcspn|stream_bucket_append|stream_bucket_make_writeable|\ stream_bucket_new|stream_bucket_prepend|stream_context_create|stream_context_get_default|stream_context_get_options|\ stream_context_get_params|stream_context_set_default|stream_context_set_option|stream_context_set_params|stream_copy_to_stream|\ stream_encoding|stream_filter_append|stream_filter_prepend|stream_filter_register|stream_filter_remove|stream_get_contents|\ stream_get_filters|stream_get_line|stream_get_meta_data|stream_get_transports|stream_get_wrappers|stream_is_local|\ stream_notification_callback|stream_register_wrapper|stream_resolve_include_path|stream_select|stream_set_blocking|stream_set_read_buffer|\ stream_set_timeout|stream_set_write_buffer|stream_socket_accept|stream_socket_client|stream_socket_enable_crypto|stream_socket_get_name|\ stream_socket_pair|stream_socket_recvfrom|stream_socket_sendto|stream_socket_server|stream_socket_shutdown|stream_supports_lock|\ stream_wrapper_register|stream_wrapper_restore|stream_wrapper_unregister|streamwrapper|strftime|strip_tags|stripcslashes|stripos|\ stripslashes|stristr|strlen|strnatcasecmp|strnatcmp|strncasecmp|strncmp|strpbrk|strpos|strptime|strrchr|strrev|strripos|strrpos|strspn|\ strstr|strtok|strtolower|strtotime|strtoupper|strtr|strval|substr|substr_compare|substr_count|substr_replace|svm|svmmodel|svn_add|\ svn_auth_get_parameter|svn_auth_set_parameter|svn_blame|svn_cat|svn_checkout|svn_cleanup|svn_client_version|svn_commit|svn_delete|\ svn_diff|svn_export|svn_fs_abort_txn|svn_fs_apply_text|svn_fs_begin_txn2|svn_fs_change_node_prop|svn_fs_check_path|\ svn_fs_contents_changed|svn_fs_copy|svn_fs_delete|svn_fs_dir_entries|svn_fs_file_contents|svn_fs_file_length|svn_fs_is_dir|svn_fs_is_file|\ svn_fs_make_dir|svn_fs_make_file|svn_fs_node_created_rev|svn_fs_node_prop|svn_fs_props_changed|svn_fs_revision_prop|svn_fs_revision_root|\ svn_fs_txn_root|svn_fs_youngest_rev|svn_import|svn_log|svn_ls|svn_mkdir|svn_repos_create|svn_repos_fs|svn_repos_fs_begin_txn_for_commit|\ svn_repos_fs_commit_txn|svn_repos_hotcopy|svn_repos_open|svn_repos_recover|svn_revert|svn_status|svn_update|swf_actiongeturl|\ swf_actiongotoframe|swf_actiongotolabel|swf_actionnextframe|swf_actionplay|swf_actionprevframe|swf_actionsettarget|swf_actionstop|\ swf_actiontogglequality|swf_actionwaitforframe|swf_addbuttonrecord|swf_addcolor|swf_closefile|swf_definebitmap|swf_definefont|\ swf_defineline|swf_definepoly|swf_definerect|swf_definetext|swf_endbutton|swf_enddoaction|swf_endshape|swf_endsymbol|swf_fontsize|\ swf_fontslant|swf_fonttracking|swf_getbitmapinfo|swf_getfontinfo|swf_getframe|swf_labelframe|swf_lookat|swf_modifyobject|swf_mulcolor|\ swf_nextid|swf_oncondition|swf_openfile|swf_ortho|swf_ortho2|swf_perspective|swf_placeobject|swf_polarview|swf_popmatrix|swf_posround|\ swf_pushmatrix|swf_removeobject|swf_rotate|swf_scale|swf_setfont|swf_setframe|swf_shapearc|swf_shapecurveto|swf_shapecurveto3|\ swf_shapefillbitmapclip|swf_shapefillbitmaptile|swf_shapefilloff|swf_shapefillsolid|swf_shapelinesolid|swf_shapelineto|swf_shapemoveto|\ swf_showframe|swf_startbutton|swf_startdoaction|swf_startshape|swf_startsymbol|swf_textwidth|swf_translate|swf_viewport|swfaction|\ swfbitmap|swfbutton|swfdisplayitem|swffill|swffont|swffontchar|swfgradient|swfmorph|swfmovie|swfprebuiltclip|swfshape|swfsound|\ swfsoundinstance|swfsprite|swftext|swftextfield|swfvideostream|swish_construct|swish_getmetalist|swish_getpropertylist|swish_prepare|\ swish_query|swishresult_getmetalist|swishresult_stem|swishresults_getparsedwords|swishresults_getremovedstopwords|swishresults_nextresult|\ swishresults_seekresult|swishsearch_execute|swishsearch_resetlimit|swishsearch_setlimit|swishsearch_setphrasedelimiter|\ swishsearch_setsort|swishsearch_setstructure|sybase_affected_rows|sybase_close|sybase_connect|sybase_data_seek|\ sybase_deadlock_retry_count|sybase_fetch_array|sybase_fetch_assoc|sybase_fetch_field|sybase_fetch_object|sybase_fetch_row|\ sybase_field_seek|sybase_free_result|sybase_get_last_message|sybase_min_client_severity|sybase_min_error_severity|\ sybase_min_message_severity|sybase_min_server_severity|sybase_num_fields|sybase_num_rows|sybase_pconnect|sybase_query|sybase_result|\ sybase_select_db|sybase_set_message_handler|sybase_unbuffered_query|symlink|sys_get_temp_dir|sys_getloadavg|syslog|system|tag|tan|tanh|\ tcpwrap_check|tempnam|textdomain|tidy|tidy_access_count|tidy_config_count|tidy_diagnose|tidy_error_count|tidy_get_error_buffer|\ tidy_get_output|tidy_load_config|tidy_reset_config|tidy_save_config|tidy_set_encoding|tidy_setopt|tidy_warning_count|tidynode|time|\ time_nanosleep|time_sleep_until|timezone_abbreviations_list|timezone_identifiers_list|timezone_location_get|timezone_name_from_abbr|\ timezone_name_get|timezone_offset_get|timezone_open|timezone_transitions_get|timezone_version_get|tmpfile|token_get_all|token_name|\ tokyotyrant|tokyotyrantquery|tokyotyranttable|tostring|tostring|touch|trait_exists|transliterator|traversable|trigger_error|trim|uasort|ucfirst|\ ucwords|udm_add_search_limit|udm_alloc_agent|udm_alloc_agent_array|udm_api_version|udm_cat_list|udm_cat_path|udm_check_charset|\ udm_check_stored|udm_clear_search_limits|udm_close_stored|udm_crc32|udm_errno|udm_error|udm_find|udm_free_agent|udm_free_ispell_data|\ udm_free_res|udm_get_doc_count|udm_get_res_field|udm_get_res_param|udm_hash32|udm_load_ispell_data|udm_open_stored|udm_set_agent_param|\ uksort|umask|underflowexception|unexpectedvalueexception|uniqid|unixtojd|unlink|unpack|unregister_tick_function|unserialize|unset|\ urldecode|urlencode|use_soap_error_handler|user_error|usleep|usort|utf8_decode|utf8_encode|v8js|v8jsexception|var_dump|var_export|variant|\ variant_abs|variant_add|variant_and|variant_cast|variant_cat|variant_cmp|variant_date_from_timestamp|variant_date_to_timestamp|\ variant_div|variant_eqv|variant_fix|variant_get_type|variant_idiv|variant_imp|variant_int|variant_mod|variant_mul|variant_neg|variant_not|\ variant_or|variant_pow|variant_round|variant_set|variant_set_type|variant_sub|variant_xor|version_compare|vfprintf|virtual|\ vpopmail_add_alias_domain|vpopmail_add_alias_domain_ex|vpopmail_add_domain|vpopmail_add_domain_ex|vpopmail_add_user|vpopmail_alias_add|\ vpopmail_alias_del|vpopmail_alias_del_domain|vpopmail_alias_get|vpopmail_alias_get_all|vpopmail_auth_user|vpopmail_del_domain|\ vpopmail_del_domain_ex|vpopmail_del_user|vpopmail_error|vpopmail_passwd|vpopmail_set_user_quota|vprintf|vsprintf|w32api_deftype|\ w32api_init_dtype|w32api_invoke_function|w32api_register_function|w32api_set_call_method|wddx_add_vars|wddx_deserialize|wddx_packet_end|\ wddx_packet_start|wddx_serialize_value|wddx_serialize_vars|win32_continue_service|win32_create_service|win32_delete_service|\ win32_get_last_control_message|win32_pause_service|win32_ps_list_procs|win32_ps_stat_mem|win32_ps_stat_proc|win32_query_service_status|\ win32_set_service_status|win32_start_service|win32_start_service_ctrl_dispatcher|win32_stop_service|wincache_fcache_fileinfo|\ wincache_fcache_meminfo|wincache_lock|wincache_ocache_fileinfo|wincache_ocache_meminfo|wincache_refresh_if_changed|\ wincache_rplist_fileinfo|wincache_rplist_meminfo|wincache_scache_info|wincache_scache_meminfo|wincache_ucache_add|wincache_ucache_cas|\ wincache_ucache_clear|wincache_ucache_dec|wincache_ucache_delete|wincache_ucache_exists|wincache_ucache_get|wincache_ucache_inc|\ wincache_ucache_info|wincache_ucache_meminfo|wincache_ucache_set|wincache_unlock|wordwrap|xattr_get|xattr_list|xattr_remove|xattr_set|\ xattr_supported|xdiff_file_bdiff|xdiff_file_bdiff_size|xdiff_file_bpatch|xdiff_file_diff|xdiff_file_diff_binary|xdiff_file_merge3|\ xdiff_file_patch|xdiff_file_patch_binary|xdiff_file_rabdiff|xdiff_string_bdiff|xdiff_string_bdiff_size|xdiff_string_bpatch|\ xdiff_string_diff|xdiff_string_diff_binary|xdiff_string_merge3|xdiff_string_patch|xdiff_string_patch_binary|xdiff_string_rabdiff|\ xhprof_disable|xhprof_enable|xhprof_sample_disable|xhprof_sample_enable|xml_error_string|xml_get_current_byte_index|\ xml_get_current_column_number|xml_get_current_line_number|xml_get_error_code|xml_parse|xml_parse_into_struct|xml_parser_create|\ xml_parser_create_ns|xml_parser_free|xml_parser_get_option|xml_parser_set_option|xml_set_character_data_handler|xml_set_default_handler|\ xml_set_element_handler|xml_set_end_namespace_decl_handler|xml_set_external_entity_ref_handler|xml_set_notation_decl_handler|\ xml_set_object|xml_set_processing_instruction_handler|xml_set_start_namespace_decl_handler|xml_set_unparsed_entity_decl_handler|xmlreader|\ xmlrpc_decode|xmlrpc_decode_request|xmlrpc_encode|xmlrpc_encode_request|xmlrpc_get_type|xmlrpc_is_fault|xmlrpc_parse_method_descriptions|\ xmlrpc_server_add_introspection_data|xmlrpc_server_call_method|xmlrpc_server_create|xmlrpc_server_destroy|\ xmlrpc_server_register_introspection_callback|xmlrpc_server_register_method|xmlrpc_set_type|xmlwriter_end_attribute|xmlwriter_end_cdata|\ xmlwriter_end_comment|xmlwriter_end_document|xmlwriter_end_dtd|xmlwriter_end_dtd_attlist|xmlwriter_end_dtd_element|\ xmlwriter_end_dtd_entity|xmlwriter_end_element|xmlwriter_end_pi|xmlwriter_flush|xmlwriter_full_end_element|xmlwriter_open_memory|\ xmlwriter_open_uri|xmlwriter_output_memory|xmlwriter_set_indent|xmlwriter_set_indent_string|xmlwriter_start_attribute|\ xmlwriter_start_attribute_ns|xmlwriter_start_cdata|xmlwriter_start_comment|xmlwriter_start_document|xmlwriter_start_dtd|\ xmlwriter_start_dtd_attlist|xmlwriter_start_dtd_element|xmlwriter_start_dtd_entity|xmlwriter_start_element|xmlwriter_start_element_ns|\ xmlwriter_start_pi|xmlwriter_text|xmlwriter_write_attribute|xmlwriter_write_attribute_ns|xmlwriter_write_cdata|xmlwriter_write_comment|\ xmlwriter_write_dtd|xmlwriter_write_dtd_attlist|xmlwriter_write_dtd_element|xmlwriter_write_dtd_entity|xmlwriter_write_element|\ xmlwriter_write_element_ns|xmlwriter_write_pi|xmlwriter_write_raw|xpath_eval|xpath_eval_expression|xpath_new_context|xpath_register_ns|\ xpath_register_ns_auto|xptr_eval|xptr_new_context|xslt_backend_info|xslt_backend_name|xslt_backend_version|xslt_create|xslt_errno|\ xslt_error|xslt_free|xslt_getopt|xslt_process|xslt_set_base|xslt_set_encoding|xslt_set_error_handler|xslt_set_log|xslt_set_object|\ xslt_set_sax_handler|xslt_set_sax_handlers|xslt_set_scheme_handler|xslt_set_scheme_handlers|xslt_setopt|xsltprocessor|yaml_emit|\ yaml_emit_file|yaml_parse|yaml_parse_file|yaml_parse_url|yaz_addinfo|yaz_ccl_conf|yaz_ccl_parse|yaz_close|yaz_connect|yaz_database|\ yaz_element|yaz_errno|yaz_error|yaz_es|yaz_es_result|yaz_get_option|yaz_hits|yaz_itemorder|yaz_present|yaz_range|yaz_record|yaz_scan|\ yaz_scan_result|yaz_schema|yaz_search|yaz_set_option|yaz_sort|yaz_syntax|yaz_wait|yp_all|yp_cat|yp_err_string|yp_errno|yp_first|\ yp_get_default_domain|yp_master|yp_match|yp_next|yp_order|zend_logo_guid|zend_thread_id|zend_version|zip_close|zip_entry_close|\ zip_entry_compressedsize|zip_entry_compressionmethod|zip_entry_filesize|zip_entry_name|zip_entry_open|zip_entry_read|zip_open|zip_read|\ ziparchive|ziparchive_addemptydir|ziparchive_addfile|ziparchive_addfromstring|ziparchive_close|ziparchive_deleteindex|\ ziparchive_deletename|ziparchive_extractto|ziparchive_getarchivecomment|ziparchive_getcommentindex|ziparchive_getcommentname|\ ziparchive_getfromindex|ziparchive_getfromname|ziparchive_getnameindex|ziparchive_getstatusstring|ziparchive_getstream|\ ziparchive_locatename|ziparchive_open|ziparchive_renameindex|ziparchive_renamename|ziparchive_setCommentName|ziparchive_setarchivecomment|\ ziparchive_setcommentindex|ziparchive_statindex|ziparchive_statname|ziparchive_unchangeall|ziparchive_unchangearchive|\ ziparchive_unchangeindex|ziparchive_unchangename|zlib_get_coding_type|array_is_list|fdatasync|fdiv|fsync|get_debug_type|get_resource_id|\ json_validate|mb_str_pad|mysqli_execute_query|preg_last_error_msg|stream_context_set_options|str_contains|str_ends_with|str_starts_with'.split('|') ); // http://php.net/manual/en/reserved.keywords.php var keywords = lang.arrayToMap( 'abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|\ endif|endswitch|endwhile|extends|final|finally|for|foreach|function|global|goto|if|implements|instanceof|insteadof|interface|namespace|new|or|private|protected|\ public|static|switch|throw|trait|try|use|var|while|xor|yield'.split('|') ); // http://php.net/manual/en/reserved.keywords.php var languageConstructs = lang.arrayToMap( ('__halt_compiler|die|echo|empty|exit|eval|include|include_once|isset|list|require|require_once|return|print|unset').split('|') ); var builtinConstants = lang.arrayToMap( ('true|TRUE|false|FALSE|null|NULL|__CLASS__|__DIR__|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__NAMESPACE__|__TRAIT__').split('|') ); var builtinVariables = lang.arrayToMap( '$GLOBALS|$_SERVER|$_GET|$_POST|$_FILES|$_REQUEST|$_SESSION|$_ENV|$_COOKIE|$php_errormsg|$HTTP_RAW_POST_DATA|\ $http_response_header|$argc|$argv'.split('|') ); // Discovery done by downloading 'Many HTML files' from: http://php.net/download-docs.php // Then search for files containing 'deprecated' (case-insensitive) and look at each file that turns up. var builtinFunctionsDeprecated = lang.arrayToMap( 'key_exists|cairo_matrix_create_scale|cairo_matrix_create_translate|call_user_method|call_user_method_array|com_addref|com_get|\ com_invoke|com_isenum|com_load|com_release|com_set|connection_timeout|cubrid_load_from_glo|cubrid_new_glo|cubrid_save_to_glo|\ cubrid_send_glo|define_syslog_variables|dl|ereg|ereg_replace|eregi|eregi_replace|hw_documentattributes|hw_documentbodytag|\ hw_documentsize|hw_outputdocument|imagedashedline|maxdb_bind_param|maxdb_bind_result|maxdb_client_encoding|maxdb_close_long_data|\ maxdb_execute|maxdb_fetch|maxdb_get_metadata|maxdb_param_count|maxdb_send_long_data|mcrypt_ecb|mcrypt_generic_end|mime_content_type|\ mysql_createdb|mysql_dbname|mysql_db_query|mysql_drop_db|mysql_dropdb|mysql_escape_string|mysql_fieldflags|mysql_fieldflags|\ mysql_fieldname|mysql_fieldtable|mysql_fieldtype|mysql_freeresult|mysql_listdbs|mysql_list_fields|mysql_listfields|mysql_list_tables|\ mysql_listtables|mysql_numfields|mysql_numrows|mysql_selectdb|mysql_tablename|mysqli_bind_param|mysqli_bind_result|\ mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_execute|\ mysqli_fetch|mysqli_get_metadata|mysqli_master_query|mysqli_param_count|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|\ mysqli_send_long_data|mysqli_send_query|mysqli_slave_query|ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|\ ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|\ ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|\ ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|ociloadlob|ocilogoff|ocilogon|ocinewcollection|\ ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|ocirollback|ocirowcount|ocisavelob|ocisavelobfile|\ ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|PDF_add_annotation|PDF_add_bookmark|\ PDF_add_launchlink|PDF_add_locallink|PDF_add_note|PDF_add_outline|PDF_add_pdflink|PDF_add_weblink|PDF_attach_file|PDF_begin_page|\ PDF_begin_template|PDF_close_pdi|PDF_close|PDF_findfont|PDF_get_font|PDF_get_fontname|PDF_get_fontsize|PDF_get_image_height|\ PDF_get_image_width|PDF_get_majorversion|PDF_get_minorversion|PDF_get_pdi_parameter|PDF_get_pdi_value|PDF_open_ccitt|PDF_open_file|\ PDF_open_gif|PDF_open_image_file|PDF_open_image|PDF_open_jpeg|PDF_open_pdi|PDF_open_tiff|PDF_place_image|PDF_place_pdi_page|\ PDF_set_border_color|PDF_set_border_dash|PDF_set_border_style|PDF_set_char_spacing|PDF_set_duration|PDF_set_horiz_scaling|\ PDF_set_info_author|PDF_set_info_creator|PDF_set_info_keywords|PDF_set_info_subject|PDF_set_info_title|PDF_set_leading|\ PDF_set_text_matrix|PDF_set_text_rendering|PDF_set_text_rise|PDF_set_word_spacing|PDF_setgray_fill|PDF_setgray_stroke|PDF_setgray|\ PDF_setpolydash|PDF_setrgbcolor_fill|PDF_setrgbcolor_stroke|PDF_setrgbcolor|PDF_show_boxed|php_check_syntax|px_set_tablename|\ px_set_targetencoding|runkit_sandbox_output_handler|session_is_registered|session_register|session_unregister\ set_magic_quotes_runtime|magic_quotes_runtime|set_socket_blocking|socket_set_blocking|set_socket_timeout|socket_set_timeout|split|spliti|\ sql_regcase'.split('|') ); var keywordsDeprecated = lang.arrayToMap( ('cfunction|old_function').split('|') ); var futureReserved = lang.arrayToMap([]); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : /(?:#|\/\/)(?:[^?]|\?[^>])*/ }, docComment.getStartRule("doc-start"), { token : "comment", // multi line comment regex : "\\/\\*", next : "comment" }, { token : "string.regexp", regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)" }, { token : "string", // " string start regex : '"', next : "qqstring" }, { token : "string", // ' string start regex : "'", next : "qstring" }, { token : "constant.numeric", // hex regex : /0[xX][0-9a-fA-F]+(?:_[0-9a-fA-F]+)*\b/ }, { token : "constant.numeric", // octal regex : /0[oO]?[0-7]+(_[0-7]+)*\b/ }, { token : "constant.numeric", // binary regex : /0[bB][01]+(_[01]+)*\b/ }, { token : "constant.numeric", // float regex : /(?:[\d]+(?:_\d+)*\.?\d*(?:_\d+)*|\.\d+(?:_\d+)*)(?:[eE][+-]?\d+(?:_\d+)*)?\b/ }, { token : "constant.language", // constants regex : "\\b(?:DEFAULT_INCLUDE_PATH|E_(?:ALL|CO(?:MPILE_(?:ERROR|WARNING)|RE_(?:ERROR|WARNING))|" + "ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|" + "HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|" + "L(?:IBDIR|OCALSTATEDIR)|O(?:S|UTPUT_HANDLER_(?:CONT|END|START))|PREFIX|S(?:API|HLIB_SUFFIX|YSCONFDIR)|" + "VERSION))|__COMPILER_HALT_OFFSET__)\\b" }, { token : ["keyword", "text", "support.class"], regex : "\\b(new)(\\s+)(\\w+)" }, { token : ["support.class", "keyword.operator"], regex : "\\b(\\w+)(::)" }, { token : "constant.language", // constants regex : "\\b(?:A(?:B(?:DAY_(?:1|2|3|4|5|6|7)|MON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9))|LT_DIGITS|M_STR|" + "SSERT_(?:ACTIVE|BAIL|CALLBACK|QUIET_EVAL|WARNING))|C(?:ASE_(?:LOWER|UPPER)|HAR_MAX|" + "O(?:DESET|NNECTION_(?:ABORTED|NORMAL|TIMEOUT)|UNT_(?:NORMAL|RECURSIVE))|" + "R(?:EDITS_(?:ALL|DOCS|FULLPAGE|G(?:ENERAL|ROUP)|MODULES|QA|SAPI)|NCYSTR|" + "YPT_(?:BLOWFISH|EXT_DES|MD5|S(?:ALT_LENGTH|TD_DES)))|URRENCY_SYMBOL)|D(?:AY_(?:1|2|3|4|5|6|7)|" + "ECIMAL_POINT|IRECTORY_SEPARATOR|_(?:FMT|T_FMT))|E(?:NT_(?:COMPAT|NOQUOTES|QUOTES)|RA(?:_(?:D_(?:FMT|T_FMT)|" + "T_FMT|YEAR)|)|XTR_(?:IF_EXISTS|OVERWRITE|PREFIX_(?:ALL|I(?:F_EXISTS|NVALID)|SAME)|SKIP))|FRAC_DIGITS|GROUPING|" + "HTML_(?:ENTITIES|SPECIALCHARS)|IN(?:FO_(?:ALL|C(?:ONFIGURATION|REDITS)|ENVIRONMENT|GENERAL|LICENSE|MODULES|VARIABLES)|" + "I_(?:ALL|PERDIR|SYSTEM|USER)|T_(?:CURR_SYMBOL|FRAC_DIGITS))|L(?:C_(?:ALL|C(?:OLLATE|TYPE)|M(?:ESSAGES|ONETARY)|NUMERIC|TIME)|" + "O(?:CK_(?:EX|NB|SH|UN)|G_(?:A(?:LERT|UTH(?:PRIV|))|C(?:ONS|R(?:IT|ON))|D(?:AEMON|EBUG)|E(?:MERG|RR)|INFO|KERN|" + "L(?:OCAL(?:0|1|2|3|4|5|6|7)|PR)|MAIL|N(?:DELAY|EWS|O(?:TICE|WAIT))|ODELAY|P(?:ERROR|ID)|SYSLOG|U(?:SER|UCP)|WARNING)))|" + "M(?:ON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9|DECIMAL_POINT|GROUPING|THOUSANDS_SEP)|_(?:1_PI|2_(?:PI|SQRTPI)|E|L(?:N(?:10|2)|" + "OG(?:10E|2E))|PI(?:_(?:2|4)|)|SQRT(?:1_2|2)))|N(?:EGATIVE_SIGN|O(?:EXPR|STR)|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|" + "P(?:ATH(?:INFO_(?:BASENAME|DIRNAME|EXTENSION)|_SEPARATOR)|M_STR|OSITIVE_SIGN|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|" + "RADIXCHAR|S(?:EEK_(?:CUR|END|SET)|ORT_(?:ASC|DESC|NUMERIC|REGULAR|STRING)|TR_PAD_(?:BOTH|LEFT|RIGHT))|" + "T(?:HOUS(?:ANDS_SEP|EP)|_FMT(?:_AMPM|))|YES(?:EXPR|STR)|STD(?:IN|OUT|ERR))\\b" }, { token : function(value) { if (keywords.hasOwnProperty(value)) return "keyword"; else if (builtinConstants.hasOwnProperty(value)) return "constant.language"; else if (builtinVariables.hasOwnProperty(value)) return "variable.language"; else if (futureReserved.hasOwnProperty(value)) return "invalid.illegal"; else if (builtinFunctions.hasOwnProperty(value)) return "support.function"; else if (value == "debugger") return "invalid.deprecated"; else if(value.match(/^(\$[a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*|self|parent)$/)) return "variable"; return "identifier"; }, regex : /[a-zA-Z_$\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*/ }, { onMatch : function(value, currentSate, state) { value = value.substr(3); if (value[0] == "'" || value[0] == '"') value = value.slice(1, -1); state.unshift(this.next, value); return "markup.list"; }, regex : /<<<(?:\w+|'\w+'|"\w+")$/, next: "heredoc" }, { token : "keyword.operator", regex : "::|!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|!=|!==|<=|>=|=>|<<=|>>=|>>>=|<>|<|>|\\.=|=|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "punctuation.operator", regex : /[,;]/ }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "heredoc" : [ { onMatch : function(value, currentState, stack) { if (stack[1] != value) { this.next = ""; return "string"; } stack.shift(); stack.shift(); this.next = this.nextState; return "markup.list"; }, regex : "^\\w+(?=;?$)", nextState: "start" }, { token: "string", regex : ".*" } ], "comment" : [ { token : "comment", regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "qqstring" : [ { token : "constant.language.escape", regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})' }, { token : "variable", regex : /\$[\w]+(?:\[[\w\]+]|[=\-]>\w+)?/ }, { token : "variable", regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now }, {token : "string", regex : '"', next : "start"}, {defaultToken : "string"} ], "qstring" : [ {token : "constant.language.escape", regex : /\\['\\]/}, {token : "string", regex : "'", next : "start"}, {defaultToken : "string"} ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; oop.inherits(PhpLangHighlightRules, TextHighlightRules); var PhpHighlightRules = function() { HtmlHighlightRules.call(this); var startRules = [ { token : "support.php_tag", // php open tag regex : "<\\?(?:php|=)?", push : "php-start" } ]; var endRules = [ { token : "support.php_tag", // php close tag regex : "\\?>", next : "pop" } ]; for (var key in this.$rules) this.$rules[key].unshift.apply(this.$rules[key], startRules); this.embedRules(PhpLangHighlightRules, "php-", endRules, ["start"]); this.normalizeRules(); }; oop.inherits(PhpHighlightRules, HtmlHighlightRules); exports.PhpHighlightRules = PhpHighlightRules; exports.PhpLangHighlightRules = PhpLangHighlightRules; ================================================ FILE: src/mode/php_laravel_blade.js ================================================ "use strict"; var oop = require("../lib/oop"); var PHPLaravelBladeHighlightRules = require("./php_laravel_blade_highlight_rules").PHPLaravelBladeHighlightRules; var PHPMode = require("./php").Mode; var JavaScriptMode = require("./javascript").Mode; var CssMode = require("./css").Mode; var HtmlMode = require("./html").Mode; var Mode = function() { PHPMode.call(this); this.HighlightRules = PHPLaravelBladeHighlightRules; this.createModeDelegates({ "js-": JavaScriptMode, "css-": CssMode, "html-": HtmlMode }); }; oop.inherits(Mode, PHPMode); (function() { this.$id = "ace/mode/php_laravel_blade"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/php_laravel_blade_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var PhpHighlightRules = require("./php_highlight_rules").PhpHighlightRules; var PHPLaravelBladeHighlightRules = function() { PhpHighlightRules.call(this); var bladeRules = { start: [{ include: "bladeComments" }, { include: "directives" }, { include: "parenthesis" }], comments: [{ include: "bladeComments" }, { token: "punctuation.definition.comment.blade", regex: "(\\/\\/(.)*)|(\\#(.)*)" }, { token: "punctuation.definition.comment.begin.php", regex: "(?:\\/\\*)", push: [{ token: "punctuation.definition.comment.end.php", regex: "(?:\\*\\/)", next: "pop" }, { defaultToken: "comment.block.blade" }] }], bladeComments: [{ token: "punctuation.definition.comment.begin.blade", regex: "(?:\\{\\{\\-\\-)", push: [{ token: "punctuation.definition.comment.end.blade", regex: "(?:\\-\\-\\}\\})", next: "pop" }, { defaultToken: "comment.block.blade" }] }], parenthesis: [{ token: "parenthesis.begin.blade", regex: "\\(", push: [{ token: "parenthesis.end.blade", regex: "\\)", next: "pop" }, { include: "strings" }, { include: "variables" }, { include: "lang" }, { include: "parenthesis" }, { include: "comments" }, { defaultToken: "source.blade" }] }], directives: [{ token: ["directive.declaration.blade", "keyword.directives.blade"], regex: "(@)(endunless|endisset|endempty|endauth|endguest|endcomponent|endslot|endalert|endverbatim|endsection|show|php|endphp|endpush|endprepend|endenv|endforelse|isset|empty|component|slot|alert|json|verbatim|section|auth|guest|hasSection|forelse|includeIf|includeWhen|includeFirst|each|push|stack|prepend|inject|env|elseenv|unless|yield|extends|parent|include|acfrepeater|block|can|cannot|choice|debug|elsecan|elsecannot|embed|hipchat|lang|layout|macro|macrodef|minify|partial|render|servers|set|slack|story|task|unset|wpposts|acfend|after|append|breakpoint|endafter|endcan|endcannot|endembed|endmacro|endmarkdown|endminify|endpartial|endsetup|endstory|endtask|endunless|markdown|overwrite|setup|stop|wpempty|wpend|wpquery)" }, { token: ["directive.declaration.blade", "keyword.control.blade"], regex: "(@)(if|else|elseif|endif|foreach|endforeach|switch|case|break|default|endswitch|for|endfor|while|endwhile|continue)" }, { token: ["directive.ignore.blade", "injections.begin.blade"], regex: "(@?)(\\{\\{)", push: [{ token: "injections.end.blade", regex: "\\}\\}", next: "pop" }, { include: "strings" }, { include: "variables" }, { include: "comments" }, { defaultToken: "source.blade" }] }, { token: "injections.unescaped.begin.blade", regex: "\\{\\!\\!", push: [{ token: "injections.unescaped.end.blade", regex: "\\!\\!\\}", next: "pop" }, { include: "strings" }, { include: "variables" }, { defaultToken: "source.blade" }] } ], lang: [{ token: "keyword.operator.blade", regex: "(?:!=|!|<=|>=|<|>|===|==|=|\\+\\+|\\;|\\,|%|&&|\\|\\|)|\\b(?:and|or|eq|neq|ne|gte|gt|ge|lte|lt|le|not|mod|as)\\b" }, { token: "constant.language.blade", regex: "\\b(?:TRUE|FALSE|true|false)\\b" }], strings: [{ token: "punctuation.definition.string.begin.blade", regex: "\"", push: [{ token: "punctuation.definition.string.end.blade", regex: "\"", next: "pop" }, { token: "string.character.escape.blade", regex: "\\\\." }, { defaultToken: "string.quoted.single.blade" }] }, { token: "punctuation.definition.string.begin.blade", regex: "'", push: [{ token: "punctuation.definition.string.end.blade", regex: "'", next: "pop" }, { token: "string.character.escape.blade", regex: "\\\\." }, { defaultToken: "string.quoted.double.blade" }] }], variables: [{ token: "variable.blade", regex: "\\$([a-zA-Z_][a-zA-Z0-9_]*)\\b" }, { token: ["keyword.operator.blade", "constant.other.property.blade"], regex: "(->)([a-zA-Z_][a-zA-Z0-9_]*)\\b" }, { token: ["keyword.operator.blade", "meta.function-call.object.blade", "punctuation.definition.variable.blade", "variable.blade", "punctuation.definition.variable.blade" ], regex: "(->)([a-zA-Z_][a-zA-Z0-9_]*)(\\()(.*?)(\\))" }] }; var bladeStart = bladeRules.start; for (var rule in this.$rules) { this.$rules[rule].unshift.apply(this.$rules[rule], bladeStart); } Object.keys(bladeRules).forEach(function(x) { if (!this.$rules[x]) this.$rules[x] = bladeRules[x]; }, this); this.normalizeRules(); }; oop.inherits(PHPLaravelBladeHighlightRules, PhpHighlightRules); exports.PHPLaravelBladeHighlightRules = PHPLaravelBladeHighlightRules; ================================================ FILE: src/mode/php_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var Tokenizer = require("../tokenizer").Tokenizer; var Mode = require("./php").Mode; var assert = require("../test/assertions"); module.exports = { "test: inline mode" : function() { var mode = new Mode(); var tokenizer = mode.getTokenizer(); var tokens = tokenizer.getLineTokens("'juhu kinners' ?> html <? 'php'", "start").tokens; assert.equal("string", tokens[tokens.length - 1].type); assert.notEqual("string", tokens[0].type); assert.equal(tokens.length, 4); mode = new Mode({inline: true}); tokenizer = mode.getTokenizer(); tokens = tokenizer.getLineTokens("'juhu kinners' ?> html <? 'php'", "start").tokens; assert.equal("string", tokens[0].type); assert.equal("string", tokens[tokens.length - 1].type); assert.equal(tokens.length, 9); } }; require("../test/run")(module); ================================================ FILE: src/mode/pig.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PigHighlightRules = require("./pig_highlight_rules").PigHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = PigHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "/*", end: "*/"}; // Extra logic goes here. this.$id = "ace/mode/pig"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/pig_highlight_rules.js ================================================ /* This file was autogenerated from Pig.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PigHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ token: "comment.block.pig", regex: /\/\*/, push: [{ token: "comment.block.pig", regex: /\*\//, next: "pop" }, { defaultToken: "comment.block.pig" }] }, { token: "comment.line.double-dash.asciidoc", regex: /--.*$/ }, { token: "keyword.control.pig", regex: /\b(?:ASSERT|LOAD|STORE|DUMP|FILTER|DISTINCT|FOREACH|GENERATE|STREAM|JOIN|COGROUP|GROUP|CROSS|ORDER|LIMIT|UNION|SPLIT|DESCRIBE|EXPLAIN|ILLUSTRATE|AS|BY|INTO|USING|LIMIT|PARALLEL|OUTER|INNER|DEFAULT|LEFT|SAMPLE|RANK|CUBE|ALL|KILL|QUIT|MAPREDUCE|ASC|DESC|THROUGH|SHIP|CACHE|DECLARE|CASE|WHEN|THEN|END|IN|PARTITION|FULL|IMPORT|IF|ONSCHEMA|INPUT|OUTPUT)\b/, caseInsensitive: true }, { token: "storage.datatypes.pig", regex: /\b(?:int|long|float|double|chararray|bytearray|boolean|datetime|biginteger|bigdecimal|tuple|bag|map)\b/, caseInsensitive: true }, { token: "support.function.storage.pig", regex: /\b(?:PigStorage|BinStorage|BinaryStorage|PigDump|HBaseStorage|JsonLoader|JsonStorage|AvroStorage|TextLoader|PigStreaming|TrevniStorage|AccumuloStorage)\b/ }, { token: "support.function.udf.pig", regex: /\b(?:DIFF|TOBAG|TOMAP|TOP|TOTUPLE|RANDOM|FLATTEN|flatten|CUBE|ROLLUP|IsEmpty|ARITY|PluckTuple|SUBTRACT|BagToString)\b/ }, { token: "support.function.udf.math.pig", regex: /\b(?:ABS|ACOS|ASIN|ATAN|CBRT|CEIL|COS|COSH|EXP|FLOOR|LOG|LOG10|ROUND|ROUND_TO|SIN|SINH|SQRT|TAN|TANH|AVG|COUNT|COUNT_STAR|MAX|MIN|SUM|COR|COV)\b/ }, { token: "support.function.udf.string.pig", regex: /\b(?:CONCAT|INDEXOF|LAST_INDEX_OF|LCFIRST|LOWER|REGEX_EXTRACT|REGEX_EXTRACT_ALL|REPLACE|SIZE|STRSPLIT|SUBSTRING|TOKENIZE|TRIM|UCFIRST|UPPER|LTRIM|RTRIM|ENDSWITH|STARTSWITH|TRIM)\b/ }, { token: "support.function.udf.datetime.pig", regex: /\b(?:AddDuration|CurrentTime|DaysBetween|GetDay|GetHour|GetMilliSecond|GetMinute|GetMonth|GetSecond|GetWeek|GetWeekYear|GetYear|HoursBetween|MilliSecondsBetween|MinutesBetween|MonthsBetween|SecondsBetween|SubtractDuration|ToDate|WeeksBetween|YearsBetween|ToMilliSeconds|ToString|ToUnixTime)\b/ }, { token: "support.function.command.pig", regex: /\b(?:cat|cd|copyFromLocal|copyToLocal|cp|ls|mkdir|mv|pwd|rm)\b/ }, { token: "variable.pig", regex: /\$[a_zA-Z0-9_]+/ }, { token: "constant.language.pig", regex: /\b(?:NULL|true|false|stdin|stdout|stderr)\b/, caseInsensitive: true }, { token: "constant.numeric.pig", regex: /\b\d+(?:\.\d+)?\b/ }, { token: "keyword.operator.comparison.pig", regex: /!=|==|<|>|<=|>=|\b(?:MATCHES|IS|OR|AND|NOT)\b/, caseInsensitive: true }, { token: "keyword.operator.arithmetic.pig", regex: /\+|\-|\*|\/|\%|\?|:|::|\.\.|#/ }, { token: "string.quoted.double.pig", regex: /"/, push: [{ token: "string.quoted.double.pig", regex: /"/, next: "pop" }, { token: "constant.character.escape.pig", regex: /\\./ }, { defaultToken: "string.quoted.double.pig" }] }, { token: "string.quoted.single.pig", regex: /'/, push: [{ token: "string.quoted.single.pig", regex: /'/, next: "pop" }, { token: "constant.character.escape.pig", regex: /\\./ }, { defaultToken: "string.quoted.single.pig" }] }, { todo: { token: [ "text", "keyword.parameter.pig", "text", "storage.type.parameter.pig" ], regex: /^(\s*)(set)(\s+)(\S+)/, caseInsensitive: true, push: [{ token: "text", regex: /$/, next: "pop" }, { include: "$self" }] } }, { token: [ "text", "keyword.alias.pig", "text", "storage.type.alias.pig" ], regex: /(\s*)(DEFINE|DECLARE|REGISTER)(\s+)(\S+)/, caseInsensitive: true, push: [{ token: "text", regex: /;?$/, next: "pop" }] }] }; this.normalizeRules(); }; PigHighlightRules.metaData = { fileTypes: ["pig"], name: "Pig", scopeName: "source.pig" }; oop.inherits(PigHighlightRules, TextHighlightRules); exports.PigHighlightRules = PigHighlightRules; ================================================ FILE: src/mode/plain_text.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var Behaviour = require("./behaviour").Behaviour; var Mode = function() { this.HighlightRules = TextHighlightRules; this.$behaviour = new Behaviour(); }; oop.inherits(Mode, TextMode); (function() { this.type = "text"; this.getNextLineIndent = function(state, line, tab) { return ''; }; this.$id = "ace/mode/plain_text"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/plain_text_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var PlainTextMode = require("./plain_text").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new PlainTextMode(); }, "test: lines should not be indented" : function() { assert.equal("", this.mode.getNextLineIndent("start", " abc", " ")); } }; require("../test/run")(module); ================================================ FILE: src/mode/plsql.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 */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PLSqlHighlightRules = require("./plsql_highlight_rules").plsqlHighlightRules; var FoldMode = require("./folding/sql").FoldMode; var Mode = function() { this.HighlightRules = PLSqlHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/plsql"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/plsql_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 (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var plsqlHighlightRules = function() { var keywords = ( "all|alter|and|any|array|arrow|as|asc|at|begin|between|by|case|check|clusters|cluster|colauth|columns|compress|connect|crash|create|cross|current|database|declare|default|delete|desc|distinct|drop|else|end|exception|exclusive|exists|fetch|form|for|foreign|from|goto|grant|group|having|identified|if|in|inner|indexes|index|insert|intersect|into|is|join|key|left|like|lock|minus|mode|natural|nocompress|not|nowait|null|of|on|option|or|order|overlaps|outer|primary|prior|procedure|public|qualify|range|record|references|resource|revoke|right|select|share|size|sql|start|subtype|tabauth|table|then|to|type|union|unique|update|use|values|view|views|when|where|with" ); var builtinConstants = ( "true|false" ); var builtinFunctions = ( "abs|acos|add_months|ascii|asciistr|asin|atan|atan2|avg|bfilename|bin_to_num|bitand|cardinality|case|cast|ceil|chartorowid|chr|coalesce|compose|concat|convert|corr|cos|cosh|count|covar_pop|covar_samp|cume_dist|current_date|current_timestamp|dbtimezone|decode|decompose|dense_rank|dump|empty_blob|empty_clob|exp|extract|first_value|floor|from_tz|greatest|group_id|hextoraw|initcap|instr|instr2|instr4|instrb|instrc|lag|last_day|last_value|lead|least|length|length2|length4|lengthb|lengthc|listagg|ln|lnnvl|localtimestamp|log|lower|lpad|ltrim|max|median|min|mod|months_between|nanvl|nchr|new_time|next_day|nth_value|nullif|numtodsinterval|numtoyminterval|nvl|nvl2|power|rank|rawtohex|regexp_count|regexp_instr|regexp_replace|regexp_substr|remainder|replace|round|row_number|rownum|rpad|rtrim|sessiontimezone|sign|sin|sinh|soundex|sqrt|stddev|substr|sum|sys_context|sysdate|systimestamp|tan|tanh|to_char|to_clob|to_date|to_dsinterval|to_lob|to_multi_byte|to_nclob|to_number|to_single_byte|to_timestamp|to_timestamp_tz|to_yminterval|translate|trim|trunc|tz_offset|uid|upper|user|userenv|var_pop|var_samp|variance|vsize" ); var dataTypes = ( "char|nchar|nvarchar2|varchar2|long|raw|" + "number|numeric|float|dec|decimal|integer|int|smallint|real|double|precision|" + "date|timestamp|interval|year|day|" + "bfile|blob|clob|nclob|" + "rowid|urowid" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords, "constant.language": builtinConstants, "storage.type": dataTypes }, "identifier", true); this.$rules = { "start" : [ { token : "comment", regex : "--.*$" }, { token : "comment", start : "/\\*", end : "\\*/" }, { 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+" } ] }; this.normalizeRules(); }; oop.inherits(plsqlHighlightRules, TextHighlightRules); exports.plsqlHighlightRules = plsqlHighlightRules; ================================================ FILE: src/mode/powershell.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PowershellHighlightRules = require("./powershell_highlight_rules").PowershellHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = PowershellHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"}); }; 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/powershell"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/powershell_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PowershellHighlightRules = function() { var identifierRe = "[a-zA-Z\\?_\u00a1-\uffff][a-zA-Z\\d\\?_\u00a1-\uffff]*"; // Help Reference: about_Language_Keywords // https://technet.microsoft.com/en-us/library/hh847744.aspx var keywords = ( "begin|break|catch|class|continue|data|define|do|dynamicparam|else|elseif|end|enum|exit|filter|" + "finally|for|foreach|from|function|if|in|inlinescript|hidden|parallel|param|" + "process|return|static|sequence|switch|throw|trap|try|until|using|while|workflow|var" ); // Command to enumerate all module commands in Windows PowerShell: // PS C:\> Get-Module -ListAvailable | Select-Object -Unique Name -ExpandProperty Name | Sort-Object | // ForEach-Object { "// Module $_"; '"' + ((Get-Command -Module $_ | Select-Object -ExpandProperty Name) -join '|') + '|" +' } | clip var builtinFunctions = ( // Module AppBackgroundTask "Get-AppBackgroundTask|Start-AppBackgroundTask|Unregister-AppBackgroundTask|Disable-AppBackgroundTaskDiagnosticLog|Enable-AppBackgroundTaskDiagnosticLog|Set-AppBackgroundTaskResourcePolicy|" + // Module AppLocker "Get-AppLockerFileInformation|Get-AppLockerPolicy|New-AppLockerPolicy|Set-AppLockerPolicy|Test-AppLockerPolicy|" + // Module AppvClient "Add-AppvClientConnectionGroup|Add-AppvClientPackage|Add-AppvPublishingServer|Disable-Appv|Disable-AppvClientConnectionGroup|Disable-AppvClientMode|Disable-AppvPublishingServer|Enable-Appv|Enable-AppvClientConnectionGroup|Enable-AppvClientMode|Enable-AppvPublishingServer|Get-AppvClientApplication|Get-AppvClientConfiguration|Get-AppvClientConnectionGroup|Get-AppvClientMode|Get-AppvClientPackage|Get-AppvClientPackageStatus|Get-AppvClientPackageVersion|Get-AppvClientPackageVersionHistory|Get-AppvClientPackageVersionStatus|Get-AppvClientPublishingServer|Get-AppvClientSFTFileSystem|Get-AppvClientStatus|Get-AppvPublishingServer|Get-AppvVirtualProcess|Publish-AppvClientPackage|Remove-AppvClientConnectionGroup|Remove-AppvClientPackage|Remove-AppvPublishingServer|Set-AppvClientConfiguration|Set-AppvClientMode|Set-AppvClientPackage|Set-AppvClientPublishingServer|Set-AppvVirtualProcess|Sync-AppvPublishingServer|Get-AppvStatus|Mount-AppvClientConnectionGroup|Repair-AppvClientConnectionGroup|Repair-AppvClientPackage|Send-AppvClientReport|Set-AppvPublishingServer|Start-AppvVirtualProcess|Stop-AppvClientConnectionGroup|Stop-AppvClientPackage|Unpublish-AppvClientPackage|" + // Module AppvSequencer "Expand-AppvSequencerPackage|New-AppvPackageAccelerator|New-AppvSequencerPackage|Update-AppvSequencerPackage|" + // Module Appx "Add-AppSharedPackageContainer|Add-AppxPackage|Add-AppxVolume|Dismount-AppxVolume|Get-AppSharedPackageContainer|Get-AppxDefaultVolume|Get-AppxLastError|Get-AppxLog|Get-AppxPackage|Get-AppxPackageAutoUpdateSettings|Get-AppxPackageManifest|Get-AppxVolume|Invoke-CommandInDesktopPackage|Mount-AppxVolume|Move-AppxPackage|Remove-AppSharedPackageContainer|Remove-AppxPackage|Remove-AppxPackageAutoUpdateSettings|Remove-AppxVolume|Reset-AppSharedPackageContainer|Reset-AppxPackage|Set-AppxDefaultVolume|Set-AppxPackageAutoUpdateSettings|" + // Module AssignedAccess "Clear-AssignedAccess|Get-AssignedAccess|Set-AssignedAccess|" + // Module BestPractices "Get-BpaModel|Get-BpaResult|Invoke-BpaModel|Set-BpaResult|" + // Module BitLocker "Add-BitLockerKeyProtector|Backup-BitLockerKeyProtector|BackupToAAD-BitLockerKeyProtector|Clear-BitLockerAutoUnlock|Disable-BitLocker|Disable-BitLockerAutoUnlock|Enable-BitLocker|Enable-BitLockerAutoUnlock|Get-BitLockerVolume|Lock-BitLocker|Remove-BitLockerKeyProtector|Resume-BitLocker|Suspend-BitLocker|Unlock-BitLocker|" + // Module BitsTransfer "Add-BitsFile|Complete-BitsTransfer|Get-BitsTransfer|Remove-BitsTransfer|Resume-BitsTransfer|Set-BitsTransfer|Start-BitsTransfer|Suspend-BitsTransfer|" + // Module BootEventCollector "Checkpoint-SbecActiveConfig|Clear-SbecProviderCache|Disable-SbecAutologger|Disable-SbecBcd|Enable-SbecAutologger|Enable-SbecBcd|Enable-SbecBootImage|Enable-SbecWdsBcd|Get-SbecActiveConfig|Get-SbecBackupConfig|Get-SbecDestination|Get-SbecForwarding|Get-SbecHistory|Get-SbecLocalizedMessage|Get-SbecLogSession|Get-SbecTraceProviders|New-SbecUnattendFragment|Redo-SbecActiveConfig|Restore-SbecBackupConfig|Save-SbecInstance|Save-SbecLogSession|Set-SbecActiveConfig|Set-SbecLogSession|Start-SbecInstance|Start-SbecLogSession|Start-SbecNtKernelLogSession|Start-SbecSimpleLogSession|Stop-SbecInstance|Stop-SbecLogSession|Test-SbecActiveConfig|Test-SbecConfig|Undo-SbecActiveConfig|" + // Module BranchCache "Add-BCDataCacheExtension|Clear-BCCache|Disable-BC|Disable-BCDowngrading|Disable-BCServeOnBattery|Enable-BCDistributed|Enable-BCDowngrading|Enable-BCHostedClient|Enable-BCHostedServer|Enable-BCLocal|Enable-BCServeOnBattery|Export-BCCachePackage|Export-BCSecretKey|Get-BCClientConfiguration|Get-BCContentServerConfiguration|Get-BCDataCache|Get-BCDataCacheExtension|Get-BCHashCache|Get-BCHostedCacheServerConfiguration|Get-BCNetworkConfiguration|Get-BCStatus|Import-BCCachePackage|Import-BCSecretKey|Publish-BCFileContent|Publish-BCWebContent|Remove-BCDataCacheExtension|Reset-BC|Set-BCAuthentication|Set-BCCache|Set-BCDataCacheEntryMaxAge|Set-BCMinSMBLatency|Set-BCSecretKey|" + // Module ClusterAwareUpdating "Add-CauClusterRole|Disable-CauClusterRole|Enable-CauClusterRole|Export-CauReport|Get-CauClusterRole|Get-CauPlugin|Get-CauReport|Get-CauRun|Invoke-CauRun|Invoke-CauScan|Register-CauPlugin|Remove-CauClusterRole|Save-CauDebugTrace|Set-CauClusterRole|Stop-CauRun|Test-CauSetup|Unregister-CauPlugin|" + // Module CimCmdlets "Export-BinaryMiLog|Get-CimAssociatedInstance|Get-CimClass|Get-CimInstance|Get-CimSession|Import-BinaryMiLog|Invoke-CimMethod|New-CimInstance|New-CimSession|New-CimSessionOption|Register-CimIndicationEvent|Remove-CimInstance|Remove-CimSession|Set-CimInstance|" + // Module CIPolicy "ConvertFrom-CIPolicy|" + // Module ConfigCI "Add-SignerRule|ConvertFrom-CIPolicy|Edit-CIPolicyRule|Get-CIPolicy|Get-CIPolicyIdInfo|Get-CIPolicyInfo|Get-SystemDriver|Merge-CIPolicy|New-CIPolicy|New-CIPolicyRule|Remove-CIPolicyRule|Set-CIPolicyIdInfo|Set-CIPolicySetting|Set-CIPolicyVersion|Set-HVCIOptions|Set-RuleOption|" + // Module DcbQoS "Disable-NetQosFlowControl|Enable-NetQosFlowControl|Get-NetQosDcbxSetting|Get-NetQosFlowControl|Get-NetQosTrafficClass|New-NetQosTrafficClass|Remove-NetQosTrafficClass|Set-NetQosDcbxSetting|Set-NetQosFlowControl|Set-NetQosTrafficClass|Switch-NetQosDcbxSetting|Switch-NetQosFlowControl|Switch-NetQosTrafficClass|" + // Module Deduplication "Disable-DedupVolume|Enable-DedupVolume|Expand-DedupFile|Get-DedupJob|Get-DedupMetadata|Get-DedupSchedule|Get-DedupStatus|Get-DedupVolume|Measure-DedupFileMetadata|New-DedupSchedule|Remove-DedupSchedule|Set-DedupSchedule|Set-DedupVolume|Start-DedupJob|Stop-DedupJob|Update-DedupStatus|" + // Module Defender "Add-MpPreference|Get-MpComputerStatus|Get-MpPreference|Get-MpThreat|Get-MpThreatCatalog|Get-MpThreatDetection|Remove-MpPreference|Remove-MpThreat|Set-MpPreference|Start-MpScan|Start-MpWDOScan|Update-MpSignature|" + // Module DeviceHealthAttestation "Backup-DHASConfiguration|Get-DHASActiveEncryptionCertificate|Get-DHASActiveSigningCertificate|Get-DHASCertificateChainPolicy|Get-DHASInactiveEncryptionCertificate|Get-DHASInactiveSigningCertificate|Install-DeviceHealthAttestation|Remove-DHASInactiveEncryptionCertificate|Remove-DHASInactiveSigningCertificate|Restore-DHASConfiguration|Set-DHASActiveEncryptionCertificate|Set-DHASActiveSigningCertificate|Set-DHASCertificateChainPolicy|Set-DHASSupportedAuthenticationSchema|Uninstall-DeviceHealthAttestation||" + // Module DFSN "Get-DfsnAccess|Get-DfsnFolder|Get-DfsnFolderTarget|Get-DfsnRoot|Get-DfsnRootTarget|Get-DfsnServerConfiguration|Grant-DfsnAccess|Move-DfsnFolder|New-DfsnFolder|New-DfsnFolderTarget|New-DfsnRoot|New-DfsnRootTarget|Remove-DfsnAccess|Remove-DfsnFolder|Remove-DfsnFolderTarget|Remove-DfsnRoot|Remove-DfsnRootTarget|Revoke-DfsnAccess|Set-DfsnFolder|Set-DfsnFolderTarget|Set-DfsnRoot|Set-DfsnRootTarget|Set-DfsnServerConfiguration|" + // Module DFSR "Add-DfsrConnection|Add-DfsrMember|ConvertFrom-DfsrGuid|Export-DfsrClone|Get-DfsrBacklog|Get-DfsrCloneState|Get-DfsrConnection|Get-DfsrConnectionSchedule|Get-DfsrDelegation|Get-DfsReplicatedFolder|Get-DfsReplicationGroup|Get-DfsrFileHash|Get-DfsrGroupSchedule|Get-DfsrIdRecord|Get-DfsrMember|Get-DfsrMembership|Get-DfsrPreservedFiles|Get-DfsrServiceConfiguration|Get-DfsrState|Grant-DfsrDelegation|Import-DfsrClone|New-DfsReplicatedFolder|New-DfsReplicationGroup|Remove-DfsrConnection|Remove-DfsReplicatedFolder|Remove-DfsReplicationGroup|Remove-DfsrMember|Remove-DfsrPropagationTestFile|Reset-DfsrCloneState|Restore-DfsrPreservedFiles|Revoke-DfsrDelegation|Set-DfsrConnection|Set-DfsrConnectionSchedule|Set-DfsReplicatedFolder|Set-DfsReplicationGroup|Set-DfsrGroupSchedule|Set-DfsrMember|Set-DfsrMembership|Set-DfsrServiceConfiguration|Start-DfsrPropagationTest|Suspend-DfsReplicationGroup|Sync-DfsReplicationGroup|Update-DfsrConfigurationFromAD|Write-DfsrHealthReport|Write-DfsrPropagationReport|" + // Module DhcpServer "Add-DhcpServerInDC|Add-DhcpServerSecurityGroup|Add-DhcpServerv4Class|Add-DhcpServerv4ExclusionRange|Add-DhcpServerv4Failover|Add-DhcpServerv4FailoverScope|Add-DhcpServerv4Filter|Add-DhcpServerv4Lease|Add-DhcpServerv4MulticastExclusionRange|Add-DhcpServerv4MulticastScope|Add-DhcpServerv4OptionDefinition|Add-DhcpServerv4Policy|Add-DhcpServerv4PolicyIPRange|Add-DhcpServerv4Reservation|Add-DhcpServerv4Scope|Add-DhcpServerv4Superscope|Add-DhcpServerv6Class|Add-DhcpServerv6ExclusionRange|Add-DhcpServerv6Lease|Add-DhcpServerv6OptionDefinition|Add-DhcpServerv6Reservation|Add-DhcpServerv6Scope|Backup-DhcpServer|Export-DhcpServer|Get-DhcpServerAuditLog|Get-DhcpServerDatabase|Get-DhcpServerDnsCredential|Get-DhcpServerInDC|Get-DhcpServerSetting|Get-DhcpServerv4Binding|Get-DhcpServerv4Class|Get-DhcpServerv4DnsSetting|Get-DhcpServerv4ExclusionRange|Get-DhcpServerv4Failover|Get-DhcpServerv4Filter|Get-DhcpServerv4FilterList|Get-DhcpServerv4FreeIPAddress|Get-DhcpServerv4Lease|Get-DhcpServerv4MulticastExclusionRange|Get-DhcpServerv4MulticastLease|Get-DhcpServerv4MulticastScope|Get-DhcpServerv4MulticastScopeStatistics|Get-DhcpServerv4OptionDefinition|Get-DhcpServerv4OptionValue|Get-DhcpServerv4Policy|Get-DhcpServerv4PolicyIPRange|Get-DhcpServerv4Reservation|Get-DhcpServerv4Scope|Get-DhcpServerv4ScopeStatistics|Get-DhcpServerv4Statistics|Get-DhcpServerv4Superscope|Get-DhcpServerv4SuperscopeStatistics|Get-DhcpServerv6Binding|Get-DhcpServerv6Class|Get-DhcpServerv6DnsSetting|Get-DhcpServerv6ExclusionRange|Get-DhcpServerv6FreeIPAddress|Get-DhcpServerv6Lease|Get-DhcpServerv6OptionDefinition|Get-DhcpServerv6OptionValue|Get-DhcpServerv6Reservation|Get-DhcpServerv6Scope|Get-DhcpServerv6ScopeStatistics|Get-DhcpServerv6StatelessStatistics|Get-DhcpServerv6StatelessStore|Get-DhcpServerv6Statistics|Get-DhcpServerVersion|Import-DhcpServer|Invoke-DhcpServerv4FailoverReplication|Remove-DhcpServerDnsCredential|Remove-DhcpServerInDC|Remove-DhcpServerv4Class|Remove-DhcpServerv4ExclusionRange|Remove-DhcpServerv4Failover|Remove-DhcpServerv4FailoverScope|Remove-DhcpServerv4Filter|Remove-DhcpServerv4Lease|Remove-DhcpServerv4MulticastExclusionRange|Remove-DhcpServerv4MulticastLease|Remove-DhcpServerv4MulticastScope|Remove-DhcpServerv4OptionDefinition|Remove-DhcpServerv4OptionValue|Remove-DhcpServerv4Policy|Remove-DhcpServerv4PolicyIPRange|Remove-DhcpServerv4Reservation|Remove-DhcpServerv4Scope|Remove-DhcpServerv4Superscope|Remove-DhcpServerv6Class|Remove-DhcpServerv6ExclusionRange|Remove-DhcpServerv6Lease|Remove-DhcpServerv6OptionDefinition|Remove-DhcpServerv6OptionValue|Remove-DhcpServerv6Reservation|Remove-DhcpServerv6Scope|Rename-DhcpServerv4Superscope|Repair-DhcpServerv4IPRecord|Restore-DhcpServer|Set-DhcpServerAuditLog|Set-DhcpServerDatabase|Set-DhcpServerDnsCredential|Set-DhcpServerSetting|Set-DhcpServerv4Binding|Set-DhcpServerv4Class|Set-DhcpServerv4DnsSetting|Set-DhcpServerv4Failover|Set-DhcpServerv4FilterList|Set-DhcpServerv4MulticastScope|Set-DhcpServerv4OptionDefinition|Set-DhcpServerv4OptionValue|Set-DhcpServerv4Policy|Set-DhcpServerv4Reservation|Set-DhcpServerv4Scope|Set-DhcpServerv6Binding|Set-DhcpServerv6Class|Set-DhcpServerv6DnsSetting|Set-DhcpServerv6OptionDefinition|Set-DhcpServerv6OptionValue|Set-DhcpServerv6Reservation|Set-DhcpServerv6Scope|Set-DhcpServerv6StatelessStore|" + // Module DirectAccessClientComponents "Disable-DAManualEntryPointSelection|Enable-DAManualEntryPointSelection|Get-DAClientExperienceConfiguration|Get-DAEntryPointTableItem|New-DAEntryPointTableItem|Remove-DAEntryPointTableItem|Rename-DAEntryPointTableItem|Reset-DAClientExperienceConfiguration|Reset-DAEntryPointTableItem|Set-DAClientExperienceConfiguration|Set-DAEntryPointTableItem|" + // Module Dism "Add-AppxProvisionedPackage|Add-WindowsCapability|Add-WindowsDriver|Add-WindowsImage|Add-WindowsPackage|Clear-WindowsCorruptMountPoint|Disable-WindowsOptionalFeature|Dismount-WindowsImage|Enable-WindowsOptionalFeature|Expand-WindowsCustomDataImage|Expand-WindowsImage|Export-WindowsCapabilitySource|Export-WindowsDriver|Export-WindowsImage|Get-AppxProvisionedPackage|Get-NonRemovableAppsPolicy|Get-WIMBootEntry|Get-WindowsCapability|Get-WindowsDriver|Get-WindowsEdition|Get-WindowsImage|Get-WindowsImageContent|Get-WindowsOptionalFeature|Get-WindowsPackage|Get-WindowsReservedStorageState|Mount-WindowsImage|New-WindowsCustomImage|New-WindowsImage|Optimize-AppXProvisionedPackages|Optimize-WindowsImage|Remove-AppxProvisionedPackage|Remove-WindowsCapability|Remove-WindowsDriver|Remove-WindowsImage|Remove-WindowsPackage|Repair-WindowsImage|Save-WindowsImage|Set-AppXProvisionedDataFile|Set-NonRemovableAppsPolicy|Set-WindowsEdition|Set-WindowsProductKey|Set-WindowsReservedStorageState|Split-WindowsImage|Start-OSUninstall|Update-WIMBootEntry|Use-WindowsUnattend|" + // Module DnsClient "Add-DnsClientDohServerAddress|Add-DnsClientNrptRule|Clear-DnsClientCache|Get-DnsClient|Get-DnsClientCache|Get-DnsClientDohServerAddress|Get-DnsClientGlobalSetting|Get-DnsClientNrptGlobal|Get-DnsClientNrptPolicy|Get-DnsClientNrptRule|Get-DnsClientServerAddress|Register-DnsClient|Remove-DnsClientDohServerAddress|Remove-DnsClientNrptRule|Resolve-DnsName|Set-DnsClient|Set-DnsClientDohServerAddress|Set-DnsClientGlobalSetting|Set-DnsClientNrptGlobal|Set-DnsClientNrptRule|Set-DnsClientServerAddress|" + // Module DnsServer "Add-DnsServerClientSubnet|Add-DnsServerConditionalForwarderZone|Add-DnsServerDirectoryPartition|Add-DnsServerForwarder|Add-DnsServerPrimaryZone|Add-DnsServerQueryResolutionPolicy|Add-DnsServerRecursionScope|Add-DnsServerResourceRecord|Add-DnsServerResourceRecordA|Add-DnsServerResourceRecordAAAA|Add-DnsServerResourceRecordCName|Add-DnsServerResourceRecordDnsKey|Add-DnsServerResourceRecordDS|Add-DnsServerResourceRecordMX|Add-DnsServerResourceRecordPtr|Add-DnsServerResponseRateLimitingExceptionlist|Add-DnsServerRootHint|Add-DnsServerSecondaryZone|Add-DnsServerSigningKey|Add-DnsServerStubZone|Add-DnsServerTrustAnchor|Add-DnsServerVirtualizationInstance|Add-DnsServerZoneDelegation|Add-DnsServerZoneScope|Add-DnsServerZoneTransferPolicy|Clear-DnsServerCache|Clear-DnsServerStatistics|ConvertTo-DnsServerPrimaryZone|ConvertTo-DnsServerSecondaryZone|Disable-DnsServerPolicy|Disable-DnsServerSigningKeyRollover|Enable-DnsServerPolicy|Enable-DnsServerSigningKeyRollover|Export-DnsServerDnsSecPublicKey|Export-DnsServerZone|Get-DnsServer|Get-DnsServerCache|Get-DnsServerClientSubnet|Get-DnsServerDiagnostics|Get-DnsServerDirectoryPartition|Get-DnsServerDnsSecZoneSetting|Get-DnsServerDsSetting|Get-DnsServerEDns|Get-DnsServerForwarder|Get-DnsServerGlobalNameZone|Get-DnsServerGlobalQueryBlockList|Get-DnsServerQueryResolutionPolicy|Get-DnsServerRecursion|Get-DnsServerRecursionScope|Get-DnsServerResourceRecord|Get-DnsServerResponseRateLimiting|Get-DnsServerResponseRateLimitingExceptionlist|Get-DnsServerRootHint|Get-DnsServerScavenging|Get-DnsServerSetting|Get-DnsServerSigningKey|Get-DnsServerStatistics|Get-DnsServerTrustAnchor|Get-DnsServerTrustPoint|Get-DnsServerVirtualizationInstance|Get-DnsServerZone|Get-DnsServerZoneAging|Get-DnsServerZoneDelegation|Get-DnsServerZoneScope|Get-DnsServerZoneTransferPolicy|Import-DnsServerResourceRecordDS|Import-DnsServerRootHint|Import-DnsServerTrustAnchor|Invoke-DnsServerSigningKeyRollover|Invoke-DnsServerZoneSign|Invoke-DnsServerZoneUnsign|Register-DnsServerDirectoryPartition|Remove-DnsServerClientSubnet|Remove-DnsServerDirectoryPartition|Remove-DnsServerForwarder|Remove-DnsServerQueryResolutionPolicy|Remove-DnsServerRecursionScope|Remove-DnsServerResourceRecord|Remove-DnsServerResponseRateLimitingExceptionlist|Remove-DnsServerRootHint|Remove-DnsServerSigningKey|Remove-DnsServerTrustAnchor|Remove-DnsServerVirtualizationInstance|Remove-DnsServerZone|Remove-DnsServerZoneDelegation|Remove-DnsServerZoneScope|Remove-DnsServerZoneTransferPolicy|Reset-DnsServerZoneKeyMasterRole|Restore-DnsServerPrimaryZone|Restore-DnsServerSecondaryZone|Resume-DnsServerZone|Set-DnsServer|Set-DnsServerCache|Set-DnsServerClientSubnet|Set-DnsServerConditionalForwarderZone|Set-DnsServerDiagnostics|Set-DnsServerDnsSecZoneSetting|Set-DnsServerDsSetting|Set-DnsServerEDns|Set-DnsServerForwarder|Set-DnsServerGlobalNameZone|Set-DnsServerGlobalQueryBlockList|Set-DnsServerPrimaryZone|Set-DnsServerQueryResolutionPolicy|Set-DnsServerRecursion|Set-DnsServerRecursionScope|Set-DnsServerResourceRecord|Set-DnsServerResourceRecordAging|Set-DnsServerResponseRateLimiting|Set-DnsServerResponseRateLimitingExceptionlist|Set-DnsServerRootHint|Set-DnsServerScavenging|Set-DnsServerSecondaryZone|Set-DnsServerSetting|Set-DnsServerSigningKey|Set-DnsServerStubZone|Set-DnsServerVirtualizationInstance|Set-DnsServerZoneAging|Set-DnsServerZoneDelegation|Set-DnsServerZoneTransferPolicy|Show-DnsServerCache|Show-DnsServerKeyStorageProvider|Start-DnsServerScavenging|Start-DnsServerZoneTransfer|Step-DnsServerSigningKeyRollover|Suspend-DnsServerZone|Sync-DnsServerZone|Test-DnsServer|Test-DnsServerDnsSecZoneSetting|Unregister-DnsServerDirectoryPartition|Update-DnsServerTrustPoint|" + // Module EventTracingManagement "Add-EtwTraceProvider|Get-AutologgerConfig|Get-EtwTraceProvider|Get-EtwTraceSession|New-AutologgerConfig|New-EtwTraceSession|Remove-AutologgerConfig|Remove-EtwTraceProvider|Save-EtwTraceSession|Send-EtwTraceSession|Set-EtwTraceProvider|Start-EtwTraceSession|Stop-EtwTraceSession|Update-AutologgerConfig|Update-EtwTraceSession|" + // Module FailoverClusters "Add-ClusterCheckpoint|Add-ClusterDisk|Add-ClusterFileServerRole|Add-ClusterGenericApplicationRole|Add-ClusterGenericScriptRole|Add-ClusterGenericServiceRole|Add-ClusterGroup|Add-ClusterGroupSetDependency|Add-ClusterGroupToSet|Add-ClusteriSCSITargetServerRole|Add-ClusterNode|Add-ClusterResource|Add-ClusterResourceDependency|Add-ClusterResourceType|Add-ClusterScaleOutFileServerRole|Add-ClusterSharedVolume|Add-ClusterVirtualMachineRole|Add-ClusterVMMonitoredItem|Block-ClusterAccess|Clear-ClusterDiskReservation|Clear-ClusterNode|Disable-ClusterStorageSpacesDirect|Enable-ClusterStorageSpacesDirect|Get-Cluster|Get-ClusterAccess|Get-ClusterAvailableDisk|Get-ClusterCheckpoint|Get-ClusterDiagnosticInfo|Get-ClusterFaultDomain|Get-ClusterFaultDomainXML|Get-ClusterGroup|Get-ClusterGroupSet|Get-ClusterGroupSetDependency|Get-ClusterLog|Get-ClusterNetwork|Get-ClusterNetworkInterface|Get-ClusterNode|Get-ClusterOwnerNode|Get-ClusterParameter|Get-ClusterQuorum|Get-ClusterResource|Get-ClusterResourceDependency|Get-ClusterResourceDependencyReport|Get-ClusterResourceType|Get-ClusterSharedVolume|Get-ClusterSharedVolumeState|Get-ClusterStorageSpacesDirect|Get-ClusterVMMonitoredItem|Grant-ClusterAccess|Move-ClusterGroup|Move-ClusterResource|Move-ClusterSharedVolume|Move-ClusterVirtualMachineRole|New-Cluster|New-ClusterFaultDomain|New-ClusterGroupSet|New-ClusterNameAccount|Remove-Cluster|Remove-ClusterAccess|Remove-ClusterCheckpoint|Remove-ClusterFaultDomain|Remove-ClusterGroup|Remove-ClusterGroupFromSet|Remove-ClusterGroupSet|Remove-ClusterGroupSetDependency|Remove-ClusterNode|Remove-ClusterResource|Remove-ClusterResourceDependency|Remove-ClusterResourceType|Remove-ClusterSharedVolume|Remove-ClusterVMMonitoredItem|Repair-ClusterStorageSpacesDirect|Reset-ClusterVMMonitoredState|Resume-ClusterNode|Resume-ClusterResource|Set-ClusterFaultDomain|Set-ClusterFaultDomainXML|Set-ClusterGroupSet|Set-ClusterLog|Set-ClusterOwnerNode|Set-ClusterParameter|Set-ClusterQuorum|Set-ClusterResourceDependency|Set-ClusterStorageSpacesDirect|Set-ClusterStorageSpacesDirectDisk|Start-Cluster|Start-ClusterGroup|Start-ClusterNode|Start-ClusterResource|Stop-Cluster|Stop-ClusterGroup|Stop-ClusterNode|Stop-ClusterResource|Suspend-ClusterNode|Suspend-ClusterResource|Test-Cluster|Test-ClusterResourceFailure|Update-ClusterFunctionalLevel|Update-ClusterIPResource|Update-ClusterNetworkNameResource|Update-ClusterVirtualMachineConfiguration|" + // Module FileServerResourceManager "Get-FsrmAdrSetting|Get-FsrmAutoQuota|Get-FsrmClassification|Get-FsrmClassificationPropertyDefinition|Get-FsrmClassificationRule|Get-FsrmEffectiveNamespace|Get-FsrmFileGroup|Get-FsrmFileManagementJob|Get-FsrmFileScreen|Get-FsrmFileScreenException|Get-FsrmFileScreenTemplate|Get-FsrmMacro|Get-FsrmMgmtProperty|Get-FsrmQuota|Get-FsrmQuotaTemplate|Get-FsrmRmsTemplate|Get-FsrmSetting|Get-FsrmStorageReport|New-FsrmAction|New-FsrmAutoQuota|New-FsrmClassificationPropertyDefinition|New-FsrmClassificationPropertyValue|New-FsrmClassificationRule|New-FsrmFileGroup|New-FsrmFileManagementJob|New-FsrmFileScreen|New-FsrmFileScreenException|New-FsrmFileScreenTemplate|New-FsrmFmjAction|New-FsrmFmjCondition|New-FsrmFMJNotification|New-FsrmFmjNotificationAction|New-FsrmQuota|New-FsrmQuotaTemplate|New-FsrmQuotaThreshold|New-FsrmScheduledTask|New-FsrmStorageReport|Remove-FsrmAutoQuota|Remove-FsrmClassificationPropertyDefinition|Remove-FsrmClassificationRule|Remove-FsrmFileGroup|Remove-FsrmFileManagementJob|Remove-FsrmFileScreen|Remove-FsrmFileScreenException|Remove-FsrmFileScreenTemplate|Remove-FsrmMgmtProperty|Remove-FsrmQuota|Remove-FsrmQuotaTemplate|Remove-FsrmStorageReport|Reset-FsrmFileScreen|Reset-FsrmQuota|Send-FsrmTestEmail|Set-FsrmAdrSetting|Set-FsrmAutoQuota|Set-FsrmClassification|Set-FsrmClassificationPropertyDefinition|Set-FsrmClassificationRule|Set-FsrmFileGroup|Set-FsrmFileManagementJob|Set-FsrmFileScreen|Set-FsrmFileScreenException|Set-FsrmFileScreenTemplate|Set-FsrmMgmtProperty|Set-FsrmQuota|Set-FsrmQuotaTemplate|Set-FsrmSetting|Set-FsrmStorageReport|Start-FsrmClassification|Start-FsrmFileManagementJob|Start-FsrmStorageReport|Stop-FsrmClassification|Stop-FsrmFileManagementJob|Stop-FsrmStorageReport|Update-FsrmAutoQuota|Update-FsrmClassificationPropertyDefinition|Update-FsrmQuota|Wait-FsrmClassification|Wait-FsrmFileManagementJob|Wait-FsrmStorageReport|" + // Module GroupPolicy "Backup-GPO|Copy-GPO|Get-GPInheritance|Get-GPO|Get-GPOReport|Get-GPPermission|Get-GPPrefRegistryValue|Get-GPRegistryValue|Get-GPResultantSetOfPolicy|Get-GPStarterGPO|Import-GPO|Invoke-GPUpdate|New-GPLink|New-GPO|New-GPStarterGPO|Remove-GPLink|Remove-GPO|Remove-GPPrefRegistryValue|Remove-GPRegistryValue|Rename-GPO|Restore-GPO|Set-GPInheritance|Set-GPLink|Set-GPPermission|Set-GPPrefRegistryValue|Set-GPRegistryValue|" + // Module HardwareCertification "Export-HwCertTestCollectionToXml|Import-HwCertTestCollectionFromXml|Merge-HwCertTestCollectionFromPackage|Merge-HwCertTestCollectionFromXml|New-HwCertProjectDefinitionFile|New-HwCertTestCollection|New-HwCertTestCollectionExcelReport|" + // Module HgsAttestation "Add-HgsAttestationCIPolicy|Add-HgsAttestationDumpPolicy|Add-HgsAttestationHostGroup|Add-HgsAttestationTpmHost|Add-HgsAttestationTpmPolicy|Disable-HgsAttestationPolicy|Enable-HgsAttestationPolicy|Get-HgsAttestationHostGroup|Get-HgsAttestationPolicy|Get-HgsAttestationSignerCertificate|Get-HgsAttestationTpmHost|Remove-HgsAttestationHostGroup|Remove-HgsAttestationPolicy|Remove-HgsAttestationTpmHost|" + // Module HgsClient "ConvertTo-HgsKeyProtector|Export-HgsGuardian|Get-HgsAttestationBaselinePolicy|Get-HgsClientConfiguration|Get-HgsGuardian|Grant-HgsKeyProtectorAccess|Import-HgsGuardian|New-HgsGuardian|New-HgsKeyProtector|Remove-HgsGuardian|Revoke-HgsKeyProtectorAccess|Set-HgsClientConfiguration|Test-HgsClientConfiguration|" + // Module HgsDiagnostics "Get-HgsTrace|Get-HgsTraceFileData|New-HgsTraceTarget|Test-HgsTraceTarget|" + // Module HgsKeyProtection "Add-HgsKeyProtectionAttestationSignerCertificate|Add-HgsKeyProtectionCertificate|Export-HgsKeyProtectionState|Get-HgsKeyProtectionAttestationSignerCertificate|Get-HgsKeyProtectionCertificate|Get-HgsKeyProtectionConfiguration|Import-HgsKeyProtectionState|Remove-HgsKeyProtectionAttestationSignerCertificate|Remove-HgsKeyProtectionCertificate|Set-HgsKeyProtectionAttestationSignerCertificatePolicy|Set-HgsKeyProtectionCertificate|Set-HgsKeyProtectionConfiguration|" + // Module HgsServer "Clear-HgsServer|Export-HgsServerState|Get-HgsServer|Import-HgsServerState|Initialize-HgsServer|Install-HgsServer|Set-HgsServer|Test-HgsServer|Uninstall-HgsServer|" + // Module HNVDiagnostics "Debug-SlbDatapath|Debug-VirtualMachineQueueOperation|Disable-MuxEchoResponder|Enable-MuxEchoResponder|Get-CustomerRoute|Get-NetworkControllerVipResource|Get-PACAMapping|Get-ProviderAddress|Get-VipHostMapping|Get-VMNetworkAdapterPortId|Get-VMSwitchExternalPortId|Test-DipHostReachability|Test-EncapOverheadSettings|Test-LogicalNetworkConnection|Test-LogicalNetworkSupportsJumboPacket|Test-VipReachability|Test-VirtualNetworkConnection|" + // Module HostComputeService "Get-ComputeProcess|Stop-ComputeProcess|" + // Module Hyper-V "Add-VMDvdDrive|Add-VMFibreChannelHba|Add-VMGpuPartitionAdapter|Add-VMGroupMember|Add-VMHardDiskDrive|Add-VMMigrationNetwork|Add-VMNetworkAdapter|Add-VMNetworkAdapterAcl|Add-VMNetworkAdapterExtendedAcl|Add-VmNetworkAdapterRoutingDomainMapping|Add-VMRemoteFx3dVideoAdapter|Add-VMScsiController|Add-VMStoragePath|Add-VMSwitch|Add-VMSwitchExtensionPortFeature|Add-VMSwitchExtensionSwitchFeature|Add-VMSwitchTeamMember|Checkpoint-VM|Compare-VM|Complete-VMFailover|Connect-VMNetworkAdapter|Connect-VMSan|Convert-VHD|Copy-VMFile|Debug-VM|Disable-VMConsoleSupport|Disable-VMEventing|Disable-VMIntegrationService|Disable-VMMigration|Disable-VMRemoteFXPhysicalVideoAdapter|Disable-VMResourceMetering|Disable-VMSwitchExtension|Disable-VMTPM|Disconnect-VMNetworkAdapter|Disconnect-VMSan|Dismount-VHD|Enable-VMConsoleSupport|Enable-VMEventing|Enable-VMIntegrationService|Enable-VMMigration|Enable-VMRemoteFXPhysicalVideoAdapter|Enable-VMReplication|Enable-VMResourceMetering|Enable-VMSwitchExtension|Enable-VMTPM|Export-VM|Export-VMSnapshot|Get-VHD|Get-VHDSet|Get-VHDSnapshot|Get-VM|Get-VMBios|Get-VMComPort|Get-VMConnectAccess|Get-VMDvdDrive|Get-VMFibreChannelHba|Get-VMFirmware|Get-VMFloppyDiskDrive|Get-VMGpuPartitionAdapter|Get-VMGroup|Get-VMHardDiskDrive|Get-VMHost|Get-VMHostCluster|Get-VMHostNumaNode|Get-VMHostNumaNodeStatus|Get-VMHostPartitionableGpu|Get-VMHostSupportedVersion|Get-VMIdeController|Get-VMIntegrationService|Get-VMKeyProtector|Get-VMMemory|Get-VMMigrationNetwork|Get-VMNetworkAdapter|Get-VMNetworkAdapterAcl|Get-VMNetworkAdapterExtendedAcl|Get-VMNetworkAdapterFailoverConfiguration|Get-VmNetworkAdapterIsolation|Get-VMNetworkAdapterRoutingDomainMapping|Get-VMNetworkAdapterTeamMapping|Get-VMNetworkAdapterVlan|Get-VMProcessor|Get-VMRemoteFx3dVideoAdapter|Get-VMRemoteFXPhysicalVideoAdapter|Get-VMReplication|Get-VMReplicationAuthorizationEntry|Get-VMReplicationServer|Get-VMResourcePool|Get-VMSan|Get-VMScsiController|Get-VMSecurity|Get-VMSnapshot|Get-VMStoragePath|Get-VMSwitch|Get-VMSwitchExtension|Get-VMSwitchExtensionPortData|Get-VMSwitchExtensionPortFeature|Get-VMSwitchExtensionSwitchData|Get-VMSwitchExtensionSwitchFeature|Get-VMSwitchTeam|Get-VMSystemSwitchExtension|Get-VMSystemSwitchExtensionPortFeature|Get-VMSystemSwitchExtensionSwitchFeature|Get-VMVideo|Grant-VMConnectAccess|Import-VM|Import-VMInitialReplication|Measure-VM|Measure-VMReplication|Measure-VMResourcePool|Merge-VHD|Mount-VHD|Move-VM|Move-VMStorage|New-VFD|New-VHD|New-VM|New-VMGroup|||New-VMReplicationAuthorizationEntry|New-VMResourcePool|New-VMSan|New-VMSwitch|Optimize-VHD|Optimize-VHDSet|Remove-VHDSnapshot|Remove-VM|Remove-VMDvdDrive|Remove-VMFibreChannelHba|Remove-VMGpuPartitionAdapter|Remove-VMGroup|Remove-VMGroupMember|Remove-VMHardDiskDrive|Remove-VMMigrationNetwork|Remove-VMNetworkAdapter|Remove-VMNetworkAdapterAcl|Remove-VMNetworkAdapterExtendedAcl|Remove-VMNetworkAdapterRoutingDomainMapping|Remove-VMNetworkAdapterTeamMapping|Remove-VMRemoteFx3dVideoAdapter|Remove-VMReplication|Remove-VMReplicationAuthorizationEntry|Remove-VMResourcePool|Remove-VMSan|Remove-VMSavedState|Remove-VMScsiController|Remove-VMSnapshot|Remove-VMStoragePath|Remove-VMSwitch|Remove-VMSwitchExtensionPortFeature|Remove-VMSwitchExtensionSwitchFeature|Remove-VMSwitchTeamMember|Rename-VM|Rename-VMGroup|Rename-VMNetworkAdapter|Rename-VMResourcePool|Rename-VMSan|Rename-VMSnapshot|Rename-VMSwitch|Repair-VM|Reset-VMReplicationStatistics|Reset-VMResourceMetering|Resize-VHD|Restart-VM|Restore-VMSnapshot|Resume-VM|Resume-VMReplication|Revoke-VMConnectAccess|Save-VM|Set-VHD|Set-VM|Set-VMBios|Set-VMComPort|Set-VMDvdDrive|Set-VMFibreChannelHba|Set-VMFirmware|Set-VMFloppyDiskDrive|Set-VMGpuPartitionAdapter|Set-VMHardDiskDrive|Set-VMHost|Set-VMHostCluster|Set-VMHostPartitionableGpu|Set-VMKeyProtector|Set-VMMemory|Set-VMMigrationNetwork|Set-VMNetworkAdapter|Set-VMNetworkAdapterFailoverConfiguration|Set-VmNetworkAdapterIsolation|Set-VmNetworkAdapterRoutingDomainMapping|Set-VMNetworkAdapterTeamMapping|Set-VMNetworkAdapterVlan|Set-VMProcessor|Set-VMRemoteFx3dVideoAdapter|Set-VMReplication|Set-VMReplicationAuthorizationEntry|Set-VMReplicationServer|Set-VMResourcePool|Set-VMSan|Set-VMSecurity|Set-VMSecurityPolicy|Set-VMSwitch|Set-VMSwitchExtensionPortFeature|Set-VMSwitchExtensionSwitchFeature|Set-VMSwitchTeam|Set-VMVideo|Start-VM|Start-VMFailover|Start-VMInitialReplication|Start-VMTrace|Stop-VM|Stop-VMFailover|Stop-VMInitialReplication|Stop-VMReplication|Stop-VMTrace|Suspend-VM|Suspend-VMReplication|Test-VHD|Test-VMNetworkAdapter|Test-VMReplicationConnection|Update-VMVersion|" + // Module IISAdministration "Clear-IISCentralCertProvider|Clear-IISConfigCollection|Disable-IISCentralCertProvider|Disable-IISSharedConfig|Enable-IISCentralCertProvider|Enable-IISSharedConfig|Export-IISConfiguration|Get-IISAppPool|Get-IISCentralCertProvider|Get-IISConfigAttributeValue|Get-IISConfigCollection|Get-IISConfigCollectionElement|Get-IISConfigElement|Get-IISConfigSection|Get-IISServerManager|Get-IISSharedConfig|Get-IISSite|Get-IISSiteBinding|New-IISConfigCollectionElement|New-IISSite|New-IISSiteBinding|Remove-IISConfigAttribute|Remove-IISConfigCollectionElement|Remove-IISConfigElement|Remove-IISSite|Remove-IISSiteBinding|Reset-IISServerManager|Set-IISCentralCertProvider|Set-IISCentralCertProviderCredential|Set-IISConfigAttributeValue|Start-IISCommitDelay|Start-IISSite|Stop-IISCommitDelay|Stop-IISSite|" + // Module International "Copy-UserInternationalSettingsToSystem|Get-WinAcceptLanguageFromLanguageListOptOut|Get-WinCultureFromLanguageListOptOut|Get-WinDefaultInputMethodOverride|Get-WinHomeLocation|Get-WinLanguageBarOption|Get-WinSystemLocale|Get-WinUILanguageOverride|Get-WinUserLanguageList|New-WinUserLanguageList|Set-Culture|Set-WinAcceptLanguageFromLanguageListOptOut|Set-WinCultureFromLanguageListOptOut|Set-WinDefaultInputMethodOverride|Set-WinHomeLocation|Set-WinLanguageBarOption|Set-WinSystemLocale|Set-WinUILanguageOverride|Set-WinUserLanguageList|" + // Module IpamServer "Add-IpamAddress|Add-IpamAddressSpace|Add-IpamBlock|Add-IpamCustomField|Add-IpamCustomFieldAssociation|Add-IpamCustomValue|Add-IpamDiscoveryDomain|" + // Module iSCSI "Connect-IscsiTarget|Disconnect-IscsiTarget|Get-IscsiConnection|Get-IscsiSession|Get-IscsiTarget|Get-IscsiTargetPortal|New-IscsiTargetPortal|Register-IscsiSession|Remove-IscsiTargetPortal|Set-IscsiChapSecret|Unregister-IscsiSession|Update-IscsiTarget|Update-IscsiTargetPortal|" + // Module IscsiTarget "Add-IscsiVirtualDiskTargetMapping|Checkpoint-IscsiVirtualDisk|Convert-IscsiVirtualDisk|Dismount-IscsiVirtualDiskSnapshot|Export-IscsiTargetServerConfiguration|Export-IscsiVirtualDiskSnapshot|Get-IscsiServerTarget|Get-IscsiTargetServerSetting|Get-IscsiVirtualDisk|Get-IscsiVirtualDiskSnapshot|Import-IscsiTargetServerConfiguration|Import-IscsiVirtualDisk|Mount-IscsiVirtualDiskSnapshot|New-IscsiServerTarget|New-IscsiVirtualDisk|Remove-IscsiServerTarget|Remove-IscsiVirtualDisk|Remove-IscsiVirtualDiskSnapshot|Remove-IscsiVirtualDiskTargetMapping|Resize-IscsiVirtualDisk|Restore-IscsiVirtualDisk|Set-IscsiServerTarget|Set-IscsiTargetServerSetting|Set-IscsiVirtualDisk|Set-IscsiVirtualDiskSnapshot|Stop-IscsiVirtualDiskOperation|" + // Module ISE "Get-IseSnippet|Import-IseSnippet|New-IseSnippet|" + // Module Kds "Add-KdsRootKey|Clear-KdsCache|Get-KdsConfiguration|Get-KdsRootKey|Set-KdsConfiguration|Test-KdsRootKey|" + // Module LanguagePackManagement "Get-InstalledLanguage|Get-SystemPreferredUILanguage|Install-Language|Set-SystemPreferredUILanguage|Uninstall-Language|" + // Module LAPS "Find-LapsADExtendedRights|Get-LapsAADPassword|Get-LapsADPassword|Get-LapsDiagnostics|Invoke-LapsPolicyProcessing|Reset-LapsPassword|Set-LapsADAuditing|Set-LapsADComputerSelfPermission|Set-LapsADPasswordExpirationTime|Set-LapsADReadPasswordPermission|Set-LapsADResetPasswordPermission|Update-LapsADSchema|" + // Module Microsoft.DiagnosticDataViewer "Disable-DiagnosticDataViewing|Enable-DiagnosticDataViewing|Get-DiagnosticData|Get-DiagnosticDataTypes|Get-DiagnosticDataViewingSetting|Get-DiagnosticStoreCapacity|Set-DiagnosticStoreCapacity|" + // Module Microsoft.PowerShell.Archive "Compress-Archive|Expand-Archive|" + // Module Microsoft.PowerShell.Diagnostics "Export-Counter|Get-Counter|Get-WinEvent|Import-Counter|New-WinEvent|" + // Module Microsoft.PowerShell.Host "Start-Transcript|Stop-Transcript|" + // Module Microsoft.PowerShell.Management "Add-Computer|Add-Content|Checkpoint-Computer|Clear-Content|Clear-EventLog|Clear-Item|Clear-ItemProperty|Clear-RecycleBin|Complete-Transaction|Convert-Path|Copy-Item|Copy-ItemProperty|Debug-Process|Disable-ComputerRestore|Enable-ComputerRestore|Get-ChildItem|Get-Clipboard|Get-ComputerRestorePoint|Get-Content|Get-ControlPanelItem|Get-EventLog|Get-HotFix|Get-Item|Get-ItemProperty|Get-ItemPropertyValue|Get-Location|Get-Process|Get-PSDrive|Get-PSProvider|Get-Service|Get-Transaction|Get-WmiObject|Invoke-Item|Invoke-WmiMethod|Join-Path|Limit-EventLog|Move-Item|Move-ItemProperty|New-EventLog|New-Item|New-ItemProperty|New-PSDrive|New-Service|New-WebServiceProxy|Pop-Location|Push-Location|Register-WmiEvent|Remove-Computer|Remove-EventLog|Remove-Item|Remove-ItemProperty|Remove-PSDrive|Remove-WmiObject|Rename-Computer|Rename-Item|Rename-ItemProperty|Reset-ComputerMachinePassword|Resolve-Path|Restart-Computer|Restart-Service|Restore-Computer|Resume-Service|Set-Clipboard|Set-Content|Set-Item|Set-ItemProperty|Set-Location|Set-Service|Set-WmiInstance|Show-ControlPanelItem|Show-EventLog|Split-Path|Start-Process|Start-Service|Start-Transaction|Stop-Computer|Stop-Process|Stop-Service|Suspend-Service|Test-ComputerSecureChannel|Test-Connection|Test-Path|Undo-Transaction|Use-Transaction|Wait-Process|Write-EventLog|" + // Module Microsoft.PowerShell.ODataUtils "Export-ODataEndpointProxy|" + // Module Microsoft.PowerShell.Security "ConvertFrom-SecureString|ConvertTo-SecureString|Get-Acl|Get-AuthenticodeSignature|Get-CmsMessage|Get-Credential|Get-ExecutionPolicy|Get-PfxCertificate|Protect-CmsMessage|Set-Acl|Set-AuthenticodeSignature|Set-ExecutionPolicy|Unprotect-CmsMessage|" + // Module Microsoft.PowerShell.Utility "ConvertFrom-SddlString|Format-Hex|Get-FileHash|Import-PowerShellDataFile|New-Guid|New-TemporaryFile|Add-Member|Add-Type|Clear-Variable|Compare-Object|ConvertFrom-Csv|ConvertFrom-Json|ConvertFrom-String|ConvertFrom-StringData|Convert-String|ConvertTo-Csv|ConvertTo-Html|ConvertTo-Json|ConvertTo-Xml|Debug-Runspace|Disable-PSBreakpoint|Disable-RunspaceDebug|Enable-PSBreakpoint|Enable-RunspaceDebug|Export-Alias|Export-Clixml|Export-Csv|Export-FormatData|Export-PSSession|Format-Custom|Format-List|Format-Table|Format-Wide|Get-Alias|Get-Culture|Get-Date|Get-Event|Get-EventSubscriber|Get-FormatData|Get-Host|Get-Member|Get-PSBreakpoint|Get-PSCallStack|Get-Random|Get-Runspace|Get-RunspaceDebug|Get-TraceSource|Get-TypeData|Get-UICulture|Get-Unique|Get-Variable|Group-Object|Import-Alias|Import-Clixml|Import-Csv|Import-LocalizedData|Import-PSSession|Invoke-Expression|Invoke-RestMethod|Invoke-WebRequest|Measure-Command|Measure-Object|New-Alias|New-Event|New-Object|New-TimeSpan|New-Variable|Out-File|Out-GridView|Out-Printer|Out-String|Read-Host|Register-EngineEvent|Register-ObjectEvent|Remove-Event|Remove-PSBreakpoint|Remove-TypeData|Remove-Variable|Select-Object|Select-String|Select-Xml|Send-MailMessage|Set-Alias|Set-Date|Set-PSBreakpoint|Set-TraceSource|Set-Variable|Show-Command|Sort-Object|Start-Sleep|Tee-Object|Trace-Command|Unblock-File|Unregister-Event|Update-FormatData|Update-List|Update-TypeData|Wait-Debugger|Wait-Event|Write-Debug|Write-Error|Write-Host|Write-Information|Write-Output|Write-Progress|Write-Verbose|Write-Warning|" + // Module Microsoft.WSMan.Management "Connect-WSMan|Disable-WSManCredSSP|Disconnect-WSMan|Enable-WSManCredSSP|Get-WSManCredSSP|Get-WSManInstance|Invoke-WSManAction|New-WSManInstance|New-WSManSessionOption|Remove-WSManInstance|Set-WSManInstance|Set-WSManQuickConfig|Test-WSMan|" + // Module MMAgent "Debug-MMAppPrelaunch|Disable-MMAgent|Enable-MMAgent|Get-MMAgent|Set-MMAgent|" + // Module MPIO "Clear-MSDSMSupportedHW|Disable-MSDSMAutomaticClaim|Enable-MSDSMAutomaticClaim|Get-MPIOAvailableHW|Get-MPIOSetting|Get-MSDSMAutomaticClaimSettings|Get-MSDSMGlobalDefaultLoadBalancePolicy|Get-MSDSMSupportedHW|New-MSDSMSupportedHW|Remove-MSDSMSupportedHW|Set-MPIOSetting|Set-MSDSMGlobalDefaultLoadBalancePolicy|Update-MPIOClaimedHW|" + // Module MsDtc "Add-DtcClusterTMMapping|Complete-DtcDiagnosticTransaction|Get-Dtc|Get-DtcAdvancedHostSetting|Get-DtcAdvancedSetting|Get-DtcClusterDefault|Get-DtcClusterTMMapping|Get-DtcDefault|Get-DtcLog|Get-DtcNetworkSetting|Get-DtcTransaction|Get-DtcTransactionsStatistics|Get-DtcTransactionsTraceSession|Get-DtcTransactionsTraceSetting|Install-Dtc|Join-DtcDiagnosticResourceManager|New-DtcDiagnosticTransaction|Receive-DtcDiagnosticTransaction|Remove-DtcClusterTMMapping|Reset-DtcLog|Send-DtcDiagnosticTransaction|Set-DtcAdvancedHostSetting|Set-DtcAdvancedSetting|Set-DtcClusterDefault|Set-DtcClusterTMMapping|Set-DtcDefault|Set-DtcLog|Set-DtcNetworkSetting|Set-DtcTransaction|Set-DtcTransactionsTraceSession|Set-DtcTransactionsTraceSetting|Start-Dtc|Start-DtcDiagnosticResourceManager|Start-DtcTransactionsTraceSession|Stop-Dtc|Stop-DtcDiagnosticResourceManager|Stop-DtcTransactionsTraceSession|Test-Dtc|Undo-DtcDiagnosticTransaction|Uninstall-Dtc|Write-DtcTransactionsTraceSession|" + // Module MSMQ "Clear-MSMQOutgoingQueue|Clear-MSMQQueue|Enable-MSMQCertificate|Get-MSMQCertificate|Get-MSMQOutgoingQueue|Get-MsmqQueue|Get-MsmqQueueACL|Get-MsmqQueueManager|Get-MsmqQueueManagerACL|Move-MsmqMessage|New-MsmqMessage|New-MsmqQueue|Receive-MsmqQueue|Remove-MsmqCertificate|Remove-MsmqQueue|Resume-MsmqOutgoingQueue|Send-MsmqQueue|Set-MsmqQueue|Set-MsmqQueueACL|Set-MsmqQueueManager|Set-MsmqQueueManagerACL|Suspend-MsmqOutgoingQueue|" + // Module MultiPoint "Add-WmsSystem|Clear-WmsStation|Close-WmsApp|Close-WmsSession|Disable-WmsDiskProtection|Disable-WmsScheduledUpdate|Disable-WmsWebLimiting|Disconnect-WmsSession|Enable-WmsDiskProtection|Enable-WmsScheduledUpdate|Enable-WmsWebLimiting|Get-WmsAlert|Get-WmsApp|Get-WmsDiskProtection|Get-WmsScheduledUpdate|Get-WmsSession|Get-WmsStation|Get-WmsSystem|Get-WmsUser|Get-WmsVersion|Get-WmsWebLimiting|Hide-WmsIdentifier|Join-WmsStation|Lock-WmsSession|Lock-WmsUsbStorage|New-WmsUser|Open-WmsApp|Publish-WmsDesktop|Remove-WmsSystem|Remove-WmsUser|Restart-WmsSystem|Resume-WmsDiskProtection|Search-WmsSystem|Set-WmsScheduledUpdate|Set-WmsStation|Set-WmsSystem|Set-WmsUser|Set-WmsWebLimiting|Show-WmsDesktop|Show-WmsIdentifier|Split-WmsStation|Stop-WmsSystem|Suspend-WmsDiskProtection|Unlock-WmsSession|Unlock-WmsUsbStorage|Unpublish-WmsDesktop|Update-WmsStation|" + // Module MultipointVdi "Disable-WmsVirtualDesktopRole|Enable-WmsVirtualDesktopRole|Get-WmsVirtualDesktop|Import-WmsVirtualDesktop|New-WmsVirtualDesktop|New-WmsVirtualDesktopTemplate|Open-WmsVirtualDesktop|" + // Module NanoServerImageGenerator "Edit-NanoServerImage|Get-NanoServerPackage|New-NanoServerImage|" + // Module NetAdapter "Disable-NetAdapter|Disable-NetAdapterBinding|Disable-NetAdapterChecksumOffload|Disable-NetAdapterEncapsulatedPacketTaskOffload|Disable-NetAdapterIPsecOffload|Disable-NetAdapterLso|Disable-NetAdapterPowerManagement|Disable-NetAdapterQos|Disable-NetAdapterRdma|Disable-NetAdapterRsc|Disable-NetAdapterRss|Disable-NetAdapterSriov|Disable-NetAdapterUso|Disable-NetAdapterVmq|Enable-NetAdapter|Enable-NetAdapterBinding|Enable-NetAdapterChecksumOffload|Enable-NetAdapterEncapsulatedPacketTaskOffload|Enable-NetAdapterIPsecOffload|Enable-NetAdapterLso|Enable-NetAdapterPowerManagement|Enable-NetAdapterQos|Enable-NetAdapterRdma|Enable-NetAdapterRsc|Enable-NetAdapterRss|Enable-NetAdapterSriov|Enable-NetAdapterUso|Enable-NetAdapterVmq|Get-NetAdapter|Get-NetAdapterAdvancedProperty|Get-NetAdapterBinding|Get-NetAdapterChecksumOffload|Get-NetAdapterDataPathConfiguration|Get-NetAdapterEncapsulatedPacketTaskOffload|Get-NetAdapterHardwareInfo|Get-NetAdapterIPsecOffload|Get-NetAdapterLso|Get-NetAdapterPowerManagement|Get-NetAdapterQos|Get-NetAdapterRdma|Get-NetAdapterRsc|Get-NetAdapterRss|Get-NetAdapterSriov|Get-NetAdapterSriovVf|Get-NetAdapterStatistics|Get-NetAdapterUso|Get-NetAdapterVmq|Get-NetAdapterVmqQueue|Get-NetAdapterVPort|New-NetAdapterAdvancedProperty|Remove-NetAdapterAdvancedProperty|Rename-NetAdapter|Reset-NetAdapterAdvancedProperty|Restart-NetAdapter|Set-NetAdapter|Set-NetAdapterAdvancedProperty|Set-NetAdapterBinding|Set-NetAdapterChecksumOffload|Set-NetAdapterDataPathConfiguration|Set-NetAdapterEncapsulatedPacketTaskOffload|Set-NetAdapterIPsecOffload|Set-NetAdapterLso|Set-NetAdapterPowerManagement|Set-NetAdapterQos|Set-NetAdapterRdma|Set-NetAdapterRsc|Set-NetAdapterRss|Set-NetAdapterSriov|Set-NetAdapterUso|Set-NetAdapterVmq|" + // Module NetConnection "Get-NetConnectionProfile|Set-NetConnectionProfile|" + // Module NetEventPacketCapture "Add-NetEventNetworkAdapter|Add-NetEventPacketCaptureProvider|Add-NetEventProvider|Add-NetEventVFPProvider|Add-NetEventVmNetworkAdapter|Add-NetEventVmSwitch|Add-NetEventVmSwitchProvider|Add-NetEventWFPCaptureProvider|Get-NetEventNetworkAdapter|Get-NetEventPacketCaptureProvider|Get-NetEventProvider|Get-NetEventSession|Get-NetEventVFPProvider|Get-NetEventVmNetworkAdapter|Get-NetEventVmSwitch|Get-NetEventVmSwitchProvider|Get-NetEventWFPCaptureProvider|New-NetEventSession|Remove-NetEventNetworkAdapter|Remove-NetEventPacketCaptureProvider|Remove-NetEventProvider|Remove-NetEventSession|Remove-NetEventVFPProvider|Remove-NetEventVmNetworkAdapter|Remove-NetEventVmSwitch|Remove-NetEventVmSwitchProvider|Remove-NetEventWFPCaptureProvider|Set-NetEventPacketCaptureProvider|Set-NetEventProvider|Set-NetEventSession|Set-NetEventVFPProvider|Set-NetEventVmSwitchProvider|Set-NetEventWFPCaptureProvider|Start-NetEventSession|Stop-NetEventSession|" + // Module NetLbfo "Add-NetLbfoTeamMember|Add-NetLbfoTeamNic|Get-NetLbfoTeam|Get-NetLbfoTeamMember|Get-NetLbfoTeamNic|New-NetLbfoTeam|Remove-NetLbfoTeam|Remove-NetLbfoTeamMember|Remove-NetLbfoTeamNic|Rename-NetLbfoTeam|Set-NetLbfoTeam|Set-NetLbfoTeamMember|Set-NetLbfoTeamNic|" + // Module NetLldpAgent "Disable-NetLldpAgent|Enable-NetLldpAgent|Get-NetLldpAgent|" + // Module NetNat "Add-NetNatExternalAddress|Add-NetNatStaticMapping|Get-NetNat|Get-NetNatExternalAddress|Get-NetNatGlobal|Get-NetNatSession|Get-NetNatStaticMapping|New-NetNat|Remove-NetNat|Remove-NetNatExternalAddress|Remove-NetNatStaticMapping|Set-NetNat|Set-NetNatGlobal|" + // Module NetQos "Get-NetQosPolicy|New-NetQosPolicy|Remove-NetQosPolicy|Set-NetQosPolicy|" + // Module NetSecurity "Copy-NetFirewallRule|Copy-NetIPsecMainModeCryptoSet|Copy-NetIPsecMainModeRule|Copy-NetIPsecPhase1AuthSet|Copy-NetIPsecPhase2AuthSet|Copy-NetIPsecQuickModeCryptoSet|Copy-NetIPsecRule|Disable-NetFirewallRule|Disable-NetIPsecMainModeRule|Disable-NetIPsecRule|Enable-NetFirewallRule|Enable-NetIPsecMainModeRule|Enable-NetIPsecRule|Find-NetIPsecRule|Get-DAPolicyChange|Get-NetFirewallAddressFilter|Get-NetFirewallApplicationFilter|Get-NetFirewallDynamicKeywordAddress|Get-NetFirewallInterfaceFilter|Get-NetFirewallInterfaceTypeFilter|Get-NetFirewallPortFilter|Get-NetFirewallProfile|Get-NetFirewallRule|Get-NetFirewallSecurityFilter|Get-NetFirewallServiceFilter|Get-NetFirewallSetting|Get-NetIPsecDospSetting|Get-NetIPsecMainModeCryptoSet|Get-NetIPsecMainModeRule|Get-NetIPsecMainModeSA|Get-NetIPsecPhase1AuthSet|Get-NetIPsecPhase2AuthSet|Get-NetIPsecQuickModeCryptoSet|Get-NetIPsecQuickModeSA|Get-NetIPsecRule|New-NetFirewallDynamicKeywordAddress|New-NetFirewallRule|New-NetIPsecAuthProposal|New-NetIPsecDospSetting|New-NetIPsecMainModeCryptoProposal|New-NetIPsecMainModeCryptoSet|New-NetIPsecMainModeRule|New-NetIPsecPhase1AuthSet|New-NetIPsecPhase2AuthSet|New-NetIPsecQuickModeCryptoProposal|New-NetIPsecQuickModeCryptoSet|New-NetIPsecRule|Open-NetGPO|Remove-NetFirewallDynamicKeywordAddress|Remove-NetFirewallRule|Remove-NetIPsecDospSetting|Remove-NetIPsecMainModeCryptoSet|Remove-NetIPsecMainModeRule|Remove-NetIPsecMainModeSA|Remove-NetIPsecPhase1AuthSet|Remove-NetIPsecPhase2AuthSet|Remove-NetIPsecQuickModeCryptoSet|Remove-NetIPsecQuickModeSA|Remove-NetIPsecRule|Rename-NetFirewallRule|Rename-NetIPsecMainModeCryptoSet|Rename-NetIPsecMainModeRule|Rename-NetIPsecPhase1AuthSet|Rename-NetIPsecPhase2AuthSet|Rename-NetIPsecQuickModeCryptoSet|Rename-NetIPsecRule|Save-NetGPO|Set-NetFirewallAddressFilter|Set-NetFirewallApplicationFilter|Set-NetFirewallInterfaceFilter|Set-NetFirewallInterfaceTypeFilter|Set-NetFirewallPortFilter|Set-NetFirewallProfile|Set-NetFirewallRule|Set-NetFirewallSecurityFilter|Set-NetFirewallServiceFilter|Set-NetFirewallSetting|Set-NetIPsecDospSetting|Set-NetIPsecMainModeCryptoSet|Set-NetIPsecMainModeRule|Set-NetIPsecPhase1AuthSet|Set-NetIPsecPhase2AuthSet|Set-NetIPsecQuickModeCryptoSet|Set-NetIPsecRule|Show-NetFirewallRule|Show-NetIPsecRule|Sync-NetIPsecRule|Update-NetFirewallDynamicKeywordAddress|Update-NetIPsecRule|" + // Module NetSwitchTeam "Add-NetSwitchTeamMember|Get-NetSwitchTeam|Get-NetSwitchTeamMember|New-NetSwitchTeam|Remove-NetSwitchTeam|Remove-NetSwitchTeamMember|Rename-NetSwitchTeam|" + // Module NetTCPIP "Find-NetRoute|Get-NetCompartment|Get-NetIPAddress|Get-NetIPConfiguration|Get-NetIPInterface|Get-NetIPv4Protocol|Get-NetIPv6Protocol|Get-NetNeighbor|Get-NetOffloadGlobalSetting|Get-NetPrefixPolicy|Get-NetRoute|Get-NetTCPConnection|Get-NetTCPSetting|Get-NetTransportFilter|Get-NetUDPEndpoint|Get-NetUDPSetting|New-NetIPAddress|New-NetNeighbor|New-NetRoute|New-NetTransportFilter|Remove-NetIPAddress|Remove-NetNeighbor|Remove-NetRoute|Remove-NetTransportFilter|Set-NetIPAddress|Set-NetIPInterface|Set-NetIPv4Protocol|Set-NetIPv6Protocol|Set-NetNeighbor|Set-NetOffloadGlobalSetting|Set-NetRoute|Set-NetTCPSetting|Set-NetUDPSetting|Test-NetConnection|" + // Module NetWNV "Get-NetVirtualizationCustomerRoute|Get-NetVirtualizationGlobal|Get-NetVirtualizationLookupRecord|Get-NetVirtualizationProviderAddress|Get-NetVirtualizationProviderRoute|New-NetVirtualizationCustomerRoute|New-NetVirtualizationLookupRecord|New-NetVirtualizationProviderAddress|New-NetVirtualizationProviderRoute|Remove-NetVirtualizationCustomerRoute|Remove-NetVirtualizationLookupRecord|Remove-NetVirtualizationProviderAddress|Remove-NetVirtualizationProviderRoute|Select-NetVirtualizationNextHop|Set-NetVirtualizationCustomerRoute|Set-NetVirtualizationGlobal|Set-NetVirtualizationLookupRecord|Set-NetVirtualizationProviderAddress|Set-NetVirtualizationProviderRoute|" + // Module NetworkConnectivityStatus "Get-DAConnectionStatus|Get-NCSIPolicyConfiguration|Reset-NCSIPolicyConfiguration|Set-NCSIPolicyConfiguration|" + // Module NetworkController "Add-NetworkControllerNode|Clear-NetworkControllerNodeContent|Disable-NetworkControllerNode|Enable-NetworkControllerNode|Get-NetworkController|Get-NetworkControllerAccessControlList|Get-NetworkControllerAccessControlListRule|Get-NetworkControllerAuditingSettingsConfiguration|Get-NetworkControllerBackup|Get-NetworkControllerCluster|Get-NetworkControllerConnectivityCheck|Get-NetworkControllerConnectivityCheckResult|Get-NetworkControllerCredential|Get-NetworkControllerDiagnostic|Get-NetworkControllerDiscovery|Get-NetworkControllerFabricRoute|Get-NetworkControllerGateway|Get-NetworkControllerGatewayPool|Get-NetworkControllerIDnsServerConfiguration|Get-NetworkControllerInternalResourceInstances|Get-NetworkControllerIpPool|Get-NetworkControllerIpReservation|Get-NetworkControllerLoadBalancer|Get-NetworkControllerLoadBalancerBackendAddressPool|Get-NetworkControllerLoadBalancerConfiguration|Get-NetworkControllerLoadBalancerFrontendIpConfiguration|Get-NetworkControllerLoadBalancerInboundNatRule|Get-NetworkControllerLoadBalancerMux|Get-NetworkControllerLoadBalancerOutboundNatRule|Get-NetworkControllerLoadBalancerProbe|Get-NetworkControllerLoadBalancingRule|Get-NetworkControllerLogicalNetwork|Get-NetworkControllerLogicalSubnet|Get-NetworkControllerMacPool|Get-NetworkControllerNetworkInterface|Get-NetworkControllerNetworkInterfaceIpConfiguration|Get-NetworkControllerNode|Get-NetworkControllerPublicIpAddress|Get-NetworkControllerRestore|Get-NetworkControllerRoute|Get-NetworkControllerRouteTable|Get-NetworkControllerServer|Get-NetworkControllerServerInterface|Get-NetworkControllerServiceInsertion|Get-NetworkControllerState|Get-NetworkControllerStatistics|Get-NetworkControllerSubnetEgressReset|Get-NetworkControllerVirtualGateway|Get-NetworkControllerVirtualGatewayBgpPeer|Get-NetworkControllerVirtualGatewayBgpRouter|Get-NetworkControllerVirtualGatewayNetworkConnection|Get-NetworkControllerVirtualGatewayPolicyMap|Get-NetworkControllerVirtualNetwork|Get-NetworkControllerVirtualNetworkConfiguration|Get-NetworkControllerVirtualNetworkPeering|Get-NetworkControllerVirtualServer|Get-NetworkControllerVirtualSubnet|Get-NetworkControllerVirtualSwitchConfiguration|Install-NetworkController|Install-NetworkControllerCluster|Invoke-NetworkControllerConnectivityCheck|Invoke-NetworkControllerState|Invoke-NetworkControllerSubnetEgressReset|New-NetworkControllerAccessControlList|New-NetworkControllerAccessControlListRule|New-NetworkControllerBackup|New-NetworkControllerCredential|New-NetworkControllerFabricRoute|New-NetworkControllerGateway|New-NetworkControllerGatewayPool|New-NetworkControllerIDnsServerConfiguration|New-NetworkControllerIpPool|New-NetworkControllerIpReservation|New-NetworkControllerLoadBalancer|New-NetworkControllerLoadBalancerBackendAddressPool|New-NetworkControllerLoadBalancerConfiguration|New-NetworkControllerLoadBalancerFrontendIpConfiguration|New-NetworkControllerLoadBalancerInboundNatRule|New-NetworkControllerLoadBalancerMux|New-NetworkControllerLoadBalancerOutboundNatRule|New-NetworkControllerLoadBalancerProbe|New-NetworkControllerLoadBalancingRule|New-NetworkControllerLogicalNetwork|New-NetworkControllerLogicalSubnet|New-NetworkControllerMacPool|New-NetworkControllerNetworkInterface|New-NetworkControllerNetworkInterfaceIpConfiguration|New-NetworkControllerNodeObject|New-NetworkControllerPublicIpAddress|New-NetworkControllerRestore|New-NetworkControllerRoute|New-NetworkControllerRouteTable|New-NetworkControllerServer|New-NetworkControllerServerInterface|New-NetworkControllerServiceInsertion|New-NetworkControllerVirtualGateway|New-NetworkControllerVirtualGatewayBgpPeer|New-NetworkControllerVirtualGatewayBgpRouter|New-NetworkControllerVirtualGatewayNetworkConnection|New-NetworkControllerVirtualGatewayPolicyMap|New-NetworkControllerVirtualNetwork|New-NetworkControllerVirtualNetworkPeering|New-NetworkControllerVirtualServer|New-NetworkControllerVirtualSubnet|Remove-NetworkControllerAccessControlList|Remove-NetworkControllerAccessControlListRule|Remove-NetworkControllerBackup|Remove-NetworkControllerCredential|Remove-NetworkControllerFabricRoute|Remove-NetworkControllerGateway|Remove-NetworkControllerGatewayPool|Remove-NetworkControllerIpPool|Remove-NetworkControllerIpReservation|Remove-NetworkControllerLoadBalancer|Remove-NetworkControllerLoadBalancerBackendAddressPool|Remove-NetworkControllerLoadBalancerConfiguration|Remove-NetworkControllerLoadBalancerFrontendIpConfiguration|Remove-NetworkControllerLoadBalancerInboundNatRule|Remove-NetworkControllerLoadBalancerMux|Remove-NetworkControllerLoadBalancerOutboundNatRule|Remove-NetworkControllerLoadBalancerProbe|Remove-NetworkControllerLoadBalancingRule|Remove-NetworkControllerLogicalNetwork|Remove-NetworkControllerLogicalSubnet|Remove-NetworkControllerMacPool|Remove-NetworkControllerNetworkInterface|Remove-NetworkControllerNetworkInterfaceIpConfiguration|Remove-NetworkControllerNode|Remove-NetworkControllerPublicIpAddress|Remove-NetworkControllerRestore|Remove-NetworkControllerRoute|Remove-NetworkControllerRouteTable|Remove-NetworkControllerServer|Remove-NetworkControllerServerInterface|Remove-NetworkControllerServiceInsertion|Remove-NetworkControllerVirtualGateway|Remove-NetworkControllerVirtualGatewayBgpPeer|Remove-NetworkControllerVirtualGatewayBgpRouter|Remove-NetworkControllerVirtualGatewayNetworkConnection|Remove-NetworkControllerVirtualGatewayPolicyMap|Remove-NetworkControllerVirtualNetwork|Remove-NetworkControllerVirtualNetworkPeering|Remove-NetworkControllerVirtualServer|Remove-NetworkControllerVirtualSubnet|Repair-NetworkControllerCluster|Set-NetworkController|Set-NetworkControllerAuditingSettingsConfiguration|Set-NetworkControllerCluster|Set-NetworkControllerDiagnostic|Set-NetworkControllerNode|Set-NetworkControllerVirtualNetworkConfiguration|Set-NetworkControllerVirtualSwitchConfiguration|Uninstall-NetworkController|Uninstall-NetworkControllerCluster|Update-NetworkController|" + // Module NetworkControllerDiagnostics "Debug-NetworkController|Debug-NetworkControllerConfigurationState|Debug-ServiceFabricNodeStatus|Get-NetworkControllerDeploymentInfo|Get-NetworkControllerManagedDevices|Get-NetworkControllerReplica|" + // Module NetworkLoadBalancingClusters "Add-NlbClusterNode|Add-NlbClusterNodeDip|Add-NlbClusterPortRule|Add-NlbClusterVip|Disable-NlbClusterPortRule|Enable-NlbClusterPortRule|Get-NlbCluster|Get-NlbClusterDriverInfo|Get-NlbClusterNode|Get-NlbClusterNodeDip|Get-NlbClusterNodeNetworkInterface|Get-NlbClusterPortRule|Get-NlbClusterVip|New-NlbCluster|New-NlbClusterIpv6Address|Remove-NlbCluster|Remove-NlbClusterNode|Remove-NlbClusterNodeDip|Remove-NlbClusterPortRule|Remove-NlbClusterVip|Resume-NlbCluster|Resume-NlbClusterNode|Set-NlbCluster|Set-NlbClusterNode|Set-NlbClusterNodeDip|Set-NlbClusterPortRule|Set-NlbClusterPortRuleNodeHandlingPriority|Set-NlbClusterPortRuleNodeWeight|Set-NlbClusterVip|Start-NlbCluster|Start-NlbClusterNode|Stop-NlbCluster|Stop-NlbClusterNode|Suspend-NlbCluster|Suspend-NlbClusterNode|" + // Module NetworkSwitchManager "Disable-NetworkSwitchEthernetPort|Disable-NetworkSwitchFeature|Disable-NetworkSwitchVlan|Enable-NetworkSwitchEthernetPort|Enable-NetworkSwitchFeature|Enable-NetworkSwitchVlan|Get-NetworkSwitchEthernetPort|Get-NetworkSwitchFeature|Get-NetworkSwitchGlobalData|Get-NetworkSwitchVlan|New-NetworkSwitchVlan|Remove-NetworkSwitchEthernetPortIPAddress|Remove-NetworkSwitchVlan|Restore-NetworkSwitchConfiguration|Save-NetworkSwitchConfiguration|Set-NetworkSwitchEthernetPortIPAddress|Set-NetworkSwitchPortMode|Set-NetworkSwitchPortProperty|Set-NetworkSwitchVlanProperty|" + // Module NetworkTransition "Add-NetIPHttpsCertBinding|Disable-NetDnsTransitionConfiguration|Disable-NetIPHttpsProfile|Disable-NetNatTransitionConfiguration|Enable-NetDnsTransitionConfiguration|Enable-NetIPHttpsProfile|Enable-NetNatTransitionConfiguration|Get-Net6to4Configuration|Get-NetDnsTransitionConfiguration|Get-NetDnsTransitionMonitoring|Get-NetIPHttpsConfiguration|Get-NetIPHttpsState|Get-NetIsatapConfiguration|Get-NetNatTransitionConfiguration|Get-NetNatTransitionMonitoring|Get-NetTeredoConfiguration|Get-NetTeredoState|New-NetIPHttpsConfiguration|New-NetNatTransitionConfiguration|Remove-NetIPHttpsCertBinding|Remove-NetIPHttpsConfiguration|Remove-NetNatTransitionConfiguration|Rename-NetIPHttpsConfiguration|Reset-Net6to4Configuration|Reset-NetDnsTransitionConfiguration|Reset-NetIPHttpsConfiguration|Reset-NetIsatapConfiguration|Reset-NetTeredoConfiguration|Set-Net6to4Configuration|Set-NetDnsTransitionConfiguration|Set-NetIPHttpsConfiguration|Set-NetIsatapConfiguration|Set-NetNatTransitionConfiguration|Set-NetTeredoConfiguration|" + // Module NFS "Disconnect-NfsSession|Get-NfsClientConfiguration|Get-NfsClientgroup|Get-NfsClientLock|Get-NfsMappedIdentity|Get-NfsMappingStore|Get-NfsMountedClient|Get-NfsNetgroup|Get-NfsNetgroupStore|Get-NfsOpenFile|Get-NfsServerConfiguration|Get-NfsSession|Get-NfsShare|Get-NfsSharePermission|Get-NfsStatistics|Grant-NfsSharePermission|Install-NfsMappingStore|New-NfsClientgroup|New-NfsMappedIdentity|New-NfsNetgroup|New-NfsShare|Remove-NfsClientgroup|Remove-NfsMappedIdentity|Remove-NfsNetgroup|Remove-NfsShare|Rename-NfsClientgroup|Reset-NfsStatistics|Resolve-NfsMappedIdentity|Revoke-NfsClientLock|Revoke-NfsMountedClient|Revoke-NfsOpenFile|Revoke-NfsSharePermission|Set-NfsClientConfiguration|Set-NfsClientgroup|Set-NfsMappedIdentity|Set-NfsMappingStore|Set-NfsNetgroup|Set-NfsNetgroupStore|Set-NfsServerConfiguration|Set-NfsShare|Test-NfsMappedIdentity|Test-NfsMappingStore|" + // Module NPS "Export-NpsConfiguration|Get-NpsRadiusClient|Get-NpsSharedSecretTemplate|Import-NpsConfiguration|New-NpsRadiusClient|Remove-NpsRadiusClient|Set-NpsRadiusClient|" + // Module PackageManagement "Find-Package|Find-PackageProvider|Get-Package|Get-PackageProvider|Get-PackageSource|Import-PackageProvider|Install-Package|Install-PackageProvider|Register-PackageSource|Save-Package|Set-PackageSource|Uninstall-Package|Unregister-PackageSource|" + // Module PcsvDevice "Clear-PcsvDeviceLog|Get-PcsvDevice|Get-PcsvDeviceLog|Restart-PcsvDevice|Set-PcsvDeviceBootConfiguration|Set-PcsvDeviceNetworkConfiguration|Set-PcsvDeviceUserPassword|Start-PcsvDevice|Stop-PcsvDevice|" + // Module PersistentMemory "Get-PmemDedicatedMemory|Get-PmemDisk|Get-PmemPhysicalDevice|Get-PmemUnusedRegion|Initialize-PmemPhysicalDevice|New-PmemDedicatedMemory|New-PmemDisk|Remove-PmemDedicatedMemory|Remove-PmemDisk|" + // Module Pester "AfterAll|AfterEach|Assert-MockCalled|Assert-VerifiableMocks|BeforeAll|BeforeEach|Context|Describe|Get-MockDynamicParameters|Get-TestDriveItem|In|InModuleScope|Invoke-Mock|Invoke-Pester|It|Mock|New-Fixture|Set-DynamicParameterVariables|Setup|Should|" + // Module PKI "Add-CertificateEnrollmentPolicyServer|Export-Certificate|Export-PfxCertificate|Get-Certificate|Get-CertificateAutoEnrollmentPolicy|Get-CertificateEnrollmentPolicyServer|Get-CertificateNotificationTask|Get-PfxData|Import-Certificate|Import-PfxCertificate|New-CertificateNotificationTask|New-SelfSignedCertificate|Remove-CertificateEnrollmentPolicyServer|Remove-CertificateNotificationTask|Set-CertificateAutoEnrollmentPolicy|Switch-Certificate|Test-Certificate|" + // Module PlatformIdentifier "Get-PlatformIdentifier|" + // Module PnpDevice "Disable-PnpDevice|Enable-PnpDevice|Get-PnpDevice|Get-PnpDeviceProperty|" + // Module PowerShellGet "Find-DscResource|Find-Module|Find-Script|Get-InstalledModule|Get-InstalledScript|Get-PSRepository|Install-Module|Install-Script|New-ScriptFileInfo|Publish-Module|Publish-Script|Register-PSRepository|Save-Module|Save-Script|Set-PSRepository|Test-ScriptFileInfo|Uninstall-Module|Uninstall-Script|Unregister-PSRepository|Update-Module|Update-ModuleManifest|Update-Script|Update-ScriptFileInfo|" + // Module PrintManagement "Add-Printer|Add-PrinterDriver|Add-PrinterPort|Get-PrintConfiguration|Get-Printer|Get-PrinterDriver|Get-PrinterPort|Get-PrinterProperty|Get-PrintJob|Read-PrinterNfcTag|Remove-Printer|Remove-PrinterDriver|Remove-PrinterPort|Remove-PrintJob|Rename-Printer|Restart-PrintJob|Resume-PrintJob|Set-PrintConfiguration|Set-Printer|Set-PrinterProperty|Suspend-PrintJob|Write-PrinterNfcTag|" + // Module ProcessMitigations "ConvertTo-ProcessMitigationPolicy|Get-ProcessMitigation|Set-ProcessMitigation|" + // Module Provisioning "Export-ProvisioningPackage|Export-Trace|Get-ProvisioningPackage|Get-TrustedProvisioningCertificate|Install-ProvisioningPackage|Install-TrustedProvisioningCertificate|Uninstall-ProvisioningPackage|Uninstall-TrustedProvisioningCertificate|" + // Module PSDesiredStateConfiguration "Configuration|Disable-DscDebug|Enable-DscDebug|Get-DscConfiguration|Get-DscConfigurationStatus|Get-DscLocalConfigurationManager|Get-DscResource|New-DscChecksum|Remove-DscConfigurationDocument|Restore-DscConfiguration|Stop-DscConfiguration|Invoke-DscResource|Publish-DscConfiguration|Set-DscLocalConfigurationManager|Start-DscConfiguration|Test-DscConfiguration|Update-DscConfiguration|" + // Module PSDiagnostics "Disable-PSTrace|Disable-PSWSManCombinedTrace|Disable-WSManTrace|Enable-PSTrace|Enable-PSWSManCombinedTrace|Enable-WSManTrace|Get-LogProperties|Set-LogProperties|Start-Trace|Stop-Trace|" + // Module PSReadline "PSConsoleHostReadline|Get-PSReadlineKeyHandler|Get-PSReadlineOption|Remove-PSReadlineKeyHandler|Set-PSReadlineKeyHandler|Set-PSReadlineOption|" + // Module PSScheduledJob "Add-JobTrigger|Disable-JobTrigger|Disable-ScheduledJob|Enable-JobTrigger|Enable-ScheduledJob|Get-JobTrigger|Get-ScheduledJob|Get-ScheduledJobOption|New-JobTrigger|New-ScheduledJobOption|Register-ScheduledJob|Remove-JobTrigger|Set-JobTrigger|Set-ScheduledJob|Set-ScheduledJobOption|Unregister-ScheduledJob|" + // Module PSWorkflow "New-PSWorkflowSession|New-PSWorkflowExecutionOption|" + // Module PSWorkflowUtility "Invoke-AsWorkflow|" + // Module RDMgmt "Add-RDServer|Add-RDSessionHost|Add-RDVirtualDesktopToCollection|Disable-RDVirtualDesktopADMachineAccountReuse|Disconnect-RDUser|Enable-RDVirtualDesktopADMachineAccountReuse|Export-RDPersonalSessionDesktopAssignment|Export-RDPersonalVirtualDesktopAssignment|Get-RDAvailableApp|Get-RDCertificate|Get-RDConnectionBrokerHighAvailability|Get-RDDeploymentGatewayConfiguration|Get-RDFileTypeAssociation|Get-RDLicenseConfiguration|Get-RDPersonalSessionDesktopAssignment|Get-RDPersonalVirtualDesktopAssignment|Get-RDPersonalVirtualDesktopPatchSchedule|Get-RDRemoteApp|Get-RDRemoteDesktop|Get-RDServer|Get-RDSessionCollection|Get-RDSessionCollectionConfiguration|Get-RDSessionHost|Get-RDUserSession|Get-RDVirtualDesktop|Get-RDVirtualDesktopCollection|Get-RDVirtualDesktopCollectionConfiguration|Get-RDVirtualDesktopCollectionJobStatus|Get-RDVirtualDesktopConcurrency|Get-RDVirtualDesktopIdleCount|Get-RDVirtualDesktopTemplateExportPath|Get-RDWorkspace|Grant-RDOUAccess|Import-RDPersonalSessionDesktopAssignment|Import-RDPersonalVirtualDesktopAssignment|Invoke-RDUserLogoff|Move-RDVirtualDesktop|New-RDCertificate|New-RDPersonalVirtualDesktopPatchSchedule|New-RDRemoteApp|New-RDSessionCollection|New-RDSessionDeployment|New-RDVirtualDesktopCollection|New-RDVirtualDesktopDeployment|Remove-RDDatabaseConnectionString|Remove-RDPersonalSessionDesktopAssignment|Remove-RDPersonalVirtualDesktopAssignment|Remove-RDPersonalVirtualDesktopPatchSchedule|Remove-RDRemoteApp|Remove-RDServer|Remove-RDSessionCollection|Remove-RDSessionHost|Remove-RDVirtualDesktopCollection|Remove-RDVirtualDesktopFromCollection|Send-RDUserMessage|Set-RDActiveManagementServer|Set-RDCertificate|Set-RDClientAccessName|Set-RDConnectionBrokerHighAvailability|Set-RDDatabaseConnectionString|Set-RDDeploymentGatewayConfiguration|Set-RDFileTypeAssociation|Set-RDLicenseConfiguration|Set-RDPersonalSessionDesktopAssignment|Set-RDPersonalVirtualDesktopAssignment|Set-RDPersonalVirtualDesktopPatchSchedule|Set-RDRemoteApp|Set-RDRemoteDesktop|Set-RDSessionCollectionConfiguration|Set-RDSessionHost|Set-RDVirtualDesktopCollectionConfiguration|Set-RDVirtualDesktopConcurrency|Set-RDVirtualDesktopIdleCount|Set-RDVirtualDesktopTemplateExportPath|Set-RDWorkspace|Stop-RDVirtualDesktopCollectionJob|Test-RDOUAccess|Test-RDVirtualDesktopADMachineAccountReuse|Update-RDVirtualDesktopCollection|" + // Module RemoteAccess "Add-BgpCustomRoute|Add-BgpPeer|Add-BgpRouteAggregate|Add-BgpRouter|Add-BgpRoutingPolicy|Add-BgpRoutingPolicyForPeer|Add-DAAppServer|Add-DAClient|Add-DAClientDnsConfiguration|Add-DAEntryPoint|Add-DAMgmtServer|Add-RemoteAccessIpFilter|Add-RemoteAccessLoadBalancerNode|Add-RemoteAccessRadius|Add-VpnIPAddressRange|Add-VpnS2SInterface|Add-VpnSstpProxyRule|Clear-BgpRouteFlapDampening|Clear-RemoteAccessInboxAccountingStore|Clear-VpnS2SInterfaceStatistics|Connect-VpnS2SInterface|Disable-BgpRouteFlapDampening|Disable-DAMultiSite|Disable-DAOtpAuthentication|Disable-RemoteAccessRoutingDomain|Disconnect-VpnS2SInterface|Disconnect-VpnUser|Enable-BgpRouteFlapDampening|Enable-DAMultiSite|Enable-DAOtpAuthentication|Enable-RemoteAccessRoutingDomain|Get-BgpCustomRoute|Get-BgpPeer|Get-BgpRouteAggregate|Get-BgpRouteFlapDampening|Get-BgpRouteInformation|Get-BgpRouter|Get-BgpRoutingPolicy|Get-BgpStatistics|Get-DAAppServer|Get-DAClient|Get-DAClientDnsConfiguration|Get-DAEntryPoint|Get-DAEntryPointDC|Get-DAMgmtServer|Get-DAMultiSite|Get-DANetworkLocationServer|Get-DAOtpAuthentication|Get-DAServer|Get-RemoteAccess|Get-RemoteAccessAccounting|Get-RemoteAccessConfiguration|Get-RemoteAccessConnectionStatistics|Get-RemoteAccessConnectionStatisticsSummary|Get-RemoteAccessHealth|Get-RemoteAccessIpFilter|Get-RemoteAccessLoadBalancer|Get-RemoteAccessRadius|Get-RemoteAccessRoutingDomain|Get-RemoteAccessUserActivity|Get-RoutingProtocolPreference|Get-VpnAuthProtocol|Get-VpnS2SInterface|Get-VpnS2SInterfaceStatistics|Get-VpnServerConfiguration|Get-VpnSstpProxyRule|Install-RemoteAccess|New-VpnSstpProxyRule|New-VpnTrafficSelector|Remove-BgpCustomRoute|Remove-BgpPeer|Remove-BgpRouteAggregate|Remove-BgpRouter|Remove-BgpRoutingPolicy|Remove-BgpRoutingPolicyForPeer|Remove-DAAppServer|Remove-DAClient|Remove-DAClientDnsConfiguration|Remove-DAEntryPoint|Remove-DAMgmtServer|Remove-RemoteAccessIpFilter|Remove-RemoteAccessLoadBalancerNode|Remove-RemoteAccessRadius|Remove-VpnIPAddressRange|Remove-VpnS2SInterface|Remove-VpnSstpProxyRule|Set-BgpPeer|Set-BgpRouteAggregate|Set-BgpRouteFlapDampening|Set-BgpRouter|Set-BgpRoutingPolicy|Set-BgpRoutingPolicyForPeer|Set-DAAppServerConnection|Set-DAClient|Set-DAClientDnsConfiguration|Set-DAEntryPoint|Set-DAEntryPointDC|Set-DAMultiSite|Set-DANetworkLocationServer|Set-DAOtpAuthentication|Set-DAServer|Set-RemoteAccess|Set-RemoteAccessAccounting|Set-RemoteAccessConfiguration|Set-RemoteAccessInboxAccountingStore|Set-RemoteAccessIpFilter|Set-RemoteAccessLoadBalancer|Set-RemoteAccessRadius|Set-RemoteAccessRoutingDomain|Set-RoutingProtocolPreference|Set-VpnAuthProtocol|Set-VpnAuthType|Set-VpnIPAddressAssignment|Set-VpnS2SInterface|Set-VpnServerConfiguration|Set-VpnSstpProxyRule|Start-BgpPeer|Stop-BgpPeer|Uninstall-RemoteAccess|Update-DAMgmtServer|" + // Module RemoteDesktopServices "Convert-License|" + // Module ScheduledTasks "Disable-ScheduledTask|Enable-ScheduledTask|Export-ScheduledTask|Get-ClusteredScheduledTask|Get-ScheduledTask|Get-ScheduledTaskInfo|New-ScheduledTask|New-ScheduledTaskAction|New-ScheduledTaskPrincipal|New-ScheduledTaskSettingsSet|New-ScheduledTaskTrigger|Register-ClusteredScheduledTask|Register-ScheduledTask|Set-ClusteredScheduledTask|Set-ScheduledTask|Start-ScheduledTask|Stop-ScheduledTask|Unregister-ClusteredScheduledTask|Unregister-ScheduledTask|" + // Module SecureBoot "Confirm-SecureBootUEFI|Format-SecureBootUEFI|Get-SecureBootPolicy|Get-SecureBootUEFI|Set-SecureBootUEFI|" + // Module ServerCore "Get-DisplayResolution|Set-DisplayResolution|" + // Module ServerManager "Disable-ServerManagerStandardUserRemoting|Enable-ServerManagerStandardUserRemoting|Get-WindowsFeature|Install-WindowsFeature|Uninstall-WindowsFeature|" + // Module ServerManagerTasks "Get-SMCounterSample|Get-SMPerformanceCollector|Get-SMServerBpaResult|Get-SMServerClusterName|Get-SMServerEvent|Get-SMServerFeature|Get-SMServerInventory|Get-SMServerService|Remove-SMServerPerformanceLog|Start-SMPerformanceCollector|Stop-SMPerformanceCollector|" + // Module ShieldedVmCmdlets "Get-KeyProtectorFromShieldingDataFile|Get-ShieldedVMProvisioningStatus|Initialize-ShieldedVM|New-ShieldedVMSpecializationDataFile|Test-ShieldingDataApplicability|" + // Module ShieldedVMDataFile "Import-ShieldingDataFile|New-ShieldingDataFile|New-VolumeIDQualifier|Save-ShieldedVMRecoveryKey|Save-VolumeSignatureCatalog|Unprotect-ShieldedVMRecoveryKey|" + // Module ShieldedVMTemplate "Initialize-VMShieldingHelperVHD|Protect-TemplateDisk|" + // Module SmbShare "Block-SmbShareAccess|Close-SmbOpenFile|Close-SmbSession|Disable-SmbDelegation|Enable-SmbDelegation|Get-SmbBandwidthLimit|Get-SmbClientConfiguration|Get-SmbClientNetworkInterface|Get-SmbConnection|Get-SmbDelegation|Get-SmbGlobalMapping|Get-SmbMapping|Get-SmbMultichannelConnection|Get-SmbMultichannelConstraint|Get-SmbOpenFile|Get-SmbServerCertificateMapping|Get-SmbServerCertProps|Get-SmbServerConfiguration|Get-SmbServerNetworkInterface|Get-SmbSession|Get-SmbShare|Get-SmbShareAccess|Grant-SmbShareAccess|New-SmbGlobalMapping|New-SmbMapping|New-SmbMultichannelConstraint|New-SmbServerCertificateMapping|New-SmbShare|Remove-SmbBandwidthLimit|Remove-SmbComponent|Remove-SmbGlobalMapping|Remove-SmbMapping|Remove-SmbMultichannelConstraint|Remove-SmbServerCertificateMapping|Remove-SmbShare|Reset-SmbClientConfiguration|Reset-SmbServerConfiguration|Revoke-SmbShareAccess|Set-SmbBandwidthLimit|Set-SmbClientConfiguration|Set-SmbPathAcl|Set-SmbServerCertificateMapping|Set-SmbServerConfiguration|Set-SmbShare|Unblock-SmbShareAccess|Update-SmbMultichannelConnection|" + // Module SmbWitness "Move-SmbClient|Get-SmbWitnessClient|Move-SmbWitnessClient|" + // Module SMISConfig "Register-SmisProvider|Search-SmisProvider|Unregister-SmisProvider|" + // Module SoftwareInventoryLogging "Get-SilComputer|Get-SilComputerIdentity|Get-SilData|Get-SilLogging|Get-SilSoftware|Get-SilUalAccess|Get-SilWindowsUpdate|Publish-SilData|Set-SilLogging|Start-SilLogging|Stop-SilLogging|" + // Module StartLayout "Get-StartApps|Export-StartLayout|Import-StartLayout|Export-StartLayoutEdgeAssets|" + // Module Storage "Add-InitiatorIdToMaskingSet|Add-PartitionAccessPath|Add-PhysicalDisk|Add-TargetPortToMaskingSet|Add-VirtualDiskToMaskingSet|Block-FileShareAccess|Clear-Disk|Clear-FileStorageTier|Connect-VirtualDisk|Debug-FileShare|Debug-StorageSubSystem|Debug-Volume|Disable-PhysicalDiskIdentification|Disable-StorageEnclosureIdentification|Disable-StorageHighAvailability|Disable-StorageMaintenanceMode|Disconnect-VirtualDisk|Dismount-DiskImage|Enable-PhysicalDiskIdentification|Enable-StorageEnclosureIdentification|Enable-StorageHighAvailability|Enable-StorageMaintenanceMode|Format-Volume|Get-DedupProperties|Get-Disk|||||Get-DiskImage|Get-DiskStorageNodeView|Get-FileIntegrity|Get-FileShare|Get-FileShareAccessControlEntry|Get-FileStorageTier|Get-InitiatorId|Get-InitiatorPort|Get-MaskingSet|Get-OffloadDataTransferSetting|Get-Partition|Get-PartitionSupportedSize|Get-PhysicalDisk|Get-PhysicalDiskStorageNodeView|Get-PhysicalExtent|Get-PhysicalExtentAssociation|Get-ResiliencySetting|Get-StorageAdvancedProperty|Get-StorageDiagnosticInfo|Get-StorageEnclosure|Get-StorageEnclosureStorageNodeView|Get-StorageEnclosureVendorData|Get-StorageFaultDomain|Get-StorageFileServer|Get-StorageFirmwareInformation|Get-StorageHealthAction|Get-StorageHealthReport|Get-StorageHealthSetting|Get-StorageJob|Get-StorageNode|Get-StoragePool|Get-StorageProvider|Get-StorageReliabilityCounter|Get-StorageSetting|Get-StorageSubSystem|Get-StorageTier|Get-StorageTierSupportedSize|Get-SupportedClusterSizes|Get-SupportedFileSystems|Get-TargetPort|Get-TargetPortal|Get-VirtualDisk|Get-VirtualDiskSupportedSize|Get-Volume|Get-VolumeCorruptionCount|Get-VolumeScrubPolicy|Grant-FileShareAccess|Hide-VirtualDisk|Initialize-Disk|Mount-DiskImage|New-FileShare|New-MaskingSet|New-Partition|New-StorageFileServer|New-StoragePool|New-StorageSubsystemVirtualDisk|New-StorageTier|New-VirtualDisk|New-VirtualDiskClone|New-VirtualDiskSnapshot|New-Volume|Optimize-StoragePool|Optimize-Volume|Register-StorageSubsystem|Remove-FileShare|Remove-InitiatorId|Remove-InitiatorIdFromMaskingSet|Remove-MaskingSet|Remove-Partition|Remove-PartitionAccessPath|Remove-PhysicalDisk|Remove-StorageFileServer|Remove-StorageHealthSetting|Remove-StoragePool|Remove-StorageTier|Remove-TargetPortFromMaskingSet|Remove-VirtualDisk|Remove-VirtualDiskFromMaskingSet|Rename-MaskingSet|Repair-FileIntegrity|Repair-VirtualDisk|Repair-Volume|Reset-PhysicalDisk|Reset-StorageReliabilityCounter|Resize-Partition|Resize-StorageTier|Resize-VirtualDisk|Revoke-FileShareAccess|Set-Disk|Set-FileIntegrity|Set-FileShare|Set-FileStorageTier|Set-InitiatorPort|Set-Partition|Set-PhysicalDisk|Set-ResiliencySetting|Set-StorageFileServer|Set-StorageHealthSetting|Set-StoragePool|Set-StorageProvider|Set-StorageSetting|Set-StorageSubSystem|Set-StorageTier|Set-VirtualDisk|Set-Volume|Set-VolumeScrubPolicy|Show-VirtualDisk|Start-StorageDiagnosticLog|Stop-StorageDiagnosticLog|Stop-StorageJob|Unblock-FileShareAccess|Unregister-StorageSubsystem|Update-Disk|Update-HostStorageCache|Update-StorageFirmware|Update-StoragePool|Update-StorageProviderCache|Write-VolumeCache|" + // Module StorageQoS "Get-StorageQoSFlow|Get-StorageQosPolicy|Get-StorageQosPolicyStore|Get-StorageQosVolume|New-StorageQosPolicy|Remove-StorageQosPolicy|Set-StorageQosPolicy|Set-StorageQosPolicyStore|" + // Module StorageReplica "Clear-SRMetadata|Dismount-SRDestination|Export-SRConfiguration|Get-SRAccess|Get-SRDelegation|Get-SRGroup|Get-SRNetworkConstraint|Get-SRPartnership|Grant-SRAccess|Grant-SRDelegation|Mount-SRDestination|New-SRGroup|New-SRPartnership|Remove-SRGroup|Remove-SRNetworkConstraint|Remove-SRPartnership|Revoke-SRAccess|Revoke-SRDelegation|Set-SRGroup|Set-SRNetworkConstraint|Set-SRPartnership|Suspend-SRGroup|Sync-SRGroup|Test-SRTopology|" + // Module SyncShare "Disable-SyncShare|Enable-SyncShare|Get-SyncServerSetting|Get-SyncShare|Get-SyncUserStatus|New-SyncShare|Remove-SyncShare|Repair-SyncShare|Set-SyncServerSetting|Set-SyncShare|" + // Module SystemInsights "Add-InsightsCapability|Disable-InsightsCapability|Disable-InsightsCapabilitySchedule|Enable-InsightsCapability|Enable-InsightsCapabilitySchedule|Get-InsightsCapability|Get-InsightsCapabilityAction|Get-InsightsCapabilityResult|Get-InsightsCapabilitySchedule|Invoke-InsightsCapability|Remove-InsightsCapability|Remove-InsightsCapabilityAction|Set-InsightsCapabilityAction|Set-InsightsCapabilitySchedule|Update-InsightsCapability|" + // Module TLS "Disable-TlsCipherSuite|Disable-TlsEccCurve|Disable-TlsSessionTicketKey|Enable-TlsCipherSuite|Enable-TlsEccCurve|Enable-TlsSessionTicketKey|Export-TlsSessionTicketKey|Get-TlsCipherSuite|Get-TlsEccCurve|New-TlsSessionTicketKey|" + // Module TroubleshootingPack "Get-TroubleshootingPack|Invoke-TroubleshootingPack|" + // Module TrustedPlatformModule "Clear-Tpm|ConvertTo-TpmOwnerAuth|Disable-TpmAutoProvisioning|Enable-TpmAutoProvisioning|Get-Tpm|Get-TpmEndorsementKeyInfo|Get-TpmSupportedFeature|Import-TpmOwnerAuth|Initialize-Tpm|Set-TpmOwnerAuth|Unblock-Tpm|" + // Module UEV "Clear-UevAppxPackage|Clear-UevConfiguration|Disable-Uev|Disable-UevAppxPackage|Disable-UevTemplate|Enable-Uev|Enable-UevAppxPackage|Enable-UevTemplate|Export-UevConfiguration|Export-UevPackage|Get-UevAppxPackage|Get-UevConfiguration|Get-UevStatus|Get-UevTemplate|Get-UevTemplateProgram|Import-UevConfiguration|Register-UevTemplate|Repair-UevTemplateIndex|Restore-UevBackup|Restore-UevUserSetting|Set-UevConfiguration|Set-UevTemplateProfile|Test-UevTemplate|Unregister-UevTemplate|Update-UevTemplate|" + // Module UpdateServices "Add-WsusComputer|Add-WsusDynamicCategory|Approve-WsusUpdate|Deny-WsusUpdate|Get-WsusClassification|Get-WsusComputer|Get-WsusDynamicCategory|Get-WsusProduct|Get-WsusServer|Get-WsusUpdate|Invoke-WsusServerCleanup|Remove-WsusDynamicCategory|Set-WsusClassification|Set-WsusDynamicCategory|Set-WsusProduct|Set-WsusServerSynchronization|" + // Module UserAccessLogging "Disable-Ual|Enable-Ual|Get-Ual|Get-UalDailyAccess|Get-UalDailyDeviceAccess|Get-UalDailyUserAccess|Get-UalDeviceAccess|Get-UalDns|Get-UalHyperV|Get-UalOverview|Get-UalServerDevice|Get-UalServerUser|Get-UalSystemId|Get-UalUserAccess|" + // Module VAMT "Add-VamtProductKey|Export-VamtData|Find-VamtManagedMachine|Get-VamtConfirmationId|Get-VamtProduct|Get-VamtProductKey|Import-VamtData|Initialize-VamtData|Install-VamtConfirmationId|Install-VamtProductActivation|Install-VamtProductKey|Update-VamtProduct|" + // Module VpnClient "Add-VpnConnection|Add-VpnConnectionRoute|Add-VpnConnectionTriggerApplication|Add-VpnConnectionTriggerDnsConfiguration|Add-VpnConnectionTriggerTrustedNetwork|Get-VpnConnection|Get-VpnConnectionTrigger|New-EapConfiguration|New-VpnServerAddress|Remove-VpnConnection|Remove-VpnConnectionRoute|Remove-VpnConnectionTriggerApplication|Remove-VpnConnectionTriggerDnsConfiguration|Remove-VpnConnectionTriggerTrustedNetwork|Set-VpnConnection|Set-VpnConnectionIPsecConfiguration|Set-VpnConnectionProxy|Set-VpnConnectionTriggerDnsConfiguration|Set-VpnConnectionTriggerTrustedNetwork|" + // Module WDS "Add-WdsDriverPackage|Approve-WdsClient|Copy-WdsInstallImage|Deny-WdsClient|Disable-WdsBootImage|Disable-WdsDriverPackage|Disable-WdsInstallImage|Disconnect-WdsMulticastClient|Enable-WdsBootImage|Enable-WdsDriverPackage|Enable-WdsInstallImage|Export-WdsBootImage|Export-WdsInstallImage|Get-WdsBootImage|Get-WdsClient|Get-WdsDriverPackage|Get-WdsInstallImage|Get-WdsInstallImageGroup|Get-WdsMulticastClient|Import-WdsBootImage|Import-WdsDriverPackage|Import-WdsInstallImage|New-WdsClient|New-WdsInstallImageGroup|Remove-WdsBootImage|Remove-WdsClient|Remove-WdsDriverPackage|Remove-WdsInstallImage|Remove-WdsInstallImageGroup|Set-WdsBootImage|Set-WdsClient|Set-WdsInstallImage|Set-WdsInstallImageGroup|" + // Module WebAdministration "Add-WebConfiguration|Add-WebConfigurationLock|Add-WebConfigurationProperty|Backup-WebConfiguration|Clear-WebCentralCertProvider|Clear-WebConfiguration|Clear-WebRequestTracingSetting|Clear-WebRequestTracingSettings|ConvertTo-WebApplication|Disable-WebCentralCertProvider|Disable-WebGlobalModule|Disable-WebRequestTracing|Enable-WebCentralCertProvider|Enable-WebGlobalModule|Enable-WebRequestTracing|Get-WebAppDomain|Get-WebApplication|Get-WebAppPoolState|Get-WebBinding|Get-WebCentralCertProvider|Get-WebConfigFile|Get-WebConfiguration|Get-WebConfigurationBackup|Get-WebConfigurationLocation|Get-WebConfigurationLock|Get-WebConfigurationProperty|Get-WebFilePath|Get-WebGlobalModule|Get-WebHandler|Get-WebItemState|Get-WebManagedModule|Get-WebRequest|Get-Website|Get-WebsiteState|Get-WebURL|Get-WebVirtualDirectory|New-WebApplication|New-WebAppPool|New-WebBinding|New-WebFtpSite|New-WebGlobalModule|New-WebHandler|New-WebManagedModule|New-Website|New-WebVirtualDirectory|Remove-WebApplication|Remove-WebAppPool|Remove-WebBinding|Remove-WebConfigurationBackup|Remove-WebConfigurationLocation|Remove-WebConfigurationLock|Remove-WebConfigurationProperty|Remove-WebGlobalModule|Remove-WebHandler|Remove-WebManagedModule|Remove-Website|Remove-WebVirtualDirectory|Rename-WebConfigurationLocation|Restart-WebAppPool|Restart-WebItem|Restore-WebConfiguration|Select-WebConfiguration|Set-WebBinding|Set-WebCentralCertProvider|Set-WebCentralCertProviderCredential|Set-WebConfiguration|Set-WebConfigurationProperty|Set-WebGlobalModule|Set-WebHandler|Set-WebManagedModule|Start-WebAppPool|Start-WebCommitDelay|Start-WebItem|Start-Website|Stop-WebAppPool|Stop-WebCommitDelay|Stop-WebItem|Stop-Website|" + // Module WebApplicationProxy "Add-WebApplicationProxyApplication|Get-WebApplicationProxyApplication|Get-WebApplicationProxyAvailableADFSRelyingParty|Get-WebApplicationProxyConfiguration|Get-WebApplicationProxyHealth|Get-WebApplicationProxySslCertificate|Install-WebApplicationProxy|Remove-WebApplicationProxyApplication|Set-WebApplicationProxyApplication|Set-WebApplicationProxyConfiguration|Set-WebApplicationProxySslCertificate|Update-WebApplicationProxyDeviceRegistration|" + // Module WHEA "Get-WheaMemoryPolicy|Set-WheaMemoryPolicy|" + // Module WindowsDeveloperLicense "Get-WindowsDeveloperLicense|Show-WindowsDeveloperLicenseRegistration|Unregister-WindowsDeveloperLicense|" + // Module WindowsDiagnosticData "Clear-WindowsDiagnosticData|" + // Module WindowsErrorReporting "Disable-WindowsErrorReporting|Enable-WindowsErrorReporting|Get-WindowsErrorReporting|" + // Module WindowsSearch "Get-WindowsSearchSetting|Set-WindowsSearchSetting|" + // Module WindowsServerBackup "Add-WBBackupTarget|Add-WBBareMetalRecovery|Add-WBFileSpec|Add-WBSystemState|Add-WBVirtualMachine|Add-WBVolume|Backup-ACL|Get-WBBackupSet|Get-WBBackupTarget|Get-WBBackupVolumeBrowsePath|Get-WBBareMetalRecovery|Get-WBDisk|Get-WBFileSpec|Get-WBJob|Get-WBPerformanceConfiguration|Get-WBPolicy|Get-WBSchedule|Get-WBSummary|Get-WBSystemState|Get-WBVirtualMachine|Get-WBVolume|Get-WBVssBackupOption|New-WBBackupTarget|New-WBFileSpec|New-WBPolicy|Remove-WBBackupSet|Remove-WBBackupTarget|Remove-WBBareMetalRecovery|Remove-WBCatalog|Remove-WBFileSpec|Remove-WBPolicy|Remove-WBSystemState|Remove-WBVirtualMachine|Remove-WBVolume|Restore-ACL|Restore-WBCatalog|Resume-WBBackup|Resume-WBVolumeRecovery|Set-WBPerformanceConfiguration|Set-WBPolicy|Set-WBSchedule|Set-WBVssBackupOption|Start-WBApplicationRecovery|Start-WBBackup|Start-WBFileRecovery|Start-WBHyperVRecovery|Start-WBSystemStateRecovery|Start-WBVolumeRecovery|Stop-WBJob|" + // Module WindowsUpdate "Get-WindowsUpdateLog" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords }, "identifier"); // Help Reference: about_Operators // https://technet.microsoft.com/en-us/library/hh847732.aspx var binaryOperatorsRe = ( // Comparison Operators "eq|ne|gt|lt|le|ge|like|notlike|match|notmatch|contains|notcontains|in|notin|band|bor|bxor|bnot|" + "ceq|cne|cgt|clt|cle|cge|clike|cnotlike|cmatch|cnotmatch|ccontains|cnotcontains|cin|cnotin|" + "ieq|ine|igt|ilt|ile|ige|ilike|inotlike|imatch|inotmatch|icontains|inotcontains|iin|inotin|" + // Logical Operators "and|or|xor|not|" + // String Operators "split|join|replace|f|" + "csplit|creplace|" + "isplit|ireplace|" + // Type Operators "is|isnot|as|" + // Shift Operators "shl|shr" ); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : "#.*$" }, { token : "comment.start", regex : "<#", next : "comment" }, { token : "string", // multi line regex : /@'$/, push: [ { token: "string", regex: /^'@/, next: "pop" }, { defaultToken: "string" } ] }, { token : "string", // multi line regex : /@"$/, push: [ { token: "string", regex: /^"@/, next: "pop" }, {include: "expressions"}, {include: "expandable-strings"}, { defaultToken: "string" } ] }, {include: "strings"}, {include: "variables"}, {include: "statements"}, {include: "expressions"}, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment.end", regex : "#>", next : "start" }, { token : "doc.comment.tag", regex : "^\\.\\w+" }, { defaultToken : "comment" } ], "expandable-strings" : [ { token: "constant.language.escape", regex: /`./ }, {include: "variables"} ], "variables": [ { token : "variable.instance", regex : "[$]"+identifierRe+"\\b" }, { token : "variable.braced", regex: /\$\{/, push: [ { token: "variable.braced", regex: /\}/, next: "pop" }, { token: "constant.language.escape", regex: /`./ }, {defaultToken: "variable.braced"} ] } ], "statements" : [ { token : "punctuation", regex: ";" }, { token : "keyword.operator", regex : "\\-(?:" + binaryOperatorsRe + ")" }, { // Arithmetic, Assignment, Redirection, Call, Not & Pipeline Operators token : "keyword.operator", regex : "&|\\+|\\-|\\*|\\/|\\%|\\=|\\>|\\&|\\!|\\|" }, {include: "constants"}, { token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b" } ], "constants": [ { 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 : "[$](?:[Tt]rue|[Ff]alse)\\b" }, { token : "constant.language", regex : "[$][Nn]ull\\b" } ], "strings": [ { token : "string", // single line regex : "['][^']*[']" }, { token : "string", // single line regex : /"/, push: [ { token: "string", regex: /"|$/, next: "pop" }, {include: "expressions"}, {include: "expandable-strings"}, { defaultToken: "string" } ] } ], "expressions": [ { token: "keyword.operator", regex: /[$@]\(/, push: [ { token: "keyword.operator", regex: /\)/, next: "pop" }, {include: "parens-block"}, {include: "expressions"}, {include: "strings"}, {include: "variables"}, {include: "statements"} ] }, {//hash literal expressions token: "keyword.operator", regex: /@\{/, push: [ { token: "keyword.operator", regex: /\}/, next: "pop" }, {include: "parens-block"}, {include: "strings"}, {include: "variables"}, {include: "statements"} ] } ], "parens-block": [ { token: "paren.lparen", regex: /\(/, push: [ { token: "paren.rparen", regex: /\)/, next: "pop" }, {include: "parens-block"}, {include: "strings"}, {include: "variables"}, {include: "statements"} ] } ] }; this.normalizeRules(); }; oop.inherits(PowershellHighlightRules, TextHighlightRules); exports.PowershellHighlightRules = PowershellHighlightRules; ================================================ FILE: src/mode/praat.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PraatHighlightRules = require("./praat_highlight_rules").PraatHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = PraatHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; 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.$id = "ace/mode/praat"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/praat_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PraatHighlightRules = function() { var keywords = ( "if|then|else|elsif|elif|endif|fi|" + "endfor|endproc|" + // related keywords specified below "while|endwhile|" + "repeat|until|" + "select|plus|minus|" + "assert|asserterror" ); var predefinedVariables = ( "macintosh|windows|unix|" + "praatVersion|praatVersion\\$" + "pi|undefined|" + "newline\\$|tab\\$|" + "shellDirectory\\$|homeDirectory\\$|preferencesDirectory\\$|" + "temporaryDirectory\\$|defaultDirectory\\$" ); // What is "endSendPraat"? Function? Directive? var directives = ( "clearinfo|endSendPraat" ); var functions = ( // Info functions "writeInfo|writeInfoLine|appendInfo|appendInfoLine|info\\$|" + "writeFile|writeFileLine|appendFile|appendFileLine|" + // Math functions "abs|round|floor|ceiling|min|max|imin|imax|" + "sqrt|sin|cos|tan|arcsin|arccos|arctan|arctan2|sinc|sincpi|" + "exp|ln|lnBeta|lnGamma|log10|log2|" + "sinh|cosh|tanh|arcsinh|arccosh|arctanh|" + "sigmoid|invSigmoid|erf|erfc|" + "random(?:Uniform|Integer|Gauss|Poisson|Binomial)|" + "gaussP|gaussQ|invGaussQ|incompleteGammaP|incompleteBeta|" + "chiSquareP|chiSquareQ|invChiSquareQ|studentP|studentQ|invStudentQ|" + "fisherP|fisherQ|invFisherQ|" + "binomialP|binomialQ|invBinomialP|invBinomialQ|" + "hertzToBark|barkToHerz|" + "hertzToMel|melToHertz|" + "hertzToSemitones|semitonesToHerz|" + "erb|hertzToErb|erbToHertz|" + "phonToDifferenceLimens|differenceLimensToPhon|" + "soundPressureToPhon|" + "beta|beta2|besselI|besselK|" + "numberOfColumns|numberOfRows|" + // String functions "selected|selected\\$|numberOfSelected|variableExists|"+ "index|rindex|startsWith|endsWith|"+ "index_regex|rindex_regex|replace_regex\\$|"+ "length|extractWord\\$|extractLine\\$|extractNumber|" + "left\\$|right\\$|mid\\$|replace\\$|" + "date\\$|fixed\\$|percent\\$|" + // Array functions "zero#|linear#|randomUniform#|randomInteger#|randomGauss#|" + // Pause functions "beginPause|endPause|" + // Demo functions "demoShow|demoWindowTitle|demoInput|demoWaitForInput|" + "demoClicked|demoClickedIn|demoX|demoY|" + "demoKeyPressed|demoKey\\$|" + "demoExtraControlKeyPressed|demoShiftKeyPressed|"+ "demoCommandKeyPressed|demoOptionKeyPressed|" + // File functions "environment\\$|chooseReadFile\\$|" + "chooseDirectory\\$|createDirectory|fileReadable|deleteFile|" + "selectObject|removeObject|plusObject|minusObject|" + "runScript|exitScript|" + // sendpraat functions "beginSendPraat|endSendPraat|" + // Other "objectsAreIdentical" ); var objectTypes = ( "Activation|AffineTransform|AmplitudeTier|Art|Artword|Autosegment|" + "BarkFilter|CCA|Categories|Cepstrum|Cepstrumc|ChebyshevSeries|" + "ClassificationTable|Cochleagram|Collection|Configuration|" + "Confusion|ContingencyTable|Corpus|Correlation|Covariance|" + "CrossCorrelationTable|CrossCorrelationTables|DTW|Diagonalizer|" + "Discriminant|Dissimilarity|Distance|Distributions|DurationTier|" + "EEG|ERP|ERPTier|Eigen|Excitation|Excitations|ExperimentMFC|FFNet|" + "FeatureWeights|Formant|FormantFilter|FormantGrid|FormantPoint|" + "FormantTier|GaussianMixture|HMM|HMM_Observation|" + "HMM_ObservationSequence|HMM_State|HMM_StateSequence|Harmonicity|" + "ISpline|Index|Intensity|IntensityTier|IntervalTier|KNN|KlattGrid|" + "KlattTable|LFCC|LPC|Label|LegendreSeries|LinearRegression|" + "LogisticRegression|LongSound|Ltas|MFCC|MSpline|ManPages|" + "Manipulation|Matrix|MelFilter|MixingMatrix|Movie|Network|" + "OTGrammar|OTHistory|OTMulti|PCA|PairDistribution|ParamCurve|" + "Pattern|Permutation|Pitch|PitchTier|PointProcess|Polygon|" + "Polynomial|Procrustes|RealPoint|RealTier|ResultsMFC|Roots|SPINET|" + "SSCP|SVD|Salience|ScalarProduct|Similarity|SimpleString|" + "SortedSetOfString|Sound|Speaker|Spectrogram|Spectrum|SpectrumTier|" + "SpeechSynthesizer|SpellingChecker|Strings|StringsIndex|Table|" + "TableOfReal|TextGrid|TextInterval|TextPoint|TextTier|Tier|" + "Transition|VocalTract|Weight|WordList" ); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { // Interpolated strings token : "string.interpolated", regex : /'((?:\.?[a-z][a-zA-Z0-9_.]*)(?:\$|#|:[0-9]+)?)'/ }, { // stopwatch token : ["text", "text", "keyword.operator", "text", "keyword"], regex : /(^\s*)(?:(\.?[a-z][a-zA-Z0-9_.]*\$?\s+)(=)(\s+))?(stopwatch)/ }, { // Directives which introduce unquoted strings token : ["text", "keyword", "text", "string"], regex : /(^\s*)(print(?:line|tab)?|echo|exit|pause|send(?:praat|socket)|include|execute|system(?:_nocheck)?)(\s+)(.*)/ }, { // Directives with no arguments token : ["text", "keyword"], regex : "(^\\s*)(" + directives + ")$" }, { // Operators token : ["text", "keyword.operator", "text"], regex : /(\s+)((?:\+|-|\/|\*|<|>)=?|==?|!=|%|\^|\||and|or|not)(\s+)/ }, { // Commands token : ["text", "text", "keyword.operator", "text", "keyword", "text", "keyword"], regex : /(^\s*)(?:(\.?[a-z][a-zA-Z0-9_.]*\$?\s+)(=)(\s+))?(?:((?:no)?warn|(?:unix_)?nocheck|noprogress)(\s+))?((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/ }, { // Editor mode token : ["text", "keyword", "text", "keyword"], regex : /(^\s*)((?:no(?:warn|check))?)(\s*)(\b(?:editor(?::?)|endeditor)\b)/ }, { // Demo commands token : ["text", "keyword", "text", "keyword"], regex : /(^\s*)(?:(demo)?(\s+))((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/ }, { // Font-sizing commands token : ["text", "keyword", "text", "keyword"], regex : /^(\s*)(?:(demo)(\s+))?(10|12|14|16|24)$/ }, { // do-style command calls token : ["text", "support.function", "text"], regex : /(\s*)(do\$?)(\s*:\s*|\s*\(\s*)/ }, { // Object types token : "entity.name.type", regex : "(" + objectTypes + ")" }, { // Predefined variables token : "variable.language", regex : "(" + predefinedVariables + ")" }, { // Functions token : ["support.function", "text"], regex : "((?:" + functions + ")\\$?)(\\s*(?::|\\())" }, { // For-loop declarations token : "keyword", regex : /(\bfor\b)/, next : "for" }, { // Generic keywords token : "keyword", regex : "(\\b(?:" + keywords + ")\\b)" }, { // Generic strings token : "string", regex : /"[^"]*"/ }, { // Multiline quoted strings token : "string", regex : /"[^"]*$/, next : "brokenstring" }, { // Form declarations token : ["text", "keyword", "text", "entity.name.section"], regex : /(^\s*)(\bform\b)(\s+)(.*)/, next : "form" }, { // Numeric constants token : "constant.numeric", regex : /\b[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ }, { // Procedure declarations token : ["keyword", "text", "entity.name.function"], regex : /(procedure)(\s+)([^:\s]+)/ }, { // New-style procedure calls token : ["entity.name.function", "text"], regex : /(@\S+)(:|\s*\()/ }, { // Old-style procedure calls token : ["text", "keyword", "text", "entity.name.function"], regex : /(^\s*)(call)(\s+)(\S+)/ }, { // Comments token : "comment", regex : /(^\s*#|;).*$/ }, { token : "text", regex : /\s+/ } ], "form" : [ { token : ["keyword", "text", "constant.numeric"], regex : /((?:optionmenu|choice)\s+)(\S+:\s+)([0-9]+)/ }, { token : ["keyword", "constant.numeric"], regex : /((?:option|button)\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/ }, { token : ["keyword", "string"], regex : /((?:option|button)\s+)(.*)/ }, { token : ["keyword", "text", "string"], regex : /((?:sentence|text)\s+)(\S+\s*)(.*)/ }, { token : ["keyword", "text", "string", "invalid.illegal"], regex : /(word\s+)(\S+\s*)(\S+)?(\s.*)?/ }, { token : ["keyword", "text", "constant.language"], regex : /(boolean\s+)(\S+\s*)(0|1|"?(?:yes|no)"?)/ }, { token : ["keyword", "text", "constant.numeric"], regex : /((?:real|natural|positive|integer)\s+)(\S+\s*)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/ }, { token : ["keyword", "string"], regex : /(comment\s+)(.*)/ }, { token : "keyword", regex : 'endform', next : "start" } ], "for" : [ { token : ["keyword", "text", "constant.numeric", "text"], regex : /(from|to)(\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?)(\s*)/ }, { token : ["keyword", "text"], regex : /(from|to)(\s+\S+\s*)/ }, { token : "text", regex : /$/, next : "start" } ], "brokenstring" : [ { token : ["text", "string"], regex : /(\s*\.{3})([^"]*)/ }, { token : "string", regex : /"/, next : "start" } ] }; }; oop.inherits(PraatHighlightRules, TextHighlightRules); exports.PraatHighlightRules = PraatHighlightRules; ================================================ FILE: src/mode/prisma.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PrismaHighlightRules = require("./prisma_highlight_rules").PrismaHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = PrismaHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; // this.blockComment = {start: ""/*"", end: ""*/""}; // Extra logic goes here. this.$id = "ace/mode/prisma"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/prisma_highlight_rules.js ================================================ /* This file was autogenerated from ../convert.json (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PrismaHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ include: "#triple_comment" }, { include: "#double_comment" }, { include: "#model_block_definition" }, { include: "#config_block_definition" }, { include: "#enum_block_definition" }, { include: "#type_definition" }], "#model_block_definition": [{ token: [ "source.prisma.embedded.source", "storage.type.model.prisma", "source.prisma.embedded.source", "entity.name.type.model.prisma", "source.prisma.embedded.source", "punctuation.definition.tag.prisma" ], regex: /^(\s*)(model|type)(\s+)([A-Za-z][\w]*)(\s+)({)/, push: [{ token: "punctuation.definition.tag.prisma", regex: /\s*\}/, next: "pop" }, { include: "#triple_comment" }, { include: "#double_comment" }, { include: "#field_definition" }, { defaultToken: "source.prisma.embedded.source" }] }], "#enum_block_definition": [{ token: [ "source.prisma.embedded.source", "storage.type.enum.prisma", "source.prisma.embedded.source", "entity.name.type.enum.prisma", "source.prisma.embedded.source", "punctuation.definition.tag.prisma" ], regex: /^(\s*)(enum)(\s+)([A-Za-z][\w]*)(\s+)({)/, push: [{ token: "punctuation.definition.tag.prisma", regex: /\s*\}/, next: "pop" }, { include: "#triple_comment" }, { include: "#double_comment" }, { include: "#enum_value_definition" }, { defaultToken: "source.prisma.embedded.source" }] }], "#config_block_definition": [{ token: [ "source.prisma.embedded.source", "storage.type.config.prisma", "source.prisma.embedded.source", "entity.name.type.config.prisma", "source.prisma.embedded.source", "punctuation.definition.tag.prisma" ], regex: /^(\s*)(generator|datasource)(\s+)([A-Za-z][\w]*)(\s+)({)/, push: [{ token: "source.prisma.embedded.source", regex: /\s*\}/, next: "pop" }, { include: "#triple_comment" }, { include: "#double_comment" }, { include: "#assignment" }, { defaultToken: "source.prisma.embedded.source" }] }], "#assignment": [{ token: [ "text", "variable.other.assignment.prisma", "text", "keyword.operator.terraform", "text" ], regex: /^(\s*)(\w+)(\s*)(=)(\s*)/, push: [{ token: "text", regex: /$/, next: "pop" }, { include: "#value" }, { include: "#double_comment_inline" }] }], "#field_definition": [{ token: [ "text", "variable.other.assignment.prisma", "invalid.illegal.colon.prisma", "text", "support.type.primitive.prisma", "keyword.operator.list_type.prisma", "keyword.operator.optional_type.prisma", "invalid.illegal.required_type.prisma" ], regex: /^(\s*)(\w+)((?:\s*:)?)(\s+)(\w+)((?:\[\])?)((?:\?)?)((?:\!)?)/ }, { include: "#attribute_with_arguments" }, { include: "#attribute" }], "#type_definition": [{ token: [ "text", "storage.type.type.prisma", "text", "entity.name.type.type.prisma", "text", "support.type.primitive.prisma" ], regex: /^(\s*)(type)(\s+)(\w+)(\s*=\s*)(\w+)/ }, { include: "#attribute_with_arguments" }, { include: "#attribute" }], "#enum_value_definition": [{ token: [ "text", "variable.other.assignment.prisma", "text" ], regex: /^(\s*)(\w+)(\s*$)/ }, { include: "#attribute_with_arguments" }, { include: "#attribute" }], "#attribute_with_arguments": [{ token: [ "entity.name.function.attribute.prisma", "punctuation.definition.tag.prisma" ], regex: /(@@?[\w\.]+)(\()/, push: [{ token: "punctuation.definition.tag.prisma", regex: /\)/, next: "pop" }, { include: "#named_argument" }, { include: "#value" }, { defaultToken: "source.prisma.attribute.with_arguments" }] }], "#attribute": [{ token: "entity.name.function.attribute.prisma", regex: /@@?[\w\.]+/ }], "#array": [{ token: "source.prisma.array", regex: /\[/, push: [{ token: "source.prisma.array", regex: /\]/, next: "pop" }, { include: "#value" }, { defaultToken: "source.prisma.array" }] }], "#value": [{ include: "#array" }, { include: "#functional" }, { include: "#literal" }], "#functional": [{ token: [ "support.function.functional.prisma", "punctuation.definition.tag.prisma" ], regex: /(\w+)(\()/, push: [{ token: "punctuation.definition.tag.prisma", regex: /\)/, next: "pop" }, { include: "#value" }, { defaultToken: "source.prisma.functional" }] }], "#literal": [{ include: "#boolean" }, { include: "#number" }, { include: "#double_quoted_string" }, { include: "#identifier" }], "#identifier": [{ token: "support.constant.constant.prisma", regex: /\b(?:\w)+\b/ }], "#map_key": [{ token: [ "variable.parameter.key.prisma", "text", "punctuation.definition.separator.key-value.prisma", "text" ], regex: /(\w+)(\s*)(:)(\s*)/ }], "#named_argument": [{ include: "#map_key" }, { include: "#value" }], "#triple_comment": [{ token: "comment.prisma", regex: /\/\/\//, push: [{ token: "comment.prisma", regex: /$/, next: "pop" }, { defaultToken: "comment.prisma" }] }], "#double_comment": [{ token: "comment.prisma", regex: /\/\//, push: [{ token: "comment.prisma", regex: /$/, next: "pop" }, { defaultToken: "comment.prisma" }] }], "#double_comment_inline": [{ token: "comment.prisma", regex: /\/\/[^$]*/ }], "#boolean": [{ token: "constant.language.boolean.prisma", regex: /\b(?:true|false)\b/ }], "#number": [{ token: "constant.numeric.prisma", regex: /(?:0(?:x|X)[0-9a-fA-F]*|(?:\+|-)?\b(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:(?:e|E)(?:\+|-)?[0-9]+)?)(?:[LlFfUuDdg]|UL|ul)?\b/ }], "#double_quoted_string": [{ token: "string.quoted.double.start.prisma", regex: /"/, push: [{ token: "string.quoted.double.end.prisma", regex: /"/, next: "pop" }, { include: "#string_interpolation" }, { token: "string.quoted.double.prisma", regex: /[\w\-\/\._\\%@:\?=]+/ }, { defaultToken: "unnamed" }] }], "#string_interpolation": [{ token: "keyword.control.interpolation.start.prisma", regex: /\$\{/, push: [{ token: "keyword.control.interpolation.end.prisma", regex: /\s*\}/, next: "pop" }, { include: "#value" }, { defaultToken: "source.tag.embedded.source.prisma" }] }] }; this.normalizeRules(); }; PrismaHighlightRules.metaData = { name: "Prisma", scopeName: "source.prisma" }; oop.inherits(PrismaHighlightRules, TextHighlightRules); exports.PrismaHighlightRules = PrismaHighlightRules; ================================================ FILE: src/mode/prolog.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PrologHighlightRules = require("./prolog_highlight_rules").PrologHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = PrologHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "%"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/prolog"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/prolog_highlight_rules.js ================================================ /* This file was autogenerated from https://raw.github.com/stephenroller/prolog-tmbundle/master/Syntaxes/Prolog.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PrologHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { include: '#comment' }, { include: '#basic_fact' }, { include: '#rule' }, { include: '#directive' }, { include: '#fact' } ], '#atom': [ { token: 'constant.other.atom.prolog', regex: '\\b[a-z][a-zA-Z0-9_]*\\b' }, { token: 'constant.numeric.prolog', regex: '-?\\d+(?:\\.\\d+)?' }, { include: '#string' } ], '#basic_elem': [ { include: '#comment' }, { include: '#statement' }, { include: '#constants' }, { include: '#operators' }, { include: '#builtins' }, { include: '#list' }, { include: '#atom' }, { include: '#variable' } ], '#basic_fact': [ { token: [ 'entity.name.function.fact.basic.prolog', 'punctuation.end.fact.basic.prolog' ], regex: '([a-z]\\w*)(\\.)' } ], '#builtins': [ { token: 'support.function.builtin.prolog', regex: '\\b(?:abolish|abort|ancestors|arg|ascii|assert[az]|atom(?:ic)?|body|char|close|conc|concat|consult|define|definition|dynamic|dump|fail|file|free|free_proc|functor|getc|goal|halt|head|head|integer|length|listing|match_args|member|next_clause|nl|nonvar|nth|number|cvars|nvars|offset|op|print?|prompt|putc|quoted|ratom|read|redefine|rename|retract(?:all)?|see|seeing|seen|skip|spy|statistics|system|tab|tell|telling|term|time|told|univ|unlink_clause|unspy_predicate|var|write)\\b' } ], '#comment': [ { token: [ 'punctuation.definition.comment.prolog', 'comment.line.percentage.prolog' ], regex: '(%)(.*$)' }, { token: 'punctuation.definition.comment.prolog', regex: '/\\*', push: [ { token: 'punctuation.definition.comment.prolog', regex: '\\*/', next: 'pop' }, { defaultToken: 'comment.block.prolog' } ] } ], '#constants': [ { token: 'constant.language.prolog', regex: '\\b(?:true|false|yes|no)\\b' } ], '#directive': [ { token: 'keyword.operator.directive.prolog', regex: ':-', push: [ { token: 'meta.directive.prolog', regex: '\\.', next: 'pop' }, { include: '#comment' }, { include: '#statement' }, { defaultToken: 'meta.directive.prolog' } ] } ], '#expr': [ { include: '#comments' }, { token: 'meta.expression.prolog', regex: '\\(', push: [ { token: 'meta.expression.prolog', regex: '\\)', next: 'pop' }, { include: '#expr' }, { defaultToken: 'meta.expression.prolog' } ] }, { token: 'keyword.control.cutoff.prolog', regex: '!' }, { token: 'punctuation.control.and.prolog', regex: ',' }, { token: 'punctuation.control.or.prolog', regex: ';' }, { include: '#basic_elem' } ], '#fact': [ { token: [ 'entity.name.function.fact.prolog', 'punctuation.begin.fact.parameters.prolog' ], regex: '([a-z]\\w*)(\\()(?!.*:-)', push: [ { token: [ 'punctuation.end.fact.parameters.prolog', 'punctuation.end.fact.prolog' ], regex: '(\\))(\\.?)', next: 'pop' }, { include: '#parameter' }, { defaultToken: 'meta.fact.prolog' } ] } ], '#list': [ { token: 'punctuation.begin.list.prolog', regex: '\\[(?=.*\\])', push: [ { token: 'punctuation.end.list.prolog', regex: '\\]', next: 'pop' }, { include: '#comment' }, { token: 'punctuation.separator.list.prolog', regex: ',' }, { token: 'punctuation.concat.list.prolog', regex: '\\|', push: [ { token: 'meta.list.concat.prolog', regex: '(?=\\s*\\])', next: 'pop' }, { include: '#basic_elem' }, { defaultToken: 'meta.list.concat.prolog' } ] }, { include: '#basic_elem' }, { defaultToken: 'meta.list.prolog' } ] } ], '#operators': [ { token: 'keyword.operator.prolog', regex: '\\\\\\+|\\bnot\\b|\\bis\\b|->|[><]|[><\\\\:=]?=|(?:=\\\\|\\\\=)=' } ], '#parameter': [ { token: 'variable.language.anonymous.prolog', regex: '\\b_\\b' }, { token: 'variable.parameter.prolog', regex: '\\b[A-Z_]\\w*\\b' }, { token: 'punctuation.separator.parameters.prolog', regex: ',' }, { include: '#basic_elem' }, { token: 'text', regex: '[^\\s]' } ], '#rule': [ { token: 'meta.rule.prolog', regex: '(?=[a-z]\\w*.*:-)', push: [ { token: 'punctuation.rule.end.prolog', regex: '\\.', next: 'pop' }, { token: 'meta.rule.signature.prolog', regex: '(?=[a-z]\\w*.*:-)', push: [ { token: 'meta.rule.signature.prolog', regex: '(?=:-)', next: 'pop' }, { token: 'entity.name.function.rule.prolog', regex: '[a-z]\\w*(?=\\(|\\s*:-)' }, { token: 'punctuation.rule.parameters.begin.prolog', regex: '\\(', push: [ { token: 'punctuation.rule.parameters.end.prolog', regex: '\\)', next: 'pop' }, { include: '#parameter' }, { defaultToken: 'meta.rule.parameters.prolog' } ] }, { defaultToken: 'meta.rule.signature.prolog' } ] }, { token: 'keyword.operator.definition.prolog', regex: ':-', push: [ { token: 'meta.rule.definition.prolog', regex: '(?=\\.)', next: 'pop' }, { include: '#comment' }, { include: '#expr' }, { defaultToken: 'meta.rule.definition.prolog' } ] }, { defaultToken: 'meta.rule.prolog' } ] } ], '#statement': [ { token: 'meta.statement.prolog', regex: '(?=[a-z]\\w*\\()', push: [ { token: 'punctuation.end.statement.parameters.prolog', regex: '\\)', next: 'pop' }, { include: '#builtins' }, { include: '#atom' }, { token: 'punctuation.begin.statement.parameters.prolog', regex: '\\(', push: [ { token: 'meta.statement.parameters.prolog', regex: '(?=\\))', next: 'pop' }, { token: 'punctuation.separator.statement.prolog', regex: ',' }, { include: '#basic_elem' }, { defaultToken: 'meta.statement.parameters.prolog' } ] }, { defaultToken: 'meta.statement.prolog' } ] } ], '#string': [ { token: 'punctuation.definition.string.begin.prolog', regex: '\'', push: [ { token: 'punctuation.definition.string.end.prolog', regex: '\'', next: 'pop' }, { token: 'constant.character.escape.prolog', regex: '\\\\.' }, { token: 'constant.character.escape.quote.prolog', regex: '\'\'' }, { defaultToken: 'string.quoted.single.prolog' } ] } ], '#variable': [ { token: 'variable.language.anonymous.prolog', regex: '\\b_\\b' }, { token: 'variable.other.prolog', regex: '\\b[A-Z_][a-zA-Z0-9_]*\\b' } ] }; this.normalizeRules(); }; PrologHighlightRules.metaData = { fileTypes: [ 'plg', 'prolog' ], foldingStartMarker: '(%\\s*region \\w*)|([a-z]\\w*.*:- ?)', foldingStopMarker: '(%\\s*end(\\s*region)?)|(?=\\.)', keyEquivalent: '^~P', name: 'Prolog', scopeName: 'source.prolog' }; oop.inherits(PrologHighlightRules, TextHighlightRules); exports.PrologHighlightRules = PrologHighlightRules; ================================================ FILE: src/mode/properties.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PropertiesHighlightRules = require("./properties_highlight_rules").PropertiesHighlightRules; var Mode = function() { this.HighlightRules = PropertiesHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/properties"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/properties_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PropertiesHighlightRules = function() { var escapeRe = /\\u[0-9a-fA-F]{4}|\\/; this.$rules = { "start" : [ { token : "comment", regex : /[!#].*$/ }, { // Empty value token : "keyword", regex : /[=:]$/ }, { token : "keyword", regex : /[=:]/, next : "value" }, { token : "constant.language.escape", regex : escapeRe }, { defaultToken: "variable" } ], "value" : [ { // Multi-line string regex : /\\$/, token : "string", next : "value" }, { regex : /$/, token : "string", next : "start" }, { token : "constant.language.escape", regex : escapeRe }, { defaultToken: "string" } ] }; }; oop.inherits(PropertiesHighlightRules, TextHighlightRules); exports.PropertiesHighlightRules = PropertiesHighlightRules; ================================================ FILE: src/mode/protobuf.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var CMode = require("./c_cpp").Mode; var ProtobufHighlightRules = require("./protobuf_highlight_rules").ProtobufHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { CMode.call(this); this.foldingRules = new CStyleFoldMode(); this.HighlightRules = ProtobufHighlightRules; }; oop.inherits(Mode, CMode); (function() { // Extra logic goes here. this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/protobuf"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/protobuf_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ProtobufHighlightRules = function() { var builtinTypes = "double|float|int32|int64|uint32|uint64|sint32|" + "sint64|fixed32|fixed64|sfixed32|sfixed64|bool|" + "string|bytes"; var keywordDeclaration = "message|required|optional|repeated|package|" + "import|option|enum"; var keywordMapper = this.createKeywordMapper({ "keyword.declaration.protobuf": keywordDeclaration, "support.type": builtinTypes }, "identifier"); this.$rules = { "start": [{ token: "comment", regex: /\/\/.*$/ }, { token: "comment", regex: /\/\*/, next: "comment" }, { token: "constant", regex: "<[^>]+>" }, { regex: "=", token: "keyword.operator.assignment.protobuf" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single line regex : '[\'](?:(?:\\\\.)|(?:[^\'\\\\]))*?[\']' }, { token: "constant.numeric", // hex regex: "0[xX][0-9a-fA-F]+\\b" }, { token: "constant.numeric", // float regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\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(ProtobufHighlightRules, TextHighlightRules); exports.ProtobufHighlightRules = ProtobufHighlightRules; ================================================ FILE: src/mode/prql.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HighlightRules = require("./prql_highlight_rules").PrqlHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = HighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; // Extra logic goes here. this.$id = "ace/mode/prql"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/prql_highlight_rules.js ================================================ // https://prql-lang.org/ // https://github.com/PRQL/prql "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PrqlHighlightRules = function() { var builtinFunctions = "min|max|sum|average|stddev|every|any|concat_array|count|" + "lag|lead|first|last|rank|rank_dense|row_number|" + "round|as|in|" + "tuple_every|tuple_map|tuple_zip|_eq|_is_null|" + "from_text|" + "lower|upper|" + "read_parquet|read_csv"; var builtinTypes = [ "bool", "int", "int8", "int16", "int32", "int64", "int128", "float", "text", "timestamp", "set"].join("|"); var keywordMapper = this.createKeywordMapper({ "constant.language": "null", "constant.language.boolean": "true|false", "keyword": "let|into|case|prql|type|module|internal", "storage.type": "let|func", "support.function": builtinFunctions, "support.type": builtinTypes, "variable.language": "date|math" }, "identifier"); var escapeRe = /\\(\d+|['"\\&bfnrt]|u\{[0-9a-fA-F]{1,6}\}|x[0-9a-fA-F]{2})/; var identifierRe = /[A-Za-z_][a-z_A-Z0-9]/.source; var numRe = /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/.source; var bidi = "[\\u202A\\u202B\\u202D\\u202E\\u2066\\u2067\\u2068\\u202C\\u2069]"; this.$rules = { start: [ { token: "string.start", regex: 's?"', next: "string" }, { token: "string.start", regex: 'f"', next: "fstring" }, { token: "string.start", regex: 'r"', next: "rstring" }, { token: "string.single", start: "'", end: "'" }, { token: "string.character", regex: "'(?:" + escapeRe.source + "|.)'?" }, { token: "constant.language", regex: "^" + identifierRe + "*" }, { token : ["constant.numeric", "keyword"], regex : "(" + numRe + ")(years|months|weeks|days|hours|minutes|seconds|milliseconds|microseconds)" }, { token: "constant.numeric", // hexadecimal, octal and binary regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ }, { token: "constant.numeric", // decimal integers and floats regex: numRe }, { token: "comment.block.documentation", regex: "#!.*" }, { token: "comment.line.number-sign", regex: "#.*" }, { token: "keyword.operator", regex: /\|\s*/, next: "pipe" }, { token: "keyword.operator", regex: /->|=>|==|!=|>=|<=|~=|&&|\|\||\?\?|\/\/|@/ }, { token: "invalid.illegal", regex: bidi }, { token: "punctuation.operator", regex: /[,`]/ }, { token: keywordMapper, regex: "[\\w\\xff-\\u218e\\u2455-\\uffff]+\\b" }, { token: "paren.lparen", regex: /[\[({]/ }, { token: "paren.rparen", regex: /[\])}]/ } ], pipe: [{ token: "constant.language", regex: identifierRe + "*", next: "pop" },{ token: "error", regex: "", next: "pop" }], string: [{ token: "constant.character.escape", regex: escapeRe }, { token: "text", regex: /\\(\s|$)/, next: "stringGap" }, { token: "string.end", regex: '"', next: "start" }, { token: "invalid.illegal", regex: bidi }, { defaultToken: "string.double" }], stringGap: [{ token: "text", regex: /\\/, next: "string" }, { token: "error", regex: "", next: "start" }], fstring: [{ token: "constant.character.escape", regex: escapeRe }, { token: "string.end", regex: '"', next: "start" }, { token: "invalid.illegal", regex: bidi }, { token: "paren.lparen", regex: "{", push: "fstringParenRules" }, { token: "invalid.illegal", regex: bidi }, { defaultToken: "string" }], fstringParenRules: [{ token: "constant.language", regex: "^" + identifierRe + "*" }, { token: "paren.rparen", regex: "}", next: "pop" }], rstring: [{ token: "string.end", regex: '"', next: "start" }, { token: "invalid.illegal", regex: bidi }, { defaultToken: "string" }] }; this.normalizeRules(); }; oop.inherits(PrqlHighlightRules, TextHighlightRules); exports.PrqlHighlightRules = PrqlHighlightRules; ================================================ FILE: src/mode/puppet.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PuppetHighlightRules = require("./puppet_highlight_rules").PuppetHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function () { TextMode.call(this); this.HighlightRules = PuppetHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function () { this.lineCommentStart = "#"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/puppet"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/puppet_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PuppetHighlightRules = function () { this.$rules = { "start": [ { token: ['keyword.type.puppet', 'constant.class.puppet', 'keyword.inherits.puppet', 'constant.class.puppet'], regex: "^\\s*(class)(\\s+(?:[-_A-Za-z0-9\".]+::)*[-_A-Za-z0-9\".]+\\s*)(?:(inherits\\s*)(\\s+(?:[-_A-Za-z0-9\".]+::)*[-_A-Za-z0-9\".]+\\s*))?" }, { token: ['storage.function.puppet', 'name.function.puppet', 'punctuation.lpar'], regex: "(^\\s*define)(\\s+[a-zA-Z0-9_:]+\\s*)(\\()", push: [{ token: 'punctuation.rpar.puppet', regex: "\\)", next: 'pop' }, {include: "constants"}, {include: "variable"}, {include: "strings"}, {include: "operators"}, {defaultToken: 'string'}] }, { token: ["language.support.class", "keyword.operator"], regex: "\\b([a-zA-Z_]+)(\\s+=>)" }, { token: ["exported.resource.puppet", "keyword.name.resource.puppet", "paren.lparen"], regex: "(\\@\\@)?(\\s*[a-zA-Z_]*)(\\s*\\{)" }, { token: "qualified.variable.puppet", regex: "(\\$([a-z][a-z0-9_]*)?(::[a-z][a-z0-9_]*)*::[a-z0-9_][a-zA-Z0-9_]*)" }, { token: "singleline.comment.puppet", regex: '#(.)*$' }, { token: "multiline.comment.begin.puppet", regex: '^\\s*\\/\\*', push: "blockComment" }, { token: "keyword.control.puppet", regex: "\\b(case|if|unless|else|elsif|in|default:|and|or)\\s+(?!::)" }, { token: "keyword.control.puppet", regex: "\\b(import|default|inherits|include|require|contain|node|application|consumes|environment|site|function|produces)\\b" }, { token: "support.function.puppet", regex: "\\b(lest|str2bool|escape|gsub|Timestamp|Timespan|with|alert|crit|debug|notice|sprintf|split|step|strftime|slice|shellquote|type|sha1|defined|scanf|reverse_each|regsubst|return|emerg|reduce|err|failed|fail|versioncmp|file|generate|then|info|realize|search|tag|tagged|template|epp|warning|hiera_include|each|assert_type|binary_file|create_resources|dig|digest|filter|lookup|find_file|fqdn_rand|hiera_array|hiera_hash|inline_epp|inline_template|map|match|md5|new|next)\\b" }, { token: "constant.types.puppet", regex: "\\b(String|File|Package|Service|Class|Integer|Array|Catalogentry|Variant|Boolean|Undef|Number|Hash|Float|Numeric|NotUndef|Callable|Optional|Any|Regexp|Sensitive|Sensitive.new|Type|Resource|Default|Enum|Scalar|Collection|Data|Pattern|Tuple|Struct)\\b" }, { token: "paren.lparen", regex: "[[({]" }, { token: "paren.rparen", regex: "[\\])}]" }, {include: "variable"}, {include: "constants"}, {include: "strings"}, {include: "operators"}, { token: "regexp.begin.string.puppet", regex: "\\s*(\\/(\\S)+)\\/" } ], blockComment: [{ regex: "\\*\\/", token: "multiline.comment.end.puppet", next: "pop" }, { defaultToken: "comment" }], "constants": [ { token: "constant.language.puppet", regex: "\\b(false|true|running|stopped|installed|purged|latest|file|directory|held|undef|present|absent|link|mounted|unmounted)\\b" } ], "variable": [ { token: "variable.puppet", regex: "(\\$[a-z0-9_\{][a-zA-Z0-9_]*)" } ], "strings": [ { token: "punctuation.quote.puppet", regex: "'", push: [{ token: 'punctuation.quote.puppet', regex: "'", next: 'pop' }, {include: "escaped_chars"}, {defaultToken: 'string'}] }, { token: "punctuation.quote.puppet", regex: '"', push: [{ token: 'punctuation.quote.puppet', regex: '"', next: 'pop' }, {include: "escaped_chars"}, {include: "variable"}, {defaultToken: 'string'}] } ], "escaped_chars": [ { token: "constant.escaped_char.puppet", regex: "\\\\." } ], "operators": [ { token: "keyword.operator", regex: "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|=|::|," } ] }; this.normalizeRules(); }; oop.inherits(PuppetHighlightRules, TextHighlightRules); exports.PuppetHighlightRules = PuppetHighlightRules; ================================================ FILE: src/mode/python.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules; var PythonFoldMode = require("./folding/pythonic").FoldMode; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = PythonHighlightRules; this.foldingRules = new PythonFoldMode("\\:"); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$pairQuotesAfter = { "'": /[ruf]/i, '"': /[ruf]/i }; 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; }; var outdents = { "pass": 1, "return": 1, "raise": 1, "break": 1, "continue": 1 }; this.checkOutdent = function(state, line, input) { if (input !== "\r\n" && input !== "\r" && input !== "\n") return false; var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens) return false; // ignore trailing comments do { var last = tokens.pop(); } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/)))); if (!last) return false; return (last.type == "keyword" && outdents[last.value]); }; this.autoOutdent = function(state, doc, row) { // outdenting in python is slightly different because it always applies // to the next line and only of a new line is inserted row += 1; var indent = this.$getIndent(doc.getLine(row)); var tab = doc.getTabString(); if (indent.slice(-tab.length) == tab) doc.remove(new Range(row, indent.length-tab.length, row, indent.length)); }; this.$id = "ace/mode/python"; this.snippetFileId = "ace/snippets/python"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/python_highlight_rules.js ================================================ /* * TODO: python delimiters */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PythonHighlightRules = function() { var keywords = ( "and|as|assert|break|class|continue|def|del|elif|else|except|exec|" + "finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" + "raise|return|try|while|with|yield|async|await|nonlocal" ); var builtinConstants = ( "True|False|None|NotImplemented|Ellipsis|__debug__" ); var builtinFunctions = ( "abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" + "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" + "binfile|bin|iter|property|tuple|bool|filter|len|range|type|bytearray|" + "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" + "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" + "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" + "__import__|complex|hash|min|apply|delattr|help|next|setattr|set|" + "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern|" + "ascii|breakpoint|bytes" ); //var futureReserved = ""; var keywordMapper = this.createKeywordMapper({ "invalid.deprecated": "debugger", "support.function": builtinFunctions, "variable.language": "self|cls", "constant.language": builtinConstants, "keyword": keywords }, "identifier"); var strPre = "[uU]?"; var strRawPre = "[rR]"; var strFormatPre = "[fF]"; var strRawFormatPre = "(?:[rR][fF]|[fF][rR])"; var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; var octInteger = "(?:0[oO]?[0-7]+)"; var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; var binInteger = "(?:0[bB][01]+)"; var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")"; var exponent = "(?:[eE][+-]?\\d+)"; var fraction = "(?:\\.\\d+)"; var intPart = "(?:\\d+)"; var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")"; var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"; this.$rules = { "start" : [ { token : "comment", regex : "#.*$" }, { token : "string", // multi line """ string start regex : strPre + '"{3}', next : "qqstring3" }, { token : "string", // " string regex : strPre + '"(?=.)', next : "qqstring" }, { token : "string", // multi line ''' string start regex : strPre + "'{3}", next : "qstring3" }, { token : "string", // ' string regex : strPre + "'(?=.)", next : "qstring" }, { token: "string", regex: strRawPre + '"{3}', next: "rawqqstring3" }, { token: "string", regex: strRawPre + '"(?=.)', next: "rawqqstring" }, { token: "string", regex: strRawPre + "'{3}", next: "rawqstring3" }, { token: "string", regex: strRawPre + "'(?=.)", next: "rawqstring" }, { token: "string", regex: strFormatPre + '"{3}', next: "fqqstring3" }, { token: "string", regex: strFormatPre + '"(?=.)', next: "fqqstring" }, { token: "string", regex: strFormatPre + "'{3}", next: "fqstring3" }, { token: "string", regex: strFormatPre + "'(?=.)", next: "fqstring" },{ token: "string", regex: strRawFormatPre + '"{3}', next: "rfqqstring3" }, { token: "string", regex: strRawFormatPre + '"(?=.)', next: "rfqqstring" }, { token: "string", regex: strRawFormatPre + "'{3}", next: "rfqstring3" }, { token: "string", regex: strRawFormatPre + "'(?=.)", next: "rfqstring" }, { token: "keyword.operator", regex: "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|@|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|=" }, { token: "punctuation", regex: ",|:|;|\\->|\\+=|\\-=|\\*=|\\/=|\\/\\/=|%=|@=|&=|\\|=|^=|>>=|<<=|\\*\\*=" }, { token: "paren.lparen", regex: "[\\[\\(\\{]" }, { token: "paren.rparen", regex: "[\\]\\)\\}]" }, { token: ["keyword", "text", "entity.name.function"], regex: "(def|class)(\\s+)([\\u00BF-\\u1FFF\\u2C00-\\uD7FF\\w]+)" }, { token: "text", regex: "\\s+" }, { include: "constants" }], "qqstring3": [{ token: "constant.language.escape", regex: stringEscape }, { token: "string", // multi line """ string end regex: '"{3}', next: "start" }, { defaultToken: "string" }], "qstring3": [{ token: "constant.language.escape", regex: stringEscape }, { token: "string", // multi line ''' string end regex: "'{3}", next: "start" }, { defaultToken: "string" }], "qqstring": [{ token: "constant.language.escape", regex: stringEscape }, { token: "string", regex: "\\\\$", next: "qqstring" }, { token: "string", regex: '"|$', next: "start" }, { defaultToken: "string" }], "qstring": [{ token: "constant.language.escape", regex: stringEscape }, { token: "string", regex: "\\\\$", next: "qstring" }, { token: "string", regex: "'|$", next: "start" }, { defaultToken: "string" }], "rawqqstring3": [{ token: "string", // multi line """ string end regex: '"{3}', next: "start" }, { defaultToken: "string" }], "rawqstring3": [{ token: "string", // multi line ''' string end regex: "'{3}", next: "start" }, { defaultToken: "string" }], "rawqqstring": [{ token: "string", regex: "\\\\$", next: "rawqqstring" }, { token: "string", regex: '"|$', next: "start" }, { defaultToken: "string" }], "rawqstring": [{ token: "string", regex: "\\\\$", next: "rawqstring" }, { token: "string", regex: "'|$", next: "start" }, { defaultToken: "string" }], "fqqstring3": [{ token: "constant.language.escape", regex: stringEscape }, { token: "string", // multi line """ string end regex: '"{3}', next: "start" }, { token: "paren.lparen", regex: "{", push: "fqstringParRules" }, { defaultToken: "string" }], "fqstring3": [{ token: "constant.language.escape", regex: stringEscape }, { token: "string", // multi line ''' string end regex: "'{3}", next: "start" }, { token: "paren.lparen", regex: "{", push: "fqstringParRules" }, { defaultToken: "string" }], "fqqstring": [{ token: "constant.language.escape", regex: stringEscape }, { token: "string", regex: "\\\\$", next: "fqqstring" }, { token: "string", regex: '"|$', next: "start" }, { token: "paren.lparen", regex: "{", push: "fqstringParRules" }, { defaultToken: "string" }], "fqstring": [{ token: "constant.language.escape", regex: stringEscape }, { token: "string", regex: "'|$", next: "start" }, { token: "paren.lparen", regex: "{", push: "fqstringParRules" }, { defaultToken: "string" }], "rfqqstring3": [{ token: "string", // multi line """ string end regex: '"{3}', next: "start" }, { token: "paren.lparen", regex: "{", push: "fqstringParRules" }, { defaultToken: "string" }], "rfqstring3": [{ token: "string", // multi line ''' string end regex: "'{3}", next: "start" }, { token: "paren.lparen", regex: "{", push: "fqstringParRules" }, { defaultToken: "string" }], "rfqqstring": [{ token: "string", regex: "\\\\$", next: "rfqqstring" }, { token: "string", regex: '"|$', next: "start" }, { token: "paren.lparen", regex: "{", push: "fqstringParRules" }, { defaultToken: "string" }], "rfqstring": [{ token: "string", regex: "'|$", next: "start" }, { token: "paren.lparen", regex: "{", push: "fqstringParRules" }, { defaultToken: "string" }], "fqstringParRules": [{//TODO: nested {} token: "paren.lparen", regex: "[\\[\\(]" }, { token: "paren.rparen", regex: "[\\]\\)]" }, { token: "string", regex: "\\s+" }, { token: "string", regex: "'[^']*'" }, { token: "string", regex: '"[^"]*"' }, { token: "function.support", regex: "(!s|!r|!a)" }, { include: "constants" },{ token: 'paren.rparen', regex: "}", next: 'pop' },{ token: 'paren.lparen', regex: "{", push: "fqstringParRules" }], "constants": [{ token: "constant.numeric", // imaginary regex: "(?:" + floatNumber + "|\\d+)[jJ]\\b" }, { token: "constant.numeric", // float regex: floatNumber }, { token: "constant.numeric", // long integer regex: integer + "[lL]\\b" }, { token: "constant.numeric", // integer regex: integer + "\\b" }, { token: ["punctuation", "function.support"],// method regex: "(\\.)([a-zA-Z_]+)\\b" }, { token: keywordMapper, regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }] }; this.normalizeRules(); }; oop.inherits(PythonHighlightRules, TextHighlightRules); exports.PythonHighlightRules = PythonHighlightRules; ================================================ FILE: src/mode/python_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var Tokenizer = require("../tokenizer").Tokenizer; var Mode = require("./python").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new Mode(); }, "test: getTokenizer() (smoke test)" : function() { var tokenizer = this.mode.getTokenizer(); assert.ok(tokenizer instanceof Tokenizer); var tokens = tokenizer.getLineTokens("'juhu'", "start").tokens; assert.equal("string", tokens[0].type); }, "test: auto outdent after 'pass', 'return' and 'raise'" : function() { assert.ok(this.mode.checkOutdent("start", " pass", "\n")); assert.ok(this.mode.checkOutdent("start", " pass ", "\n")); assert.ok(this.mode.checkOutdent("start", " return", "\n")); assert.ok(this.mode.checkOutdent("start", " raise", "\n")); assert.equal(this.mode.checkOutdent("start", " raise", " "), false); assert.ok(this.mode.checkOutdent("start", " pass # comment", "\n")); assert.equal(this.mode.checkOutdent("start", "'juhu'", "\n"), false); }, "test: auto outdent" : function() { var session = new EditSession([" if True:", " pass", " "]); this.mode.autoOutdent("start", session, 1); assert.equal(" ", session.getLine(2)); } }; require("../test/run")(module); ================================================ FILE: src/mode/qml.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var QmlHighlightRules = require("./qml_highlight_rules").QmlHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = QmlHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$quotes = { '"': '"', "'": "'" }; this.$id = "ace/mode/qml"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/qml_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var QmlHighlightRules = function() { // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects var keywordMapper = this.createKeywordMapper({ "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors "Namespace|QName|XML|XMLList|" + // E4X "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors "SyntaxError|TypeError|URIError|" + "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions "isNaN|parseFloat|parseInt|" + "JSON|Math|" + // Other "this|arguments|prototype|window|document" , // Pseudo "keyword": "const|yield|import|get|set|async|await|" + "break|case|catch|continue|default|delete|do|else|finally|for|function|" + "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + // invalid or reserved "__parent__|__count__|escape|unescape|with|__proto__|" + "class|enum|extends|super|export|implements|private|public|interface|package|protected|static|" + // qml "readonly|string|int|bool|date|color|url|real|double|var|variant|" + "height|width|anchors|parent|" + "Abstract3DSeries|AbstractActionInput|AbstractAnimation|AbstractAxis|AbstractAxis3D|AbstractAxisInput|" + "AbstractBarSeries|AbstractButton|AbstractClipAnimator|AbstractClipBlendNode|AbstractDataProxy|AbstractGraph3D|" + "AbstractInputHandler3D|AbstractPhysicalDevice|AbstractRayCaster|AbstractSeries|AbstractSkeleton|AbstractTextureImage|" + "Accelerometer|AccelerometerReading|Accessible|Action|ActionGroup|ActionInput|" + "AdditiveClipBlend|Address|Affector|Age|AlphaCoverage|AlphaTest|" + "Altimeter|AltimeterReading|AmbientLightReading|AmbientLightSensor|AmbientTemperatureReading|AmbientTemperatureSensor|" + "AnalogAxisInput|AnchorAnimation|AnchorChanges|AngleDirection|AnimatedImage|AnimatedSprite|" + "Animation|AnimationController|AnimationGroup|Animator|ApplicationWindow|ApplicationWindowStyle|" + "AreaSeries|Armature|AttenuationModelInverse|AttenuationModelLinear|Attractor|Attribute|" + "Audio|AudioCategory|AudioEngine|AudioListener|AudioSample|AuthenticationDialogRequest|" + "Axis|AxisAccumulator|AxisSetting|BackspaceKey|Bar3DSeries|BarCategoryAxis|" + "BarDataProxy|BarSeries|BarSet|Bars3D|BaseKey|Behavior|" + "Binding|Blend|BlendEquation|BlendEquationArguments|BlendedClipAnimator|BlitFramebuffer|" + "BluetoothDiscoveryModel|BluetoothService|BluetoothSocket|BorderImage|BorderImageMesh|BoxPlotSeries|" + "BoxSet|BrightnessContrast|Buffer|BusyIndicator|BusyIndicatorStyle|Button|" + "ButtonAxisInput|ButtonGroup|ButtonStyle|Calendar|CalendarStyle|Camera|" + "Camera3D|CameraCapabilities|CameraCapture|CameraExposure|CameraFlash|CameraFocus|" + "CameraImageProcessing|CameraLens|CameraRecorder|CameraSelector|CandlestickSeries|CandlestickSet|" + "Canvas|Canvas3D|Canvas3DAbstractObject|Canvas3DActiveInfo|Canvas3DBuffer|Canvas3DContextAttributes|" + "Canvas3DFrameBuffer|Canvas3DProgram|Canvas3DRenderBuffer|Canvas3DShader|Canvas3DShaderPrecisionFormat|Canvas3DTexture|" + "Canvas3DTextureProvider|Canvas3DUniformLocation|CanvasGradient|CanvasImageData|CanvasPixelArray|Category|" + "CategoryAxis|CategoryAxis3D|CategoryModel|CategoryRange|ChangeLanguageKey|ChartView|" + "CheckBox|CheckBoxStyle|CheckDelegate|CircularGauge|CircularGaugeStyle|ClearBuffers|" + "ClipAnimator|ClipPlane|CloseEvent|ColorAnimation|ColorDialog|ColorDialogRequest|" + "ColorGradient|ColorGradientStop|ColorMask|ColorOverlay|Colorize|Column|" + "ColumnLayout|ComboBox|ComboBoxStyle|Compass|CompassReading|Component|Component3D|" + "ComputeCommand|ConeGeometry|ConeMesh|ConicalGradient|Connections|ContactDetail|" + "ContactDetails|Container|Context2D|Context3D|ContextMenuRequest|Control|" + "CoordinateAnimation|CuboidGeometry|CuboidMesh|CullFace|CumulativeDirection|" + "Custom3DItem|Custom3DLabel|Custom3DVolume|CustomParticle|CylinderGeometry|CylinderMesh|" + "Date|DateTimeAxis|DelayButton|DelayButtonStyle|DelegateChoice|DelegateChooser|DelegateModel|" + "DelegateModelGroup|DepthTest|Desaturate|Dial|DialStyle|Dialog|DialogButtonBox|DiffuseMapMaterial|" + "DiffuseSpecularMapMaterial|DiffuseSpecularMaterial|Direction|DirectionalBlur|DirectionalLight|DispatchCompute|" + "Displace|DistanceReading|DistanceSensor|Dithering|DoubleValidator|Drag|DragEvent|DragHandler|Drawer|DropArea|" + "DropShadow|DwmFeatures|DynamicParameter|EditorialModel|Effect|EllipseShape|Emitter|EnterKey|EnterKeyAction|" + "Entity|EntityLoader|EnvironmentLight|EventConnection|EventPoint|EventTouchPoint|ExclusiveGroup|ExtendedAttributes|" + "ExtrudedTextGeometry|ExtrudedTextMesh|FastBlur|FileDialog|FileDialogRequest|FillerKey|FilterKey|FinalState|" + "FirstPersonCameraController|Flickable|Flipable|Flow|FocusScope|FolderListModel|FontDialog|FontLoader|" + "FontMetrics|FormValidationMessageRequest|ForwardRenderer|Frame|FrameAction|FrameGraphNode|Friction|" + "FrontFace|FrustumCulling|FullScreenRequest|GLStateDumpExt|GammaAdjust|Gauge|GaugeStyle|GaussianBlur|" + "GeocodeModel|Geometry|GeometryRenderer|GestureEvent|Glow|GoochMaterial|Gradient|GradientStop|GraphicsApiFilter|" + "GraphicsInfo|Gravity|Grid|GridLayout|GridMesh|GridView|GroupBox|GroupGoal|Gyroscope|GyroscopeReading|HBarModelMapper|" + "HBoxPlotModelMapper|HCandlestickModelMapper|HPieModelMapper|HXYModelMapper|HandlerPoint|HandwritingInputPanel|" + "HandwritingModeKey|HeightMapSurfaceDataProxy|HideKeyboardKey|HistoryState|HolsterReading|HolsterSensor|HorizontalBarSeries|" + "|HorizontalPercentBarSeries|HorizontalStackedBarSeries|HoverHandler|HueSaturation|HumidityReading|HumiditySensor|" + "IRProximityReading|IRProximitySensor|Icon|Image|ImageModel|ImageParticle|InnerShadow|InputChord|InputContext|InputEngine|" + "InputHandler3D|InputMethod|InputModeKey|InputPanel|InputSequence|InputSettings|Instantiator|IntValidator|InvokedServices|" + "Item|ItemDelegate|ItemGrabResult|ItemModelBarDataProxy|ItemModelScatterDataProxy|ItemModelSurfaceDataProxy|ItemParticle|" + "ItemSelectionModel|IviApplication|IviSurface|JavaScriptDialogRequest|Joint|JumpList|JumpListCategory|JumpListDestination|" + "JumpListLink|JumpListSeparator|Key|KeyEvent|KeyIcon|KeyNavigation|KeyPanel|KeyboardColumn|KeyboardDevice|KeyboardHandler|" + "KeyboardLayout|KeyboardLayoutLoader|KeyboardRow|KeyboardStyle|KeyframeAnimation|Keys|Label|Layer|LayerFilter|Layout|" + "LayoutMirroring|Legend|LerpBlend|LevelAdjust|LevelOfDetail|LevelOfDetailBoundingSphere|LevelOfDetailLoader|" + "LevelOfDetailSwitch|LidReading|LidSensor|Light|Light3D|LightReading|LightSensor|LineSeries|LineShape|LineWidth|" + "LinearGradient|ListElement|ListModel|ListView|Loader|Locale|Location|LogValueAxis|LogValueAxis3DFormatter|LoggingCategory|" + "LogicalDevice|Magnetometer|MagnetometerReading|Map|MapCircle|MapCircleObject|MapCopyrightNotice|MapGestureArea|MapIconObject|" + "MapItemGroup|MapItemView|MapObjectView|MapParameter|MapPinchEvent|MapPolygon|MapPolygonObject|MapPolyline|MapPolylineObject|" + "MapQuickItem|MapRectangle|MapRoute|MapRouteObject|MapType|Margins|MaskShape|MaskedBlur|Material|Matrix4x4|MediaPlayer|" + "MemoryBarrier|Menu|MenuBar|MenuBarItem|MenuBarStyle|MenuItem|MenuSeparator|MenuStyle|Mesh|MessageDialog|ModeKey|MorphTarget|" + "MorphingAnimation|MouseArea|MouseDevice|MouseEvent|MouseHandler|MultiPointHandler|MultiPointTouchArea|MultiSampleAntiAliasing|" + "Navigator|NdefFilter|NdefMimeRecord|NdefRecord|NdefTextRecord|NdefUriRecord|NearField|NoDepthMask|NoDraw|Node|NodeInstantiator|" + "NormalDiffuseMapAlphaMaterial|NormalDiffuseMapMaterial|NormalDiffuseSpecularMapMaterial|Number|NumberAnimation|NumberKey|Object3D|" + "ObjectModel|ObjectPicker|OpacityAnimator|OpacityMask|OpenGLInfo|OrbitCameraController|OrientationReading|OrientationSensor|Overlay|" + "Package|Page|PageIndicator|Pane|ParallelAnimation|Parameter|ParentAnimation|ParentChange|Particle|ParticleGroup|ParticlePainter|" + "ParticleSystem|Path|PathAngleArc|PathAnimation|PathArc|PathAttribute|PathCubic|PathCurve|PathElement|PathInterpolator|PathLine|" + "PathMove|PathPercent|PathQuad|PathSvg|PathView|PauseAnimation|PerVertexColorMaterial|PercentBarSeries|PhongAlphaMaterial|" + "PhongMaterial|PickEvent|PickLineEvent|PickPointEvent|PickTriangleEvent|PickingSettings|Picture|PieMenu|PieMenuStyle|PieSeries|" + "PieSlice|PinchArea|PinchEvent|PinchHandler|Place|PlaceAttribute|PlaceSearchModel|PlaceSearchSuggestionModel|PlaneGeometry|" + "PlaneMesh|PlayVariation|Playlist|PlaylistItem|Plugin|PluginParameter|PointDirection|PointHandler|PointLight|PointSize|" + "PointerDevice|PointerDeviceHandler|PointerEvent|PointerHandler|PolarChartView|PolygonOffset|Popup|Position|PositionSource|" + "Positioner|PressureReading|PressureSensor|Product|ProgressBar|ProgressBarStyle|PropertyAction|PropertyAnimation|PropertyChanges|" + "ProximityFilter|ProximityReading|ProximitySensor|QAbstractState|QAbstractTransition|QSignalTransition|" + "QVirtualKeyboardSelectionListModel|Qt|QtMultimedia|QtObject|QtPositioning|QuaternionAnimation|QuotaRequest|RadialBlur|" + "RadialGradient|Radio|RadioButton|RadioButtonStyle|RadioData|RadioDelegate|RangeSlider|Ratings|RayCaster|Rectangle|" + "RectangleShape|RectangularGlow|RecursiveBlur|RegExpValidator|RegisterProtocolHandlerRequest|RenderCapture|" + "RenderCaptureReply|RenderPass|RenderPassFilter|RenderSettings|RenderState|RenderStateSet|RenderSurfaceSelector|" + "RenderTarget|RenderTargetOutput|RenderTargetSelector|Repeater|ReviewModel|Rotation|RotationAnimation|RotationAnimator|" + "RotationReading|RotationSensor|RoundButton|Route|RouteLeg|RouteManeuver|RouteModel|RouteQuery|RouteSegment|Row|" + "RowLayout|Scale|ScaleAnimator|Scatter3D|Scatter3DSeries|ScatterDataProxy|ScatterSeries|Scene2D|Scene3D|SceneLoader|" + "ScissorTest|Screen|ScreenRayCaster|ScriptAction|ScrollBar|ScrollIndicator|ScrollView|ScrollViewStyle|ScxmlStateMachine|" + "SeamlessCubemap|SelectionListItem|Sensor|SensorGesture|SensorGlobal|SensorReading|SequentialAnimation|Settings|" + "SettingsStore|ShaderEffect|ShaderEffectSource|ShaderProgram|ShaderProgramBuilder|Shape|ShellSurface|ShellSurfaceItem|" + "ShiftHandler|ShiftKey|Shortcut|SignalSpy|SignalTransition|SinglePointHandler|Skeleton|SkeletonLoader|Slider|SliderStyle|" + "SmoothedAnimation|SortPolicy|Sound|SoundEffect|SoundInstance|SpaceKey|SphereGeometry|SphereMesh|SpinBox|SpinBoxStyle|" + "SplineSeries|SplitView|SpotLight|SpringAnimation|Sprite|SpriteGoal|SpriteSequence|Stack|StackLayout|StackView|" + "StackViewDelegate|StackedBarSeries|State|StateChangeScript|StateGroup|StateMachine|StateMachineLoader|StatusBar|" + "StatusBarStyle|StatusIndicator|StatusIndicatorStyle|StencilMask|StencilOperation|StencilOperationArguments|StencilTest|" + "StencilTestArguments|Store|String|Supplier|Surface3D|Surface3DSeries|SurfaceDataProxy|SwipeDelegate|SwipeView|Switch|" + "SwitchDelegate|SwitchStyle|SymbolModeKey|SystemPalette|Tab|TabBar|TabButton|TabView|TabViewStyle|TableView|TableViewColumn|" + "TableViewStyle|TapHandler|TapReading|TapSensor|TargetDirection|TaskbarButton|Technique|TechniqueFilter|TestCase|Text|TextArea|" + "TextAreaStyle|TextEdit|TextField|TextFieldStyle|TextInput|TextMetrics|TextureImage|TextureImageFactory|Theme3D|ThemeColor|" + "ThresholdMask|ThumbnailToolBar|ThumbnailToolButton|TiltReading|TiltSensor|TimeoutTransition|Timer|ToggleButton|" + "ToggleButtonStyle|ToolBar|ToolBarStyle|ToolButton|ToolSeparator|ToolTip|Torch|TorusGeometry|TorusMesh|TouchEventSequence|" + "TouchInputHandler3D|TouchPoint|Trace|TraceCanvas|TraceInputArea|TraceInputKey|TraceInputKeyPanel|TrailEmitter|Transaction|" + "Transform|Transition|Translate|TreeView|TreeViewStyle|Tumbler|TumblerColumn|TumblerStyle|Turbulence|UniformAnimator|User|" + "VBarModelMapper|VBoxPlotModelMapper|VCandlestickModelMapper|VPieModelMapper|VXYModelMapper|ValueAxis|ValueAxis3D|" + "ValueAxis3DFormatter|Vector3dAnimation|VertexBlendAnimation|Video|VideoOutput|ViewTransition|Viewport|" + "VirtualKeyboardSettings|Wander|WavefrontMesh|WaylandClient|WaylandCompositor|WaylandHardwareLayer|" + "WaylandOutput|WaylandQuickItem|WaylandSeat|WaylandSurface|WaylandView|Waypoint|" + "WebChannel|WebEngine|WebEngineAction|WebEngineCertificateError|WebEngineDownloadItem|WebEngineHistory|" + "WebEngineHistoryListModel|WebEngineLoadRequest|WebEngineNavigationRequest|WebEngineNewViewRequest|WebEngineProfile|WebEngineScript|" + "WebEngineSettings|WebEngineView|WebSocket|WebSocketServer|WebView|WebViewLoadRequest|" + "WheelEvent|Window|WlShell|WlShellSurface|WorkerScript|XAnimator|" + "XYPoint|XYSeries|XdgDecorationManagerV1|XdgPopup|XdgPopupV5|XdgPopupV6|" + "XdgShell|XdgShellV5|XdgShellV6|XdgSurface|XdgSurfaceV5|XdgSurfaceV6|" + "XdgToplevel|XdgToplevelV6|XmlListModel|XmlRole|YAnimator|ZoomBlur", "storage.type": "const|let|var|function|" + // js "property|", // qml "constant.language": "null|Infinity|NaN|undefined", "support.function": "print|console\\.log", "constant.language.boolean": "true|false" }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "string", // single line regex : '"', next : "string" }, { 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 : "text", regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "comment", regex : "\\/\\/.*$" }, { token : "comment.start", regex : "\\/\\*", next : "comment" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" }, { token : keywordMapper, regex : "\\b\\w+\\b" } ], "string" : [ { token : "constant.language.escape", regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/ }, { token : "string", regex : '"|$', next : "start" }, { defaultToken : "string" } ], "comment" : [ { token : "comment.end", regex : "\\*\\/", next : "start" }, { defaultToken: "comment" } ] }; }; oop.inherits(QmlHighlightRules, TextHighlightRules); exports.QmlHighlightRules = QmlHighlightRules; ================================================ FILE: src/mode/r.js ================================================ /* * r.js * * Copyright (C) 2009-11 by RStudio, Inc. * * The Initial Developer of the Original Code is * Ajax.org B.V. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * 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 * */ "use strict"; var unicode = require("../unicode"); var Range = require("../range").Range; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var RHighlightRules = require("./r_highlight_rules").RHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function(){ this.HighlightRules = RHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; // todo import codeModel from RStudio this.tokenRe = new RegExp("^[" + unicode.wordChars + "._]+", "g"); this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "._]|\s])+", "g"); /*this.$complements = { "(": ")", "[": "]", '"': '"', "'": "'", "{": "}" }; this.$reOpen = /^[(["'{]$/; this.$reClose = /^[)\]"'}]$/; this.getNextLineIndent = function(state, line, tab, tabSize, row) { return this.codeModel.getNextLineIndent(row, line, state, tab, tabSize); }; this.allowAutoInsert = this.smartAllowAutoInsert; this.checkOutdent = function(state, line, input) { if (! /^\s+$/.test(line)) return false; return /^\s*[\{\}\)]/.test(input); }; this.getIndentForOpenBrace = function(openBracePos) { return this.codeModel.getIndentForOpenBrace(openBracePos); }; this.autoOutdent = function(state, doc, row) { if (row == 0) return 0; var line = doc.getLine(row); var match = line.match(/^(\s*[\}\)])/); if (match) { var column = match[1].length; var openBracePos = doc.findMatchingBracket({row: row, column: column}); if (!openBracePos || openBracePos.row == row) return 0; var indent = this.codeModel.getIndentForOpenBrace(openBracePos); doc.replace(new Range(row, 0, row, column-1), indent); } match = line.match(/^(\s*\{)/); if (match) { var column = match[1].length; var indent = this.codeModel.getBraceIndent(row-1); doc.replace(new Range(row, 0, row, column-1), indent); } }; this.$getIndent = function(line) { var match = line.match(/^(\s+)/); if (match) { return match[1]; } return ""; }; this.transformAction = function(state, action, editor, session, text) { if (action === 'insertion' && text === "\n") { // If newline in a doxygen comment, continue the comment var pos = editor.getSelectionRange().start; var match = /^((\s*#+')\s*)/.exec(session.doc.getLine(pos.row)); if (match && editor.getSelectionRange().start.column >= match[2].length) { return {text: "\n" + match[1]}; } } return false; };*/ this.$id = "ace/mode/r"; this.snippetFileId = "ace/snippets/r"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/r_highlight_rules.js ================================================ /* * r_highlight_rules.js * * Copyright (C) 2009-11 by RStudio, Inc. * * The Initial Developer of the Original Code is * Ajax.org B.V. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * 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 * */ var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules; var RHighlightRules = function() { var keywords = lang.arrayToMap( ("function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass") .split("|") ); var buildinConstants = lang.arrayToMap( ("NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|" + "NA_complex_").split("|") ); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { // Roxygen token : "comment.sectionhead", regex : "#+(?!').*(?:----|====|####)\\s*$" }, { // Roxygen token : "comment", regex : "#+'", next : "rd-start" }, { token : "comment", regex : "#.*$" }, { token : "string", // multi line string start regex : '["]', next : "qqstring" }, { token : "string", // multi line string start regex : "[']", next : "qstring" }, { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F]+[Li]?\\b" }, { token : "constant.numeric", // explicit integer regex : "\\d+L\\b" }, { token : "constant.numeric", // number regex : "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b" }, { token : "constant.numeric", // number with leading decimal regex : "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b" }, { token : "constant.language.boolean", regex : "(?:TRUE|FALSE|T|F)\\b" }, { token : "identifier", regex : "`.*?`" }, { onMatch : function(value) { if (keywords[value]) return "keyword"; else if (buildinConstants[value]) return "constant.language"; else if (value == '...' || value.match(/^\.\.\d+$/)) return "variable.language"; else return "identifier"; }, regex : "[a-zA-Z.][a-zA-Z0-9._]*\\b" }, { token : "keyword.operator", regex : "%%|>=|<=|==|!=|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||~|\\$|:" }, { token : "keyword.operator", // infix operators regex : "%.*?%" }, { // Obviously these are neither keywords nor operators, but // labelling them as such was the easiest way to get them // to be colored distinctly from regular text token : "paren.keyword.operator", regex : "[[({]" }, { // Obviously these are neither keywords nor operators, but // labelling them as such was the easiest way to get them // to be colored distinctly from regular text token : "paren.keyword.operator", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "qqstring" : [ { token : "string", regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', next : "start" }, { token : "string", regex : '.+' } ], "qstring" : [ { token : "string", regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next : "start" }, { token : "string", regex : '.+' } ] }; var rdRules = new TexHighlightRules("comment").getRules(); // Make all embedded TeX virtual-comment so they don't interfere with // auto-indent. for (var i = 0; i < rdRules["start"].length; i++) { rdRules["start"][i].token += ".virtual-comment"; } this.addRules(rdRules, "rd-"); this.$rules["rd-start"].unshift({ token: "text", regex: "^", next: "start" }); this.$rules["rd-start"].unshift({ token : "keyword", regex : "@(?!@)[^ ]*" }); this.$rules["rd-start"].unshift({ token : "comment", regex : "@@" }); this.$rules["rd-start"].push({ token : "comment", regex : "[^%\\\\[({\\])}]+" }); }; oop.inherits(RHighlightRules, TextHighlightRules); exports.RHighlightRules = RHighlightRules; ================================================ FILE: src/mode/raku.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var RakuHighlightRules = require("./raku_highlight_rules").RakuHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = RakuHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode({start: "^=(begin)\\b", end: "^=(end)\\b"}); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.blockComment = [ {start: "=begin", end: "=end", lineStartOnly: true}, {start: "=item", end: "=end", lineStartOnly: true} ]; 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.$id = "ace/mode/raku"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/raku_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var RakuHighlightRules = function() { var keywords = ( "my|our|class|role|grammar|is|does|sub|method|submethod|try|" + "default|when|if|elsif|else|unless|with|orwith|without|for|given|proceed|" + "succeed|loop|while|until|repeat|module|use|need|import|require|unit|" + "constant|enum|multi|return|has|token|rule|make|made|proto|state|augment|" + "but|anon|supersede|let|subset|gather|returns|return-rw|temp|" + "BEGIN|CHECK|INIT|END|CLOSE|ENTER|LEAVE|KEEP|UNDO|PRE|POST|FIRST|NEXT|LAST|CATCH|CONTROL|QUIT|DOC" ); var types = ( "Any|Array|Associative|AST|atomicint|Attribute|Backtrace|Backtrace::Frame|" + "Bag|Baggy|BagHash|Blob|Block|Bool|Buf|Callable|CallFrame|Cancellation|" + "Capture|Channel|Code|compiler|Complex|ComplexStr|Cool|CurrentThreadScheduler|" + "Cursor|Date|Dateish|DateTime|Distro|Duration|Encoding|Exception|Failure|"+ "FatRat|Grammar|Hash|HyperWhatever|Instant|Int|IntStr|IO|IO::ArgFiles|"+ "IO::CatHandle|IO::Handle|IO::Notification|IO::Path|IO::Path::Cygwin|"+ "IO::Path::QNX|IO::Path::Unix|IO::Path::Win32|IO::Pipe|IO::Socket|"+ "IO::Socket::Async|IO::Socket::INET|IO::Spec|IO::Spec::Cygwin|IO::Spec::QNX|"+ "IO::Spec::Unix|IO::Spec::Win32|IO::Special|Iterable|Iterator|Junction|Kernel|"+ "Label|List|Lock|Lock::Async|Macro|Map|Match|Metamodel::AttributeContainer|"+ "Metamodel::C3MRO|Metamodel::ClassHOW|Metamodel::EnumHOW|Metamodel::Finalization|"+ "Metamodel::MethodContainer|Metamodel::MROBasedMethodDispatch|Metamodel::MultipleInheritance|"+ "Metamodel::Naming|Metamodel::Primitives|Metamodel::PrivateMethodContainer|"+ "Metamodel::RoleContainer|Metamodel::Trusting|Method|Mix|MixHash|Mixy|Mu|"+ "NFC|NFD|NFKC|NFKD|Nil|Num|Numeric|NumStr|ObjAt|Order|Pair|Parameter|Perl|"+ "Pod::Block|Pod::Block::Code|Pod::Block::Comment|Pod::Block::Declarator|"+ "Pod::Block::Named|Pod::Block::Para|Pod::Block::Table|Pod::Heading|Pod::Item|"+ "Positional|PositionalBindFailover|Proc|Proc::Async|Promise|Proxy|PseudoStash|"+ "Raku|QuantHash|Range|Rat|Rational|RatStr|Real|Regex|Routine|Scalar|Scheduler|"+ "Semaphore|Seq|Set|SetHash|Setty|Signature|Slip|Stash|Str|StrDistance|Stringy|"+ "Sub|Submethod|Supplier|Supplier::Preserving|Supply|Systemic|Tap|Telemetry|"+ "Telemetry::Instrument::Thread|Telemetry::Instrument::Usage|Telemetry::Period|"+ "Telemetry::Sampler|Thread|ThreadPoolScheduler|UInt|Uni|utf8|Variable|Version|"+ "VM|Whatever|WhateverCode|WrapHandle|int|uint|num|str|"+ "int8|int16|int32|int64|uint8|uint16|uint32|uint64|long|longlong|num32|num64|size_t|bool|CArray|Pointer|"+ "Backtrace|Backtrace::Frame|Exception|Failure|X::AdHoc|X::Anon::Augment|X::Anon::Multi|"+ "X::Assignment::RO|X::Attribute::NoPackage|X::Attribute::Package|X::Attribute::Undeclared|"+ "X::Augment::NoSuchType|X::Bind|X::Bind::NativeType|X::Bind::Slice|X::Caller::NotDynamic|"+ "X::Channel::ReceiveOnClosed|X::Channel::SendOnClosed|X::Comp|X::Composition::NotComposable|"+ "X::Constructor::Positional|X::ControlFlow|X::ControlFlow::Return|X::DateTime::TimezoneClash|"+ "X::Declaration::Scope|X::Declaration::Scope::Multi|X::Does::TypeObject|X::Eval::NoSuchLang|"+ "X::Export::NameClash|X::IO|X::IO::Chdir|X::IO::Chmod|X::IO::Copy|X::IO::Cwd|X::IO::Dir|"+ "X::IO::DoesNotExist|X::IO::Link|X::IO::Mkdir|X::IO::Move|X::IO::Rename|X::IO::Rmdir|X::IO::Symlink|"+ "X::IO::Unlink|X::Inheritance::NotComposed|X::Inheritance::Unsupported|X::Method::InvalidQualifier|"+ "X::Method::NotFound|X::Method::Private::Permission|X::Method::Private::Unqualified|"+ "X::Mixin::NotComposable|X::NYI|X::NoDispatcher|X::Numeric::Real|X::OS|X::Obsolete|X::OutOfRange|"+ "X::Package::Stubbed|X::Parameter::Default|X::Parameter::MultipleTypeConstraints|"+ "X::Parameter::Placeholder|X::Parameter::Twigil|X::Parameter::WrongOrder|X::Phaser::Multiple|"+ "X::Phaser::PrePost|X::Placeholder::Block|X::Placeholder::Mainline|X::Pod|X::Proc::Async|"+ "X::Proc::Async::AlreadyStarted|X::Proc::Async::CharsOrBytes|X::Proc::Async::MustBeStarted|"+ "X::Proc::Async::OpenForWriting|X::Proc::Async::TapBeforeSpawn|X::Proc::Unsuccessful|"+ "X::Promise::CauseOnlyValidOnBroken|X::Promise::Vowed|X::Redeclaration|X::Role::Initialization|"+ "X::Seq::Consumed|X::Sequence::Deduction|X::Signature::NameClash|X::Signature::Placeholder|"+ "X::Str::Numeric|X::StubCode|X::Syntax|X::Syntax::Augment::WithoutMonkeyTyping|"+ "X::Syntax::Comment::Embedded|X::Syntax::Confused|X::Syntax::InfixInTermPosition|"+ "X::Syntax::Malformed|X::Syntax::Missing|X::Syntax::NegatedPair|X::Syntax::NoSelf|"+ "X::Syntax::Number::RadixOutOfRange|X::Syntax::P5|X::Syntax::Regex::Adverb|"+ "X::Syntax::Regex::SolitaryQuantifier|X::Syntax::Reserved|X::Syntax::Self::WithoutObject|"+ "X::Syntax::Signature::InvocantMarker|X::Syntax::Term::MissingInitializer|X::Syntax::UnlessElse|"+ "X::Syntax::Variable::Match|X::Syntax::Variable::Numeric|X::Syntax::Variable::Twigil|X::Temporal|"+ "X::Temporal::InvalidFormat|X::TypeCheck|X::TypeCheck::Assignment|X::TypeCheck::Binding|"+ "X::TypeCheck::Return|X::TypeCheck::Splice|X::Undeclared" ); var builtinFunctions = ( "abs|abs2rel|absolute|accept|ACCEPTS|accessed|acos|acosec|acosech|acosh|"+ "acotan|acotanh|acquire|act|action|actions|add|add_attribute|add_enum_value|"+ "add_fallback|add_method|add_parent|add_private_method|add_role|add_trustee|"+ "adverb|after|all|allocate|allof|allowed|alternative-names|annotations|antipair|"+ "antipairs|any|anyof|app_lifetime|append|arch|archname|args|arity|asec|asech|"+ "asin|asinh|ASSIGN-KEY|ASSIGN-POS|assuming|ast|at|atan|atan2|atanh|AT-KEY|"+ "atomic-assign|atomic-dec-fetch|atomic-fetch|atomic-fetch-add|atomic-fetch-dec|"+ "atomic-fetch-inc|atomic-fetch-sub|atomic-inc-fetch|AT-POS|attributes|auth|await|"+ "backtrace|Bag|BagHash|base|basename|base-repeating|batch|BIND-KEY|BIND-POS|"+ "bind-stderr|bind-stdin|bind-stdout|bind-udp|bits|bless|block|bool-only|"+ "bounds|break|Bridge|broken|BUILD|build-date|bytes|cache|callframe|calling-package|"+ "CALL-ME|callsame|callwith|can|cancel|candidates|cando|canonpath|caps|caption|"+ "Capture|cas|catdir|categorize|categorize-list|catfile|catpath|cause|ceiling|"+ "cglobal|changed|Channel|chars|chdir|child|child-name|child-typename|chmod|chomp|"+ "chop|chr|chrs|chunks|cis|classify|classify-list|cleanup|clone|close|closed|"+ "close-stdin|code|codes|collate|column|comb|combinations|command|comment|"+ "compiler|Complex|compose|compose_type|composer|condition|config|configure_destroy|"+ "configure_type_checking|conj|connect|constraints|construct|contains|contents|copy|"+ "cos|cosec|cosech|cosh|cotan|cotanh|count|count-only|cpu-cores|cpu-usage|CREATE|"+ "create_type|cross|cue|curdir|curupdir|d|Date|DateTime|day|daycount|day-of-month|"+ "day-of-week|day-of-year|days-in-month|declaration|decode|decoder|deepmap|"+ "defined|DEFINITE|delayed|DELETE-KEY|DELETE-POS|denominator|desc|DESTROY|destroyers|"+ "devnull|did-you-mean|die|dir|dirname|dir-sep|DISTROnames|do|done|duckmap|dynamic|"+ "e|eager|earlier|elems|emit|enclosing|encode|encoder|encoding|end|ends-with|enum_from_value|"+ "enum_value_list|enum_values|enums|eof|EVAL|EVALFILE|exception|excludes-max|excludes-min|"+ "EXISTS-KEY|EXISTS-POS|exit|exitcode|exp|expected|explicitly-manage|expmod|extension|f|"+ "fail|fc|feature|file|filename|find_method|find_method_qualified|finish|first|flat|flatmap|"+ "flip|floor|flush|fmt|format|formatter|freeze|from|from-list|from-loop|from-posix|full|"+ "full-barrier|get|get_value|getc|gist|got|grab|grabpairs|grep|handle|handled|handles|"+ "hardware|has_accessor|head|headers|hh-mm-ss|hidden|hides|hour|how|hyper|id|illegal|"+ "im|in|indent|index|indices|indir|infinite|infix|install_method_cache|"+ "Instant|instead|int-bounds|interval|in-timezone|invalid-str|invert|invocant|IO|"+ "IO::Notification.watch-path|is_trusted|is_type|isa|is-absolute|is-hidden|is-initial-thread|"+ "is-int|is-lazy|is-leap-year|isNaN|is-prime|is-relative|is-routine|is-setting|is-win|item|"+ "iterator|join|keep|kept|KERNELnames|key|keyof|keys|kill|kv|kxxv|l|lang|last|lastcall|later|"+ "lazy|lc|leading|level|line|lines|link|listen|live|local|lock|log|log10|lookup|lsb|"+ "MAIN|match|max|maxpairs|merge|message|method_table|methods|migrate|min|minmax|"+ "minpairs|minute|misplaced|Mix|MixHash|mkdir|mode|modified|month|move|mro|msb|multiness|"+ "name|named|named_names|narrow|nativecast|native-descriptor|nativesizeof|new|new_type|"+ "new-from-daycount|new-from-pairs|next|nextcallee|next-handle|nextsame|nextwith|NFC|NFD|"+ "NFKC|NFKD|nl-in|nl-out|nodemap|none|norm|not|note|now|nude|numerator|Numeric|of|"+ "offset|offset-in-hours|offset-in-minutes|old|on-close|one|on-switch|open|opened|"+ "operation|optional|ord|ords|orig|os-error|osname|out-buffer|pack|package|package-kind|"+ "package-name|packages|pair|pairs|pairup|parameter|params|parent|parent-name|parents|parse|"+ "parse-base|parsefile|parse-names|parts|path|path-sep|payload|peer-host|peer-port|periods|"+ "perl|permutations|phaser|pick|pickpairs|pid|placeholder|plus|polar|poll|polymod|pop|pos|"+ "positional|posix|postfix|postmatch|precomp-ext|precomp-target|pred|prefix|prematch|prepend|"+ "print|printf|print-nl|print-to|private|private_method_table|proc|produce|Promise|prompt|"+ "protect|pull-one|push|push-all|push-at-least|push-exactly|push-until-lazy|put|"+ "qualifier-type|quit|r|race|radix|raku|rand|range|raw|re|read|readchars|readonly|"+ "ready|Real|reallocate|reals|reason|rebless|receive|recv|redispatcher|redo|reduce|"+ "rel2abs|relative|release|rename|repeated|replacement|report|reserved|resolve|"+ "restore|result|resume|rethrow|reverse|right|rindex|rmdir|roles_to_compose|"+ "rolish|roll|rootdir|roots|rotate|rotor|round|roundrobin|routine-type|run|rwx|s|"+ "samecase|samemark|samewith|say|schedule-on|scheduler|scope|sec|sech|second|seek|"+ "self|send|Set|set_hidden|set_name|set_package|set_rw|set_value|SetHash|"+ "set-instruments|setup_finalization|shape|share|shell|shift|sibling|sigil|"+ "sign|signal|signals|signature|sin|sinh|sink|sink-all|skip|skip-at-least|"+ "skip-at-least-pull-one|skip-one|sleep|sleep-timer|sleep-until|Slip|slurp|"+ "slurp-rest|slurpy|snap|snapper|so|socket-host|socket-port|sort|source|"+ "source-package|spawn|SPEC|splice|split|splitdir|splitpath|sprintf|spurt|"+ "sqrt|squish|srand|stable|start|started|starts-with|status|stderr|stdout|"+ "sub_signature|subbuf|subbuf-rw|subname|subparse|subst|subst-mutate|"+ "substr|substr-eq|substr-rw|succ|sum|Supply|symlink|t|tail|take|take-rw|"+ "tan|tanh|tap|target|target-name|tc|tclc|tell|then|throttle|throw|timezone|"+ "tmpdir|to|today|toggle|to-posix|total|trailing|trans|tree|trim|trim-leading|"+ "trim-trailing|truncate|truncated-to|trusts|try_acquire|trying|twigil|type|"+ "type_captures|typename|uc|udp|uncaught_handler|unimatch|uniname|uninames|"+ "uniparse|uniprop|uniprops|unique|unival|univals|unlink|unlock|unpack|unpolar|"+ "unshift|unwrap|updir|USAGE|utc|val|value|values|VAR|variable|verbose-config|"+ "version|VMnames|volume|vow|w|wait|warn|watch|watch-path|week|weekday-of-month|"+ "week-number|week-year|WHAT|WHERE|WHEREFORE|WHICH|WHO|whole-second|WHY|"+ "wordcase|words|workaround|wrap|write|write-to|yada|year|yield|yyyy-mm-dd|"+ "z|zip|zip-latest|"+ "plan|done-testing|bail-out|todo|skip|skip-rest|diag|subtest|pass|flunk|ok|"+ "nok|cmp-ok|is-deeply|isnt|is-approx|like|unlike|use-ok|isa-ok|does-ok|"+ "can-ok|dies-ok|lives-ok|eval-dies-ok|eval-lives-ok|throws-like|fails-like|"+ "rw|required|native|repr|export|symbol" ); var constants_ascii = ("pi|Inf|tau|time"); var ops_txt = ("eq|ne|gt|lt|le|ge|div|gcd|lcm|leg|cmp|ff|fff|"+ "x|before|after|Z|X|and|or|andthen|notandthen|orelse|xor" ); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "storage.type" : types, "constant.language": constants_ascii, "support.function": builtinFunctions, "keyword.operator": ops_txt }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var moduleName = "[a-zA-Z_][a-zA-Z_0-9:-]*\\b"; // Common rules used in the start block and in qqstrings and in qq-heredocs for interpolation // Numbers - Hexadecimal var hex = { token : "constant.numeric", regex : "0x[0-9a-fA-F]+\\b" }; // Numbers - Num & Rat var num_rat = { token : "constant.numeric", regex : "[+-.]?\\d[\\d_]*(?:(?:\\.\\d[\\d_]*)?(?:[eE][+-]?\\d[\\d_]*)?)?i?\\b" }; // Booleans var booleans = { token : "constant.language.boolean", regex : "(?:True|False)\\b" }; // Versions var versions = { token : "constant.other", regex : "v[0-9](?:\\.[a-zA-Z0-9*])*\\b" }; // Keywords var lang_keywords = { token : keywordMapper, regex : "[a-zA-Z][\\:a-zA-Z0-9_-]*\\b" }; // Variables - also matches $_ and $1 $2 (regex match) etc. var variables = { token : "variable.language", regex : "[$@%&][?*!.]?[a-zA-Z0-9_-]+\\b" }; // Special variables - matches $ $/ $! and @$/ var vars_special = { token: "variable.language", regex : "\\$[/|!]?|@\\$/" }; // Operators characters var ops_char = { token : "keyword.operator", regex : "=|<|>|\\+|\\*|-|/|~|%|\\?|!|\\^|\\.|\\:|\\,|"+ "»|«|\\||\\&|⚛|∘" }; // Unicode Constants var constants_unicode = { token : "constant.language", regex : "𝑒|π|τ|∞" }; // qstrings var qstrings = { token : "string.quoted.single", regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; // Word Quoting var word_quoting = { token : "string.quoted.single", regex : "[<](?:[a-zA-Z0-9 ])*[>]"}; //Regexp var regexp = { token : "string.regexp", regex : "[m|rx]?[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" }; this.$rules = { "start" : [ { token : "comment.block", // Embedded Comments - Parentheses regex : "#[`|=]\\(.*\\)" }, { token : "comment.block", // Embedded Comments - Brackets regex : "#[`|=]\\[.*\\]" }, { token : "comment.doc", // Multiline Comments regex : "^=(?:begin)\\b", next : "block_comment" }, { token : "string.unquoted", // q Heredocs regex : "q[x|w]?\\:to/END/;", next : "qheredoc" }, { token : "string.unquoted", // qq Heredocs regex : "qq[x|w]?\\:to/END/;", next : "qqheredoc" }, regexp, qstrings , { token : "string.quoted.double", // Double Quoted String regex : '"', next : "qqstring" }, word_quoting , { token: ["keyword", "text", "variable.module"], // use - Module Names, Pragmas, etc. regex: "(use)(\\s+)((?:"+moduleName+"\\.?)*)" }, hex, num_rat, booleans, versions, lang_keywords, variables, vars_special, ops_char, constants_unicode , { token : "comment", // Sigle Line Comments regex : "#.*$" }, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "qqstring" : [ { token : "constant.language.escape", regex : '\\\\(?:[nrtef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})' }, variables, vars_special , { token : "lparen", regex : "{", next : "qqinterpolation" }, { token : "string.quoted.double", regex : '"', next : "start" }, { defaultToken : "string.quoted.double" } ], "qqinterpolation" : [ hex, num_rat, booleans, versions, lang_keywords, variables, vars_special, ops_char, constants_unicode, qstrings, regexp, { token: "rparen", regex: "}", next : "qqstring" } ], "block_comment": [ { token: "comment.doc", regex: "^=end +[a-zA-Z_0-9]*", next: "start" }, { defaultToken: "comment.doc" } ], "qheredoc": [ { token: "string.unquoted", regex: "END$", next: "start" }, { defaultToken: "string.unquoted" } ], "qqheredoc": [ variables, vars_special, { token : "lparen", regex : "{", next : "qqheredocinterpolation" }, { token: "string.unquoted", regex: "END$", next: "start" }, { defaultToken: "string.unquoted" } ], "qqheredocinterpolation" : [ hex, num_rat, booleans, versions, lang_keywords, variables, vars_special, ops_char, constants_unicode, qstrings, regexp, { token: "rparen", regex: "}", next : "qqheredoc" } ] }; }; oop.inherits(RakuHighlightRules, TextHighlightRules); exports.RakuHighlightRules = RakuHighlightRules; ================================================ FILE: src/mode/razor.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var RazorHighlightRules = require("./razor_highlight_rules").RazorHighlightRules; var RazorCompletions = require("./razor_completions").RazorCompletions; var HtmlCompletions = require("./html_completions").HtmlCompletions; var Mode = function() { HtmlMode.call(this); this.$highlightRules = new RazorHighlightRules(); this.$completer = new RazorCompletions(); this.$htmlCompleter = new HtmlCompletions(); }; oop.inherits(Mode, HtmlMode); (function() { this.getCompletions = function(state, session, pos, prefix) { var razorToken = this.$completer.getCompletions(state, session, pos, prefix); var htmlToken = this.$htmlCompleter.getCompletions(state, session, pos, prefix); return razorToken.concat(htmlToken); }; this.createWorker = function(session) { return null; }; this.$id = "ace/mode/razor"; this.snippetFileId = "ace/snippets/razor"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/razor_completions.js ================================================ "use strict"; var TokenIterator = require("../token_iterator").TokenIterator; var keywords = [ "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double","else","enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override", "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "var", "virtual", "void", "volatile", "while"]; var shortHands = [ "Html", "Model", "Url", "Layout" ]; var RazorCompletions = function() { }; (function() { this.getCompletions = function(state, session, pos, prefix) { if(state.lastIndexOf("razor-short-start") == -1 && state.lastIndexOf("razor-block-start") == -1) return []; var token = session.getTokenAt(pos.row, pos.column); if (!token) return []; if(state.lastIndexOf("razor-short-start") != -1) { return this.getShortStartCompletions(state, session, pos, prefix); } if(state.lastIndexOf("razor-block-start") != -1) { return this.getKeywordCompletions(state, session, pos, prefix); } }; this.getShortStartCompletions = function(state, session, pos, prefix) { return shortHands.map(function(element){ return { value: element, meta: "keyword", score: 1000000 }; }); }; this.getKeywordCompletions = function(state, session, pos, prefix) { return shortHands.concat(keywords).map(function(element){ return { value: element, meta: "keyword", score: 1000000 }; }); }; }).call(RazorCompletions.prototype); exports.RazorCompletions = RazorCompletions; ================================================ FILE: src/mode/razor_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules; var blockPrefix = 'razor-block-'; var RazorLangHighlightRules = function() { CSharpHighlightRules.call(this); var processPotentialCallback = function(value, stackItem) { if (typeof stackItem === "function") return stackItem(value); return stackItem; }; var inBraces = 'in-braces'; this.$rules.start.unshift({ regex: '[\\[({]', onMatch: function(value, state, stack) { var prefix = /razor-[^\-]+-/.exec(state)[0]; stack.unshift(value); stack.unshift(prefix + inBraces); this.next = prefix + inBraces; return 'paren.lparen'; } }, { start: "@\\*", end: "\\*@", token: "comment" }); var parentCloseMap = { '{': '}', '[': ']', '(': ')' }; this.$rules[inBraces] = lang.deepCopy(this.$rules.start); this.$rules[inBraces].unshift({ regex: '[\\])}]', onMatch: function(value, state, stack) { var open = stack[1]; if (parentCloseMap[open] !== value) return 'invalid.illegal'; stack.shift(); // exit in-braces block stack.shift(); // exit brace marker this.next = processPotentialCallback(value, stack[0]) || 'start'; return 'paren.rparen'; } }); }; oop.inherits(RazorLangHighlightRules, CSharpHighlightRules); var RazorHighlightRules = function() { HtmlHighlightRules.call(this); // 'Blocks': @{}, @(), @functions{} var blockStartRule = { regex: '@[({]|@functions{|@code ?{', onMatch: function(value, state, stack) { stack.unshift(value); stack.unshift('razor-block-start'); this.next = 'razor-block-start'; return 'punctuation.block.razor'; } }; var blockEndMap = { '@{': '}', '@(': ')', '@functions{':'}', '@code {':'}', '@code{':'}' }; var blockEndRule = { regex: '[})]', onMatch: function(value, state, stack) { var blockStart = stack[1]; if (blockEndMap[blockStart] !== value) return 'invalid.illegal'; stack.shift(); // exit razor block stack.shift(); // remove block type marker this.next = stack.shift() || 'start'; return 'punctuation.block.razor'; } }; // Short: @Abc.Cde(Xyz).Ef var shortStartRule = { regex: "@(?![{(])", onMatch: function(value, state, stack) { stack.unshift("razor-short-start"); this.next = "razor-short-start"; return 'punctuation.short.razor'; } }; var shortEndRule = { token: "", regex: "(?=[^A-Za-z_\\.()\\[\\]])", next: 'pop' }; // Control flow: @if, etc var ifStartRule = { regex: "@(?=if)", onMatch: function(value, state, stack) { stack.unshift(function(value) { if (value !== '}') return 'start'; return stack.shift() || 'start'; }); this.next = 'razor-block-start'; return 'punctuation.control.razor'; } }; // Combined: var razorStartRules = [ { start: "@\\*", end: "\\*@", token: "comment" }, { token: ["meta.directive.razor", "text", "identifier"], regex: "^(\\s*@(?:model|inject|inherits|implements|attribute|layout|namespace|rendermode|using))(\\s+)(.+)$" }, { token: ["meta.directive.razor", "text", "string"], regex: "^(\\s*@page)(\\s+)(.*)$" }, blockStartRule, //ifStartRule, shortStartRule ]; for (var key in this.$rules) this.$rules[key].unshift.apply(this.$rules[key], razorStartRules); this.embedRules(RazorLangHighlightRules, "razor-block-", [blockEndRule], ["start"]); this.embedRules(RazorLangHighlightRules, "razor-short-", [shortEndRule], ["start"]); this.normalizeRules(); }; oop.inherits(RazorHighlightRules, HtmlHighlightRules); exports.RazorHighlightRules = RazorHighlightRules; exports.RazorLangHighlightRules = RazorLangHighlightRules; ================================================ FILE: src/mode/rdoc.js ================================================ /* * rdoc.js * * Copyright (C) 2009-11 by RStudio, Inc. * * The Initial Developer of the Original Code is * Ajax.org B.V. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * 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 * */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var RDocHighlightRules = require("./rdoc_highlight_rules").RDocHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function(suppressHighlighting) { this.HighlightRules = RDocHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.getNextLineIndent = function(state, line, tab) { return this.$getIndent(line); }; this.$id = "ace/mode/rdoc"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/rdoc_highlight_rules.js ================================================ /* * rdoc_highlight_rules.js * * Copyright (C) 2009-11 by RStudio, Inc. * * 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 * */ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LaTeXHighlightRules = require("./latex_highlight_rules"); var RDocHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : "%.*$" }, { token : "text", // non-command regex : "\\\\[$&%#\\{\\}]" }, { token : "keyword", // command regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b", next : "nospell" }, { token : "keyword", // command regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])" }, { // Obviously these are neither keywords nor operators, but // labelling them as such was the easiest way to get them // to be colored distinctly from regular text token : "paren.keyword.operator", regex : "[[({]" }, { // Obviously these are neither keywords nor operators, but // labelling them as such was the easiest way to get them // to be colored distinctly from regular text token : "paren.keyword.operator", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], // This mode is necessary to prevent spell checking, but to keep the // same syntax highlighting behavior. "nospell" : [ { token : "comment", regex : "%.*$", next : "start" }, { token : "nospell.text", // non-command regex : "\\\\[$&%#\\{\\}]" }, { token : "keyword", // command regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b" }, { token : "keyword", // command regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])", next : "start" }, { token : "paren.keyword.operator", regex : "[[({]" }, { token : "paren.keyword.operator", regex : "[\\])]" }, { token : "paren.keyword.operator", regex : "}", next : "start" }, { token : "nospell.text", regex : "\\s+" }, { token : "nospell.text", regex : "\\w+" } ] }; }; oop.inherits(RDocHighlightRules, TextHighlightRules); exports.RDocHighlightRules = RDocHighlightRules; ================================================ FILE: src/mode/red.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var RedHighlightRules = require("./red_highlight_rules").RedHighlightRules; var RedFoldMode = require("./folding/cstyle").FoldMode; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = RedHighlightRules; this.foldingRules = new RedFoldMode(); this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.blockComment = { start: "comment {", 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/red"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/red_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var RedHighlightRules = function() { //var keywordMapper = this.createKeywordMapper({ //}, "text", true, " "); var compoundKeywords = ""; this.$rules = { "start" : [ {token : "keyword.operator", regex: /\s([\-+%/=<>*]|(?:\*\*\|\/\/|==|>>>?|<>|<<|=>|<=|=\?))(\s|(?=:))/}, {token : "string.email", regex : /\w[-\w._]*\@\w[-\w._]*/}, {token : "value.time", regex : /\b\d+:\d+(:\d+)?/}, {token : "string.url", regex : /\w[-\w_]*\:(\/\/)?\w[-\w._]*(:\d+)?/}, {token : "value.date", regex : /(\b\d{1,4}[-/]\d{1,2}[-/]\d{1,2}|\d{1,2}[-/]\d{1,2}[-/]\d{1,4})\b/}, {token : "value.tuple", regex : /\b\d{1,3}\.\d{1,3}\.\d{1,3}(\.\d{1,3}){0,9}/}, {token : "value.pair", regex: /[+-]?\d+x[-+]?\d+/}, {token : "value.binary", regex : /\b2#{([01]{8})+}/}, {token : "value.binary", regex : /\b64#{([\w/=+])+}/}, {token : "value.binary", regex : /(16)?#{([\dabcdefABCDEF][\dabcdefABCDEF])*}/}, {token : "value.issue", regex : /#\w[-\w'*.]*/}, {token : "value.numeric", regex: /[+-]?\d['\d]*(?:\.\d+)?e[-+]?\d{1,3}\%?(?!\w)/}, {token : "invalid.illegal", regex: /[+-]?\d['\d]*(?:\.\d+)?\%?[a-zA-Z]/}, {token : "value.numeric", regex: /[+-]?\d['\d]*(?:\.\d+)?\%?(?![a-zA-Z])/}, {token : "value.character", regex : /#"(\^[-@/_~^"HKLM\[]|.)"/}, {token : "string.file", regex : /%[-\w\.\/]+/}, {token : "string.tag", regex : /</, next : "tag"}, {token : "string", regex : /"/, next : "string"}, {token : "string.other", regex : "{", next : "string.other"}, {token : "comment", regex : "comment [{]", next : "comment"}, {token : "comment", regex : /;.+$/}, //{token : "invalid", regex: "\\.{2,}"}, {token : "paren.map-start", regex : "#\\("}, {token : "paren.block-start", regex : "[\\[]"}, {token : "paren.block-end", regex : "[\\]]"}, {token : "paren.parens-start", regex : "[(]"}, {token : "paren.parens-end", regex : "\\)"}, //{token : "keyword", regex : compoundKeywords}, {token : "keyword", regex : "/local|/external"}, {token : "keyword.preprocessor", regex : "#(if|either|" + "switch|case|include|do|macrolocal|reset|process|trace)"}, {token : "constant.datatype!", regex : "(?:datatype|unset|none|logic|block|paren|string|" + "file|url|char|integer|float|word|set-word|lit-word|" + "get-word|refinement|issue|native|action|op|function|" + "path|lit-path|set-path|get-path|routine|bitset|point|" + "object|typeset|error|vector|hash|pair|percent|tuple|" + "map|binary|time|tag|email|handle|date|image|event|" + "series|any-type|number|any-object|scalar|" + "any-string|any-word|any-function|any-block|any-list|" + "any-path|immediate|all-word|internal|external|default)!(?![-!?\\w~])"}, {token : "keyword.function", regex : "\\b(?:collect|quote|on-parse-event|math|last|source|expand|" + "show|context|object|input|quit|dir|make-dir|cause-error|" + "error\\?|none\\?|block\\?|any-list\\?|word\\?|char\\?|" + "any-string\\?|series\\?|binary\\?|attempt|url\\?|" + "string\\?|suffix\\?|file\\?|object\\?|body-of|first|" + "second|third|mod|clean-path|dir\\?|to-red-file|" + "normalize-dir|list-dir|pad|empty\\?|dirize|offset\\?|" + "what-dir|expand-directives|load|split-path|change-dir|" + "to-file|path-thru|save|load-thru|View|float\\?|to-float|" + "charset|\\?|probe|set-word\\?|q|words-of|replace|repend|" + "react|function\\?|spec-of|unset\\?|halt|op\\?|" + "any-function\\?|to-paren|tag\\?|routine|class-of|" + "size-text|draw|handle\\?|link-tabs-to-parent|" + "link-sub-to-parent|on-face-deep-change*|" + "update-font-faces|do-actor|do-safe|do-events|pair\\?|" + "foreach-face|hex-to-rgb|issue\\?|alter|path\\?|" + "typeset\\?|datatype\\?|set-flag|layout|extract|image\\?|" + "get-word\\?|to-logic|to-set-word|to-block|center-face|" + "dump-face|request-font|request-file|request-dir|rejoin|" + "ellipsize-at|any-block\\?|any-object\\?|map\\?|keys-of|" + "a-an|also|parse-func-spec|help-string|what|routine\\?|" + "action\\?|native\\?|refinement\\?|common-substr|" + "red-complete-file|red-complete-path|unview|comment|\\?\\?|" + "fourth|fifth|values-of|bitset\\?|email\\?|get-path\\?|" + "hash\\?|integer\\?|lit-path\\?|lit-word\\?|logic\\?|" + "paren\\?|percent\\?|set-path\\?|time\\?|tuple\\?|date\\?|" + "vector\\?|any-path\\?|any-word\\?|number\\?|immediate\\?|" + "scalar\\?|all-word\\?|to-bitset|to-binary|to-char|to-email|" + "to-get-path|to-get-word|to-hash|to-integer|to-issue|" + "to-lit-path|to-lit-word|to-map|to-none|to-pair|to-path|" + "to-percent|to-refinement|to-set-path|to-string|to-tag|" + "to-time|to-typeset|to-tuple|to-unset|to-url|to-word|" + "to-image|to-date|parse-trace|modulo|eval-set-path|" + "extract-boot-args|flip-exe-flag|split|do-file|" + "exists-thru\\?|read-thru|do-thru|cos|sin|tan|acos|asin|" + "atan|atan2|sqrt|clear-reactions|dump-reactions|react\\?|" + "within\\?|overlap\\?|distance\\?|face\\?|metrics\\?|" + "get-scroller|insert-event-func|remove-event-func|" + "set-focus|help|fetch-help|about|ls|ll|pwd|cd|" + "red-complete-input|matrix)(?![-!?\\w~])"}, {token : "keyword.action", regex : "\\b(?:to|remove|copy|insert|change|clear|move|poke|put|" + "random|reverse|sort|swap|take|trim|add|subtract|" + "divide|multiply|make|reflect|form|mold|modify|" + "absolute|negate|power|remainder|round|even\\?|odd\\?|" + "and~|complement|or~|xor~|append|at|back|find|skip|" + "tail|head|head\\?|index\\?|length\\?|next|pick|" + "select|tail\\?|delete|read|write)(?![-_!?\\w~])" }, {token : "keyword.native", regex : "\\b(?:not|any|set|uppercase|lowercase|checksum|" + "try|catch|browse|throw|all|as|" + "remove-each|func|function|does|has|do|reduce|" + "compose|get|print|prin|equal\\?|not-equal\\?|" + "strict-equal\\?|lesser\\?|greater\\?|lesser-or-equal\\?|" + "greater-or-equal\\?|same\\?|type\\?|stats|bind|in|parse|" + "union|unique|intersect|difference|exclude|" + "complement\\?|dehex|negative\\?|positive\\?|max|min|" + "shift|to-hex|sine|cosine|tangent|arcsine|arccosine|" + "arctangent|arctangent2|NaN\\?|zero\\?|log-2|log-10|log-e|" + "exp|square-root|construct|value\\?|as-pair|" + "extend|debase|enbase|to-local-file|" + "wait|unset|new-line|new-line\\?|context\\?|set-env|" + "get-env|list-env|now|sign\\?|call|size\\?)(?![-!?\\w~])" }, {token : "keyword", regex : "\\b(?:Red(?=\\s+\\[)|object|context|make|self|keep)(?![-!?\\w~])" }, {token: "variable.language", regex : "this"}, {token: "keyword.control", regex : "(?:while|if|return|case|unless|either|until|loop|repeat|" + "forever|foreach|forall|switch|break|continue|exit)(?![-!?\\w~])"}, {token: "constant.language", regex : "\\b(?:true|false|on|off|yes|none|no)(?![-!?\\w~])"}, {token: "constant.numeric", regex : /\bpi(?![^-_])/}, {token: "constant.character", regex : "\\b(space|tab|newline|cr|lf)(?![-!?\\w~])"}, {token: "keyword.operator", regex : "\s(or|and|xor|is)\s"}, //{token : keywordMapper, regex : "\\b\\w[-\\w'*.]*\\b"}, {token : "variable.get-path", regex : /:\w[-\w'*.?!]*(\/\w[-\w'*.?!]*)(\/\w[-\w'*.?!]*)*/}, {token : "variable.set-path", regex : /\w[-\w'*.?!]*(\/\w[-\w'*.?!]*)(\/\w[-\w'*.?!]*)*:/}, {token : "variable.lit-path", regex : /'\w[-\w'*.?!]*(\/\w[-\w'*.?!]*)(\/\w[-\w'*.?!]*)*/}, {token : "variable.path", regex : /\w[-\w'*.?!]*(\/\w[-\w'*.?!]*)(\/\w[-\w'*.?!]*)*/}, {token : "variable.refinement", regex : /\/\w[-\w'*.?!]*/}, {token : "keyword.view.style", regex : "\\b(?:window|base|button|text|field|area|check|" + "radio|progress|slider|camera|text-list|" + "drop-list|drop-down|panel|group-box|" + "tab-panel|h1|h2|h3|h4|h5|box|image|init)(?![-!?\\w~])"}, {token : "keyword.view.event", regex : "\\b(?:detect|on-detect|time|on-time|drawing|on-drawing|" + "scroll|on-scroll|down|on-down|up|on-up|mid-down|" + "on-mid-down|mid-up|on-mid-up|alt-down|on-alt-down|" + "alt-up|on-alt-up|aux-down|on-aux-down|aux-up|" + "on-aux-up|wheel|on-wheel|drag-start|on-drag-start|" + "drag|on-drag|drop|on-drop|click|on-click|dbl-click|" + "on-dbl-click|over|on-over|key|on-key|key-down|" + "on-key-down|key-up|on-key-up|ime|on-ime|focus|" + "on-focus|unfocus|on-unfocus|select|on-select|" + "change|on-change|enter|on-enter|menu|on-menu|close|" + "on-close|move|on-move|resize|on-resize|moving|" + "on-moving|resizing|on-resizing|zoom|on-zoom|pan|" + "on-pan|rotate|on-rotate|two-tap|on-two-tap|" + "press-tap|on-press-tap|create|on-create|created|on-created)(?![-!?\\w~])"}, {token : "keyword.view.option", regex : "\\b(?:all-over|center|color|default|disabled|down|" + "flags|focus|font|font-color|font-name|" + "font-size|hidden|hint|left|loose|name|" + "no-border|now|rate|react|select|size|space)(?![-!?\\w~])"}, {token : "constant.other.colour", regex : "\\b(?:Red|white|transparent|" + "black|gray|aqua|beige|blue|brick|brown|coal|coffee|" + "crimson|cyan|forest|gold|green|ivory|khaki|leaf|linen|" + "magenta|maroon|mint|navy|oldrab|olive|orange|papaya|" + "pewter|pink|purple|reblue|rebolor|sienna|silver|sky|" + "snow|tanned|teal|violet|water|wheat|yello|yellow|glass)(?![-!?\\w~])"}, {token : "variable.get-word", regex : /\:\w[-\w'*.?!]*/}, {token : "variable.set-word", regex : /\w[-\w'*.?!]*\:/}, {token : "variable.lit-word", regex : /'\w[-\w'*.?!]*/}, {token : "variable.word", regex : /\b\w+[-\w'*.!?]*/}, {caseInsensitive: true} ], "string" : [ //{token : "constant.language.escape", regex : "^"}, {token : "string", regex : /"/, next : "start"}, {defaultToken : "string"} ], "string.other" : [ //{token : "constant.language.escape", regex : "^"}, {token : "string.other", regex : /}/, next : "start"}, {defaultToken : "string.other"} ], "tag" : [ {token : "string.tag", regex : />/, next : "start"}, {defaultToken : "string.tag"} ], "comment" : [ //{token : "constant.language.escape", regex : "^"}, {token : "comment", regex : /}/, next : "start"}, {defaultToken : "comment"} ] }; }; oop.inherits(RedHighlightRules, TextHighlightRules); exports.RedHighlightRules = RedHighlightRules; ================================================ FILE: src/mode/redshift.js ================================================ var oop = require("../lib/oop"); var TextMode = require("../mode/text").Mode; var RedshiftHighlightRules = require("./redshift_highlight_rules").RedshiftHighlightRules; var Mode = function() { this.HighlightRules = RedshiftHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "/*", end: "*/"}; this.getNextLineIndent = function(state, line, tab) { if (state == "start" || state == "keyword.statementEnd") { return ""; } else { return this.$getIndent(line); // Keep whatever indent the previous line has } }; this.$id = "ace/mode/redshift"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/redshift_highlight_rules.js ================================================ var oop = require("../lib/oop"); var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; // Syntax highlighting for json. var JsonHighlightRules = require("./json_highlight_rules").JsonHighlightRules; var RedshiftHighlightRules = function() { // Keywords, functions, operators last updated for pg 9.3. var keywords = ( "aes128|aes256|all|allowoverwrite|analyse|analyze|and|any|array|as|asc|authorization|backup|" + "between|binary|blanksasnull|both|bytedict|bzip2|case|cast|check|collate|column|constraint|create|credentials|" + "cross|current_date|current_time|current_timestamp|current_user|current_user_id|default|deferrable|deflate|defrag|delta|" + "delta32k|desc|disable|distinct|do|else|emptyasnull|enable|encode|encrypt|encryption|end|except|explicit|false|for|foreign|" + "freeze|from|full|globaldict256|globaldict64k|grant|group|gzip|having|identity|ignore|ilike|in|initially|inner|intersect|into|is|" + "isnull|join|leading|left|like|limit|localtime|localtimestamp|lun|luns|lzo|lzop|minus|mostly13|mostly32|mostly8|natural|new|not|notnull|" + "null|nulls|off|offline|offset|old|on|only|open|or|order|outer|overlaps|parallel|partition|percent|permissions|placing|primary|raw|readratio|" + "recover|references|rejectlog|resort|restore|right|select|session_user|similar|some|sysdate|system|table|tag|tdes|text255|text32k|then|timestamp|" + "to|top|trailing|true|truncatecolumns|union|unique|user|using|verbose|wallet|when|where|with|without" ); var builtinFunctions = ( "current_schema|current_schemas|has_database_privilege|has_schema_privilege|has_table_privilege|age|current_time|current_timestamp|localtime|" + "isfinite|now|ascii|get_bit|get_byte|octet_length|set_bit|set_byte|to_ascii|avg|count|listagg|max|min|stddev_samp|stddev_pop|sum|var_samp|var_pop|" + "bit_and|bit_or|bool_and|bool_or|avg|count|cume_dist|dense_rank|first_value|last_value|lag|lead|listagg|max|median|min|nth_value|ntile|percent_rank|" + "percentile_cont|percentile_disc|rank|ratio_to_report|row_number|case|coalesce|decode|greatest|least|nvl|nvl2|nullif|add_months|age|convert_timezone|" + "current_date|timeofday|current_time|current_timestamp|date_cmp|date_cmp_timestamp|date_part_year|dateadd|datediff|date_part|date_trunc|extract|getdate|" + "interval_cmp|isfinite|last_day|localtime|localtimestamp|months_between|next_day|now|sysdate|timestamp_cmp|timestamp_cmp_date|trunc|abs|acos|asin|atan|" + "atan2|cbrt|ceiling|ceil|checksum|cos|cot|degrees|dexp|dlog1|dlog10|exp|floor|ln|log|mod|pi|power|radians|random|round|sin|sign|sqrt|tan|trunc|ascii|" + "bpcharcmp|btrim|bttext_pattern_cmp|char_length|character_length|charindex|chr|concat|crc32|func_sha1|get_bit|get_byte|initcap|left|right|len|length|" + "lower|lpad|rpad|ltrim|md5|octet_length|position|quote_ident|quote_literal|regexp_count|regexp_instr|regexp_replace|regexp_substr|repeat|replace|replicate|" + "reverse|rtrim|set_bit|set_byte|split_part|strpos|strtol|substring|textlen|to_ascii|to_hex|translate|trim|upper|json_array_length|json_extract_array_element_text|" + "json_extract_path_text|cast|convert|to_char|to_date|to_number|current_database|current_schema|current_schemas|current_user|current_user_id|has_database_privilege|" + "has_schema_privilege|has_table_privilege|pg_backend_pid|pg_last_copy_count|pg_last_copy_id|pg_last_query_id|pg_last_unload_count|session_user|slice_num|user|version" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords }, "identifier", true); var sqlRules = [{ token : "string", // single line string -- assume dollar strings if multi-line for now regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "variable.language", // pg identifier regex : '".*?"' }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : keywordMapper, regex : "[a-zA-Z_][a-zA-Z0-9_$]*\\b" // TODO - Unicode in identifiers }, { token : "keyword.operator", regex : "!|!!|!~|!~\\*|!~~|!~~\\*|#|##|#<|#<=|#<>|#=|#>|#>=|%|\\&|\\&\\&|\\&<|\\&<\\||\\&>|\\*|\\+|" + "\\-|/|<|<#>|<\\->|<<|<<=|<<\\||<=|<>|<\\?>|<@|<\\^|=|>|>=|>>|>>=|>\\^|\\?#|\\?\\-|\\?\\-\\||" + "\\?\\||\\?\\|\\||@|@\\-@|@>|@@|@@@|\\^|\\||\\|\\&>|\\|/|\\|>>|\\|\\||\\|\\|/|~|~\\*|~<=~|~<~|" + "~=|~>=~|~>~|~~|~~\\*" }, { token : "paren.lparen", regex : "[\\(]" }, { token : "paren.rparen", regex : "[\\)]" }, { token : "text", regex : "\\s+" } ]; this.$rules = { "start" : [{ token : "comment", regex : "--.*$" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi-line comment regex : "\\/\\*", next : "comment" },{ token : "keyword.statementBegin", regex : "^[a-zA-Z]+", // Could enumerate starting keywords but this allows things to work when new statements are added. next : "statement" },{ token : "support.buildin", // psql directive regex : "^\\\\[\\S]+.*$" } ], "statement" : [{ token : "comment", regex : "--.*$" }, { token : "comment", // multi-line comment regex : "\\/\\*", next : "commentStatement" }, { token : "statementEnd", regex : ";", next : "start" }, { token : "string", regex : "\\$json\\$", next : "json-start" }, { token : "string", regex : "\\$[\\w_0-9]*\\$$", // dollar quote at the end of a line next : "dollarSql" }, { token : "string", regex : "\\$[\\w_0-9]*\\$", next : "dollarStatementString" } ].concat(sqlRules), "dollarSql" : [{ token : "comment", regex : "--.*$" }, { token : "comment", // multi-line comment regex : "\\/\\*", next : "commentDollarSql" }, { token : "string", // end quoting with dollar at the start of a line regex : "^\\$[\\w_0-9]*\\$", next : "statement" }, { token : "string", regex : "\\$[\\w_0-9]*\\$", next : "dollarSqlString" } ].concat(sqlRules), "comment" : [{ token : "comment", // closing comment regex : ".*?\\*\\/", next : "start" }, { token : "comment", // comment spanning whole line regex : ".+" } ], "commentStatement" : [{ token : "comment", // closing comment regex : ".*?\\*\\/", next : "statement" }, { token : "comment", // comment spanning whole line regex : ".+" } ], "commentDollarSql" : [{ token : "comment", // closing comment regex : ".*?\\*\\/", next : "dollarSql" }, { token : "comment", // comment spanning whole line regex : ".+" } ], "dollarStatementString" : [{ token : "string", // closing dollarstring regex : ".*?\\$[\\w_0-9]*\\$", next : "statement" }, { token : "string", // dollarstring spanning whole line regex : ".+" } ], "dollarSqlString" : [{ token : "string", // closing dollarstring regex : ".*?\\$[\\w_0-9]*\\$", next : "dollarSql" }, { token : "string", // dollarstring spanning whole line regex : ".+" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.embedRules(JsonHighlightRules, "json-", [{token : "string", regex : "\\$json\\$", next : "statement"}]); }; oop.inherits(RedshiftHighlightRules, TextHighlightRules); exports.RedshiftHighlightRules = RedshiftHighlightRules; ================================================ FILE: src/mode/rhtml.js ================================================ /* * rhtml.js * * Copyright (C) 2009-11 by RStudio, Inc. * * The Initial Developer of the Original Code is * Ajax.org B.V. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * 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 */ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var RHtmlHighlightRules = require("./rhtml_highlight_rules").RHtmlHighlightRules; /* Make life easier, don't do these right now var SweaveBackgroundHighlighter = require("mode/sweave_background_highlighter").SweaveBackgroundHighlighter; var RCodeModel = require("mode/r_code_model").RCodeModel; */ var Mode = function(doc, session) { HtmlMode.call(this); this.$session = session; this.HighlightRules = RHtmlHighlightRules; /* Or these. this.codeModel = new RCodeModel(doc, this.$tokenizer, /^r-/, /^<!--\s*begin.rcode\s*(.*)/); this.foldingRules = this.codeModel; this.$sweaveBackgroundHighlighter = new SweaveBackgroundHighlighter( session, /^<!--\s*begin.rcode\s*(?:.*)/, /^\s*end.rcode\s*-->/, true); */ }; oop.inherits(Mode, HtmlMode); (function() { this.insertChunkInfo = { value: "<!--begin.rcode\n\nend.rcode-->\n", position: {row: 0, column: 15} }; this.getLanguageMode = function(position) { return this.$session.getState(position.row).match(/^r-/) ? 'R' : 'HTML'; }; /* this.getNextLineIndent = function(state, line, tab, tabSize, row) { return this.codeModel.getNextLineIndent(row, line, state, tab, tabSize); }; */ this.$id = "ace/mode/rhtml"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/rhtml_highlight_rules.js ================================================ /* * rhtml_highlight_rules.js * * Copyright (C) 2009-11 by RStudio, Inc. * * The Initial Developer of the Original Code is * Ajax.org B.V. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * 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 * */ "use strict"; var oop = require("../lib/oop"); var RHighlightRules = require("./r_highlight_rules").RHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var RHtmlHighlightRules = function() { HtmlHighlightRules.call(this); this.$rules["start"].unshift({ token: "support.function.codebegin", regex: "^<" + "!--\\s*begin.rcode\\s*(?:.*)", next: "r-start" }); this.embedRules(RHighlightRules, "r-", [{ token: "support.function.codeend", regex: "^\\s*end.rcode\\s*-->", next: "start" }], ["start"]); this.normalizeRules(); }; oop.inherits(RHtmlHighlightRules, TextHighlightRules); exports.RHtmlHighlightRules = RHtmlHighlightRules; ================================================ FILE: src/mode/robot.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var RobotHighlightRules = require("./robot_highlight_rules").RobotHighlightRules; var FoldMode = require("./folding/pythonic").FoldMode; var Mode = function() { this.HighlightRules = RobotHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$id = "ace/mode/robot"; this.snippetFileId = "ace/snippets/robot"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/robot_highlight_rules.js ================================================ 'use strict'; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var RobotHighlightRules = function() { var builtinConstantsRegex = new RegExp( /\$\{CURDIR\}|\$\{TEMPDIR\}|\$\{EXECDIR\}|\$\{\/\}|\$\{\:\}|\$\{\\n\}|\$\{true\}|\$\{false\}|\$\{none\}|\$\{null\}|\$\{space(?:\s*\*\s+[0-9]+)?\}|\$\{empty\}|&\{empty\}|@\{empty\}|\$\{TEST NAME\}|@\{TEST[\s_]TAGS\}|\$\{TEST[\s_]DOCUMENTATION\}|\$\{TEST[\s_]STATUS\}|\$\{TEST[\s_]MESSAGE\}|\$\{PREV[\s_]TEST[\s_]NAME\}|\$\{PREV[\s_]TEST[\s_]STATUS\}|\$\{PREV[\s_]TEST[\s_]MESSAGE\}|\$\{SUITE[\s_]NAME\}|\$\{SUITE[\s_]SOURCE\}|\$\{SUITE[\s_]DOCUMENTATION\}|&\{SUITE[\s_]METADATA\}|\$\{SUITE[\s_]STATUS\}|\$\{SUITE[\s_]MESSAGE\}|\$\{KEYWORD[\s_]STATUS\}|\$\{KEYWORD[\s_]MESSAGE\}|\$\{LOG[\s_]LEVEL\}|\$\{OUTPUT[\s_]FILE\}|\$\{LOG[\s_]FILE\}|\$\{REPORT[\s_]FILE\}|\$\{DEBUG[\s_]FILE\}|\$\{OUTPUT[\s_]DIR\}/ ); this.$rules = { "start" : [ { token: "string.robot.header", regex: /^\*{3}\s+(?:settings?|metadata|(?:user )?keywords?|test ?cases?|tasks?|variables?)/, caseInsensitive: true, push: [{ token: "string.robot.header", regex: /$/, next: "pop" }, { defaultToken: "string.robot.header" }], comment: "start of a table" }, { token: "comment.robot", regex: /(?:^|\s{2,}|\t|\|\s{1,})(?=[^\\])#/, push: [{ token: "comment.robot", regex: /$/, next: "pop" }, { defaultToken: "comment.robot" }] }, { token: "comment", regex: /^\s*\[?Documentation\]?/, caseInsensitive: true, push: [{ token: "comment", regex: /^(?!\s*\.\.\.)/, next: "pop" }, { defaultToken: "comment" }] }, { token: "storage.type.method.robot", regex: /\[(?:Arguments|Setup|Teardown|Precondition|Postcondition|Template|Return|Timeout)\]/, caseInsensitive: true, comment: "testcase settings" }, { token: "storage.type.method.robot", regex: /\[Tags\]/, caseInsensitive: true, push: [{ token: "storage.type.method.robot", regex: /^(?!\s*\.\.\.)/, next: "pop" }, { token: "comment", regex: /^\s*\.\.\./ }, { defaultToken: "storage.type.method.robot" }], comment: "test tags" }, { token: "constant.language", regex: builtinConstantsRegex, caseInsensitive: true }, { token: "entity.name.variable.wrapper", regex: /[$@&%]\{\{?/, push: [{ token: "entity.name.variable.wrapper", regex: /\}\}?(\s?=)?/, next: "pop" }, { include: "$self" }, { token: "entity.name.variable", regex: /./ }, { defaultToken: "entity.name.variable" }] }, { token: "keyword.control.robot", regex: /^[^\s\t*$|]+|(?=^\|)\s+[^\s\t*$|]+/, push: [{ token: "keyword.control.robot", regex: /(?=\s{2})|\t|$|\s+(?=\|)/, next: "pop" }, { defaultToken: "keyword.control.robot" }] }, { token: "constant.numeric.robot", regex: /\b[0-9]+(?:\.[0-9]+)?\b/ }, { token: "keyword", regex: /\s{2,}(for|in range|in|end|else if|if|else|with name)(\s{2,}|$)/, caseInsensitive: true }, { token: "storage.type.function", regex: /^(?:\s{2,}\s+)[^ \t*$@&%[.|]+/, push: [{ token: "storage.type.function", regex: /(?=\s{2})|\t|$|\s+(?=\|)/, next: "pop" }, { defaultToken: "storage.type.function" }] }] }; this.normalizeRules(); }; RobotHighlightRules.metadata = { fileTypes: ['robot'], name: 'Robot', scopeName: 'source.robot' }; oop.inherits(RobotHighlightRules, TextHighlightRules); exports.RobotHighlightRules = RobotHighlightRules; ================================================ FILE: src/mode/rst.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var RSTHighlightRules = require("./rst_highlight_rules").RSTHighlightRules; var Mode = function() { this.HighlightRules = RSTHighlightRules; }; oop.inherits(Mode, TextMode); (function() { this.type = "text"; this.$id = "ace/mode/rst"; this.snippetFileId = "ace/snippets/rst"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/rst_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var RSTHighlightRules = function() { var tokens = { title: "markup.heading", list: "markup.heading", table: "constant", directive: "keyword.operator", entity: "string", link: "markup.underline.list", bold: "markup.bold", italic: "markup.italic", literal: "support.function", comment: "comment" }; var startStringPrefix = "(^|\\s|[\"'(<\\[{\\-/:])"; var endStringSuffix = "(?:$|(?=\\s|[\\\\.,;!?\\-/:\"')>\\]}]))"; this.$rules = { "start": [ /* NB: Only the underline of the heading is highlighted. * ACE tokenizer does not allow backtracking, the underlined text of the * heading cannot be highlighted. */ { token : tokens.title, regex : "(^)([\\=\\-`:\\.'\"~\\^_\\*\\+#])(\\2{2,}\\s*$)" }, /* Generic directive syntax (e.g. .. code-block:: c) * All of the directive body is highlighted as a code block. */ { token : ["text", tokens.directive, tokens.literal], regex : "(^\\s*\\.\\. )([^: ]+::)(.*$)", next : "codeblock" }, { token : tokens.directive, regex : "::$", next : "codeblock" }, /* Link/anchor definitions */ { token : [tokens.entity, tokens.link], regex : "(^\\.\\. _[^:]+:)(.*$)" }, { token : [tokens.entity, tokens.link], regex : "(^__ )(https?://.*$)" }, /* Footnote definition */ { token : tokens.entity, regex : "^\\.\\. \\[[^\\]]+\\] " }, /* Comment block start */ { token : tokens.comment, regex : "^\\.\\. .*$", next : "comment" }, /* List items */ { token : tokens.list, regex : "^\\s*[\\*\\+-] " }, { token : tokens.list, regex : "^\\s*(?:[A-Za-z]|[0-9]+|[ivxlcdmIVXLCDM]+)\\. " }, { token : tokens.list, regex : "^\\s*\\(?(?:[A-Za-z]|[0-9]+|[ivxlcdmIVXLCDM]+)\\) " }, /* "Simple" tables */ { token : tokens.table, regex : "^={2,}(?: +={2,})+$" }, /* "Grid" tables */ { token : tokens.table, regex : "^\\+-{2,}(?:\\+-{2,})+\\+$" }, { token : tokens.table, regex : "^\\+={2,}(?:\\+={2,})+\\+$" }, /* Inline markup */ { token : ["text", tokens.literal], regex : startStringPrefix + "(``)(?=\\S)", next : "code" }, { token : ["text", tokens.bold], regex : startStringPrefix + "(\\*\\*)(?=\\S)", next : "bold" }, { token : ["text", tokens.italic], regex : startStringPrefix + "(\\*)(?=\\S)", next : "italic" }, /* Substitution reference */ { token : tokens.entity, regex : "\\|[\\w\\-]+?\\|" }, /* Link/footnote references */ { token : tokens.entity, regex : ":[\\w-:]+:`\\S", next : "entity" }, { token : ["text", tokens.entity], regex : startStringPrefix + "(_`)(?=\\S)", next : "entity" }, { token : tokens.entity, regex : "_[A-Za-z0-9\\-]+?" }, { token : ["text", tokens.link], regex : startStringPrefix + "(`)(?=\\S)", next : "link" }, { token : tokens.link, regex : "[A-Za-z0-9\\-]+?__?" }, { token : tokens.link, regex : "\\[[^\\]]+?\\]_" }, { token : tokens.link, regex : "https?://\\S+" }, /* "Grid" tables column separator * This is at the end to make it lower priority over all other rules. */ { token : tokens.table, regex : "\\|" } ], /* This state is used for all directive bodies and literal blocks. * The parser returns to the "start" state when reaching the first * non-empty line that does not start with at least one space. */ "codeblock": [ { token : tokens.literal, regex : "^ +.+$", next : "codeblock" }, { token : tokens.literal, regex : '^$', next: "codeblock" }, { token : "empty", regex : "", next : "start" } ], /* Inline code * The parser returns to the "start" state when reaching "``" */ "code": [ { token : tokens.literal, regex : "\\S``" + endStringSuffix, next : "start" }, { defaultToken: tokens.literal } ], /* Bold (strong) text * The parser returns to the "start" state when reaching "**" */ "bold": [ { token : tokens.bold, regex : "\\S\\*\\*" + endStringSuffix, next : "start" }, { defaultToken: tokens.bold } ], /* Italic (emphasis) text * The parser returns to the "start" state when reaching "*" */ "italic": [ { token : tokens.italic, regex : "\\S\\*" + endStringSuffix, next : "start" }, { defaultToken: tokens.italic } ], /* Explicit role/class text or link anchor definition * The parser returns to the "start" state when reaching "`" */ "entity": [ { token : tokens.entity, regex : "\\S`" + endStringSuffix, next : "start" }, { defaultToken: tokens.entity } ], /* Link reference * The parser returns to the "start" state when reaching "`_" or "`__" */ "link": [ { token : tokens.link, regex : "\\S`__?" + endStringSuffix, next : "start" }, { defaultToken: tokens.link } ], /* Comment block. * The parser returns to the "start" state when reaching the first * non-empty line that does not start with at least one space. */ "comment": [ { token : tokens.comment, regex : "^ +.+$", next : "comment" }, { token : tokens.comment, regex : '^$', next: "comment" }, { token : "empty", regex : "", next : "start" } ] }; }; oop.inherits(RSTHighlightRules, TextHighlightRules); exports.RSTHighlightRules = RSTHighlightRules; ================================================ FILE: src/mode/ruby.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var FoldMode = require("./folding/ruby").FoldMode; var Mode = function() { this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new FoldMode(); this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; 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*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } } return indent; }; this.checkOutdent = function(state, line, input) { return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { var line = session.getLine(row); if (/}/.test(line)) return this.$outdent.autoOutdent(session, row); var indent = this.$getIndent(line); var prevLine = session.getLine(row - 1); var prevIndent = this.$getIndent(prevLine); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) session.remove(new Range(row, indent.length - tab.length, row, indent.length)); } }; this.getMatching = function(session, row, column) { if (row == undefined) { var pos = session.selection.lead; column = pos.column; row = pos.row; } var startToken = session.getTokenAt(row, column); if (startToken && startToken.value in this.indentKeywords) return this.foldingRules.rubyBlock(session, row, column, true); }; this.$id = "ace/mode/ruby"; this.snippetFileId = "ace/snippets/ruby"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/ruby_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; // exports is for Haml var constantOtherSymbol = exports.constantOtherSymbol = { token : "constant.other.symbol.ruby", // symbol regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; var constantNumericHex = exports.constantNumericHex = { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; var constantNumericBinary = exports.constantNumericBinary = { token: "constant.numeric", regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ }; var constantNumericDecimal = exports.constantNumericDecimal = { token: "constant.numeric", regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ }; var constantNumericOctal = exports.constantNumericOctal = { token: "constant.numeric", regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ }; var constantNumericRational = exports.constantNumericRational = { token: "constant.numeric", //rational + complex regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ }; var constantNumericComplex = exports.constantNumericComplex = { token: "constant.numeric", //simple complex numbers regex: /\b([\d]i)\b/ }; var constantNumericFloat = exports.constantNumericFloat = { token : "constant.numeric", // float + complex regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { token : "variable.instance", // instance variable regex : "@{1,2}[a-zA-Z_\\d]+" }; var RubyHighlightRules = function() { var builtinFunctions = ( "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" + "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" + "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" + "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" + "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" + "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" + "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" + "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" + "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" + "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" + "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" + "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" + "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" + "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" + "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" + "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" + "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" + "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" + "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" + "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" + "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" + "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" + "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" + "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" + "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" + "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" + "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" + "$!|root_url|flash|session|cookies|params|request|response|logger|self" ); var keywordMapper = this.$keywords = this.createKeywordMapper({ "keyword": keywords, "constant.language": buildinConstants, "variable.language": builtinVariables, "support.function": builtinFunctions, "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; var closeParen = { "(": ")", "[": "]", "{": "}", "<": ">", "^": "^", "|": "|", "%": "%" }; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start": [ { token: "comment", regex: "#.*$" }, { token: "comment.multiline", // multi line comment regex: "^=begin(?=$|\\s.*$)", next: "comment" }, { token: "string.regexp", regex: /[/](?=.*\/)/, next: "regex" }, [{ token: ["constant.other.symbol.ruby", "string.start"], regex: /(:)?(")/, push: [{ token: "constant.language.escape", regex: escapedChars }, { token: "paren.start", regex: /#{/, push: "start" }, { token: "string.end", regex: /"/, next: "pop" }, { defaultToken: "string" }] }, { token: "string.start", regex: /`/, push: [{ token: "constant.language.escape", regex: escapedChars }, { token: "paren.start", regex: /#{/, push: "start" }, { token: "string.end", regex: /`/, next: "pop" }, { defaultToken: "string" }] }, { token: ["constant.other.symbol.ruby", "string.start"], regex: /(:)?(')/, push: [{ token: "constant.language.escape", regex: /\\['\\]/ }, { token: "string.end", regex: /'/, next: "pop" }, { defaultToken: "string" }] }, { token: "string.start",//doesn't see any differences between strings and array of strings in highlighting regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { if (stack.length) stack = []; var paren = val[val.length - 1]; stack.unshift(paren, state); this.next = "qStateWithoutInterpolation"; return this.token; } }, { token: "string.start", //doesn't see any differences between strings and array of strings in highlighting regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { if (stack.length) stack = []; var paren = val[val.length - 1]; stack.unshift(paren, state); this.next = "qStateWithInterpolation"; return this.token; } }, { token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { if (stack.length) stack = []; var paren = val[val.length - 1]; stack.unshift(paren, state); this.next = "sStateWithoutInterpolation"; return this.token; } }, { token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { if (stack.length) stack = []; var paren = val[val.length - 1]; stack.unshift(paren, state); this.next = "sStateWithInterpolation"; return this.token; } }, { token: "string.regexp", regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { if (stack.length) stack = []; var paren = val[val.length - 1]; stack.unshift(paren, state); this.next = "rState"; return this.token; } }], { token: "punctuation", // namespaces aren't symbols regex: "::" }, instanceVariable, { token: "variable.global", // global variable regex: "[$][a-zA-Z_\\d]+" }, { token: "support.class", // class name regex: "[A-Z][a-zA-Z_\\d]*" }, { token: ["punctuation.operator", "support.function"], regex: /(\.)([a-zA-Z_\d]+)(?=\()/ }, { token: ["punctuation.operator", "identifier"], regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ }, { token: "string.character", regex: "\\B\\?(?:" + escapedChars + "|\\S)" }, { token: "punctuation.operator", regex: /\?(?=.+:)/ }, constantNumericRational, constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, constantNumericBinary, constantNumericDecimal, constantNumericOctal, { token: "constant.language.boolean", regex: "(?:true|false)\\b" }, { token: keywordMapper, regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token: "punctuation.separator.key-value", regex: "=>" }, { stateName: "heredoc", onMatch: function (value, currentState, stack) { var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ {type: "constant", value: tokens[1]}, {type: "string", value: tokens[2]}, {type: "support.class", value: tokens[3]}, {type: "string", value: tokens[4]} ]; }, regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); this.next = stack[0] || "start"; return "support.class"; } this.next = ""; return "string"; }, regex: ".*$", next: "start" }], indentedHeredoc: [{ token: "string", regex: "^ +" }, { onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); this.next = stack[0] || "start"; return "support.class"; } this.next = ""; return "string"; }, regex: ".*$", next: "start" }] } }, { regex: "$", token: "empty", next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } }, { token: "keyword.operator", regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { token: "paren.lparen", regex: "[[({]" }, { token: "paren.rparen", regex: "[\\])}]", onMatch: function(value, currentState, stack) { this.next = ''; if (value == "}" && stack.length > 1 && stack[1] != "start") { stack.shift(); this.next = stack.shift(); } return this.token; } }, { token: "text", regex: "\\s+" }, { token: "punctuation.operator", regex: /[?:,;.]/ } ], "comment": [ { token: "comment.multiline", // closing comment regex: "^=end(?=$|\\s.*$)", next: "start" }, { token: "comment", // comment spanning whole line regex: ".+" } ], "qStateWithInterpolation": [{ token: "string.start",// excluded nested |^% due to difficulty in realization regex: /[(\[<{]/, onMatch: function (val, state, stack) { if (stack.length && val === stack[0]) { stack.unshift(val, state); return this.token; } return "string"; } }, { token: "constant.language.escape", regex: escapedChars }, { token: "constant.language.escape", regex: /\\./ }, { token: "paren.start", regex: /#{/, push: "start" }, { token: "string.end", regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { if (stack.length && val === closeParen[stack[0]]) { stack.shift(); this.next = stack.shift(); return this.token; } this.next = ''; return "string"; } }, { defaultToken: "string" }], "qStateWithoutInterpolation": [{ token: "string.start",// excluded nested |^% due to difficulty in realization regex: /[(\[<{]/, onMatch: function (val, state, stack) { if (stack.length && val === stack[0]) { stack.unshift(val, state); return this.token; } return "string"; } }, { token: "constant.language.escape", regex: /\\['\\]/ }, { token: "constant.language.escape", regex: /\\./ }, { token: "string.end", regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { if (stack.length && val === closeParen[stack[0]]) { stack.shift(); this.next = stack.shift(); return this.token; } this.next = ''; return "string"; } }, { defaultToken: "string" }], "sStateWithoutInterpolation": [{ token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization regex: /[(\[<{]/, onMatch: function (val, state, stack) { if (stack.length && val === stack[0]) { stack.unshift(val, state); return this.token; } return "constant.other.symbol.ruby"; } }, { token: "constant.other.symbol.ruby", regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { if (stack.length && val === closeParen[stack[0]]) { stack.shift(); this.next = stack.shift(); return this.token; } this.next = ''; return "constant.other.symbol.ruby"; } }, { defaultToken: "constant.other.symbol.ruby" }], "sStateWithInterpolation": [{ token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization regex: /[(\[<{]/, onMatch: function (val, state, stack) { if (stack.length && val === stack[0]) { stack.unshift(val, state); return this.token; } return "constant.other.symbol.ruby"; } }, { token: "constant.language.escape", regex: escapedChars }, { token: "constant.language.escape", regex: /\\./ }, { token: "paren.start", regex: /#{/, push: "start" }, { token: "constant.other.symbol.ruby", regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { if (stack.length && val === closeParen[stack[0]]) { stack.shift(); this.next = stack.shift(); return this.token; } this.next = ''; return "constant.other.symbol.ruby"; } }, { defaultToken: "constant.other.symbol.ruby" }], "rState": [{ token: "string.regexp",// excluded nested |^% due to difficulty in realization regex: /[(\[<{]/, onMatch: function (val, state, stack) { if (stack.length && val === stack[0]) { stack.unshift(val, state); return this.token; } return "constant.language.escape"; } }, { token: "paren.start", regex: /#{/, push: "start" }, { token: "string.regexp", regex: /\// }, { token: "string.regexp", regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { if (stack.length && val[0] === closeParen[stack[0]]) { stack.shift(); this.next = stack.shift(); return this.token; } this.next = ''; return "constant.language.escape"; } }, {include: "regex"}, { defaultToken: "string.regexp" }], "regex": [ {// character classes token: "regexp.keyword", regex: /\\[wWdDhHsS]/ }, { token: "constant.language.escape", regex: /\\[AGbBzZ]/ }, { token: "constant.language.escape", regex: /\\g<[a-zA-Z0-9]*>/ }, { token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ }, { token: ["constant.language.escape", "invalid", "constant.language.escape"], regex: /(\\p{\^?)([^/]*)(})/ }, {// escapes token: "regexp.keyword.operator", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" }, {// flag token: "string.regexp", regex: /[/][imxouesn]*/, next: "start" }, {// invalid operators token: "invalid", regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ }, {// operators token: "constant.language.escape", regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ }, { token: "constant.language.delimiter", regex: /\|/ }, { token: "regexp.keyword", regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ }, { token: "constant.language.escape", regex: /\[\^?/, push: "regex_character_class" }, { defaultToken: "string.regexp" } ], "regex_character_class": [ { // character classes token: "regexp.keyword", regex: /\\[wWdDhHsS]/ }, { token: "regexp.charclass.keyword.operator", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" }, { token: "constant.language.escape", regex: /&?&?\[\^?/, push: "regex_character_class" }, { token: "constant.language.escape", regex: "]", next: "pop" }, { token: "constant.language.escape", regex: "-" }, { defaultToken: "string.regexp.characterclass" } ] }; this.normalizeRules(); }; oop.inherits(RubyHighlightRules, TextHighlightRules); exports.RubyHighlightRules = RubyHighlightRules; ================================================ FILE: src/mode/ruby_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var Mode = require("./ruby").Mode; var assert = require("../test/assertions"); module.exports = { setUp: function() { this.mode = new Mode(); }, "test getNextLineIndent": function() { assert.equal(this.mode.getNextLineIndent("start", "class Foo", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " def thing(wut)", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " fork do", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " fork do |wut| ", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " something = :ruby", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " if something == 3", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " else", " "), " "); }, "test: checkOutdent": function() { assert.ok(this.mode.checkOutdent("start", " en", "d")); assert.ok(this.mode.checkOutdent("start", " els", "e")); assert.ok(this.mode.checkOutdent("start", " ", "}")); assert.equal(this.mode.checkOutdent("start", " end", "\n"), false); assert.equal(this.mode.checkOutdent("start", "foo = ba", "r"), false); }, "test: auto outdent": function() { var session = new EditSession([ "class Phil", " Foo = 'bar'", " def to_json(*a)", " {", " 'json_class' => self.class.name, # = 'Range'", " 'data' => [ first, last, exclude_end? ]", " }", " end"]); this.mode.autoOutdent("start", session, 6); assert.equal(" }", session.getLine(6)); this.mode.autoOutdent("start", session, 7); assert.equal(" end", session.getLine(7)); }, "test: different delimiters in percent strings": function() { var tokenizer = this.mode.getTokenizer(); var tokens = tokenizer.getLineTokens("%q<t(es)t>", "start").tokens; assert.equal("string", tokens[1].type); assert.equal("t(es)t", tokens[1].value); tokens = tokenizer.getLineTokens("%q<t(es)t]#comment", "start").tokens; assert.equal("string", tokens[tokens.length - 1].type); assert.equal("t(es)t]#comment", tokens[tokens.length - 1].value); tokens = tokenizer.getLineTokens("%%test 1\\%%%", "start").tokens; assert.equal("string", tokens[1].type); assert.equal("test 1", tokens[1].value); assert.equal("constant.language.escape", tokens[2].type); assert.equal("string.end", tokens[3].type); assert.notEqual("string", tokens[4].type); tokens = tokenizer.getLineTokens("%s|test|", "start").tokens; assert.equal("constant.other.symbol.ruby", tokens[0].type); assert.equal("constant.other.symbol.ruby", tokens[tokens.length - 1].type); tokens = tokenizer.getLineTokens("%S{test}", "start").tokens; assert.equal("constant.other.symbol.ruby", tokens[0].type); assert.equal("constant.other.symbol.ruby", tokens[tokens.length - 1].type); }, "test: nested and unescaped pairs of delimiters": function() { var tokenizer = this.mode.getTokenizer(); var tokens = tokenizer.getLineTokens("%(t(es)t)(", "start").tokens; assert.equal("string.end", tokens[tokens.length - 2].type); assert.equal("paren.lparen", tokens[tokens.length - 1].type); tokens = tokenizer.getLineTokens("%q(t(es)t(", "start").tokens; assert.notEqual("paren.lparen", tokens[tokens.length - 1].type); tokens = tokenizer.getLineTokens("%{tes{t} \\{test\\}}t", "start").tokens; assert.notEqual("string", tokens[tokens.length - 1].type); assert.equal("string.end", tokens[tokens.length - 2].type); assert.equal("constant.language.escape", tokens[tokens.length - 3].type); tokens = tokenizer.getLineTokens("%s[te[s]|t][", "start").tokens; assert.equal("constant.other.symbol.ruby", tokens[tokens.length - 2].type); assert.notEqual("constant.other.symbol.ruby", tokens[tokens.length - 1].type); tokens = tokenizer.getLineTokens("%s[te[s]|t[", "start").tokens; assert.equal("constant.other.symbol.ruby", tokens[tokens.length - 1].type); assert.equal(1, tokens.length); tokens = tokenizer.getLineTokens("%S[te[s]|t][", "start").tokens; assert.equal("constant.other.symbol.ruby", tokens[tokens.length - 2].type); assert.notEqual("constant.other.symbol.ruby", tokens[tokens.length - 1].type); tokens = tokenizer.getLineTokens("%S[te[s]|t[", "start").tokens; assert.equal("constant.other.symbol.ruby", tokens[tokens.length - 1].type); assert.equal(1, tokens.length); }, "test: percent Regexp strings": function() { var tokenizer = this.mode.getTokenizer(); //percent regexp strings supports interpolation var tokens = tokenizer.getLineTokens("%r(#{ \"interpolated\" } regexp)", "start").tokens; assert.equal("string.regexp", tokens[0].type); assert.equal("paren.start", tokens[1].type); assert.equal("paren.rparen", tokens[tokens.length - 2].type); assert.equal("string.regexp", tokens[tokens.length - 1].type); //bad code style, but we should support this one tokens = tokenizer.getLineTokens("%r((a|b)*)#comment", "start").tokens; assert.equal("string.regexp", tokens[0].type); assert.notEqual("string.regexp", tokens[tokens.length - 1].type); }, "test: uppercase letter in percent strings should allow interpolation and escaped characters": function() { var tokenizer = this.mode.getTokenizer(); var tokens = tokenizer.getLineTokens("%Q(interpolated string #{1 + 1})", "start").tokens; assert.equal("string.end", tokens[tokens.length - 1].type); assert.equal("string.start", tokens[0].type); assert.equal("paren.start", tokens[2].type); assert.notEqual("string", tokens[3].type); assert.equal("1", tokens[3].value); tokens = tokenizer.getLineTokens("%q(interpolated string #{1 + 1})", "start").tokens; assert.equal("string.end", tokens[tokens.length - 1].type); assert.equal("string.start", tokens[0].type); assert.equal("string", tokens[1].type); assert.equal("interpolated string #{1 + 1}", tokens[1].value); }, "test: different Heredoc tests": function() { var tokenizer = this.mode.getTokenizer(); var firstLine = tokenizer.getLineTokens("herDocs = [<<'FOO', <<BAR, <<-BAZ, <<~`EXEC`] #comment", "start"); assert.equal(8, firstLine.state.length); var nextLine = tokenizer.getLineTokens(" FOO #{literal}", firstLine.state);//this line shouldn't close FOO heredoc due to indentation assert.equal("string", nextLine.tokens[0].type); assert.equal(8, nextLine.state.length); nextLine = tokenizer.getLineTokens("FOO", nextLine.state); assert.equal("support.class", nextLine.tokens[0].type); assert.equal(6, nextLine.state.length); nextLine = tokenizer.getLineTokens(" BAR", nextLine.state);//not closing BAR heredoc due to indentation assert.equal("string", nextLine.tokens[0].type); assert.equal(6, nextLine.state.length); nextLine = tokenizer.getLineTokens("BAR", nextLine.state); assert.equal("support.class", nextLine.tokens[0].type); assert.equal(4, nextLine.state.length); nextLine = tokenizer.getLineTokens(" BAZ indented", nextLine.state); assert.equal("string", nextLine.tokens[0].type); assert.equal(4, nextLine.state.length); nextLine = tokenizer.getLineTokens(" BAZ", nextLine.state); assert.equal("support.class", nextLine.tokens[1].type); assert.equal(2, nextLine.state.length); nextLine = tokenizer.getLineTokens(" echo hi", nextLine.state); assert.equal("string", nextLine.tokens[0].type); assert.equal(2, nextLine.state.length); nextLine = tokenizer.getLineTokens(" EXEC", nextLine.state); assert.equal("support.class", nextLine.tokens[1].type); assert.equal("start", nextLine.state); } }; require("../test/run")(module); ================================================ FILE: src/mode/rust.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var RustHighlightRules = require("./rust_highlight_rules").RustHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = RustHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/", nestable: true}; this.$quotes = { '"': '"' }; this.$id = "ace/mode/rust"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/rust_highlight_rules.js ================================================ /* This file was autogenerated from https://raw.github.com/dbp/sublime-rust/master/Rust.tmLanguage (uuid: ) */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var stringEscape = /\\(?:[nrt0'"\\]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\})/.source; var wordPattern = /[a-zA-Z_\xa1-\uffff][a-zA-Z0-9_\xa1-\uffff]*/.source; var RustHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var keywordMapper = this.createKeywordMapper({ "keyword.source.rust": "abstract|alignof|as|async|await|become|box|break|catch|continue|const|crate|" + "default|do|dyn|else|enum|extern|for|final|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|" + "override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|union|" + "unsafe|unsized|use|virtual|where|while|yield|try", "storage.type.source.rust": "Self|isize|usize|char|bool|u8|u16|u32|u64|u128|f16|f32|f64|i8|i16|i32|i64|" + "i128|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|" + "c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|" + "uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t", "constant.language.source.rust": "true|false|Some|None|Ok|Err|FALSE|TRUE", "support.constant.source.rust": "EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|" + "_IONBF|_IOLBF|" + "BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|" + "S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|" + "F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO", "constant.language": "macro_rules|mac_variant" }, "identifier"); this.$rules = { start: [ { token: 'variable.other.source.rust', // `(?![\\\'])` to keep a lifetime name highlighting from continuing one character // past the name. The end `\'` will block this from matching for a character like // `'a'` (it should have character highlighting, not variable highlighting). regex: '\'' + wordPattern + '(?![\\\'])' }, { token: 'string.quoted.single.source.rust', regex: "'(?:[^'\\\\]|" + stringEscape + ")'" }, { token: 'identifier', regex: "r#" + wordPattern + "\\b" }, { stateName: "bracketedComment", onMatch: function (value, currentState, stack) { var stringStart = value.replace(/^\w+/, ""); stack.unshift(this.next, stringStart.length, currentState); return "string.quoted.raw.source.rust"; }, regex: /(b|c)?r#*"/, next: [ { onMatch: function (value, currentState, stack) { var token = "string.quoted.raw.source.rust"; if (value.length >= stack[1]) { if (value.length > stack[1]) token = "invalid"; stack.shift(); stack.shift(); this.next = stack.shift(); } else { this.next = ""; } return token; }, regex: /"#*/, next: "start" }, { defaultToken: "string.quoted.raw.source.rust" } ] }, { token: 'string.quoted.double.source.rust', regex: '"', push: [ { token: 'string.quoted.double.source.rust', regex: '"', next: 'pop' }, { token: 'constant.character.escape.source.rust', regex: stringEscape }, {defaultToken: 'string.quoted.double.source.rust'} ] }, { token: ['keyword.source.rust', 'text', 'entity.name.function.source.rust', 'punctuation'], regex: '\\b(fn)(\\s+)((?:r#)?' + wordPattern + ')(<)(?!<)', push: "generics" }, { token: ['keyword.source.rust', 'text', 'entity.name.function.source.rust'], regex: '\\b(fn)(\\s+)((?:r#)?' + wordPattern + ')' }, { token: ['support.constant', "punctuation"], regex: "(" + wordPattern + '::)(<)(?!<)', push: "generics" }, { token: 'support.constant', regex: wordPattern + '::' }, { token: 'variable.language.source.rust', regex: '\\bself\\b' }, DocCommentHighlightRules.getStartRule("doc-start"), { token: 'comment.line.doc.source.rust', regex: '///.*$' }, { token: 'comment.line.doc.source.rust', regex: '//!.*$' }, { token: 'comment.line.double-dash.source.rust', regex: '//.*$' }, { token: 'comment.start.block.source.rust', regex: '/\\*', stateName: 'comment', push: [ { token: 'comment.start.block.source.rust', regex: '/\\*', push: 'comment' }, { token: 'comment.end.block.source.rust', regex: '\\*/', next: 'pop' }, {defaultToken: 'comment.block.source.rust'} ] }, { token: ["keyword.source.rust", "identifier", "punctuaction"], regex: "(?:(impl)|(" + wordPattern + "))(<)(?!<)", stateName: 'generics', push: [ { token: 'keyword.operator', regex: /<<|=/ }, { token: "punctuaction", regex: "<(?!<)", push: "generics" }, { token: 'variable.other.source.rust', // `(?![\\\'])` to keep a lifetime name highlighting from continuing one character // past the name. The end `\'` will block this from matching for a character like // `'a'` (it should have character highlighting, not variable highlighting). regex: '\'' + wordPattern + '(?![\\\'])' }, { token: "storage.type.source.rust", regex: "\\b(u8|u16|u32|u64|u128|usize|i8|i16|i32|i64|i128|isize|char|bool)\\b" }, { token: "keyword", regex: "\\b(?:const|dyn)\\b" }, { token: "punctuation", regex: ">", next: "pop" }, {include: "punctuation"}, {include: "operators"}, {include: "constants"}, { token: "identifier", regex: "\\b"+wordPattern+"\\b" } ] }, { token: keywordMapper, regex: wordPattern }, { token: 'meta.preprocessor.source.rust', regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b' }, {include: "punctuation"}, {include: "operators"}, {include: "constants"} ], punctuation: [ { token: "paren.lparen", regex: /[\[({]/ }, { token: "paren.rparen", regex: /[\])}]/ }, { token: "punctuation.operator", regex: /[?:,;.]/ } ], operators: [ { token: 'keyword.operator', // `[*/](?![*/])=?` is separated because `//` and `/* */` become comments and must be // guarded against. This states either `*` or `/` may be matched as long as the match // it isn't followed by either of the two. An `=` may be on the end. regex: /\$|[-=]>|[-+%^=!&|<>]=?|[*/](?![*/])=?/ } ], constants: [ { token: 'constant.numeric.source.rust', regex: /\b(?:0x[a-fA-F0-9_]+|0o[0-7_]+|0b[01_]+|[0-9][0-9_]*(?!\.))(?:[iu](?:size|8|16|32|64|128))?\b/ }, { token: 'constant.numeric.source.rust', regex: /\b(?:[0-9][0-9_]*)(?:\.[0-9][0-9_]*)?(?:[Ee][+-][0-9][0-9_]*)?(?:f32|f64)?\b/ } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.normalizeRules(); }; RustHighlightRules.metaData = { fileTypes: [ 'rs', 'rc' ], foldingStartMarker: '^.*\\bfn\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$', foldingStopMarker: '^\\s*\\}', name: 'Rust', scopeName: 'source.rust' }; oop.inherits(RustHighlightRules, TextHighlightRules); exports.RustHighlightRules = RustHighlightRules; ================================================ FILE: src/mode/sac.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SaCHighlightRules = require("./sac_highlight_rules").sacHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = SaCHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/sac"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/sac_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var sacHighlightRules = function() { var keywordControls = ( "break|continue|do|else|for|if|" + "return|with|while|use|class|all|void" ); var storageType = ( "bool|char|complex|double|float|" + "byte|int|short|long|longlong|" + "ubyte|uint|ushort|ulong|ulonglong|" + "struct|typedef" ); var storageModifiers = ( "inline|external|specialize" ); var keywordOperators = ( "step|width" ); var builtinConstants = ( "true|false" ); var keywordMapper = this.$keywords = this.createKeywordMapper({ "keyword.control" : keywordControls, "storage.type" : storageType, "storage.modifier" : storageModifiers, "keyword.operator" : keywordOperators, "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", regex : "fold|foldfix|genarray|modarray|propagate" }, { 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(sacHighlightRules, TextHighlightRules); exports.sacHighlightRules = sacHighlightRules; ================================================ FILE: src/mode/sass.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SassHighlightRules = require("./sass_highlight_rules").SassHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = SassHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/sass"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/sass_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules; var SassHighlightRules = function() { ScssHighlightRules.call(this); var start = this.$rules.start; if (start[1].token == "comment") { start.splice(1, 1, { onMatch: function(value, currentState, stack) { stack.unshift(this.next, -1, value.length - 2, currentState); return "comment"; }, regex: /^\s*\/\*/, next: "comment" }, { token: "error.invalid", regex: "/\\*|[{;}]" }, { token: "support.type", regex: /^\s*:[\w\-]+\s/ }); this.$rules.comment = [ {regex: /^\s*/, onMatch: function(value, currentState, stack) { if (stack[1] === -1) stack[1] = Math.max(stack[2], value.length - 1); if (value.length <= stack[1]) { /*shift3x*/stack.shift();stack.shift();stack.shift(); this.next = stack.shift(); return "text"; } else { this.next = ""; return "comment"; } }, next: "start"}, {defaultToken: "comment"} ]; } }; oop.inherits(SassHighlightRules, ScssHighlightRules); exports.SassHighlightRules = SassHighlightRules; ================================================ FILE: src/mode/scad.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var scadHighlightRules = require("./scad_highlight_rules").scadHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = scadHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; 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/scad"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/scad_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var scadHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": "module|if|else|for", "constant.language": "NULL" }, "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("start"), { token : "comment", // multi line comment regex : "\\/\\*", next : "comment" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // multi line string start regex : '["].*\\\\$', next : "qqstring" }, { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "string", // multi line string start regex : "['].*\\\\$", next : "qstring" }, { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F]+\\b" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : "constant", // <CONSTANT> regex : "<[a-zA-Z0-9.]+>" }, { token : "keyword", // pre-compiler directivs regex : "(?:use|include)" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "qqstring" : [ { token : "string", regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', next : "start" }, { token : "string", regex : '.+' } ], "qstring" : [ { token : "string", regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next : "start" }, { token : "string", regex : '.+' } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; oop.inherits(scadHighlightRules, TextHighlightRules); exports.scadHighlightRules = scadHighlightRules; ================================================ FILE: src/mode/scala.js ================================================ "use strict"; var oop = require("../lib/oop"); var JavaScriptMode = require("./javascript").Mode; var ScalaHighlightRules = require("./scala_highlight_rules").ScalaHighlightRules; var Mode = function() { JavaScriptMode.call(this); this.HighlightRules = ScalaHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, JavaScriptMode); (function() { this.createWorker = function(session) { return null; }; this.$id = "ace/mode/scala"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/scala_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ScalaHighlightRules = function() { var keywords = ( "case|default|do|else|for|if|match|while|throw|return|try|trye|catch|finally|yield|" + "abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|null|" + "override|package|private|protected|sealed|super|this|trait|type|val|var|with|" + "assert|assume|require|print|println|printf|readLine|readBoolean|readByte|readShort|" + // package scala "readChar|readInt|readLong|readFloat|readDouble" // package scala ); var buildinConstants = ("true|false"); var langClasses = ( "AbstractMethodError|AssertionError|ClassCircularityError|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ExceptionInInitializerError|IllegalAccessError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+ "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+ "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+ "SuppressWarnings|TypeNotPresentException|UnknownError|"+ "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+ "InstantiationException|IndexOutOfBoundsException|"+ "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+ "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+ "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+ "InterruptedException|NoSuchMethodException|IllegalAccessException|"+ "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+ "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+ "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+ "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+ "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+ "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+ "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+ "ArrayStoreException|ClassCastException|LinkageError|"+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ "Cloneable|Class|CharSequence|Comparable|String|Object|" + "Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|" + "Option|Array|Char|Byte|Int|Long|Nothing|" + "App|Application|BufferedIterator|BigDecimal|BigInt|Console|Either|" + "Enumeration|Equiv|Fractional|Function|IndexedSeq|Integral|Iterator|" + "Map|Numeric|Nil|NotNull|Ordered|Ordering|PartialFunction|PartialOrdering|" + "Product|Proxy|Range|Responder|Seq|Serializable|Set|Specializable|Stream|" + "StringContext|Symbol|Traversable|TraversableOnce|Tuple|Vector|Pair|Triple" ); var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": keywords, "support.function": langClasses, "constant.language": buildinConstants }, "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.regexp", regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" }, { token : "string", regex : '"""', next : "tstring" }, { token : "string", regex : '"(?=.)', // " strings can't span multiple lines next : "string" }, { token : "symbol.constant", // single line regex : "'[\\w\\d_]+" }, { 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, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "string" : [ { token : "escape", regex : '\\\\"' }, { token : "string", regex : '"', next : "start" }, { token : "string.invalid", regex : '[^"\\\\]*$', next : "start" }, { token : "string", regex : '[^"\\\\]+' } ], "tstring" : [ { token : "string", regex : '"{3,5}', next : "start" }, { defaultToken : "string" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; oop.inherits(ScalaHighlightRules, TextHighlightRules); exports.ScalaHighlightRules = ScalaHighlightRules; ================================================ FILE: src/mode/scheme.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules; var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent; var Mode = function() { this.HighlightRules = SchemeHighlightRules; this.$outdent = new MatchingParensOutdent(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.minorIndentFunctions = ["define", "lambda", "define-macro", "define-syntax", "syntax-rules", "define-record-type", "define-structure"]; 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/scheme"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/scheme_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SchemeHighlightRules = function() { var keywordControl = "case|do|let|loop|if|else|when"; var keywordOperator = "eq?|eqv?|equal?|and|or|not|null?"; var constantLanguage = "#t|#f"; var supportFunctions = "cons|car|cdr|cond|lambda|lambda*|syntax-rules|format|set!|quote|eval|append|list|list?|member?|load"; var keywordMapper = this.createKeywordMapper({ "keyword.control": keywordControl, "keyword.operator": keywordOperator, "constant.language": constantLanguage, "support.function": supportFunctions }, "identifier", true); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start": [ { token : "comment", regex : ";.*$" }, { "token": ["storage.type.function-type.scheme", "text", "entity.name.function.scheme"], "regex": "(?:\\b(?:(define|define-syntax|define-macro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)" }, { "token": "punctuation.definition.constant.character.scheme", "regex": "#:\\S+" }, { "token": ["punctuation.definition.variable.scheme", "variable.other.global.scheme", "punctuation.definition.variable.scheme"], "regex": "(\\*)(\\S*)(\\*)" }, { "token" : "constant.numeric", // hex "regex" : "#[xXoObB][0-9a-fA-F]+" }, { "token" : "constant.numeric", // float "regex" : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?" }, { "token" : keywordMapper, "regex" : "[a-zA-Z_#][a-zA-Z0-9_\\-\\?\\!\\*]*" }, { "token" : "string", "regex" : '"(?=.)', "next" : "qqstring" } ], "qqstring": [ { "token": "constant.character.escape.scheme", "regex": "\\\\." }, { "token" : "string", "regex" : '[^"\\\\]+', "merge" : true }, { "token" : "string", "regex" : "\\\\$", "next" : "qqstring", "merge" : true }, { "token" : "string", "regex" : '"|$', "next" : "start", "merge" : true } ] }; }; oop.inherits(SchemeHighlightRules, TextHighlightRules); exports.SchemeHighlightRules = SchemeHighlightRules; ================================================ FILE: src/mode/scrypt.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var scryptHighlightRules = require("./scrypt_highlight_rules").scryptHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { this.HighlightRules = scryptHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function () { this.lineCommentStart = "//"; this.blockComment = { start: "/*", end: "*/" }; this.$quotes = { '"': '"', "'": "'" }; this.createWorker = function (session) { return null; }; this.$id = "ace/mode/scrypt"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/scrypt_highlight_rules.js ================================================ /* This file was autogenerated from ./tmthemes/tmscrypt.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var scryptHighlightRules = function () { var keywords = ( "contract|library|loop|new|private|" + "public|if|else|struct|type|" + "require|static|const|import|exit|return|asm" ); var buildinConstants = ("true|false"); var langClasses = ( "function|auto|constructor|bytes|int|bool|SigHashPreimage|PrivKey|PubKey|Sig|Ripemd160|Sha1|Sha256|" + "SigHashType|SigHashPreimage|OpCodeType" ); var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": keywords, "constant.language": buildinConstants, "support.function": langClasses }, "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", // single line regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token: "string", // single line regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token: "constant.numeric", // hex regex: /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/ }, { token: "constant.numeric", // float regex: /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/ }, { token: "constant.language.boolean", regex: "(?:true|false)\\b" }, { token: ["support.function.math.scrypt", "text", "text"], regex: /\b(abs|min|max|within|ripemd160|sha1|sha256|hash160|hash256|checkSig|checkMultiSig|num2bin|pack|unpack|len|reverseBytes|repeat)(\s*)(\()/ }, { token: [ "entity.name.type.scrypt", "text", "text", "text", "variable.object.property.scrypt" ], regex: /\b(SigHash)(\s*)(\.)(\s*)(ANYONECANPAY|ALL|FORKID|NONE|SINGLE)\b/ }, { token: [ "entity.name.type.scrypt", "text", "text", "text", "variable.object.property.scrypt" ], regex: /\b(OpCode)(\s*)(\.)(\s*)(OP_PUSHDATA1|OP_PUSHDATA2|OP_PUSHDATA4|OP_0|OP_FALSE|OP_1NEGATE|OP_1|OP_TRUE|OP_2|OP_3|OP_4|OP_5|OP_6|OP_7|OP_8|OP_9|OP_10|OP_11|OP_12|OP_13|OP_14|OP_15|OP_16|OP_1ADD|OP_1SUB|OP_NEGATE|OP_ABS|OP_NOT|OP_0NOTEQUAL|OP_ADD|OP_SUB|OP_MUL|OP_DIV|OP_MOD|OP_LSHIFT|OP_RSHIFT|OP_BOOLAND|OP_BOOLOR|OP_NUMEQUAL|OP_NUMEQUALVERIFY|OP_NUMNOTEQUAL|OP_LESSTHAN|OP_GREATERTHAN|OP_LESSTHANOREQUAL|OP_GREATERTHANOREQUAL|OP_MIN|OP_MAX|OP_WITHIN|OP_CAT|OP_SPLIT|OP_BIN2NUM|OP_NUM2BIN|OP_SIZE|OP_NOP|OP_IF|OP_NOTIF|OP_ELSE|OP_ENDIF|OP_VERIFY|OP_RETURN|OP_TOALTSTACK|OP_FROMALTSTACK|OP_IFDUP|OP_DEPTH|OP_DROP|OP_DUP|OP_NIP|OP_OVER|OP_PICK|OP_ROLL|OP_ROT|OP_SWAP|OP_TUCK|OP_2DROP|OP_2DUP|OP_3DUP|OP_2OVER|OP_2ROT|OP_2SWAP|OP_RIPEMD160|OP_SHA1|OP_SHA256|OP_HASH160|OP_HASH256|OP_CODESEPARATOR|OP_CHECKSIG|OP_CHECKSIGVERIFY|OP_CHECKMULTISIG|OP_CHECKMULTISIGVERIFY|OP_INVERT|OP_AND|OP_OR|OP_XOR|OP_EQUAL|OP_EQUALVERIFY)\b/ }, { token: "entity.name.type.scrypt", regex: /\b(?:P2PKH|P2PK|Tx|HashPuzzleRipemd160|HashPuzzleSha1|HashPuzzleSha256|HashPuzzleHash160|OpCode|SigHash)\b/ }, { token: [ "punctuation.separator.period.scrypt", 'text', "entity.name.function.scrypt", "text", "punctuation.definition.parameters.begin.bracket.round.scrypt" ], regex: /(\.)([^\S$\r]*)([\w][\w\d]*)(\s*)(\()/, push: [{ token: "punctuation.definition.parameters.end.bracket.round.scrypt", regex: /\)/, next: "pop" }, { defaultToken: "start" }] }, { token: keywordMapper, regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token: "keyword.operator", regex: "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=" }, { token: "lparen", regex: "[[({]" }, { token: "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(scryptHighlightRules, TextHighlightRules); exports.scryptHighlightRules = scryptHighlightRules; ================================================ FILE: src/mode/scss.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CssBehaviour = require("./behaviour/css").CssBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var CssCompletions = require("./css_completions").CssCompletions; var Mode = function() { this.HighlightRules = ScssHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CssBehaviour(); this.$completer = new CssCompletions(); 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); // ignore braces in comments var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } 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.getCompletions = function(state, session, pos, prefix) { return this.$completer.getCompletions(state, session, pos, prefix); }; this.$id = "ace/mode/scss"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/scss_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CssHighlightRules = require("./css_highlight_rules"); var ScssHighlightRules = function() { var properties = lang.arrayToMap(CssHighlightRules.supportType.split("|")); var functions = lang.arrayToMap( ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" + "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" + "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" + "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" + "scale_color|transparentize|type_of|unit|unitless|unquote").split("|") ); var constants = lang.arrayToMap(CssHighlightRules.supportConstant.split("|")); var colors = lang.arrayToMap(CssHighlightRules.supportConstantColor.split("|")); var keywords = lang.arrayToMap( ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|") ); var tags = lang.arrayToMap( ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" + "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" + "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" + "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" + "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" + "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" + "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" + "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" + "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|") ); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : "\\/\\/.*$" }, { token : "comment", // multi line comment regex : "\\/\\*", next : "comment" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // multi line string start regex : '["].*\\\\$', next : "qqstring" }, { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "string", // multi line string start regex : "['].*\\\\$", next : "qstring" }, { token : "constant.numeric", regex : numRe + "(?:ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)" }, { token : "constant.numeric", // hex6 color regex : "#[a-f0-9]{6}" }, { token : "constant.numeric", // hex3 color regex : "#[a-f0-9]{3}" }, { token : "constant.numeric", regex : numRe }, { token : ["support.function", "string", "support.function"], regex : "(url\\()(.*)(\\))" }, { token : function(value) { if (properties.hasOwnProperty(value.toLowerCase())) return "support.type"; if (keywords.hasOwnProperty(value)) return "keyword"; else if (constants.hasOwnProperty(value)) return "constant.language"; else if (functions.hasOwnProperty(value)) return "support.function"; else if (colors.hasOwnProperty(value.toLowerCase())) return "support.constant.color"; else if (tags.hasOwnProperty(value.toLowerCase())) return "variable.language"; else return "text"; }, regex : "\\-?[@a-z_][@a-z0-9_\\-]*" }, { token : "variable", regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b" }, { token: "variable.language", regex: "#[a-z0-9-_]+" }, { token: "variable.language", regex: "\\.[a-z0-9-_]+" }, { token: "variable.language", regex: ":[a-z0-9-_]+" }, { token: "constant", regex: "[a-z0-9-_]+" }, { token : "keyword.operator", regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" }, { caseInsensitive: true } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "qqstring" : [ { token : "string", regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', next : "start" }, { token : "string", regex : '.+' } ], "qstring" : [ { token : "string", regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next : "start" }, { token : "string", regex : '.+' } ] }; }; oop.inherits(ScssHighlightRules, TextHighlightRules); exports.ScssHighlightRules = ScssHighlightRules; ================================================ FILE: src/mode/sh.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules; var Range = require("../range").Range; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = ShHighlightRules; this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; 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; }; var outdents = { "pass": 1, "return": 1, "raise": 1, "break": 1, "continue": 1 }; this.checkOutdent = function(state, line, input) { if (input !== "\r\n" && input !== "\r" && input !== "\n") return false; var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens) return false; // ignore trailing comments do { var last = tokens.pop(); } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/)))); if (!last) return false; return (last.type == "keyword" && outdents[last.value]); }; this.autoOutdent = function(state, doc, row) { // outdenting in sh is slightly different because it always applies // to the next line and only of a new line is inserted row += 1; var indent = this.$getIndent(doc.getLine(row)); var tab = doc.getTabString(); if (indent.slice(-tab.length) == tab) doc.remove(new Range(row, indent.length-tab.length, row, indent.length)); }; this.$id = "ace/mode/sh"; this.snippetFileId = "ace/snippets/sh"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/sh_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var reservedKeywords = exports.reservedKeywords = ( '!|{|}|case|do|done|elif|else|'+ 'esac|fi|for|if|in|then|until|while|'+ '&|;|export|local|read|typeset|unset|'+ 'elif|select|set|function|declare|readonly' ); var languageConstructs = exports.languageConstructs = ( '[|]|alias|bg|bind|break|builtin|'+ 'cd|command|compgen|complete|continue|'+ 'dirs|disown|echo|enable|eval|exec|'+ 'exit|fc|fg|getopts|hash|help|history|'+ 'jobs|kill|let|logout|popd|printf|pushd|'+ 'pwd|return|set|shift|shopt|source|'+ 'suspend|test|times|trap|type|ulimit|'+ 'umask|unalias|wait' ); var ShHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "keyword": reservedKeywords, "support.function.builtin": languageConstructs, "invalid.deprecated": "debugger" }, "identifier"); var integer = "(?:(?:[1-9]\\d*)|(?:0))"; // var integer = "(?:" + decimalInteger + ")"; var fraction = "(?:\\.\\d+)"; var intPart = "(?:\\d+)"; var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")"; var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; var fileDescriptor = "(?:&" + intPart + ")"; var variableName = "[a-zA-Z_][a-zA-Z0-9_]*"; var variable = "(?:" + variableName + "(?==))"; var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))"; var func = "(?:" + variableName + "\\s*\\(\\))"; this.$rules = { "start" : [{ token : "constant", regex : /\\./ }, { token : ["text", "comment"], regex : /(^|\s)(#.*)$/ }, { token : "string.start", regex : '"', push : [{ token : "constant.language.escape", regex : /\\(?:[$`"\\]|$)/ }, { include : "variables" }, { token : "keyword.operator", regex : /`/ // TODO highlight ` }, { token : "string.end", regex : '"', next: "pop" }, { defaultToken: "string" }] }, { token : "string", regex : "\\$'", push : [{ token : "constant.language.escape", regex : /\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/ }, { token : "string", regex : "'", next: "pop" }, { defaultToken: "string" }] }, { regex : "<<<", token : "keyword.operator" }, { stateName: "heredoc", regex : "(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)", onMatch : function(value, currentState, stack) { var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[4]); return [ {type:"constant", value: tokens[1]}, {type:"text", value: tokens[2]}, {type:"string", value: tokens[3]}, {type:"support.class", value: tokens[4]}, {type:"string", value: tokens[5]} ]; }, rules: { heredoc: [{ onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); this.next = stack[0] || "start"; return "support.class"; } this.next = ""; return "string"; }, regex: ".*$", next: "start" }], indentedHeredoc: [{ token: "string", regex: "^\t+" }, { onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); this.next = stack[0] || "start"; return "support.class"; } this.next = ""; return "string"; }, regex: ".*$", next: "start" }] } }, { regex : "$", token : "empty", next : function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } }, { token : ["keyword", "text", "text", "text", "variable"], regex : /(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/ }, { token : "variable.language", regex : builtinVariable }, { token : "variable", regex : variable }, { include : "variables" }, { token : "support.function", regex : func }, { token : "support.function", regex : fileDescriptor }, { token : "string", // ' string start : "'", end : "'" }, { token : "constant.numeric", // float regex : floatNumber }, { token : "constant.numeric", // integer regex : integer + "\\b" }, { token : keywordMapper, regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b" }, { token : "keyword.operator", regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]" }, { token : "punctuation.operator", regex : ";" }, { token : "paren.lparen", regex : "[\\[\\(\\{]" }, { token : "paren.rparen", regex : "[\\]]" }, { token : "paren.rparen", regex : "[\\)\\}]", next : "pop" }], variables: [{ token : "variable", regex : /(\$)(\w+)/ }, { token : ["variable", "paren.lparen"], regex : /(\$)(\()/, push : "start" }, { token : ["variable", "paren.lparen", "keyword.operator", "variable", "keyword.operator"], regex : /(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/, push : "start" }, { token : "variable", regex : /\$[*@#?\-$!0_]/ }, { token : ["variable", "paren.lparen"], regex : /(\$)(\{)/, push : "start" }] }; this.normalizeRules(); }; oop.inherits(ShHighlightRules, TextHighlightRules); exports.ShHighlightRules = ShHighlightRules; ================================================ FILE: src/mode/sjs.js ================================================ "use strict"; var oop = require("../lib/oop"); var JSMode = require("./javascript").Mode; var SJSHighlightRules = require("./sjs_highlight_rules").SJSHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = SJSHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, JSMode); (function() { // disable jshint this.createWorker = function(session) { return null; }; this.$id = "ace/mode/sjs"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/sjs_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SJSHighlightRules = function() { var parent = new JavaScriptHighlightRules({noES6: true}); var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex "u[0-9a-fA-F]{4}|" + // unicode "[0-2][0-7]{0,2}|" + // oct "3[0-6][0-7]?|" + // oct "37[0-7]?|" + // oct "[4-7][0-7]?|" + //oct ".)"; var contextAware = function(f) { f.isContextAware = true; return f; }; var ctxBegin = function(opts) { return { token: opts.token, regex: opts.regex, next: contextAware(function(currentState, stack) { if (stack.length === 0) stack.unshift(currentState); stack.unshift(opts.next); return opts.next; }) }; }; var ctxEnd = function(opts) { return { token: opts.token, regex: opts.regex, next: contextAware(function(currentState, stack) { stack.shift(); return stack[0] || "start"; }) }; }; this.$rules = parent.$rules; this.$rules.no_regex = [ { token: "keyword", regex: "(waitfor|or|and|collapse|spawn|retract)\\b" }, { token: "keyword.operator", regex: "(->|=>|\\.\\.)" }, { token: "variable.language", regex: "(hold|default)\\b" }, ctxBegin({ token: "string", regex: "`", next: "bstring" }), ctxBegin({ token: "string", regex: '"', next: "qqstring" }), ctxBegin({ token: "string", regex: '"', next: "qqstring" }), { token: ["paren.lparen", "text", "paren.rparen"], regex: "(\\{)(\\s*)(\\|)", next: "block_arguments" } ].concat(this.$rules.no_regex); this.$rules.block_arguments = [ { token: "paren.rparen", regex: "\\|", next: "no_regex" } ].concat(this.$rules.function_arguments); this.$rules.bstring = [ { token : "constant.language.escape", regex : escapedRe }, { token : "string", regex : "\\\\$", next: "bstring" }, ctxBegin({ token : "paren.lparen", regex : "\\$\\{", next: "string_interp" }), ctxBegin({ token : "paren.lparen", regex : "\\$", next: "bstring_interp_single" }), ctxEnd({ token : "string", regex : "`" }), { defaultToken: "string" } ]; this.$rules.qqstring = [ { token : "constant.language.escape", regex : escapedRe }, { token : "string", regex : "\\\\$", next: "qqstring" }, ctxBegin({ token : "paren.lparen", regex : "#\\{", next: "string_interp" }), ctxEnd({ token : "string", regex : '"' }), { defaultToken: "string" } ]; // collect all context-aware (or stateless), brace-less // states. This gives us most normal highlighting // for use within interpreted contexts // without interfering with context nesting var embeddableRules = []; for (var i=0; i < this.$rules.no_regex.length; i++) { var rule = this.$rules.no_regex[i]; var token = String(rule.token); if (token.indexOf('paren') == -1 && (!rule.next || rule.next.isContextAware)) { embeddableRules.push(rule); } } this.$rules.string_interp = [ ctxEnd({ token: "paren.rparen", regex: "\\}" }), ctxBegin({ token: "paren.lparen", regex: '{', next: "string_interp" }) ].concat(embeddableRules); // backtick strings can have single interpolation, which accept // \w+ followed by an optional set of function call parens this.$rules.bstring_interp_single = [ { token: ["identifier", "paren.lparen"], regex: '(\\w+)(\\()', next: 'bstring_interp_single_call' }, // identifier-only match ends this interp ctxEnd({ token : "identifier", regex : "\\w*" }) ]; // the call part of a bstring_interp_single // is terminated by a close paren `)`, but // can have nested parens. this.$rules.bstring_interp_single_call = [ ctxBegin({ token: "paren.lparen", regex: "\\(", next: "bstring_interp_single_call" }), ctxEnd({ token: "paren.rparen", regex: "\\)" }) ].concat(embeddableRules); }; oop.inherits(SJSHighlightRules, TextHighlightRules); exports.SJSHighlightRules = SJSHighlightRules; ================================================ FILE: src/mode/slim.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SlimHighlightRules = require("./slim_highlight_rules").SlimHighlightRules; var Mode = function() { TextMode.call(this); this.HighlightRules = SlimHighlightRules; this.createModeDelegates({ javascript: require("./javascript").Mode, markdown: require("./markdown").Mode, coffee: require("./coffee").Mode, scss: require("./scss").Mode, sass: require("./sass").Mode, less: require("./less").Mode, ruby: require("./ruby").Mode, css: require("./css").Mode }); }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/slim"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/slim_highlight_rules.js ================================================ "use strict"; var modes = require("../config").$modes; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SlimHighlightRules = function() { this.$rules = { "start": [ { token: "keyword", regex: /^(\s*)(\w+):\s*/, onMatch: function(value, state, stack, line) { var indent = /^\s*/.exec(line)[0]; var m = value.match(/^(\s*)(\w+):/); var language = m[2]; if (!/^(javascript|ruby|coffee|markdown|css|scss|sass|less)$/.test(language)) language = ""; stack.unshift("language-embed", [], [indent, language], state); return this.token; }, stateName: "language-embed", next: [{ token: "string", regex: /^(\s*)/, onMatch: function(value, state, stack, line) { var indent = stack[2][0]; if (indent.length >= value.length) { stack.splice(0, 3); this.next = stack.shift(); return this.token; } this.next = ""; return [{type: "text", value: indent}]; }, next: "" }, { token: "string", regex: /.+/, onMatch: function(value, state, stack, line) { var indent = stack[2][0]; var language = stack[2][1]; var embedState = stack[1]; if (modes[language]) { var data = modes[language].getTokenizer().getLineTokens(line.slice(indent.length), embedState.slice(0)); stack[1] = data.state; return data.tokens; } return this.token; } }] }, { token: 'constant.begin.javascript.filter.slim', regex: '^(\\s*)():$' }, { token: 'constant.begin..filter.slim', regex: '^(\\s*)(ruby):$' }, { token: 'constant.begin.coffeescript.filter.slim', regex: '^(\\s*)():$' }, { token: 'constant.begin..filter.slim', regex: '^(\\s*)(markdown):$' }, { token: 'constant.begin.css.filter.slim', regex: '^(\\s*)():$' }, { token: 'constant.begin.scss.filter.slim', regex: '^(\\s*)():$' }, { token: 'constant.begin..filter.slim', regex: '^(\\s*)(sass):$' }, { token: 'constant.begin..filter.slim', regex: '^(\\s*)(less):$' }, { token: 'constant.begin..filter.slim', regex: '^(\\s*)(erb):$' }, { token: 'keyword.html.tags.slim', regex: '^(\\s*)((:?\\*(\\w)+)|doctype html|abbr|acronym|address|applet|area|article|aside|audio|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dialog|dfn|dir|div|dl|dt|embed|fieldset|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|link|li|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|source|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video|xmp|b|u|s|em|a)(?:([.#](\\w|\\.)+)+\\s?)?\\b' }, { token: 'keyword.slim', regex: '^(\\s*)(?:([.#](\\w|\\.)+)+\\s?)' }, { token: "string", regex: /^(\s*)('|\||\/|(\/!))\s*/, onMatch: function(val, state, stack, line) { var indent = /^\s*/.exec(line)[0]; if (stack.length < 1) { stack.push(this.next); } else { stack[0] = "mlString"; } if (stack.length < 2) { stack.push(indent.length); } else { stack[1] = indent.length; } return this.token; }, next: "mlString" }, { token: 'keyword.control.slim', regex: '^(\\s*)(\\-|==|=)', push: [{ token: 'control.end.slim', regex: '$', next: "pop" }, { include: "rubyline" }, { include: "misc" }] }, { token: 'paren', regex: '\\(', push: [{ token: 'paren', regex: '\\)', next: "pop" }, { include: "misc" }] }, { token: 'paren', regex: '\\[', push: [{ token: 'paren', regex: '\\]', next: "pop" }, { include: "misc" }] }, { include: "misc" } ], "mlString": [{ token: "indent", regex: /^\s*/, onMatch: function(val, state, stack) { var curIndent = stack[1]; if (curIndent >= val.length) { this.next = "start"; stack.splice(0); } else { this.next = "mlString"; } return this.token; }, next: "start" }, { defaultToken: "string" }], "rubyline": [{ token: "keyword.operator.ruby.embedded.slim", regex: "(==|=)(<>|><|<'|'<|<|>)?|-" }, { token: "list.ruby.operators.slim", regex: "(\\b)(for|in|do|if|else|elsif|unless|while|yield|not|and|or)\\b" }, { token: "string", regex: "['](.)*?[']" }, { token: "string", regex: "[\"](.)*?[\"]" }], "misc": [{ token: 'class.variable.slim', regex: '\\@([a-zA-Z_][a-zA-Z0-9_]*)\\b' }, { token: "list.meta.slim", regex: "(\\b)(true|false|nil)(\\b)" }, { token: 'keyword.operator.equals.slim', regex: '=' }, { token: "string", regex: "['](.)*?[']" }, { token: "string", regex: "[\"](.)*?[\"]" }] }; this.normalizeRules(); }; oop.inherits(SlimHighlightRules, TextHighlightRules); exports.SlimHighlightRules = SlimHighlightRules; ================================================ FILE: src/mode/smarty.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var SmartyHighlightRules = require("./smarty_highlight_rules").SmartyHighlightRules; var Mode = function() { HtmlMode.call(this); this.HighlightRules = SmartyHighlightRules; }; oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/smarty"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/smarty_highlight_rules.js ================================================ /* This file was autogenerated from https://raw.github.com/amitsnyderman/sublime-smarty/master/Syntaxes/Smarty.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var SmartyHighlightRules = function() { HtmlHighlightRules.call(this); var smartyRules = { start: [ { include: '#comments' }, { include: '#blocks' } ], '#blocks': [ { token: 'punctuation.section.embedded.begin.smarty', regex: '\\{%?', push: [ { token: 'punctuation.section.embedded.end.smarty', regex: '%?\\}', next: 'pop' }, { include: '#strings' }, { include: '#variables' }, { include: '#lang' }, { defaultToken: 'source.smarty' } ] } ], '#comments': [ { token: [ 'punctuation.definition.comment.smarty', 'comment.block.smarty' ], regex: '(\\{%?)(\\*)', push: [ { token: 'comment.block.smarty', regex: '\\*%?\\}', next: 'pop' }, { defaultToken: 'comment.block.smarty' } ] } ], '#lang': [ { token: 'keyword.operator.smarty', regex: '(?:!=|!|<=|>=|<|>|===|==|%|&&|\\|\\|)|\\b(?:and|or|eq|neq|ne|gte|gt|ge|lte|lt|le|not|mod)\\b' }, { token: 'constant.language.smarty', regex: '\\b(?:TRUE|FALSE|true|false)\\b' }, { token: 'keyword.control.smarty', regex: '\\b(?:if|else|elseif|foreach|foreachelse|section|switch|case|break|default)\\b' }, { token: 'variable.parameter.smarty', regex: '\\b[a-zA-Z]+=' }, { token: 'support.function.built-in.smarty', regex: '\\b(?:capture|config_load|counter|cycle|debug|eval|fetch|include_php|include|insert|literal|math|strip|rdelim|ldelim|assign|constant|block|html_[a-z_]*)\\b' }, { token: 'support.function.variable-modifier.smarty', regex: '\\|(?:capitalize|cat|count_characters|count_paragraphs|count_sentences|count_words|date_format|default|escape|indent|lower|nl2br|regex_replace|replace|spacify|string_format|strip_tags|strip|truncate|upper|wordwrap)' } ], '#strings': [ { token: 'punctuation.definition.string.begin.smarty', regex: '\'', push: [ { token: 'punctuation.definition.string.end.smarty', regex: '\'', next: 'pop' }, { token: 'constant.character.escape.smarty', regex: '\\\\.' }, { defaultToken: 'string.quoted.single.smarty' } ] }, { token: 'punctuation.definition.string.begin.smarty', regex: '"', push: [ { token: 'punctuation.definition.string.end.smarty', regex: '"', next: 'pop' }, { token: 'constant.character.escape.smarty', regex: '\\\\.' }, { defaultToken: 'string.quoted.double.smarty' } ] } ], '#variables': [ { token: [ 'punctuation.definition.variable.smarty', 'variable.other.global.smarty' ], regex: '\\b(\\$)(Smarty\\.)' }, { token: [ 'punctuation.definition.variable.smarty', 'variable.other.smarty' ], regex: '(\\$)([a-zA-Z_][a-zA-Z0-9_]*)\\b' }, { token: [ 'keyword.operator.smarty', 'variable.other.property.smarty' ], regex: '(->)([a-zA-Z_][a-zA-Z0-9_]*)\\b' }, { token: [ 'keyword.operator.smarty', 'meta.function-call.object.smarty', 'punctuation.definition.variable.smarty', 'variable.other.smarty', 'punctuation.definition.variable.smarty' ], regex: '(->)([a-zA-Z_][a-zA-Z0-9_]*)(\\()(.*?)(\\))' } ] }; var smartyStart = smartyRules.start; for (var rule in this.$rules) { this.$rules[rule].unshift.apply(this.$rules[rule], smartyStart); } Object.keys(smartyRules).forEach(function(x) { if (!this.$rules[x]) this.$rules[x] = smartyRules[x]; }, this); this.normalizeRules(); }; SmartyHighlightRules.metaData = { fileTypes: [ 'tpl' ], foldingStartMarker: '\\{%?', foldingStopMarker: '%?\\}', name: 'Smarty', scopeName: 'text.html.smarty' }; oop.inherits(SmartyHighlightRules, HtmlHighlightRules); exports.SmartyHighlightRules = SmartyHighlightRules; ================================================ FILE: src/mode/smithy.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SmithyHighlightRules = require("./smithy_highlight_rules").SmithyHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = SmithyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$quotes = {'"': '"'}; 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/smithy"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/smithy_highlight_rules.js ================================================ /* This file was autogenerated from https://raw.githubusercontent.com/awslabs/smithy-vscode/master/syntaxes/smithy.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SmithyHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ include: "#comment" }, { token: [ "meta.keyword.statement.smithy", "variable.other.smithy", "text", "keyword.operator.smithy" ], regex: /^(\$)(\s+.+)(\s*)(=)/ }, { token: [ "keyword.statement.smithy", "text", "entity.name.type.namespace.smithy" ], regex: /^(namespace)(\s+)([A-Z-a-z0-9_\.#$-]+)/ }, { token: [ "keyword.statement.smithy", "text", "keyword.statement.smithy", "text", "entity.name.type.smithy" ], regex: /^(use)(\s+)(shape|trait)(\s+)([A-Z-a-z0-9_\.#$-]+)\b/ }, { token: [ "keyword.statement.smithy", "variable.other.smithy", "text", "keyword.operator.smithy" ], regex: /^(metadata)(\s+.+)(\s*)(=)/ }, { token: [ "keyword.statement.smithy", "text", "entity.name.type.smithy" ], regex: /^(apply|byte|short|integer|long|float|double|bigInteger|bigDecimal|boolean|blob|string|timestamp|service|resource|trait|list|map|set|structure|union|document)(\s+)([A-Z-a-z0-9_\.#$-]+)\b/ }, { token: [ "keyword.operator.smithy", "text", "entity.name.type.smithy", "text", "text", "support.function.smithy", "text", "text", "support.function.smithy" ], regex: /^(operation)(\s+)([A-Z-a-z0-9_\.#$-]+)(\(.*\))(?:(\s*)(->)(\s*[A-Z-a-z0-9_\.#$-]+))?(?:(\s+)(errors))?/ }, { include: "#trait" }, { token: [ "support.type.property-name.smithy", "punctuation.separator.dictionary.pair.smithy" ], regex: /([A-Z-a-z0-9_\.#$-]+)(:)/ }, { include: "#value" }, { token: "keyword.other.smithy", regex: /\->/ }], "#comment": [{ include: "#doc_comment" }, { include: "#line_comment" }], "#doc_comment": [{ token: "comment.block.documentation.smithy", regex: /\/\/\/.*/ }], "#line_comment": [{ token: "comment.line.double-slash.smithy", regex: /\/\/.*/ }], "#trait": [{ token: [ "punctuation.definition.annotation.smithy", "storage.type.annotation.smithy" ], regex: /(@)([0-9a-zA-Z\.#-]+)/ }, { token: [ "punctuation.definition.annotation.smithy", "punctuation.definition.object.end.smithy", "meta.structure.smithy" ], regex: /(@)([0-9a-zA-Z\.#-]+)(\()/, push: [{ token: "punctuation.definition.object.end.smithy", regex: /\)/, next: "pop" }, { include: "#value" }, { include: "#object_inner" }, { defaultToken: "meta.structure.smithy" }] }], "#value": [{ include: "#constant" }, { include: "#number" }, { include: "#string" }, { include: "#array" }, { include: "#object" }], "#array": [{ token: "punctuation.definition.array.begin.smithy", regex: /\[/, push: [{ token: "punctuation.definition.array.end.smithy", regex: /\]/, next: "pop" }, { include: "#comment" }, { include: "#value" }, { token: "punctuation.separator.array.smithy", regex: /,/ }, { token: "invalid.illegal.expected-array-separator.smithy", regex: /[^\s\]]/ }, { defaultToken: "meta.structure.array.smithy" }] }], "#constant": [{ token: "constant.language.smithy", regex: /\b(?:true|false|null)\b/ }], "#number": [{ token: "constant.numeric.smithy", regex: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/ }], "#object": [{ token: "punctuation.definition.dictionary.begin.smithy", regex: /\{/, push: [{ token: "punctuation.definition.dictionary.end.smithy", regex: /\}/, next: "pop" }, { include: "#trait" }, { include: "#object_inner" }, { defaultToken: "meta.structure.dictionary.smithy" }] }], "#object_inner": [{ include: "#comment" }, { include: "#string_key" }, { token: "punctuation.separator.dictionary.key-value.smithy", regex: /:/, push: [{ token: "punctuation.separator.dictionary.pair.smithy", regex: /,|(?=\})/, next: "pop" }, { include: "#value" }, { token: "invalid.illegal.expected-dictionary-separator.smithy", regex: /[^\s,]/ }, { defaultToken: "meta.structure.dictionary.value.smithy" }] }, { token: "invalid.illegal.expected-dictionary-separator.smithy", regex: /[^\s\}]/ }], "#string_key": [{ include: "#identifier_key" }, { include: "#dquote_key" }, { include: "#squote_key" }], "#identifier_key": [{ token: "support.type.property-name.smithy", regex: /[A-Z-a-z0-9_\.#$-]+/ }], "#dquote_key": [{ include: "#dquote" }], "#squote_key": [{ include: "#squote" }], "#string": [{ include: "#textblock" }, { include: "#dquote" }, { include: "#squote" }, { include: "#identifier" }], "#textblock": [{ token: "punctuation.definition.string.begin.smithy", regex: /"""/, push: [{ token: "punctuation.definition.string.end.smithy", regex: /"""/, next: "pop" }, { token: "constant.character.escape.smithy", regex: /\\./ }, { defaultToken: "string.quoted.double.smithy" }] }], "#dquote": [{ token: "punctuation.definition.string.begin.smithy", regex: /"/, push: [{ token: "punctuation.definition.string.end.smithy", regex: /"/, next: "pop" }, { token: "constant.character.escape.smithy", regex: /\\./ }, { defaultToken: "string.quoted.double.smithy" }] }], "#squote": [{ token: "punctuation.definition.string.begin.smithy", regex: /'/, push: [{ token: "punctuation.definition.string.end.smithy", regex: /'/, next: "pop" }, { token: "constant.character.escape.smithy", regex: /\\./ }, { defaultToken: "string.quoted.single.smithy" }] }], "#identifier": [{ token: "storage.type.smithy", regex: /[A-Z-a-z_][A-Z-a-z0-9_\.#$-]*/ }] }; this.normalizeRules(); }; SmithyHighlightRules.metaData = { name: "Smithy", fileTypes: ["smithy"], scopeName: "source.smithy", foldingStartMarker: "(\\{|\\[)\\s*", foldingStopMarker: "\\s*(\\}|\\])" }; oop.inherits(SmithyHighlightRules, TextHighlightRules); exports.SmithyHighlightRules = SmithyHighlightRules; ================================================ FILE: src/mode/snippets.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SnippetHighlightRules = function() { var builtins = "SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|" + "LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME"; this.$rules = { "start" : [ {token:"constant.language.escape", regex: /\\[\$}`\\]/}, {token:"keyword", regex: "\\$(?:TM_)?(?:" + builtins + ")\\b"}, {token:"variable", regex: "\\$\\w+"}, {onMatch: function(value, state, stack) { if (stack[1]) stack[1]++; else stack.unshift(state, 1); return this.tokenName; }, tokenName: "markup.list", regex: "\\${", next: "varDecl"}, {onMatch: function(value, state, stack) { if (!stack[1]) return "text"; stack[1]--; if (!stack[1]) stack.splice(0,2); return this.tokenName; }, tokenName: "markup.list", regex: "}"}, {token: "doc.comment", regex:/^\${2}-{5,}$/} ], "varDecl" : [ {regex: /\d+\b/, token: "constant.numeric"}, {token:"keyword", regex: "(?:TM_)?(?:" + builtins + ")\\b"}, {token:"variable", regex: "\\w+"}, {regex: /:/, token: "punctuation.operator", next: "start"}, {regex: /\//, token: "string.regex", next: "regexp"}, {regex: "", next: "start"} ], "regexp" : [ {regex: /\\./, token: "escape"}, {regex: /\[/, token: "regex.start", next: "charClass"}, {regex: "/", token: "string.regex", next: "format"}, //{"default": "string.regex"}, {"token": "string.regex", regex:"."} ], charClass : [ {regex: "\\.", token: "escape"}, {regex: "\\]", token: "regex.end", next: "regexp"}, {"token": "string.regex", regex:"."} ], "format" : [ {regex: /\\[ulULE]/, token: "keyword"}, {regex: /\$\d+/, token: "variable"}, {regex: "/[gim]*:?", token: "string.regex", next: "start"}, // {"default": "string"}, {"token": "string", regex:"."} ] }; }; oop.inherits(SnippetHighlightRules, TextHighlightRules); exports.SnippetHighlightRules = SnippetHighlightRules; var SnippetGroupHighlightRules = function() { this.$rules = { "start" : [ {token: "text", regex: "^\\t", next: "sn-start"}, {token:"invalid", regex: /^ \s*/}, {token:"comment", regex: /^#.*/}, {token:"constant.language.escape", regex: "^regex ", next: "regex"}, {token:"constant.language.escape", regex: "^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\b"} ], "regex" : [ {token:"text", regex: "\\."}, {token:"keyword", regex: "/"}, {token:"empty", regex: "$", next: "start"} ] }; this.embedRules(SnippetHighlightRules, "sn-", [ {token: "text", regex: "^\\t", next: "sn-start"}, {onMatch: function(value, state, stack) { stack.splice(stack.length); return this.tokenName; }, tokenName: "text", regex: "^(?!\t)", next: "start"} ]); }; oop.inherits(SnippetGroupHighlightRules, TextHighlightRules); exports.SnippetGroupHighlightRules = SnippetGroupHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = SnippetGroupHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.$indentWithTabs = true; this.lineCommentStart = "#"; this.$id = "ace/mode/snippets"; this.snippetFileId = "ace/snippets/snippets"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/soy_template.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var SoyTemplateHighlightRules = require("./soy_template_highlight_rules").SoyTemplateHighlightRules; var Mode = function() { HtmlMode.call(this); this.HighlightRules = SoyTemplateHighlightRules; }; oop.inherits(Mode, HtmlMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/soy_template"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/soy_template_highlight_rules.js ================================================ /* This file was autogenerated from tm bundles\SoyTemplate\Syntaxes\SoyTemplate.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var SoyTemplateHighlightRules = function() { HtmlHighlightRules.call(this); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var soyRules = { start: [ { include: '#template' }, { include: '#if' }, { include: '#comment-line' }, { include: '#comment-block' }, { include: '#comment-doc' }, { include: '#call' }, { include: '#css' }, { include: '#param' }, { include: '#print' }, { include: '#msg' }, { include: '#for' }, { include: '#foreach' }, { include: '#switch' }, { include: '#tag' }, { include: 'text.html.basic' } ], '#call': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.call.soy' ], regex: '(\\{/?)(\\s*)(?=call|delcall)', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { include: '#string-quoted-single' }, { include: '#string-quoted-double' }, { token: ['entity.name.tag.soy', 'variable.parameter.soy'], regex: '(call|delcall)(\\s+[\\.\\w]+)'}, { token: [ 'entity.other.attribute-name.soy', 'text', 'keyword.operator.soy' ], regex: '\\b(data)(\\s*)(=)' }, { defaultToken: 'meta.tag.call.soy' } ] } ], '#comment-line': [ { token: [ 'comment.line.double-slash.soy', 'comment.line.double-slash.soy' ], regex: '(//)(.*$)' } ], '#comment-block': [ { token: 'punctuation.definition.comment.begin.soy', regex: '/\\*(?!\\*)', push: [ { token: 'punctuation.definition.comment.end.soy', regex: '\\*/', next: 'pop' }, { defaultToken: 'comment.block.soy' } ] } ], '#comment-doc': [ { token: 'punctuation.definition.comment.begin.soy', regex: '/\\*\\*(?!/)', push: [ { token: 'punctuation.definition.comment.end.soy', regex: '\\*/', next: 'pop' }, { token: [ 'support.type.soy', 'text', 'variable.parameter.soy' ], regex: '(@param|@param\\?)(\\s+)(\\w+)' }, { defaultToken: 'comment.block.documentation.soy' } ] } ], '#css': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.css.soy', 'entity.name.tag.soy' ], regex: '(\\{/?)(\\s*)(css)\\b', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { token: 'support.constant.soy', regex: '\\b(?:LITERAL|REFERENCE|BACKEND_SPECIFIC|GOOG)\\b' }, { defaultToken: 'meta.tag.css.soy' } ] } ], '#for': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.for.soy', 'entity.name.tag.soy' ], regex: '(\\{/?)(\\s*)(for)\\b', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { token: 'keyword.operator.soy', regex: '\\bin\\b' }, { token: 'support.function.soy', regex: '\\brange\\b' }, { include: '#variable' }, { include: '#number' }, { include: '#primitive' }, { defaultToken: 'meta.tag.for.soy' } ] } ], '#foreach': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.foreach.soy', 'entity.name.tag.soy' ], regex: '(\\{/?)(\\s*)(foreach)\\b', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { token: 'keyword.operator.soy', regex: '\\bin\\b' }, { include: '#variable' }, { defaultToken: 'meta.tag.foreach.soy' } ] } ], '#function': [ { token: 'support.function.soy', regex: '\\b(?:isFirst|isLast|index|hasData|length|keys|round|floor|ceiling|min|max|randomInt)\\b' } ], '#if': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.if.soy', 'entity.name.tag.soy' ], regex: '(\\{/?)(\\s*)(if|elseif)\\b', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { include: '#variable' }, { include: '#operator' }, { include: '#function' }, { include: '#string-quoted-single' }, { include: '#string-quoted-double' }, { defaultToken: 'meta.tag.if.soy' } ] } ], '#namespace': [ { token: [ 'entity.name.tag.soy', 'text', 'variable.parameter.soy' ], regex: '(namespace|delpackage)(\\s+)([\\w\\.]+)' } ], '#number': [ { token: 'constant.numeric', regex: '[\\d]+' } ], '#operator': [ { token: 'keyword.operator.soy', regex: '==|!=|\\band\\b|\\bor\\b|\\bnot\\b|-|\\+|/|\\?:' } ], '#param': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.param.soy', 'entity.name.tag.soy' ], regex: '(\\{/?)(\\s*)(param)', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { include: '#variable' }, { token: [ 'entity.other.attribute-name.soy', 'text', 'keyword.operator.soy' ], regex: '\\b([\\w]+)(\\s*)((?::)?)' }, { defaultToken: 'meta.tag.param.soy' } ] } ], '#primitive': [ { token: 'constant.language.soy', regex: '\\b(?:null|false|true)\\b' } ], '#msg': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.msg.soy', 'entity.name.tag.soy' ], regex: '(\\{/?)(\\s*)(msg)\\b', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { include: '#string-quoted-single' }, { include: '#string-quoted-double' }, { token: [ 'entity.other.attribute-name.soy', 'text', 'keyword.operator.soy' ], regex: '\\b(meaning|desc)(\\s*)(=)' }, { defaultToken: 'meta.tag.msg.soy' } ] } ], '#print': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.print.soy', 'entity.name.tag.soy' ], regex: '(\\{/?)(\\s*)(print)\\b', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { include: '#variable' }, { include: '#print-parameter' }, { include: '#number' }, { include: '#primitive' }, { include: '#attribute-lookup' }, { defaultToken: 'meta.tag.print.soy' } ] } ], '#print-parameter': [ { token: 'keyword.operator.soy', regex: '\\|' }, { token: 'variable.parameter.soy', regex: 'noAutoescape|id|escapeHtml|escapeJs|insertWorkBreaks|truncate' } ], '#special-character': [ { token: 'support.constant.soy', regex: '\\bsp\\b|\\bnil\\b|\\\\r|\\\\n|\\\\t|\\blb\\b|\\brb\\b' } ], '#string-quoted-double': [ { token: 'string.quoted.double', regex: '"[^"]*"' } ], '#string-quoted-single': [ { token: 'string.quoted.single', regex: '\'[^\']*\'' } ], '#switch': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.switch.soy', 'entity.name.tag.soy' ], regex: '(\\{/?)(\\s*)(switch|case)\\b', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { include: '#variable' }, { include: '#function' }, { include: '#number' }, { include: '#string-quoted-single' }, { include: '#string-quoted-double' }, { defaultToken: 'meta.tag.switch.soy' } ] } ], '#attribute-lookup': [ { token: 'punctuation.definition.attribute-lookup.begin.soy', regex: '\\[', push: [ { token: 'punctuation.definition.attribute-lookup.end.soy', regex: '\\]', next: 'pop' }, { include: '#variable' }, { include: '#function' }, { include: '#operator' }, { include: '#number' }, { include: '#primitive' }, { include: '#string-quoted-single' }, { include: '#string-quoted-double' } ] } ], '#tag': [ { token: 'punctuation.definition.tag.begin.soy', regex: '\\{', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { include: '#namespace' }, { include: '#variable' }, { include: '#special-character' }, { include: '#tag-simple' }, { include: '#function' }, { include: '#operator' }, { include: '#attribute-lookup' }, { include: '#number' }, { include: '#primitive' }, { include: '#print-parameter' } ] } ], '#tag-simple': [ { token: 'entity.name.tag.soy', regex: '{{\\s*(?:literal|else|ifempty|default)\\s*(?=\\})'} ], '#template': [ { token: [ 'punctuation.definition.tag.begin.soy', 'meta.tag.template.soy' ], regex: '(\\{/?)(\\s*)(?=template|deltemplate)', push: [ { token: 'punctuation.definition.tag.end.soy', regex: '\\}', next: 'pop' }, { token: ['entity.name.tag.soy', 'text', 'entity.name.function.soy' ], regex: '(template|deltemplate)(\\s+)([\\.\\w]+)', originalRegex: '(?<=template|deltemplate)\\s+([\\.\\w]+)' }, { token: [ 'entity.other.attribute-name.soy', 'text', 'keyword.operator.soy', 'text', 'string.quoted.double.soy' ], regex: '\\b(private)(\\s*)(=)(\\s*)("true"|"false")' }, { token: [ 'entity.other.attribute-name.soy', 'text', 'keyword.operator.soy', 'text', 'string.quoted.single.soy' ], regex: '\\b(private)(\\s*)(=)(\\s*)(\'true\'|\'false\')' }, { token: [ 'entity.other.attribute-name.soy', 'text', 'keyword.operator.soy', 'text', 'string.quoted.double.soy' ], regex: '\\b(autoescape)(\\s*)(=)(\\s*)("true"|"false"|"contextual")' }, { token: [ 'entity.other.attribute-name.soy', 'text', 'keyword.operator.soy', 'text', 'string.quoted.single.soy' ], regex: '\\b(autoescape)(\\s*)(=)(\\s*)(\'true\'|\'false\'|\'contextual\')' }, { defaultToken: 'meta.tag.template.soy' } ] } ], '#variable': [ { token: 'variable.other.soy', regex: '\\$[\\w\\.]+' } ] }; for (var i in soyRules) { if (this.$rules[i]) { this.$rules[i].unshift.apply(this.$rules[i], soyRules[i]); } else { this.$rules[i] = soyRules[i]; } } this.normalizeRules(); }; SoyTemplateHighlightRules.metaData = { comment: 'SoyTemplate', fileTypes: [ 'soy' ], firstLineMatch: '\\{\\s*namespace\\b', foldingStartMarker: '\\{\\s*template\\s+[^\\}]*\\}', foldingStopMarker: '\\{\\s*/\\s*template\\s*\\}', name: 'SoyTemplate', scopeName: 'source.soy' }; oop.inherits(SoyTemplateHighlightRules, HtmlHighlightRules); exports.SoyTemplateHighlightRules = SoyTemplateHighlightRules; ================================================ FILE: src/mode/space.js ================================================ "use strict"; var oop = require("../lib/oop"); // defines the parent mode var TextMode = require("./text").Mode; var FoldMode = require("./folding/coffee").FoldMode; // defines the language specific highlighters and folding rules var SpaceHighlightRules = require("./space_highlight_rules").SpaceHighlightRules; var Mode = function() { // set everything up this.HighlightRules = SpaceHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/space"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/space_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SpaceHighlightRules = function() { // Todo: support multiline values that escape the newline with spaces. this.$rules = { "start" : [ { token : "empty_line", regex : / */, next : "key" }, { token : "empty_line", regex : /$/, next : "key" } ], "key" : [ { token : "variable", regex : /\S+/ }, { token : "empty_line", regex : /$/, next : "start" },{ token : "keyword.operator", regex : / /, next : "value" } ], "value" : [ { token : "keyword.operator", regex : /$/, next : "start" }, { token : "string", regex : /[^$]/ } ] }; }; oop.inherits(SpaceHighlightRules, TextHighlightRules); exports.SpaceHighlightRules = SpaceHighlightRules; ================================================ FILE: src/mode/sparql.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SPARQLHighlightRules = require("./sparql_highlight_rules").SPARQLHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = SPARQLHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { // this.lineCommentStart = ""#""; // Extra logic goes here. this.$id = "ace/mode/sparql"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/sparql_highlight_rules.js ================================================ /* This file was autogenerated from sparql.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SPARQLHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ include: "#comments" }, { include: "#strings" }, { include: "#string-language-suffixes" }, { include: "#string-datatype-suffixes" }, { include: "#logic-operators" }, { include: "#relative-urls" }, { include: "#xml-schema-types" }, { include: "#rdf-schema-types" }, { include: "#owl-types" }, { include: "#qnames" }, { include: "#keywords" }, { include: "#built-in-functions" }, { include: "#variables" }, { include: "#boolean-literal" }, { include: "#punctuation-operators" }], "#boolean-literal": [{ token: "constant.language.boolean.sparql", regex: /true|false/ }], "#built-in-functions": [{ token: "support.function.sparql", regex: /[Aa][Bb][Ss]|[Aa][Vv][Gg]|[Bb][Nn][Oo][Dd][Ee]|[Bb][Oo][Uu][Nn][Dd]|[Cc][Ee][Ii][Ll]|[Cc][Oo][Aa][Ll][Ee][Ss][Cc][Ee]|[Cc][Oo][Nn][Cc][Aa][Tt]|[Cc][Oo][Nn][Tt][Aa][Ii][Nn][Ss]|[Cc][Oo][Uu][Nn][Tt]|[Dd][Aa][Tt][Aa][Tt][Yy][Pp][Ee]|[Dd][Aa][Yy]|[Ee][Nn][Cc][Oo][Dd][Ee]_[Ff][Oo][Rr]_[Uu][Rr][Ii]|[Ee][Xx][Ii][Ss][Tt][Ss]|[Ff][Ll][Oo][Oo][Rr]|[Gg][Rr][Oo][Uu][Pp]_[Cc][Oo][Nn][Cc][Aa][Tt]|[Hh][Oo][Uu][Rr][Ss]|[Ii][Ff]|[Ii][Rr][Ii]|[Ii][Ss][Bb][Ll][Aa][Nn][Kk]|[Ii][Ss][Ii][Rr][Ii]|[Ii][Ss][Ll][Ii][Tt][Ee][Rr][Aa][Ll]|[Ii][Ss][Nn][Uu][Mm][Ee][Rr][Ii][Cc]|[Ii][Ss][Uu][Rr][Ii]|[Ll][Aa][Nn][Gg]|[Ll][Aa][Nn][Gg][Mm][Aa][Tt][Cc][Hh][Ee][Ss]|[Ll][Cc][Aa][Ss][Ee]|[Mm][Aa][Xx]|[Mm][Dd]5|[Mm][Ii][Nn]|[Mm][Ii][Nn][Uu][Tt][Ee][Ss]|[Mm][Oo][Nn][Tt][Hh]|[Nn][Oo][Ww]|[Rr][Aa][Nn][Dd]|[Rr][Ee][Gg][Ee][Xx]|[Rr][Ee][Pp][Ll][Aa][Cc][Ee]|[Rr][Oo][Uu][Nn][Dd]|[Ss][Aa][Mm][Ee][Tt][Ee][Rr][Mm]|[Ss][Aa][Mm][Pp][Ll][Ee]|[Ss][Ee][Cc][Oo][Nn][Dd][Ss]|[Ss][Ee][Pp][Aa][Rr][Aa][Tt][Oo][Rr]|[Ss][Hh][Aa](?:1|256|384|512)|[Ss][Tt][Rr]|[Ss][Tt][Rr][Aa][Ff][Tt][Ee][Rr]|[Ss][Tt][Rr][Bb][Ee][Ff][Oo][Rr][Ee]|[Ss][Tt][Rr][Dd][Tt]|[Ss][Tt][Rr][Ee][Nn][Dd][Ss]|[Ss][Tt][Rr][Ll][Aa][Nn][Gg]|[Ss][Tt][Rr][Ll][Ee][Nn]|[Ss][Tt][Rr][Ss][Tt][Aa][Rr][Tt][Ss]|[Ss][Tt][Rr][Uu][Uu][Ii][Dd]|[Ss][Uu][Bb][Ss][Tt][Rr]|[Ss][Uu][Mm]|[Tt][Ii][Mm][Ee][Zz][Oo][Nn][Ee]|[Tt][Zz]|[Uu][Cc][Aa][Ss][Ee]|[Uu][Rr][Ii]|[Uu][Uu][Ii][Dd]|[Yy][Ee][Aa][Rr]/ }], "#comments": [{ token: [ "punctuation.definition.comment.sparql", "comment.line.hash.sparql" ], regex: /(#)(.*$)/ }], "#keywords": [{ token: "keyword.other.sparql", regex: /[Aa][Dd][Dd]|[Aa][Ll][Ll]|[Aa][Ss]|[As][Ss][Cc]|[Aa][Ss][Kk]|[Bb][Aa][Ss][Ee]|[Bb][Ii][Nn][Dd]|[Bb][Yy]|[Cc][Ll][Ee][Aa][Rr]|[Cc][Oo][Nn][Ss][Tt][Rr][Uu][Cc][Tt]|[Cc][Oo][Pp][Yy]|[Cc][Rr][Ee][Aa][Tt][Ee]|[Dd][Aa][Tt][Aa]|[Dd][Ee][Ff][Aa][Uu][Ll][Tt]|[Dd][Ee][Ll][Ee][Tt][Ee]|[Dd][Ee][Sc][Cc]|[Dd][Ee][Ss][Cc][Rr][Ii][Bb][Ee]|[Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt]|[Dd][Rr][Oo][Pp]|[Ff][Ii][Ll][Tt][Ee][Rr]|[Ff][Rr][Oo][Mm]|[Gg][Rr][Aa][Pp][Hh]|[Gg][Rr][Oo][Uu][Pp]|[Hh][Aa][Vv][Ii][Nn][Gg]|[Ii][Nn][Ss][Ee][Rr][Tt]|[Ll][Ii][Mm][Ii][Tt]|[Ll][Oo][Aa][Dd]|[Mm][Ii][Nn][Uu][Ss]|[Mm][Oo][Vv][Ee]|[Nn][Aa][Mm][Ee][Dd]|[Oo][Ff][Ff][Ss][Ee][Tt]|[Oo][Pp][Tt][Ii][Oo][Nn][Aa][Ll]|[Oo][Rr][Dd][Ee][Rr]|[Pp][Rr][Ee][Ff][Ii][Xx]|[Rr][Ee][Dd][Uu][Cc][Ee][Dd]|[Ss][Ee][Ll][Ee][Cc][Tt]|[Ss][Ee][Pp][Aa][Rr][Aa][Tt][Oo][Rr]|[Ss][Ee][Rr][Vv][Ii][Cc][Ee]|[Ss][Ii][Ll][Ee][Nn][Tt]|[Tt][Oo]|[Uu][Nn][Dd][Ee][Ff]|[Uu][Nn][Ii][Oo][Nn]|[Uu][Ss][Ii][Nn][Gg]|[Vv][Aa][Ll][Uu][Ee][Ss]|[Ww][He][Ee][Rr][Ee]|[Ww][Ii][Tt][Hh]/ }], "#logic-operators": [{ token: "keyword.operator.logical.sparql", regex: /\|\||&&|=|!=|<|>|<=|>=|(?:^|!?\s)IN(?:!?\s|$)|(?:^|!?\s)NOT(?:!?\s|$)|-|\+|\*|\/|\!/ }], "#owl-types": [{ token: "support.type.datatype.owl.sparql", regex: /owl:[a-zA-Z]+/ }], "#punctuation-operators": [{ token: "keyword.operator.punctuation.sparql", regex: /;|,|\.|\(|\)|\{|\}|\|/ }], "#qnames": [{ token: "entity.name.other.qname.sparql", regex: /(?:[a-zA-Z][-_a-zA-Z0-9]*)?:(?:[_a-zA-Z][-_a-zA-Z0-9]*)?/ }], "#rdf-schema-types": [{ token: "support.type.datatype.rdf.schema.sparql", regex: /rdfs?:[a-zA-Z]+|(?:^|\s)a(?:\s|$)/ }], "#relative-urls": [{ token: "string.quoted.other.relative.url.sparql", regex: /</, push: [{ token: "string.quoted.other.relative.url.sparql", regex: />/, next: "pop" }, { defaultToken: "string.quoted.other.relative.url.sparql" }] }], "#string-datatype-suffixes": [{ token: "keyword.operator.datatype.suffix.sparql", regex: /\^\^/ }], "#string-language-suffixes": [{ token: [ "keyword.operator.language.suffix.sparql", "constant.language.suffix.sparql" ], regex: /(?!")(@)([a-z]+(?:\-[a-z0-9]+)*)/ }], "#strings": [{ token: "string.quoted.triple.sparql", regex: /"""/, push: [{ token: "string.quoted.triple.sparql", regex: /"""/, next: "pop" }, { defaultToken: "string.quoted.triple.sparql" }] }, { token: "string.quoted.double.sparql", regex: /"/, push: [{ token: "string.quoted.double.sparql", regex: /"/, next: "pop" }, { token: "invalid.string.newline", regex: /$/ }, { token: "constant.character.escape.sparql", regex: /\\./ }, { defaultToken: "string.quoted.double.sparql" }] }], "#variables": [{ token: "variable.other.sparql", regex: /(?:\?|\$)[-_a-zA-Z0-9]+/ }], "#xml-schema-types": [{ token: "support.type.datatype.schema.sparql", regex: /xsd?:[a-z][a-zA-Z]+/ }] }; this.normalizeRules(); }; SPARQLHighlightRules.metaData = { fileTypes: ["rq", "sparql"], name: "SPARQL", scopeName: "source.sparql" }; oop.inherits(SPARQLHighlightRules, TextHighlightRules); exports.SPARQLHighlightRules = SPARQLHighlightRules; ================================================ FILE: src/mode/sql.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules; var SqlFoldMode = require("./folding/sql").FoldMode; var Mode = function() { this.HighlightRules = SqlHighlightRules; this.foldingRules = new SqlFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/sql"; this.snippetFileId = "ace/snippets/sql"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/sql_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SqlHighlightRules = function() { var keywords = ( "select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|" + "when|then|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|" + "foreign|not|references|default|null|inner|cross|natural|database|drop|grant|distinct|is|in|" + "all|alter|any|array|at|authorization|between|both|cast|check|collate|column|commit|constraint|"+ "cube|current|current_date|current_time|current_timestamp|current_user|describe|escape|except|" + "exists|external|extract|fetch|filter|for|full|function|global|grouping|intersect|interval|" + "into|leading|like|local|no|of|only|out|overlaps|partition|position|range|revoke|rollback|rollup|" + "row|rows|session_user|set|some|start|tablesample|time|to|trailing|truncate|unique|unknown|" + "user|using|values|window|with" ); var builtinConstants = ( "true|false" ); var builtinFunctions = ( "avg|count|first|last|max|min|sum|ucase|lcase|mid|len|round|rank|now|format|" + "coalesce|ifnull|isnull|nvl" ); var dataTypes = ( "int|numeric|decimal|date|varchar|char|bigint|float|double|bit|binary|text|set|timestamp|" + "money|real|number|integer|string" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords, "constant.language": builtinConstants, "storage.type": dataTypes }, "identifier", true); this.$rules = { "start" : [ { token : "comment", regex : "--.*$" }, { token : "comment", start : "/\\*", end : "\\*/" }, { token : "string", // " string regex : '".*?"' }, { token : "string", // ' string regex : "'.*?'" }, { token : "string", // ` string (apache drill) 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+" } ] }; this.normalizeRules(); }; oop.inherits(SqlHighlightRules, TextHighlightRules); exports.SqlHighlightRules = SqlHighlightRules; ================================================ FILE: src/mode/sqlserver.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SqlServerHighlightRules = require("./sqlserver_highlight_rules").SqlHighlightRules; var SqlServerFoldMode = require("./folding/sqlserver").FoldMode; var Mode = function() { this.HighlightRules = SqlServerHighlightRules; this.foldingRules = new SqlServerFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "/*", end: "*/"}; /** * Override keyword completions using list created in highlight rules */ this.getCompletions = function(state, session, pos, prefix) { return session.$mode.$highlightRules.completions; }; this.$id = "ace/mode/sqlserver"; this.snippetFileId = "ace/snippets/sqlserver"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/sqlserver_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SqlServerHighlightRules = function() { /** * Transact-SQL Syntax Conventions: https://msdn.microsoft.com/en-us/library/ms177563.aspx * Goal: make this imitate SSMS (SQL Server Managment Studio) */ // https://msdn.microsoft.com/en-us/library/ms189773.aspx var logicalOperators = "ALL|AND|ANY|BETWEEN|EXISTS|IN|LIKE|NOT|OR|SOME"; logicalOperators += "|NULL|IS|APPLY|INNER|OUTER|LEFT|RIGHT|JOIN|CROSS"; //SSMS colors these gray too //note: manually removed LEFT and RIGHT from built in functions below to color it same way SSMS does var builtinFunctions = ( /* https://msdn.microsoft.com/en-us/library/ms187957.aspx */ "OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|" + /* https://msdn.microsoft.com/en-us/library/ms173454.aspx */ "AVG|CHECKSUM_AGG|COUNT|COUNT_BIG|GROUPING|GROUPING_ID|MAX|MIN|STDEV|STDEVP|SUM|VAR|VARP|" + /* https://msdn.microsoft.com/en-us/library/ms189798.aspx */ "DENSE_RANK|NTILE|RANK|ROW_NUMBER" + /* https://msdn.microsoft.com/en-us/library/ms173823.aspx */ "@@DATEFIRST|@@DBTS|@@LANGID|@@LANGUAGE|@@LOCK_TIMEOUT|@@MAX_CONNECTIONS|@@MAX_PRECISION|@@NESTLEVEL|@@OPTIONS|@@REMSERVER|@@SERVERNAME|@@SERVICENAME|@@SPID|@@TEXTSIZE|@@VERSION|" + /* https://msdn.microsoft.com/en-us/library/hh231076.aspx */ "CAST|CONVERT|PARSE|TRY_CAST|TRY_CONVERT|TRY_PARSE" + /* https://msdn.microsoft.com/en-us/library/ms186285.aspx */ "@@CURSOR_ROWS|@@FETCH_STATUS|CURSOR_STATUS|" + /* https://msdn.microsoft.com/en-us/library/ms186724.aspx */ "@@DATEFIRST|@@LANGUAGE|CURRENT_TIMESTAMP|DATEADD|DATEDIFF|DATEFROMPARTS|DATENAME|DATEPART|DATETIME2FROMPARTS|DATETIMEFROMPARTS|DATETIMEOFFSETFROMPARTS|DAY|EOMONTH|GETDATE|GETUTCDATE|ISDATE|MONTH|SET DATEFIRST|SET DATEFORMAT|SET LANGUAGE|SMALLDATETIMEFROMPARTS|SP_HELPLANGUAGE|SWITCHOFFSET|SYSDATETIME|SYSDATETIMEOFFSET|SYSUTCDATETIME|TIMEFROMPARTS|TODATETIMEOFFSET|YEAR|DATETRUNC|" + /* https://msdn.microsoft.com/en-us/library/hh213226.aspx */ "CHOOSE|IIF|" + /* https://msdn.microsoft.com/en-us/library/ms177516.aspx */ "ABS|ACOS|ASIN|ATAN|ATN2|CEILING|COS|COT|DEGREES|EXP|FLOOR|LOG|LOG10|PI|POWER|RADIANS|RAND|ROUND|SIGN|SIN|SQRT|SQUARE|TAN|" + /* https://msdn.microsoft.com/en-us/library/ms187812.aspx */ "@@PROCID|APPLOCK_MODE|APPLOCK_TEST|APP_NAME|ASSEMBLYPROPERTY|COLUMNPROPERTY|COL_LENGTH|COL_NAME|DATABASEPROPERTYEX|DATABASE_PRINCIPAL_ID|DB_ID|DB_NAME|FILEGROUPPROPERTY|FILEGROUP_ID|FILEGROUP_NAME|FILEPROPERTY|FILE_ID|FILE_IDEX|FILE_NAME|FULLTEXTCATALOGPROPERTY|FULLTEXTSERVICEPROPERTY|INDEXKEY_PROPERTY|INDEXPROPERTY|INDEX_COL|OBJECTPROPERTY|OBJECTPROPERTYEX|OBJECT_DEFINITION|OBJECT_ID|OBJECT_NAME|OBJECT_SCHEMA_NAME|ORIGINAL_DB_NAME|PARSENAME|SCHEMA_ID|SCHEMA_NAME|SCOPE_IDENTITY|SERVERPROPERTY|STATS_DATE|TYPEPROPERTY|TYPE_ID|TYPE_NAME|" + /* https://msdn.microsoft.com/en-us/library/ms186236.aspx */ "CERTENCODED|CERTPRIVATEKEY|CURRENT_USER|DATABASE_PRINCIPAL_ID|HAS_PERMS_BY_NAME|IS_MEMBER|IS_ROLEMEMBER|IS_SRVROLEMEMBER|ORIGINAL_LOGIN|PERMISSIONS|PWDCOMPARE|PWDENCRYPT|SCHEMA_ID|SCHEMA_NAME|SESSION_USER|SUSER_ID|SUSER_NAME|SUSER_SID|SUSER_SNAME|SYS.FN_BUILTIN_PERMISSIONS|SYS.FN_GET_AUDIT_FILE|SYS.FN_MY_PERMISSIONS|SYSTEM_USER|USER_ID|USER_NAME|" + /* https://msdn.microsoft.com/en-us/library/ms181984.aspx */ "ASCII|CHAR|CHARINDEX|CONCAT|DIFFERENCE|FORMAT|LEN|LOWER|LTRIM|NCHAR|PATINDEX|QUOTENAME|REPLACE|REPLICATE|REVERSE|RTRIM|SOUNDEX|SPACE|STR|STUFF|SUBSTRING|UNICODE|UPPER|" + /* https://msdn.microsoft.com/en-us/library/ms187786.aspx */ "$PARTITION|@@ERROR|@@IDENTITY|@@PACK_RECEIVED|@@ROWCOUNT|@@TRANCOUNT|BINARY_CHECKSUM|CHECKSUM|CONNECTIONPROPERTY|CONTEXT_INFO|CURRENT_REQUEST_ID|ERROR_LINE|ERROR_MESSAGE|ERROR_NUMBER|ERROR_PROCEDURE|ERROR_SEVERITY|ERROR_STATE|FORMATMESSAGE|GETANSINULL|GET_FILESTREAM_TRANSACTION_CONTEXT|HOST_ID|HOST_NAME|ISNULL|ISNUMERIC|MIN_ACTIVE_ROWVERSION|NEWID|NEWSEQUENTIALID|ROWCOUNT_BIG|XACT_STATE|" + /* https://msdn.microsoft.com/en-us/library/ms177520.aspx */ "@@CONNECTIONS|@@CPU_BUSY|@@IDLE|@@IO_BUSY|@@PACKET_ERRORS|@@PACK_RECEIVED|@@PACK_SENT|@@TIMETICKS|@@TOTAL_ERRORS|@@TOTAL_READ|@@TOTAL_WRITE|FN_VIRTUALFILESTATS|" + /* https://msdn.microsoft.com/en-us/library/ms188353.aspx */ "PATINDEX|TEXTPTR|TEXTVALID|" + /* logical */ "GREATEST|LEAST|" + /* time series functions */ "GENERATE_SERIES|DATE_BUCKET|" + /* JSON functions */ "JSON_ARRAY|JSON_OBJECT|JSON_PATH_EXISTS|ISJSON|" + /* window functions */ "FIRST_VALUE|LAST_VALUE|" + /* other */ "COALESCE|NULLIF" ); // https://msdn.microsoft.com/en-us/library/ms187752.aspx var dataTypes = ("BIGINT|BINARY|BIT|CHAR|CURSOR|DATE|DATETIME|DATETIME2|DATETIMEOFFSET|DECIMAL|FLOAT|HIERARCHYID|IMAGE|INTEGER|INT|MONEY|NCHAR|NTEXT|NUMERIC|NVARCHAR|REAL|SMALLDATETIME|SMALLINT|SMALLMONEY|SQL_VARIANT|TABLE|TEXT|TIME|TIMESTAMP|TINYINT|UNIQUEIDENTIFIER|VARBINARY|VARCHAR|XML"); //https://msdn.microsoft.com/en-us/library/ms176007.aspx (these are lower case!) var builtInStoredProcedures = "sp_addextendedproc|sp_addextendedproperty|sp_addmessage|sp_addtype|sp_addumpdevice|sp_add_data_file_recover_suspect_db|sp_add_log_file_recover_suspect_db|sp_altermessage|sp_attach_db|sp_attach_single_file_db|sp_autostats|sp_bindefault|sp_bindrule|sp_bindsession|sp_certify_removable|sp_clean_db_file_free_space|sp_clean_db_free_space|sp_configure|sp_control_plan_guide|sp_createstats|sp_create_plan_guide|sp_create_plan_guide_from_handle|sp_create_removable|sp_cycle_errorlog|sp_datatype_info|sp_dbcmptlevel|sp_dbmmonitoraddmonitoring|sp_dbmmonitorchangealert|sp_dbmmonitorchangemonitoring|sp_dbmmonitordropalert|sp_dbmmonitordropmonitoring|sp_dbmmonitorhelpalert|sp_dbmmonitorhelpmonitoring|sp_dbmmonitorresults|sp_db_increased_partitions|sp_delete_backuphistory|sp_depends|sp_describe_first_result_set|sp_describe_undeclared_parameters|sp_detach_db|sp_dropdevice|sp_dropextendedproc|sp_dropextendedproperty|sp_dropmessage|sp_droptype|sp_execute|sp_executesql|sp_getapplock|sp_getbindtoken|sp_help|sp_helpconstraint|sp_helpdb|sp_helpdevice|sp_helpextendedproc|sp_helpfile|sp_helpfilegroup|sp_helpindex|sp_helplanguage|sp_helpserver|sp_helpsort|sp_helpstats|sp_helptext|sp_helptrigger|sp_indexoption|sp_invalidate_textptr|sp_lock|sp_monitor|sp_prepare|sp_prepexec|sp_prepexecrpc|sp_procoption|sp_recompile|sp_refreshview|sp_releaseapplock|sp_rename|sp_renamedb|sp_resetstatus|sp_sequence_get_range|sp_serveroption|sp_setnetname|sp_settriggerorder|sp_spaceused|sp_tableoption|sp_unbindefault|sp_unbindrule|sp_unprepare|sp_updateextendedproperty|sp_updatestats|sp_validname|sp_who|sys.sp_merge_xtp_checkpoint_files|sys.sp_xtp_bind_db_resource_pool|sys.sp_xtp_checkpoint_force_garbage_collection|sys.sp_xtp_control_proc_exec_stats|sys.sp_xtp_control_query_exec_stats|sys.sp_xtp_unbind_db_resource_pool"; // https://msdn.microsoft.com/en-us/library/ms189822.aspx var keywords = "ABSOLUTE|ACTION|ADA|ADD|ADMIN|AFTER|AGGREGATE|ALIAS|ALL|ALLOCATE|ALTER|AND|ANY|ARE|ARRAY|AS|ASC|ASENSITIVE|ASSERTION|ASYMMETRIC|AT|ATOMIC|AUTHORIZATION|BACKUP|BEFORE|BEGIN|BETWEEN|BIT_LENGTH|BLOB|BOOLEAN|BOTH|BREADTH|BREAK|BROWSE|BULK|BY|CALL|CALLED|CARDINALITY|CASCADE|CASCADED|CASE|CATALOG|CHARACTER|CHARACTER_LENGTH|CHAR_LENGTH|CHECK|CHECKPOINT|CLASS|CLOB|CLOSE|CLUSTERED|COALESCE|COLLATE|COLLATION|COLLECT|COLUMN|COMMIT|COMPLETION|COMPUTE|CONDITION|CONNECT|CONNECTION|CONSTRAINT|CONSTRAINTS|CONSTRUCTOR|CONTAINS|CONTAINSTABLE|CONTINUE|CORR|CORRESPONDING|COVAR_POP|COVAR_SAMP|CREATE|CROSS|CUBE|CUME_DIST|CURRENT|CURRENT_CATALOG|CURRENT_DATE|CURRENT_DEFAULT_TRANSFORM_GROUP|CURRENT_PATH|CURRENT_ROLE|CURRENT_SCHEMA|CURRENT_TIME|CURRENT_TRANSFORM_GROUP_FOR_TYPE|CYCLE|DATA|DATABASE|DBCC|DEALLOCATE|DEC|DECLARE|DEFAULT|DEFERRABLE|DEFERRED|DELETE|DENY|DEPTH|DEREF|DESC|DESCRIBE|DESCRIPTOR|DESTROY|DESTRUCTOR|DETERMINISTIC|DIAGNOSTICS|DICTIONARY|DISCONNECT|DISK|DISTINCT|DISTRIBUTED|DOMAIN|DOUBLE|DROP|DUMP|DYNAMIC|EACH|ELEMENT|ELSE|END|END-EXEC|EQUALS|ERRLVL|ESCAPE|EVERY|EXCEPT|EXCEPTION|EXEC|EXECUTE|EXISTS|EXIT|EXTERNAL|EXTRACT|FETCH|FILE|FILLFACTOR|FILTER|FIRST|FOR|FOREIGN|FORTRAN|FOUND|FREE|FREETEXT|FREETEXTTABLE|FROM|FULL|FULLTEXTTABLE|FUNCTION|FUSION|GENERAL|GET|GLOBAL|GO|GOTO|GRANT|GROUP|HAVING|HOLD|HOLDLOCK|HOST|HOUR|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IGNORE|IMMEDIATE|IN|INCLUDE|INDEX|INDICATOR|INITIALIZE|INITIALLY|INNER|INOUT|INPUT|INSENSITIVE|INSERT|INTEGER|INTERSECT|INTERSECTION|INTERVAL|INTO|IS|ISOLATION|ITERATE|JOIN|KEY|KILL|LANGUAGE|LARGE|LAST|LATERAL|LEADING|LESS|LEVEL|LIKE|LIKE_REGEX|LIMIT|LINENO|LN|LOAD|LOCAL|LOCALTIME|LOCALTIMESTAMP|LOCATOR|MAP|MATCH|MEMBER|MERGE|METHOD|MINUTE|MOD|MODIFIES|MODIFY|MODULE|MULTISET|NAMES|NATIONAL|NATURAL|NCLOB|NEW|NEXT|NO|NOCHECK|NONCLUSTERED|NONE|NORMALIZE|NOT|NULL|NULLIF|OBJECT|OCCURRENCES_REGEX|OCTET_LENGTH|OF|OFF|OFFSETS|OLD|ON|ONLY|OPEN|OPERATION|OPTION|OR|ORDER|ORDINALITY|OUT|OUTER|OUTPUT|OVER|OVERLAPS|OVERLAY|PAD|PARAMETER|PARAMETERS|PARTIAL|PARTITION|PASCAL|PATH|PERCENT|PERCENTILE_CONT|PERCENTILE_DISC|PERCENT_RANK|PIVOT|PLAN|POSITION|POSITION_REGEX|POSTFIX|PRECISION|PREFIX|PREORDER|PREPARE|PRESERVE|PRIMARY|PRINT|PRIOR|PRIVILEGES|PROC|PROCEDURE|PUBLIC|RAISERROR|RANGE|READ|READS|READTEXT|RECONFIGURE|RECURSIVE|REF|REFERENCES|REFERENCING|REGR_AVGX|REGR_AVGY|REGR_COUNT|REGR_INTERCEPT|REGR_R2|REGR_SLOPE|REGR_SXX|REGR_SXY|REGR_SYY|RELATIVE|RELEASE|REPLICATION|RESTORE|RESTRICT|RESULT|RETURN|RETURNS|REVERT|REVOKE|ROLE|ROLLBACK|ROLLUP|ROUTINE|ROW|ROWCOUNT|ROWGUIDCOL|ROWS|RULE|SAVE|SAVEPOINT|SCHEMA|SCOPE|SCROLL|SEARCH|SECOND|SECTION|SECURITYAUDIT|SELECT|SEMANTICKEYPHRASETABLE|SEMANTICSIMILARITYDETAILSTABLE|SEMANTICSIMILARITYTABLE|SENSITIVE|SEQUENCE|SESSION|SET|SETS|SETUSER|SHUTDOWN|SIMILAR|SIZE|SOME|SPECIFIC|SPECIFICTYPE|SQL|SQLCA|SQLCODE|SQLERROR|SQLEXCEPTION|SQLSTATE|SQLWARNING|START|STATE|STATEMENT|STATIC|STATISTICS|STDDEV_POP|STDDEV_SAMP|STRUCTURE|SUBMULTISET|SUBSTRING_REGEX|STRING_SPLIT|SYMMETRIC|SYSTEM|TABLESAMPLE|TEMPORARY|TERMINATE|TEXTSIZE|THAN|THEN|TIMEZONE_HOUR|TIMEZONE_MINUTE|TO|TOP|TRAILING|TRAN|TRANSACTION|TRANSLATE|TRANSLATE_REGEX|TRANSLATION|TREAT|TRIGGER|TRIM|TRUNCATE|TSEQUAL|UESCAPE|UNDER|UNION|UNIQUE|UNKNOWN|UNNEST|UNPIVOT|UPDATE|UPDATETEXT|USAGE|USE|USER|USING|VALUE|VALUES|VARIABLE|VARYING|VAR_POP|VAR_SAMP|VIEW|WAITFOR|WHEN|WHENEVER|WHERE|WHILE|WIDTH_BUCKET|WINDOW|WITH|WITHIN|WITHIN GROUP|WITHOUT|WORK|WRITE|WRITETEXT|XMLAGG|XMLATTRIBUTES|XMLBINARY|XMLCAST|XMLCOMMENT|XMLCONCAT|XMLDOCUMENT|XMLELEMENT|XMLEXISTS|XMLFOREST|XMLITERATE|XMLNAMESPACES|XMLPARSE|XMLPI|XMLQUERY|XMLSERIALIZE|XMLTABLE|XMLTEXT|XMLVALIDATE|ZONE"; // Microsoft's keyword list is missing a lot of things that are located on various other pages // https://msdn.microsoft.com/en-us/library/ms187373.aspx, https://msdn.microsoft.com/en-us/library/ms181714.aspx keywords += "|KEEPIDENTITY|KEEPDEFAULTS|IGNORE_CONSTRAINTS|IGNORE_TRIGGERS|XLOCK|FORCESCAN|FORCESEEK|HOLDLOCK|NOLOCK|NOWAIT|PAGLOCK|READCOMMITTED|READCOMMITTEDLOCK|READPAST|READUNCOMMITTED|REPEATABLEREAD|ROWLOCK|SERIALIZABLE|SNAPSHOT|SPATIAL_WINDOW_MAX_CELLS|TABLOCK|TABLOCKX|UPDLOCK|XLOCK|IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX|EXPAND|VIEWS|FAST|FORCE|KEEP|KEEPFIXED|MAXDOP|MAXRECURSION|OPTIMIZE|PARAMETERIZATION|SIMPLE|FORCED|RECOMPILE|ROBUST|PLAN|SPATIAL_WINDOW_MAX_CELLS|NOEXPAND|HINT"; // https://msdn.microsoft.com/en-us/library/ms173815.aspx keywords += "|LOOP|HASH|MERGE|REMOTE"; // https://msdn.microsoft.com/en-us/library/ms175976.aspx keywords += "|TRY|CATCH|THROW"; // highlighted words in SSMS that I'm not even sure where they come from keywords += "|TYPE"; //remove specific built in types from keyword list keywords = keywords.split('|'); keywords = keywords.filter(function(value, index, self) { return logicalOperators.split('|').indexOf(value) === -1 && builtinFunctions.split('|').indexOf(value) === -1 && dataTypes.split('|').indexOf(value) === -1; }); keywords = keywords.sort().join('|'); var keywordMapper = this.createKeywordMapper({ "constant.language": logicalOperators, "storage.type": dataTypes, "support.function": builtinFunctions, "support.storedprocedure": builtInStoredProcedures, "keyword": keywords }, "identifier", true); //https://msdn.microsoft.com/en-us/library/ms190356.aspx var setStatements = "SET ANSI_DEFAULTS|SET ANSI_NULLS|SET ANSI_NULL_DFLT_OFF|SET ANSI_NULL_DFLT_ON|SET ANSI_PADDING|SET ANSI_WARNINGS|SET ARITHABORT|SET ARITHIGNORE|SET CONCAT_NULL_YIELDS_NULL|SET CURSOR_CLOSE_ON_COMMIT|SET DATEFIRST|SET DATEFORMAT|SET DEADLOCK_PRIORITY|SET FIPS_FLAGGER|SET FMTONLY|SET FORCEPLAN|SET IDENTITY_INSERT|SET IMPLICIT_TRANSACTIONS|SET LANGUAGE|SET LOCK_TIMEOUT|SET NOCOUNT|SET NOEXEC|SET NUMERIC_ROUNDABORT|SET OFFSETS|SET PARSEONLY|SET QUERY_GOVERNOR_COST_LIMIT|SET QUOTED_IDENTIFIER|SET REMOTE_PROC_TRANSACTIONS|SET ROWCOUNT|SET SHOWPLAN_ALL|SET SHOWPLAN_TEXT|SET SHOWPLAN_XML|SET STATISTICS IO|SET STATISTICS PROFILE|SET STATISTICS TIME|SET STATISTICS XML|SET TEXTSIZE|SET XACT_ABORT".split('|'); var isolationLevels = "READ UNCOMMITTED|READ COMMITTED|REPEATABLE READ|SNAPSHOP|SERIALIZABLE".split('|'); for (var i = 0; i < isolationLevels.length; i++) { setStatements.push('SET TRANSACTION ISOLATION LEVEL ' + isolationLevels[i]); } this.$rules = { start: [{ token: "string.start", regex: "'", next: [{ token: "constant.language.escape", regex: /''/ }, { token: "string.end", next: "start", regex: "'" }, { defaultToken: "string" }] }, DocCommentHighlightRules.getStartRule("doc-start"), { token: "comment", regex: "--.*$" }, { token: "comment", start: "/\\*", end: "\\*/" }, { token: "constant.numeric", // float regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token: keywordMapper, regex: "@{0,2}[a-zA-Z_$][a-zA-Z0-9_$]*\\b(?!])" //up to 2 @symbols for some built in functions }, { token: "constant.class", regex: "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { //https://msdn.microsoft.com/en-us/library/ms174986.aspx token: "keyword.operator", regex: "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=|\\*" }, { token: "paren.lparen", regex: "[\\(]" }, { token: "paren.rparen", regex: "[\\)]" }, { token: "punctuation", regex: ",|;" }, { token: "text", regex: "\\s+" }], comment: [ DocCommentHighlightRules.getTagRule(), { token: "comment", regex: "\\*\\/", next: "start" }, { defaultToken: "comment", caseInsensitive: true }] }; //add each set statment as regex at top of rules so that they are processed first because they require multiple words //note: this makes the statements not match if they are not upper case.. which is not ideal but I don't know of an easy way to fix this for (var i = 0; i < setStatements.length; i++) { this.$rules.start.unshift({ token: "set.statement", regex: setStatements[i] }); } this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]); this.normalizeRules(); //prepare custom keyword completions used by mode to override default completor //this allows for custom 'meta' and proper case of completions var completions = []; var addCompletions = function(arr, meta) { arr.forEach(function(v) { completions.push({ name: v, value: v, score: 0, meta: meta }); }); }; addCompletions(builtInStoredProcedures.split('|'), 'procedure'); addCompletions(logicalOperators.split('|'), 'operator'); addCompletions(builtinFunctions.split('|'), 'function'); addCompletions(dataTypes.split('|'), 'type'); addCompletions(setStatements, 'statement'); addCompletions(keywords.split('|'), 'keyword'); this.completions = completions; }; oop.inherits(SqlServerHighlightRules, TextHighlightRules); exports.SqlHighlightRules = SqlServerHighlightRules; ================================================ FILE: src/mode/stylus.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var StylusHighlightRules = require("./stylus_highlight_rules").StylusHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = StylusHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/stylus"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/stylus_highlight_rules.js ================================================ /* THIS FILE WAS AUTOGENERATED BY Stylus.tmlanguage (UUID: 60519324-6A3A-4382-9E0B-546993A3869A) */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CssHighlightRules = require("./css_highlight_rules"); var StylusHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var keywordMapper = this.createKeywordMapper({ "support.type": CssHighlightRules.supportType, "support.function": CssHighlightRules.supportFunction, "support.constant": CssHighlightRules.supportConstant, "support.constant.color": CssHighlightRules.supportConstantColor, "support.constant.fonts": CssHighlightRules.supportConstantFonts }, "text", true); this.$rules = { start: [ { token : "comment", regex : /\/\/.*$/ }, { token : "comment", // multi line comment regex : /\/\*/, next : "comment" }, { token: ["entity.name.function.stylus", "text"], regex: "^([-a-zA-Z_][-\\w]*)?(\\()" }, { token: ["entity.other.attribute-name.class.stylus"], regex: "\\.-?[_a-zA-Z]+[_a-zA-Z0-9-]*" }, { token: ["entity.language.stylus"], regex: "^ *&" }, { token: ["variable.language.stylus"], regex: "(arguments)" }, { token: ["keyword.stylus"], regex: "@[-\\w]+" }, { token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"], regex : CssHighlightRules.pseudoElements }, { token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"], regex : CssHighlightRules.pseudoClasses }, { token: ["entity.name.tag.stylus"], regex: "(?:\\b)(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|datalist|dd|del|details|dfn|dialog|div|dl|dt|em|eventsource|fieldset|figure|figcaption|footer|form|frame|frameset|(?:h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)(?:\\b)" }, { token: "constant.numeric", // hex6 color regex: "#[a-fA-F0-9]{6}" }, { token: "constant.numeric", // hex3 color regex: "#[a-fA-F0-9]{3}" }, { token: ["punctuation.definition.entity.stylus", "entity.other.attribute-name.id.stylus"], regex: "(#)([a-zA-Z][a-zA-Z0-9_-]*)" }, { token: "meta.vendor-prefix.stylus", regex: "-webkit-|-moz\\-|-ms-|-o-" }, { token: "keyword.control.stylus", regex: "(?:!important|for|in|return|true|false|null|if|else|unless|return)\\b" }, { token: "keyword.operator.stylus", regex: "!|~|\\+|-|(?:\\*)?\\*|\\/|%|(?:\\.)\\.\\.|<|>|(?:=|:|\\?|\\+|-|\\*|\\/|%|<|>)?=|!=" }, { token: "keyword.operator.stylus", regex: "(?:in|is(?:nt)?|not)\\b" }, { token : "string", regex : "'(?=.)", next : "qstring" }, { token : "string", regex : '"(?=.)', next : "qqstring" }, { token : "constant.numeric", regex : CssHighlightRules.numRe }, { token : "keyword", regex : "(?:ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\\b" }, { token : keywordMapper, regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "qqstring" : [ { token : "string", regex : '[^"\\\\]+' }, { token : "string", regex : "\\\\$", next : "qqstring" }, { token : "string", regex : '"|$', next : "start" } ], "qstring" : [ { token : "string", regex : "[^'\\\\]+" }, { token : "string", regex : "\\\\$", next : "qstring" }, { token : "string", regex : "'|$", next : "start" } ] }; }; oop.inherits(StylusHighlightRules, TextHighlightRules); exports.StylusHighlightRules = StylusHighlightRules; ================================================ FILE: src/mode/svg.js ================================================ "use strict"; var oop = require("../lib/oop"); var XmlMode = require("./xml").Mode; var JavaScriptMode = require("./javascript").Mode; var SvgHighlightRules = require("./svg_highlight_rules").SvgHighlightRules; var MixedFoldMode = require("./folding/mixed").FoldMode; var XmlFoldMode = require("./folding/xml").FoldMode; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { XmlMode.call(this); this.HighlightRules = SvgHighlightRules; this.createModeDelegates({ "js-": JavaScriptMode }); this.foldingRules = new MixedFoldMode(new XmlFoldMode(), { "js-": new CStyleFoldMode() }); }; oop.inherits(Mode, XmlMode); (function() { this.getNextLineIndent = function(state, line, tab) { return this.$getIndent(line); }; this.$id = "ace/mode/svg"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/svg_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; var SvgHighlightRules = function() { XmlHighlightRules.call(this); this.embedTagRules(JavaScriptHighlightRules, "js-", "script"); this.normalizeRules(); }; oop.inherits(SvgHighlightRules, XmlHighlightRules); exports.SvgHighlightRules = SvgHighlightRules; ================================================ FILE: src/mode/swift.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var HighlightRules = require("./swift_highlight_rules").HighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = HighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/", nestable: true}; this.$id = "ace/mode/swift"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/swift_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SwiftHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "variable.language": "", "keyword": "__COLUMN__|__FILE__|__FUNCTION__|__LINE__" + "|as|associativity|break|case|class|continue|default|deinit|didSet" + "|do|dynamicType|else|enum|extension|fallthrough|for|func|get|if|import" + "|in|infix|init|inout|is|left|let|let|mutating|new|none|nonmutating" + "|operator|override|postfix|precedence|prefix|protocol|return|right" + "|safe|Self|self|set|struct|subscript|switch|Type|typealias" + "|unowned|unsafe|var|weak|where|while|willSet" + "|convenience|dynamic|final|infix|lazy|mutating|nonmutating|optional|override|postfix" + "|prefix|required|static|guard|defer", "storage.type": "bool|double|Double" + "|extension|float|Float|int|Int|open|internal|fileprivate|private|public|string|String", "constant.language": "false|Infinity|NaN|nil|no|null|null|off|on|super|this|true|undefined|yes", "support.function": "" }, "identifier"); function string(start, options) { var nestable = options.nestable || options.interpolation; var interpStart = options.interpolation && options.interpolation.nextState || "start"; var mainRule = { regex: start + (options.multiline ? "" : "(?=.)"), token: "string.start" }; var nextState = [ options.escape && { regex: options.escape, token: "character.escape" }, options.interpolation && { token : "paren.quasi.start", regex : lang.escapeRegExp(options.interpolation.lead + options.interpolation.open), push : interpStart }, options.error && { regex: options.error, token: "error.invalid" }, { regex: start + (options.multiline ? "" : "|$"), token: "string.end", next: nestable ? "pop" : "start" }, { defaultToken: "string" } ].filter(Boolean); if (nestable) mainRule.push = nextState; else mainRule.next = nextState; if (!options.interpolation) return mainRule; var open = options.interpolation.open; var close = options.interpolation.close; var counter = { regex: "[" + lang.escapeRegExp(open + close) + "]", onMatch: function(val, state, stack) { this.next = val == open ? this.nextState : ""; if (val == open && stack.length) { stack.unshift("start", state); return "paren"; } if (val == close && stack.length) { stack.shift(); this.next = stack.shift(); if (this.next.indexOf("string") != -1) return "paren.quasi.end"; } return val == open ? "paren.lparen" : "paren.rparen"; }, nextState: interpStart }; return [counter, mainRule]; } function comments() { return [{ token : "comment", regex : /\/\//, next : [ DocCommentHighlightRules.getTagRule(), {token : "comment", regex : "$|^", next: "start"}, {defaultToken : "comment", caseInsensitive: true} ] }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment.start", regex : /\/\*/, stateName: "nested_comment", push : [ DocCommentHighlightRules.getTagRule(), {token : "comment.start", regex : /\/\*/, push: "nested_comment"}, {token : "comment.end", regex : "\\*\\/", next : "pop"}, {defaultToken : "comment", caseInsensitive: true} ] } ]; } this.$rules = { start: [ string('"""', { escape: /\\(?:[0\\tnr"']|u{[a-fA-F1-9]{0,8}})/, interpolation: {lead: "\\", open: "(", close: ")"}, error: /\\./, multiline: true }), string('"', { escape: /\\(?:[0\\tnr"']|u{[a-fA-F1-9]{0,8}})/, interpolation: {lead: "\\", open: "(", close: ")"}, error: /\\./, multiline: false }), comments(), { regex: /@[a-zA-Z_$][a-zA-Z_$\d\u0080-\ufffe]*/, token: "variable.parameter" }, { regex: /[a-zA-Z_$][a-zA-Z_$\d\u0080-\ufffe]*/, token: keywordMapper }, { token : "constant.numeric", regex : /[+-]?(?:0(?:b[01]+|o[0-7]+|x[\da-fA-F])|\d+(?:(?:\.\d*)?(?:[PpEe][+-]?\d+)?)\b)/ }, { token : "keyword.operator", regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, next : "start" }, { token : "punctuation.operator", regex : /[?:,;.]/, next : "start" }, { token : "paren.lparen", regex : /[\[({]/, next : "start" }, { token : "paren.rparen", regex : /[\])}]/ } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.normalizeRules(); }; oop.inherits(SwiftHighlightRules, TextHighlightRules); exports.HighlightRules = SwiftHighlightRules; exports.SwiftHighlightRules = SwiftHighlightRules; ================================================ FILE: src/mode/tcl.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var TclHighlightRules = require("./tcl_highlight_rules").TclHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = TclHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; 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.$id = "ace/mode/tcl"; this.snippetFileId = "ace/snippets/tcl"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/tcl_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TclHighlightRules = function() { //TODO var builtinFunctions = ""; this.$rules = { "start" : [ { token : "comment", regex : "#.*\\\\$", next : "commentfollow" }, { token : "comment", regex : "#.*$" }, { token : "support.function", regex : '[\\\\]$', next : "splitlineStart" }, { token : "text", regex : /\\(?:["{}\[\]$\\])/ }, { token : "text", // last value before command regex : '^|[^{][;][^}]|[/\r/]', next : "commandItem" }, { token : "string", // single line regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // multi line """ string start regex : '[ ]*["]', next : "qqstring" }, { token : "variable.instance", regex : "[$]", next : "variable" }, { token : "support.function", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::" }, { token : "identifier", regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "paren.lparen", regex : "[[{]", next : "commandItem" }, { token : "paren.lparen", regex : "[(]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "commandItem" : [ { token : "comment", regex : "#.*\\\\$", next : "commentfollow" }, { token : "comment", regex : "#.*$", next : "start" }, { token : "string", // single line regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "variable.instance", regex : "[$]", next : "variable" }, { token : "support.function", regex : "(?:[:][:])[a-zA-Z0-9_/]+(?:[:][:])", next : "commandItem" }, { token : "support.function", regex : "[a-zA-Z0-9_/]+(?:[:][:])", next : "commandItem" }, { token : "support.function", regex : "(?:[:][:])", next : "commandItem" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "paren.lparen", regex : "[[({]" }, { token : "support.function", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::" }, { token : "keyword", regex : "[a-zA-Z0-9_/]+", next : "start" } ], "commentfollow" : [ { token : "comment", regex : ".*\\\\$", next : "commentfollow" }, { token : "comment", regex : '.+', next : "start" } ], "splitlineStart" : [ { token : "text", regex : "^.", next : "start" }], "variable" : [ { token : "variable.instance", // variable tcl regex : "[a-zA-Z_\\d]+(?:[(][a-zA-Z_\\d]+[)])?", next : "start" }, { token : "variable.instance", // variable tcl with braces regex : "{?[a-zA-Z_\\d]+}?", next : "start" }], "qqstring" : [ { token : "string", // multi line """ string end regex : '(?:[^\\\\]|\\\\.)*?["]', next : "start" }, { token : "string", regex : '.+' } ] }; }; oop.inherits(TclHighlightRules, TextHighlightRules); exports.TclHighlightRules = TclHighlightRules; ================================================ FILE: src/mode/terraform.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var TerraformHighlightRules = require("./terraform_highlight_rules").TerraformHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function () { TextMode.call(this); this.HighlightRules = TerraformHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function () { this.lineCommentStart = ["#", "//"]; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/terraform"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/terraform_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TerraformHighlightRules = function () { this.$rules = { "start": [ { token: ['storage.function.terraform'], regex: '\\b(output|resource|data|variable|module|export)\\b' }, { token: "variable.terraform", regex: "\\$\\s", push: [ { token: "keyword.terraform", regex: "(-var-file|-var)" }, { token: "variable.terraform", regex: "\\n|$", next: "pop" }, {include: "strings"}, {include: "variables"}, {include: "operators"}, {defaultToken: "text"} ] }, { token: "language.support.class", regex: "\\b(timeouts|provider|connection|provisioner|lifecycleprovider|atlas)\\b" }, { token: "singleline.comment.terraform", regex: '#.*$' }, { token: "singleline.comment.terraform", regex: '//.*$' }, { token: "multiline.comment.begin.terraform", regex: /\/\*/, push: "blockComment" }, { token: "storage.function.terraform", regex: "^\\s*(locals|terraform)\\s*{" }, { token: "paren.lparen", regex: "[[({]" }, { token: "paren.rparen", regex: "[\\])}]" }, {include: "constants"}, {include: "strings"}, {include: "operators"}, {include: "variables"} ], blockComment: [{ regex: /\*\//, token: "multiline.comment.end.terraform", next: "pop" }, { defaultToken: "comment" }], "constants": [ { token: "constant.language.terraform", regex: "\\b(true|false|yes|no|on|off|EOF)\\b" }, { token: "constant.numeric.terraform", regex: "(\\b([0-9]+)([kKmMgG]b?)?\\b)|(\\b(0x[0-9A-Fa-f]+)([kKmMgG]b?)?\\b)" } ], "variables": [ { token: ["variable.assignment.terraform", "keyword.operator"], regex: "\\b([a-zA-Z_]+)(\\s*=)" } ], "interpolated_variables": [ { token: "variable.terraform", regex: "\\b(var|self|count|path|local)\\b(?:\\.*[a-zA-Z_-]*)?" } ], "strings": [ { token: "punctuation.quote.terraform", regex: "'", push: [{ token: 'punctuation.quote.terraform', regex: "'", next: 'pop' }, {include: "escaped_chars"}, {defaultToken: 'string'}] }, { token: "punctuation.quote.terraform", regex: '"', push: [{ token: 'punctuation.quote.terraform', regex: '"', next: 'pop' }, {include: "interpolation"}, {include: "escaped_chars"}, {defaultToken: 'string'}] } ], "escaped_chars": [ { token: "constant.escaped_char.terraform", regex: "\\\\." } ], "operators": [ { token: "keyword.operator", regex: "\\?|:|==|!=|>|<|>=|<=|&&|\\|\\\||!|%|&|\\*|\\+|\\-|/|=" } ], "interpolation": [ {// TODO: double $ token: "punctuation.interpolated.begin.terraform", regex: "\\$?\\$\\{", push: [{ token: "punctuation.interpolated.end.terraform", regex: "\\}", next: "pop" }, {include: "interpolated_variables"}, {include: "operators"}, {include: "constants"}, {include: "strings"}, {include: "functions"}, {include: "parenthesis"}, {defaultToken: "punctuation"} ] } ], "functions": [ { token: "keyword.function.terraform", regex: "\\b(abs|basename|base64decode|base64encode|base64gzip|base64sha256|base64sha512|bcrypt|ceil|chomp|chunklist|cidrhost|cidrnetmask|cidrsubnet|coalesce|coalescelist|compact|concat|contains|dirname|distinct|element|file|floor|flatten|format|formatlist|indent|index|join|jsonencode|keys|length|list|log|lookup|lower|map|matchkeys|max|merge|min|md5|pathexpand|pow|replace|rsadecrypt|sha1|sha256|sha512|signum|slice|sort|split|substr|timestamp|timeadd|title|transpose|trimspace|upper|urlencode|uuid|values|zipmap)\\b" } ], "parenthesis": [ { token: "paren.lparen", regex: "\\[" }, { token: "paren.rparen", regex: "\\]" } ] }; this.normalizeRules(); }; oop.inherits(TerraformHighlightRules, TextHighlightRules); exports.TerraformHighlightRules = TerraformHighlightRules; ================================================ FILE: src/mode/tex.js ================================================ /* * tex.js * * Copyright (C) 2009-11 by RStudio, Inc. * * The Initial Developer of the Original Code is * Ajax.org B.V. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * 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 * */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function(suppressHighlighting) { if (suppressHighlighting) this.HighlightRules = TextHighlightRules; else this.HighlightRules = TexHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "%"; this.getNextLineIndent = function(state, line, tab) { return this.$getIndent(line); }; this.allowAutoInsert = function() { return false; }; this.$id = "ace/mode/tex"; this.snippetFileId = "ace/snippets/tex"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/tex_highlight_rules.js ================================================ /* * tex_highlight_rules.js * * Copyright (C) 2009-11 by RStudio, Inc. * * The Initial Developer of the Original Code is * Ajax.org B.V. * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * 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 * */ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TexHighlightRules = function(textClass) { if (!textClass) textClass = "text"; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : "%.*$" }, { token : textClass, // non-command regex : "\\\\[$&%#\\{\\}]" }, { token : "keyword", // command regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b", next : "nospell" }, { token : "keyword", // command regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])" }, { // Obviously these are neither keywords nor operators, but // labelling them as such was the easiest way to get them // to be colored distinctly from regular text token : "paren.keyword.operator", regex : "[[({]" }, { // Obviously these are neither keywords nor operators, but // labelling them as such was the easiest way to get them // to be colored distinctly from regular text token : "paren.keyword.operator", regex : "[\\])}]" }, { token : textClass, regex : "\\s+" } ], // This mode is necessary to prevent spell checking, but to keep the // same syntax highlighting behavior. The list of commands comes from // Texlipse. "nospell" : [ { token : "comment", regex : "%.*$", next : "start" }, { token : "nospell." + textClass, // non-command regex : "\\\\[$&%#\\{\\}]" }, { token : "keyword", // command regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b" }, { token : "keyword", // command regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])", next : "start" }, { token : "paren.keyword.operator", regex : "[[({]" }, { token : "paren.keyword.operator", regex : "[\\])]" }, { token : "paren.keyword.operator", regex : "}", next : "start" }, { token : "nospell." + textClass, regex : "\\s+" }, { token : "nospell." + textClass, regex : "\\w+" } ] }; }; oop.inherits(TexHighlightRules, TextHighlightRules); exports.TexHighlightRules = TexHighlightRules; ================================================ FILE: src/mode/text.js ================================================ "use strict"; /** * @typedef {import("../../ace-internal").Ace.SyntaxMode} SyntaxMode */ var config = require("../config"); var Tokenizer = require("../tokenizer").Tokenizer; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var unicode = require("../unicode"); var lang = require("../lib/lang"); var TokenIterator = require("../token_iterator").TokenIterator; var Range = require("../range").Range; var Mode; Mode = function() { this.HighlightRules = TextHighlightRules; }; (function() { this.$defaultBehaviour = new CstyleBehaviour(); this.tokenRe = new RegExp("^[" + unicode.wordChars + "\\$_]+", "g"); this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "\\$_]|\\s])+", "g"); /** * @this {SyntaxMode} */ this.getTokenizer = function() { if (!this.$tokenizer) { this.$highlightRules = this.$highlightRules || new this.HighlightRules(this.$highlightRuleConfig); this.$tokenizer = new Tokenizer(this.$highlightRules.getRules()); } return this.$tokenizer; }; this.lineCommentStart = ""; this.blockComment = ""; /** * @this {SyntaxMode} */ this.toggleCommentLines = function(state, session, startRow, endRow) { var doc = session.doc; var ignoreBlankLines = true; var shouldRemove = true; var minIndent = Infinity; var tabSize = session.getTabSize(); var insertAtTabStop = false; if (!this.lineCommentStart) { if (!this.blockComment) return false; /**@type {any}*/ var lineCommentStart = this.blockComment.start; var lineCommentEnd = this.blockComment.end; /**@type {any}*/ var regexpStart = new RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")"); var regexpEnd = new RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$"); var comment = function(line, i) { if (testRemove(line, i)) return; if (!ignoreBlankLines || /\S/.test(line)) { doc.insertInLine({row: i, column: line.length}, lineCommentEnd); doc.insertInLine({row: i, column: minIndent}, lineCommentStart); } }; var uncomment = function(line, i) { var m; if (m = line.match(regexpEnd)) doc.removeInLine(i, line.length - m[0].length, line.length); if (m = line.match(regexpStart)) doc.removeInLine(i, m[1].length, m[0].length); }; /**@type {any}*/ var testRemove = function(line, row) { if (regexpStart.test(line)) return true; var tokens = session.getTokens(row); for (var i = 0; i < tokens.length; i++) { if (tokens[i].type === "comment") return true; } }; } else { if (Array.isArray(this.lineCommentStart)) { /**@type {any}*/ var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join("|"); /**@type {any}*/ var lineCommentStart = this.lineCommentStart[0]; } else { var regexpStart = lang.escapeRegExp(this.lineCommentStart); /**@type {any}*/ var lineCommentStart = this.lineCommentStart; } regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?"); insertAtTabStop = session.getUseSoftTabs(); var uncomment = function(line, i) { var m = line.match(regexpStart); if (!m) return; var start = m[1].length, end = m[0].length; if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == " ") end--; doc.removeInLine(i, start, end); }; var commentWithSpace = lineCommentStart + " "; var comment = function(line, i) { if (!ignoreBlankLines || /\S/.test(line)) { if (shouldInsertSpace(line, minIndent, minIndent)) doc.insertInLine({row: i, column: minIndent}, commentWithSpace); else doc.insertInLine({row: i, column: minIndent}, lineCommentStart); } }; /**@type {any}*/ var testRemove = function(line, i) { return regexpStart.test(line); }; var shouldInsertSpace = function(line, before, after) { var spaces = 0; while (before-- && line.charAt(before) == " ") spaces++; if (spaces % tabSize != 0) return false; var spaces = 0; while (line.charAt(after++) == " ") spaces++; if (tabSize > 2) return spaces % tabSize != tabSize - 1; else return spaces % tabSize == 0; }; } function iter(fun) { for (var i = startRow; i <= endRow; i++) fun(doc.getLine(i), i); } var minEmptyLength = Infinity; iter(function(line, i) { var indent = line.search(/\S/); if (indent !== -1) { if (indent < minIndent) minIndent = indent; if (shouldRemove && !testRemove(line, i)) shouldRemove = false; } else if (minEmptyLength > line.length) { minEmptyLength = line.length; } }); if (minIndent == Infinity) { minIndent = minEmptyLength; ignoreBlankLines = false; shouldRemove = false; } if (insertAtTabStop && minIndent % tabSize != 0) minIndent = Math.floor(minIndent / tabSize) * tabSize; iter(shouldRemove ? uncomment : comment); }; /** * @this {SyntaxMode} */ this.toggleBlockComment = function(state, session, range, cursor) { var comment = this.blockComment; if (!comment) return; if (!comment.start && comment[0]) comment = comment[0]; var iterator = new TokenIterator(session, cursor.row, cursor.column); var token = iterator.getCurrentToken(); var sel = session.selection; var initialRange = session.selection.toOrientedRange(); var startRow, colDiff; if (token && /comment/.test(token.type)) { var startRange, endRange; while (token && /comment/.test(token.type)) { var i = token.value.indexOf(comment.start); if (i != -1) { var row = iterator.getCurrentTokenRow(); var column = iterator.getCurrentTokenColumn() + i; startRange = new Range(row, column, row, column + comment.start.length); break; } token = iterator.stepBackward(); } var iterator = new TokenIterator(session, cursor.row, cursor.column); var token = iterator.getCurrentToken(); while (token && /comment/.test(token.type)) { var i = token.value.indexOf(comment.end); if (i != -1) { var row = iterator.getCurrentTokenRow(); var column = iterator.getCurrentTokenColumn() + i; endRange = new Range(row, column, row, column + comment.end.length); break; } token = iterator.stepForward(); } if (endRange) session.remove(endRange); if (startRange) { session.remove(startRange); startRow = startRange.start.row; colDiff = -comment.start.length; } } else { colDiff = comment.start.length; startRow = range.start.row; session.insert(range.end, comment.end); session.insert(range.start, comment.start); } // todo: selection should have ended up in the right place automatically! if (initialRange.start.row == startRow) initialRange.start.column += colDiff; if (initialRange.end.row == startRow) initialRange.end.column += colDiff; session.selection.fromOrientedRange(initialRange); }; this.getNextLineIndent = function(state, line, tab) { return this.$getIndent(line); }; this.checkOutdent = function(state, line, input) { return false; }; this.autoOutdent = function(state, doc, row) { }; this.$getIndent = function(line) { return line.match(/^\s*/)[0]; }; this.createWorker = function(session) { return null; }; this.createModeDelegates = function (mapping) { this.$embeds = []; this.$modes = {}; for (let i in mapping) { if (mapping[i]) { var Mode = mapping[i]; var id = Mode.prototype.$id; var mode = config.$modes[id]; if (!mode) config.$modes[id] = mode = new Mode(); if (!config.$modes[i]) config.$modes[i] = mode; this.$embeds.push(i); this.$modes[i] = mode; } } var delegations = ["toggleBlockComment", "toggleCommentLines", "getNextLineIndent", "checkOutdent", "autoOutdent", "transformAction", "getCompletions"]; for (let i = 0; i < delegations.length; i++) { (function(scope) { var functionName = delegations[i]; var defaultHandler = scope[functionName]; scope[delegations[i]] = /** @this {import("../../ace-internal").Ace.SyntaxMode} */ function () { return this.$delegator(functionName, arguments, defaultHandler); }; }(this)); } }; /** * @this {SyntaxMode} */ this.$delegator = function(method, args, defaultHandler) { var state = args[0] || "start"; if (typeof state != "string") { if (Array.isArray(state[2])) { var language = state[2][state[2].length - 1]; var mode = this.$modes[language]; if (mode) return mode[method].apply(mode, [state[1]].concat([].slice.call(args, 1))); } state = state[0] || "start"; } for (var i = 0; i < this.$embeds.length; i++) { if (!this.$modes[this.$embeds[i]]) continue; var split = state.split(this.$embeds[i]); if (!split[0] && split[1]) { args[0] = split[1]; var mode = this.$modes[this.$embeds[i]]; return mode[method].apply(mode, args); } } var ret = defaultHandler.apply(this, args); return defaultHandler ? ret : undefined; }; /** * @this {SyntaxMode} */ this.transformAction = function(state, action, editor, session, param) { if (this.$behaviour) { var behaviours = this.$behaviour.getBehaviours(); for (var key in behaviours) { if (behaviours[key][action]) { var ret = behaviours[key][action].apply(this, arguments); if (ret) { return ret; } } } } }; /** * @this {SyntaxMode} */ this.getKeywords = function(append) { // this is for autocompletion to pick up regexp'ed keywords if (!this.completionKeywords) { var rules = this.$tokenizer["rules"]; var completionKeywords = []; for (var rule in rules) { var ruleItr = rules[rule]; for (var r = 0, l = ruleItr.length; r < l; r++) { if (typeof ruleItr[r].token === "string") { if (/keyword|support|storage/.test(ruleItr[r].token)) completionKeywords.push(ruleItr[r].regex); } else if (typeof ruleItr[r].token === "object") { for (var a = 0, aLength = ruleItr[r].token.length; a < aLength; a++) { if (/keyword|support|storage/.test(ruleItr[r].token[a])) { // drop surrounding parens var rule = ruleItr[r].regex.match(/\(.+?\)/g)[a]; completionKeywords.push(rule.substr(1, rule.length - 2)); } } } } } this.completionKeywords = completionKeywords; } // this is for highlighting embed rules, like HAML/Ruby or Obj-C/C if (!append) return this.$keywordList; return completionKeywords.concat(this.$keywordList || []); }; /** * @this {SyntaxMode} */ this.$createKeywordList = function() { if (!this.$highlightRules) this.getTokenizer(); return this.$keywordList = this.$highlightRules.$keywordList || []; }; /** * @this {SyntaxMode} */ this.getCompletions = function(state, session, pos, prefix) { var keywords = this.$keywordList || this.$createKeywordList(); return keywords.map(function(word) { return { name: word, value: word, score: 0, meta: "keyword" }; }); }; this.$id = "ace/mode/text"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/text_highlight_rules.js ================================================ "use strict"; const deepCopy = require("../lib/deep_copy").deepCopy; /**@type {(new() => Partial<import("../../ace-internal").Ace.HighlightRules>) & {prototype: import("../../ace-internal").Ace.HighlightRules}}*/ var TextHighlightRules; TextHighlightRules = function() { // regexp must not have capturing parentheses // regexps are ordered -> the first match is used this.$rules = { "start" : [{ token : "empty_line", regex : '^$' }, { defaultToken : "text" }] }; }; (function() { /** * @param {import("../../ace-internal").Ace.HighlightRulesMap} rules * @param {string} [prefix] * @this {import("../../ace-internal").Ace.HighlightRules} */ this.addRules = function(rules, prefix) { if (!prefix) { for (var key in rules) this.$rules[key] = rules[key]; return; } for (var key in rules) { var state = rules[key]; for (var i = 0; i < state.length; i++) { var rule = state[i]; if (rule.next || rule.onMatch) { if (typeof rule.next == "string") { if (rule.next.indexOf(prefix) !== 0) rule.next = prefix + rule.next; } if (rule.nextState && rule.nextState.indexOf(prefix) !== 0) rule.nextState = prefix + rule.nextState; } } this.$rules[prefix + key] = state; } }; /** * @returns {import("../../ace-internal").Ace.HighlightRulesMap} * @this {import("../../ace-internal").Ace.HighlightRules} */ this.getRules = function() { return this.$rules; }; /** * @param HighlightRules * @param prefix * @param escapeRules * @param states * @param append * @this {import("../../ace-internal").Ace.HighlightRules} */ this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) { var embedRules = typeof HighlightRules == "function" ? new HighlightRules().getRules() : HighlightRules; if (states) { for (var i = 0; i < states.length; i++) states[i] = prefix + states[i]; } else { states = []; for (var key in embedRules) states.push(prefix + key); } this.addRules(embedRules, prefix); if (escapeRules) { var addRules = Array.prototype[append ? "push" : "unshift"]; for (var i = 0; i < states.length; i++) addRules.apply(this.$rules[states[i]], deepCopy(escapeRules)); } if (!this.$embeds) this.$embeds = []; this.$embeds.push(prefix); }; /** * @this {import("../../ace-internal").Ace.HighlightRules} */ this.getEmbeds = function() { return this.$embeds; }; var pushState = function(currentState, stack) { if (currentState != "start" || stack.length) stack.unshift(this.nextState, currentState); return this.nextState; }; var popState = function(currentState, stack) { // if (stack[0] === currentState) stack.shift(); return stack.shift() || "start"; }; /** * @this {import("../../ace-internal").Ace.HighlightRules} */ this.normalizeRules = function() { var id = 0; var rules = this.$rules; function processState(key) { var state = rules[key]; state["processed"] = true; for (var i = 0; i < state.length; i++) { var rule = state[i]; var toInsert = null; if (Array.isArray(rule)) { toInsert = rule; // @ts-ignore rule = {}; } if (!rule.regex && rule.start) { rule.regex = rule.start; if (!rule.next) rule.next = []; rule.next.push({ defaultToken: rule.token }, { token: rule.token + ".end", regex: rule.end || rule.start, next: "pop" }); rule.token = rule.token + ".start"; rule.push = true; } var next = rule.next || rule.push; if (next && Array.isArray(next)) { var stateName = rule.stateName; if (!stateName) { stateName = rule.token; if (typeof stateName != "string") stateName = stateName[0] || ""; if (rules[stateName]) stateName += id++; } rules[stateName] = next; rule.next = stateName; processState(stateName); } else if (next == "pop") { rule.next = popState; } if (rule.push) { rule.nextState = rule.next || rule.push; rule.next = pushState; delete rule.push; } if (rule.rules) { for (var r in rule.rules) { if (rules[r]) { if (rules[r].push) rules[r].push.apply(rules[r], rule.rules[r]); } else { rules[r] = rule.rules[r]; } } } var includeName = typeof rule == "string" ? rule : rule.include; if (includeName) { if (includeName === "$self") includeName = "start"; if (Array.isArray(includeName)) toInsert = includeName.map(function(x) { return rules[x]; }); else toInsert = rules[includeName]; } if (toInsert) { /** * @type{any[]} */ // @ts-ignore var args = [i, 1].concat(toInsert); if (rule.noEscape) args = args.filter(function(x) {return !x.next;}); state.splice.apply(state, args); // skip included rules since they are already processed //i += args.length - 3; i--; } if (rule.keywordMap) { rule.token = this.createKeywordMapper( rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive ); delete rule.defaultToken; } } } Object.keys(rules).forEach(processState, this); }; this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) { var keywords = Object.create(null); this.$keywordList = []; Object.keys(map).forEach(function(className) { var a = map[className]; var list = a.split(splitChar || "|"); for (var i = list.length; i--; ) { var word = list[i]; this.$keywordList.push(word); if (ignoreCase) word = word.toLowerCase(); keywords[word] = className; } }, this); map = null; return ignoreCase ? function(value) {return keywords[value.toLowerCase()] || defaultToken; } : function(value) {return keywords[value] || defaultToken; }; }; /** * @this {import("../../ace-internal").Ace.HighlightRules} */ this.getKeywords = function() { return this.$keywords; }; }).call(TextHighlightRules.prototype); exports.TextHighlightRules = TextHighlightRules; ================================================ FILE: src/mode/text_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var TextMode = require("./text").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new TextMode(); }, "test: toggle comment lines should not do anything" : function() { var session = new EditSession([" abc", "cde", "fg"]); this.mode.toggleCommentLines("start", session, 0, 1); assert.equal([" abc", "cde", "fg"].join("\n"), session.toString()); }, "test: lines should be indented" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", " abc", " ")); } }; require("../test/run")(module); ================================================ FILE: src/mode/textile.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var TextileHighlightRules = require("./textile_highlight_rules").TextileHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { this.HighlightRules = TextileHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.type = "text"; this.getNextLineIndent = function(state, line, tab) { if (state == "intag") return tab; return ""; }; 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/textile"; this.snippetFileId = "ace/snippets/textile"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/textile_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextileHighlightRules = function() { this.$rules = { "start" : [ { token : function(value) { if (value.charAt(0) == "h") return "markup.heading." + value.charAt(1); else return "markup.heading"; }, regex : "h1|h2|h3|h4|h5|h6|bq|p|bc|pre", next : "blocktag" }, { token : "keyword", regex : "[\\*]+|[#]+" }, { token : "text", regex : ".+" } ], "blocktag" : [ { token : "keyword", regex : "\\. ", next : "start" }, { token : "keyword", regex : "\\(", next : "blocktagproperties" } ], "blocktagproperties" : [ { token : "keyword", regex : "\\)", next : "blocktag" }, { token : "string", regex : "[a-zA-Z0-9\\-_]+" }, { token : "keyword", regex : "#" } ] }; }; oop.inherits(TextileHighlightRules, TextHighlightRules); exports.TextileHighlightRules = TextileHighlightRules; ================================================ FILE: src/mode/toml.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var TomlHighlightRules = require("./toml_highlight_rules").TomlHighlightRules; var FoldMode = require("./folding/ini").FoldMode; var Mode = function() { this.HighlightRules = TomlHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$id = "ace/mode/toml"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/toml_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TomlHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "constant.language.boolean": "true|false" }, "identifier"); var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b"; this.$rules = { "start": [ { token: "comment.toml", regex: /#.*$/ }, { token : "string", regex : '"(?=.)', next : "qqstring" }, { token: ["variable.keygroup.toml"], regex: "(?:^\\s*)(\\[\\[([^\\]]+)\\]\\])" }, { token: ["variable.keygroup.toml"], regex: "(?:^\\s*)(\\[([^\\]]+)\\])" }, { token : keywordMapper, regex : identifierRe }, { token : "support.date.toml", regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)" }, { token: "constant.numeric.toml", regex: "-?\\d+(\\.?\\d+)?" } ], "qqstring" : [ { token : "string", regex : "\\\\$", next : "qqstring" }, { token : "constant.language.escape", regex : '\\\\[0tnr"\\\\]' }, { token : "string", regex : '"|$', next : "start" }, { defaultToken: "string" } ] }; }; oop.inherits(TomlHighlightRules, TextHighlightRules); exports.TomlHighlightRules = TomlHighlightRules; ================================================ FILE: src/mode/tsv.js ================================================ "use strict"; var CSVMode = require("./csv").Mode; var TsvHighlightRules = require("./tsv_highlight_rules").TsvHighlightRules; var Mode = function(options) { var mode = new CSVMode({ splitter: "\t", quote: '"' }); mode.HighlightRules = TsvHighlightRules; mode.$id = "ace/mode/tsv"; return mode; }; exports.Mode = Mode; ================================================ FILE: src/mode/tsv_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TsvHighlightRules = function() { TextHighlightRules.call(this); }; oop.inherits(TsvHighlightRules, TextHighlightRules); exports.TsvHighlightRules = TsvHighlightRules; ================================================ FILE: src/mode/tsx.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); const JavaScriptBehaviour = require("./behaviour/javascript").JavaScriptBehaviour; const JavaScriptFoldMode = require("./folding/javascript").FoldMode; var tsMode = require("./typescript").Mode; var Mode = function() { tsMode.call(this); this.$highlightRuleConfig = {jsx: true}; this.foldingRules = new JavaScriptFoldMode(); this.$behaviour = new JavaScriptBehaviour(); }; oop.inherits(Mode, tsMode); (function() { this.$id = "ace/mode/tsx"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/tsx_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TypeScriptHighlightRules = require("./typescript_highlight_rules").TypeScriptHighlightRules; var TsxHighlightRules = function () { TypeScriptHighlightRules.call(this, { jsx: true }); }; oop.inherits(TsxHighlightRules, TypeScriptHighlightRules); exports.TsxHighlightRules = TsxHighlightRules; ================================================ FILE: src/mode/turtle.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var TurtleHighlightRules = require("./turtle_highlight_rules").TurtleHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = TurtleHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { // this.lineCommentStart = ""#""; // Extra logic goes here. this.$id = "ace/mode/turtle"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/turtle_highlight_rules.js ================================================ /* This file was autogenerated from turtle.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TurtleHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ include: "#comments" }, { include: "#strings" }, { include: "#base-prefix-declarations" }, { include: "#string-language-suffixes" }, { include: "#string-datatype-suffixes" }, { include: "#relative-urls" }, { include: "#xml-schema-types" }, { include: "#rdf-schema-types" }, { include: "#owl-types" }, { include: "#qnames" }, { include: "#punctuation-operators" }], "#base-prefix-declarations": [{ token: "keyword.other.prefix.turtle", regex: /@(?:base|prefix)/ }], "#comments": [{ token: [ "punctuation.definition.comment.turtle", "comment.line.hash.turtle" ], regex: /(#)(.*$)/ }], "#owl-types": [{ token: "support.type.datatype.owl.turtle", regex: /owl:[a-zA-Z]+/ }], "#punctuation-operators": [{ token: "keyword.operator.punctuation.turtle", regex: /;|,|\.|\(|\)|\[|\]/ }], "#qnames": [{ token: "entity.name.other.qname.turtle", regex: /(?:[a-zA-Z][-_a-zA-Z0-9]*)?:(?:[_a-zA-Z][-_a-zA-Z0-9]*)?/ }], "#rdf-schema-types": [{ token: "support.type.datatype.rdf.schema.turtle", regex: /rdfs?:[a-zA-Z]+|(?:^|\s)a(?:\s|$)/ }], "#relative-urls": [{ token: "string.quoted.other.relative.url.turtle", regex: /</, push: [{ token: "string.quoted.other.relative.url.turtle", regex: />/, next: "pop" }, { defaultToken: "string.quoted.other.relative.url.turtle" }] }], "#string-datatype-suffixes": [{ token: "keyword.operator.datatype.suffix.turtle", regex: /\^\^/ }], "#string-language-suffixes": [{ token: [ "keyword.operator.language.suffix.turtle", "constant.language.suffix.turtle" ], regex: /(?!")(@)([a-z]+(?:\-[a-z0-9]+)*)/ }], "#strings": [{ token: "string.quoted.triple.turtle", regex: /"""/, push: [{ token: "string.quoted.triple.turtle", regex: /"""/, next: "pop" }, { defaultToken: "string.quoted.triple.turtle" }] }, { token: "string.quoted.double.turtle", regex: /"/, push: [{ token: "string.quoted.double.turtle", regex: /"/, next: "pop" }, { token: "invalid.string.newline", regex: /$/ }, { token: "constant.character.escape.turtle", regex: /\\./ }, { defaultToken: "string.quoted.double.turtle" }] }], "#xml-schema-types": [{ token: "support.type.datatype.xml.schema.turtle", regex: /xsd?:[a-z][a-zA-Z]+/ }] }; this.normalizeRules(); }; TurtleHighlightRules.metaData = { fileTypes: ["ttl", "nt"], name: "Turtle", scopeName: "source.turtle" }; oop.inherits(TurtleHighlightRules, TextHighlightRules); exports.TurtleHighlightRules = TurtleHighlightRules; ================================================ FILE: src/mode/twig.js ================================================ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var TwigHighlightRules = require("./twig_highlight_rules").TwigHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { HtmlMode.call(this); this.HighlightRules = TwigHighlightRules; this.$outdent = new MatchingBraceOutdent(); }; oop.inherits(Mode, HtmlMode); (function() { 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; } } 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/twig"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/twig_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TwigHighlightRules = function() { // inherit from html HtmlHighlightRules.call(this); var tags = "autoescape|block|do|embed|extends|filter|flush|for|from|if|import|include|macro|sandbox|set|spaceless|use|verbatim"; tags = tags + "|end" + tags.replace(/\|/g, "|end"); var filters = "abs|batch|capitalize|convert_encoding|date|date_modify|default|e|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|slice|sort|split|striptags|title|trim|upper|url_encode"; var functions = "attribute|constant|cycle|date|dump|parent|random|range|template_from_string"; var tests = "constant|divisibleby|sameas|defined|empty|even|iterable|odd"; var constants = "null|none|true|false"; var operators = "b-and|b-xor|b-or|in|is|and|or|not"; var keywordMapper = this.createKeywordMapper({ "keyword.control.twig": tags, "support.function.twig": [filters, functions, tests].join("|"), "keyword.operator.twig": operators, "constant.language.twig": constants }, "identifier"); // add twig start tags to the HTML start tags for (var rule in this.$rules) { this.$rules[rule].unshift({ token : "variable.other.readwrite.local.twig", regex : "\\{\\{-?", push : "twig-start" }, { token : "meta.tag.twig", regex : "\\{%-?", push : "twig-start" }, { token : "comment.block.twig", regex : "\\{#-?", push : "twig-comment" }); } // add twig closing comment to HTML comments this.$rules["twig-comment"] = [{ token : "comment.block.twig", regex : ".*-?#\\}", next : "pop" }]; this.$rules["twig-start"] = [{ token : "variable.other.readwrite.local.twig", regex : "-?\\}\\}", next : "pop" }, { token : "meta.tag.twig", regex : "-?%\\}", next : "pop" }, { token : "string", regex : "'", next : "twig-qstring" }, { token : "string", regex : '"', next : "twig-qqstring" }, { 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.assignment", regex : "=|~" }, { token : "keyword.operator.comparison", regex : "==|!=|<|>|>=|<=|===" }, { token : "keyword.operator.arithmetic", regex : "\\+|-|/|%|//|\\*|\\*\\*" }, { token : "keyword.operator.other", regex : "\\.\\.|\\|" }, { token : "punctuation.operator", regex : /\?|:|,|;|\./ }, { token : "paren.lparen", regex : /[\[\({]/ }, { token : "paren.rparen", regex : /[\])}]/ }, { token : "text", regex : "\\s+" } ]; this.$rules["twig-qqstring"] = [{ token : "constant.language.escape", regex : /\\[\\"$#ntr]|#{[^"}]*}/ }, { token : "string", regex : '"', next : "twig-start" }, { defaultToken : "string" } ]; this.$rules["twig-qstring"] = [{ token : "constant.language.escape", regex : /\\[\\'ntr]}/ }, { token : "string", regex : "'", next : "twig-start" }, { defaultToken : "string" } ]; this.normalizeRules(); }; oop.inherits(TwigHighlightRules, TextHighlightRules); exports.TwigHighlightRules = TwigHighlightRules; ================================================ FILE: src/mode/typescript.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var jsMode = require("./javascript").Mode; var TypeScriptHighlightRules = require("./typescript_highlight_rules").TypeScriptHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { this.HighlightRules = TypeScriptHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, jsMode); (function() { this.createWorker = function(session) { return null; }; this.$id = "ace/mode/typescript"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/typescript_highlight_rules.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 21e323af-f665-4161-96e7-5087d262557e) */ "use strict"; var oop = require("../lib/oop"); var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var TypeScriptHighlightRules = function (options) { var tsRules = [ // Match stuff like: function name: return type) { token: ["storage.type", "text", "entity.name.function.ts"], regex: "(function)(\\s+)([a-zA-Z0-9\$_\u00a1-\uffff][a-zA-Z0-9\d\$_\u00a1-\uffff]*)" }, { token: "keyword", regex: "(?:\\b(constructor|declare|interface|as|AS|public|private|extends|export|super|readonly|module|namespace|abstract|implements)\\b)" }, { token: ["keyword", "storage.type.variable.ts"], regex: "(class|type)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*)" }, { token: "keyword", regex: "\\b(?:super|export|import|keyof|infer)\\b" }, { token: ["storage.type.variable.ts"], regex: "(?:\\b(this\\.|string\\b|bool\\b|boolean\\b|number\\b|true\\b|false\\b|undefined\\b|any\\b|null\\b|(?:unique )?symbol\\b|object\\b|never\\b|enum\\b))" } ]; var JSRules = new JavaScriptHighlightRules({jsx: (options && options.jsx) == true}).getRules(); JSRules.no_regex = tsRules.concat(JSRules.no_regex); this.$rules = JSRules; }; oop.inherits(TypeScriptHighlightRules, JavaScriptHighlightRules); exports.TypeScriptHighlightRules = TypeScriptHighlightRules; ================================================ FILE: src/mode/vala.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ValaHighlightRules = require("./vala_highlight_rules").ValaHighlightRules; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function() { this.HighlightRules = ValaHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; 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" || state == "no_regex") { var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); if (match) { indent += tab; } } else if (state == "doc-start") { if (endState == "start" || endState == "no_regex") { 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); }; // Extra logic goes here. this.$id = "ace/mode/vala"; this.snippetFileId = "ace/snippets/vala"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/vala_highlight_rules.js ================================================ /* This file was autogenerated from https://raw.githubusercontent.com/technosophos/Vala-TMBundle/master/Syntaxes/Vala.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ValaHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: [ 'meta.using.vala', 'keyword.other.using.vala', 'meta.using.vala', 'storage.modifier.using.vala', 'meta.using.vala', 'punctuation.terminator.vala' ], regex: '^(\\s*)(using)\\b(?:(\\s*)([^ ;$]+)(\\s*)((?:;)?))?' }, { include: '#code' } ], '#all-types': [ { include: '#primitive-arrays' }, { include: '#primitive-types' }, { include: '#object-types' } ], '#annotations': [ { token: [ 'storage.type.annotation.vala', 'punctuation.definition.annotation-arguments.begin.vala' ], regex: '(@[^ (]+)(\\()', push: [ { token: 'punctuation.definition.annotation-arguments.end.vala', regex: '\\)', next: 'pop' }, { token: [ 'constant.other.key.vala', 'text', 'keyword.operator.assignment.vala' ], regex: '(\\w*)(\\s*)(=)' }, { include: '#code' }, { token: 'punctuation.seperator.property.vala', regex: ',' }, { defaultToken: 'meta.declaration.annotation.vala' } ] }, { token: 'storage.type.annotation.vala', regex: '@\\w*' } ], '#anonymous-classes-and-new': [ { token: 'keyword.control.new.vala', regex: '\\bnew\\b', push_disabled: [ { token: 'text', regex: '(?<=\\)|\\])(?!\\s*{)|(?<=})|(?=;)', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?<=\\)|\\])(?!\\s*{)|(?<=})|(?=;)', next: 'pop' }, { token: [ 'storage.type.vala', 'text' ], regex: '(\\w+)(\\s*)(?=\\[)', push: [ { token: 'text', regex: '}|(?=;|\\))', next: 'pop' }, { token: 'text', regex: '\\[', push: [ { token: 'text', regex: '\\]', next: 'pop' }, { include: '#code' } ] }, { token: 'text', regex: '{', push: [ { token: 'text', regex: '(?=})', next: 'pop' }, { include: '#code' } ] } ] }, { token: 'text', regex: '(?=\\w.*\\()', push: [ { token: 'text', regex: '(?<=\\))', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '(?<=\\))', next: 'pop' }, { include: '#object-types' }, { token: 'text', regex: '\\(', push: [ { token: 'text', regex: '\\)', next: 'pop' }, { include: '#code' } ] } ] }, { token: 'meta.inner-class.vala', regex: '{', push: [ { token: 'meta.inner-class.vala', regex: '}', next: 'pop' }, { include: '#class-body' }, { defaultToken: 'meta.inner-class.vala' } ] } ] } ], '#assertions': [ { token: [ 'keyword.control.assert.vala', 'meta.declaration.assertion.vala' ], regex: '\\b(assert|requires|ensures)(\\s)', push: [ { token: 'meta.declaration.assertion.vala', regex: '$', next: 'pop' }, { token: 'keyword.operator.assert.expression-seperator.vala', regex: ':' }, { include: '#code' }, { defaultToken: 'meta.declaration.assertion.vala' } ] } ], '#class': [ { token: 'meta.class.vala', regex: '(?=\\w?[\\w\\s]*(?:class|(?:@)?interface|enum|struct|namespace)\\s+\\w+)', push: [ { token: 'paren.vala', regex: '}', next: 'pop' }, { include: '#storage-modifiers' }, { include: '#comments' }, { token: [ 'storage.modifier.vala', 'meta.class.identifier.vala', 'entity.name.type.class.vala' ], regex: '(class|(?:@)?interface|enum|struct|namespace)(\\s+)([\\w\\.]+)' }, { token: 'storage.modifier.extends.vala', regex: ':', push: [ { token: 'meta.definition.class.inherited.classes.vala', regex: '(?={|,)', next: 'pop' }, { include: '#object-types-inherited' }, { include: '#comments' }, { defaultToken: 'meta.definition.class.inherited.classes.vala' } ] }, { token: [ 'storage.modifier.implements.vala', 'meta.definition.class.implemented.interfaces.vala' ], regex: '(,)(\\s)', push: [ { token: 'meta.definition.class.implemented.interfaces.vala', regex: '(?=\\{)', next: 'pop' }, { include: '#object-types-inherited' }, { include: '#comments' }, { defaultToken: 'meta.definition.class.implemented.interfaces.vala' } ] }, { token: 'paren.vala', regex: '{', push: [ { token: 'paren.vala', regex: '(?=})', next: 'pop' }, { include: '#class-body' }, { defaultToken: 'meta.class.body.vala' } ] }, { defaultToken: 'meta.class.vala' } ], comment: 'attempting to put namespace in here.' } ], '#class-body': [ { include: '#comments' }, { include: '#class' }, { include: '#enums' }, { include: '#methods' }, { include: '#annotations' }, { include: '#storage-modifiers' }, { include: '#code' } ], '#code': [ { include: '#comments' }, { include: '#class' }, { token: 'text', regex: '{', push: [ { token: 'text', regex: '}', next: 'pop' }, { include: '#code' } ] }, { include: '#assertions' }, { include: '#parens' }, { include: '#constants-and-special-vars' }, { include: '#anonymous-classes-and-new' }, { include: '#keywords' }, { include: '#storage-modifiers' }, { include: '#strings' }, { include: '#all-types' } ], '#comments': [ { token: 'punctuation.definition.comment.vala', regex: '/\\*\\*/' }, { include: 'text.html.javadoc' }, { include: '#comments-inline' } ], '#comments-inline': [ { token: 'punctuation.definition.comment.vala', regex: '/\\*', push: [ { token: 'punctuation.definition.comment.vala', regex: '\\*/', next: 'pop' }, { defaultToken: 'comment.block.vala' } ] }, { token: [ 'text', 'punctuation.definition.comment.vala', 'comment.line.double-slash.vala' ], regex: '(\\s*)(//)(.*$)' } ], '#constants-and-special-vars': [ { token: 'constant.language.vala', regex: '\\b(?:true|false|null)\\b' }, { token: 'variable.language.vala', regex: '\\b(?:this|base)\\b' }, { token: 'constant.numeric.vala', regex: '\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:[LlFfUuDd]|UL|ul)?\\b' }, { token: [ 'keyword.operator.dereference.vala', 'constant.other.vala' ], regex: '((?:\\.)?)\\b([A-Z][A-Z0-9_]+)(?!<|\\.class|\\s*\\w+\\s*=)\\b' } ], '#enums': [ { token: 'text', regex: '^(?=\\s*[A-Z0-9_]+\\s*(?:{|\\(|,))', push: [ { token: 'text', regex: '(?=;|})', next: 'pop' }, { token: 'constant.other.enum.vala', regex: '\\w+', push: [ { token: 'meta.enum.vala', regex: '(?=,|;|})', next: 'pop' }, { include: '#parens' }, { token: 'text', regex: '{', push: [ { token: 'text', regex: '}', next: 'pop' }, { include: '#class-body' } ] }, { defaultToken: 'meta.enum.vala' } ] } ] } ], '#keywords': [ { token: 'keyword.control.catch-exception.vala', regex: '\\b(?:try|catch|finally|throw)\\b' }, { token: 'keyword.control.vala', regex: '\\?|:|\\?\\?' }, { token: 'keyword.control.vala', regex: '\\b(?:return|break|case|continue|default|do|while|for|foreach|switch|if|else|in|yield|get|set|value)\\b' }, { token: 'keyword.operator.vala', regex: '\\b(?:typeof|is|as)\\b' }, { token: 'keyword.operator.comparison.vala', regex: '==|!=|<=|>=|<>|<|>' }, { token: 'keyword.operator.assignment.vala', regex: '=' }, { token: 'keyword.operator.increment-decrement.vala', regex: '\\-\\-|\\+\\+' }, { token: 'keyword.operator.arithmetic.vala', regex: '\\-|\\+|\\*|\\/|%' }, { token: 'keyword.operator.logical.vala', regex: '!|&&|\\|\\|' }, { token: 'keyword.operator.dereference.vala', regex: '\\.(?=\\S)', originalRegex: '(?<=\\S)\\.(?=\\S)' }, { token: 'punctuation.terminator.vala', regex: ';' }, { token: 'keyword.operator.ownership', regex: 'owned|unowned' } ], '#methods': [ { token: 'meta.method.vala', regex: '(?!new)(?=\\w.*\\s+)(?=[^=]+\\()', push: [ { token: 'paren.vala', regex: '}|(?=;)', next: 'pop' }, { include: '#storage-modifiers' }, { token: [ 'entity.name.function.vala', 'meta.method.identifier.vala' ], regex: '([\\~\\w\\.]+)(\\s*\\()', push: [ { token: 'meta.method.identifier.vala', regex: '\\)', next: 'pop' }, { include: '#parameters' }, { defaultToken: 'meta.method.identifier.vala' } ] }, { token: 'meta.method.return-type.vala', regex: '(?=\\w.*\\s+\\w+\\s*\\()', push: [ { token: 'meta.method.return-type.vala', regex: '(?=\\w+\\s*\\()', next: 'pop' }, { include: '#all-types' }, { defaultToken: 'meta.method.return-type.vala' } ] }, { include: '#throws' }, { token: 'paren.vala', regex: '{', push: [ { token: 'paren.vala', regex: '(?=})', next: 'pop' }, { include: '#code' }, { defaultToken: 'meta.method.body.vala' } ] }, { defaultToken: 'meta.method.vala' } ] } ], '#namespace': [ { token: 'text', regex: '^(?=\\s*[A-Z0-9_]+\\s*(?:{|\\(|,))', push: [ { token: 'text', regex: '(?=;|})', next: 'pop' }, { token: 'constant.other.namespace.vala', regex: '\\w+', push: [ { token: 'meta.namespace.vala', regex: '(?=,|;|})', next: 'pop' }, { include: '#parens' }, { token: 'text', regex: '{', push: [ { token: 'text', regex: '}', next: 'pop' }, { include: '#code' } ] }, { defaultToken: 'meta.namespace.vala' } ] } ], comment: 'This is not quite right. See the class grammar right now' } ], '#object-types': [ { token: 'storage.type.generic.vala', regex: '\\b(?:[a-z]\\w*\\.)*[A-Z]+\\w*<', push: [ { token: 'storage.type.generic.vala', regex: '>|[^\\w\\s,\\?<\\[()\\]]', TODO: 'FIXME: regexp doesn\'t have js equivalent', originalRegex: '>|[^\\w\\s,\\?<\\[(?:[,]+)\\]]', next: 'pop' }, { include: '#object-types' }, { token: 'storage.type.generic.vala', regex: '<', push: [ { token: 'storage.type.generic.vala', regex: '>|[^\\w\\s,\\[\\]<]', next: 'pop' }, { defaultToken: 'storage.type.generic.vala' } ], comment: 'This is just to support <>\'s with no actual type prefix' }, { defaultToken: 'storage.type.generic.vala' } ] }, { token: 'storage.type.object.array.vala', regex: '\\b(?:[a-z]\\w*\\.)*[A-Z]+\\w*(?=\\[)', push: [ { token: 'storage.type.object.array.vala', regex: '(?=[^\\]\\s])', next: 'pop' }, { token: 'text', regex: '\\[', push: [ { token: 'text', regex: '\\]', next: 'pop' }, { include: '#code' } ] }, { defaultToken: 'storage.type.object.array.vala' } ] }, { token: [ 'storage.type.vala', 'keyword.operator.dereference.vala', 'storage.type.vala' ], regex: '\\b(?:([a-z]\\w*)(\\.))*([A-Z]+\\w*\\b)' } ], '#object-types-inherited': [ { token: 'entity.other.inherited-class.vala', regex: '\\b(?:[a-z]\\w*\\.)*[A-Z]+\\w*<', push: [ { token: 'entity.other.inherited-class.vala', regex: '>|[^\\w\\s,<]', next: 'pop' }, { include: '#object-types' }, { token: 'storage.type.generic.vala', regex: '<', push: [ { token: 'storage.type.generic.vala', regex: '>|[^\\w\\s,<]', next: 'pop' }, { defaultToken: 'storage.type.generic.vala' } ], comment: 'This is just to support <>\'s with no actual type prefix' }, { defaultToken: 'entity.other.inherited-class.vala' } ] }, { token: [ 'entity.other.inherited-class.vala', 'keyword.operator.dereference.vala', 'entity.other.inherited-class.vala' ], regex: '\\b(?:([a-z]\\w*)(\\.))*([A-Z]+\\w*)' } ], '#parameters': [ { token: 'storage.modifier.vala', regex: 'final' }, { include: '#primitive-arrays' }, { include: '#primitive-types' }, { include: '#object-types' }, { token: 'variable.parameter.vala', regex: '\\w+' } ], '#parens': [ { token: 'text', regex: '\\(', push: [ { token: 'text', regex: '\\)', next: 'pop' }, { include: '#code' } ] } ], '#primitive-arrays': [ { token: 'storage.type.primitive.array.vala', regex: '\\b(?:bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|object|short|ushort|string|void|int8|int16|int32|int64|uint8|uint16|uint32|uint64)(?:\\[\\])*\\b' } ], '#primitive-types': [ { token: 'storage.type.primitive.vala', regex: '\\b(?:var|bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|object|short|ushort|string|void|signal|int8|int16|int32|int64|uint8|uint16|uint32|uint64)\\b', comment: 'var is not really a primitive, but acts like one in most cases' } ], '#storage-modifiers': [ { token: 'storage.modifier.vala', regex: '\\b(?:public|private|protected|internal|static|final|sealed|virtual|override|abstract|readonly|volatile|dynamic|async|unsafe|out|ref|weak|owned|unowned|const)\\b', comment: 'Not sure about unsafe and readonly' } ], '#strings': [ { token: 'punctuation.definition.string.begin.vala', regex: '@"', push: [ { token: 'punctuation.definition.string.end.vala', regex: '"', next: 'pop' }, { token: 'constant.character.escape.vala', regex: '\\\\.|%[\\w\\.\\-]+|\\$(?:\\w+|\\([\\w\\s\\+\\-\\*\\/]+\\))' }, { defaultToken: 'string.quoted.interpolated.vala' } ] }, { token: 'punctuation.definition.string.begin.vala', regex: '"', push: [ { token: 'punctuation.definition.string.end.vala', regex: '"', next: 'pop' }, { token: 'constant.character.escape.vala', regex: '\\\\.' }, { token: 'constant.character.escape.vala', regex: '%[\\w\\.\\-]+' }, { defaultToken: 'string.quoted.double.vala' } ] }, { token: 'punctuation.definition.string.begin.vala', regex: '\'', push: [ { token: 'punctuation.definition.string.end.vala', regex: '\'', next: 'pop' }, { token: 'constant.character.escape.vala', regex: '\\\\.' }, { defaultToken: 'string.quoted.single.vala' } ] }, { token: 'punctuation.definition.string.begin.vala', regex: '"""', push: [ { token: 'punctuation.definition.string.end.vala', regex: '"""', next: 'pop' }, { token: 'constant.character.escape.vala', regex: '%[\\w\\.\\-]+' }, { defaultToken: 'string.quoted.triple.vala' } ] } ], '#throws': [ { token: 'storage.modifier.vala', regex: 'throws', push: [ { token: 'meta.throwables.vala', regex: '(?={|;)', next: 'pop' }, { include: '#object-types' }, { defaultToken: 'meta.throwables.vala' } ] } ], '#values': [ { include: '#strings' }, { include: '#object-types' }, { include: '#constants-and-special-vars' } ] }; this.normalizeRules(); }; ValaHighlightRules.metaData = { comment: 'Based heavily on the Java bundle\'s language syntax. TODO:\n* Closures\n* Delegates\n* Properties: Better support for properties.\n* Annotations\n* Error domains\n* Named arguments\n* Array slicing, negative indexes, multidimensional\n* construct blocks\n* lock blocks?\n* regex literals\n* DocBlock syntax highlighting. (Currently importing javadoc)\n* Folding rule for comments.\n', fileTypes: [ 'vala' ], foldingStartMarker: '(\\{\\s*(//.*)?$|^\\s*// \\{\\{\\{)', foldingStopMarker: '^\\s*(\\}|// \\}\\}\\}$)', name: 'Vala', scopeName: 'source.vala' }; oop.inherits(ValaHighlightRules, TextHighlightRules); exports.ValaHighlightRules = ValaHighlightRules; ================================================ FILE: src/mode/vbscript.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var VBScriptHighlightRules = require("./vbscript_highlight_rules").VBScriptHighlightRules; var FoldMode = require("./folding/vbscript").FoldMode; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = VBScriptHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ["'", "REM"]; var outdentKeywords = [ "else", "elseif", "end", "loop", "next", "wend" ]; function isSecondOfDoubleKeyword(tokens, i) { var val = tokens[i].value.toLowerCase(); var prevToken = i >= 2 ? tokens[i - 2] : null; if (!prevToken) return false; var prevVal = prevToken.value.toLowerCase(); // Do While / Do Until / Loop While / Loop Until if ((val === "while" || val === "until") && (prevVal === "do" || prevVal === "loop")) { return true; } // Exit For / Exit Do / Exit Sub / Exit Function / Exit Property if (prevVal === "exit" && (val === "for" || val === "do" || val === "sub" || val === "function" || val === "property")) { return true; } return false; } function getNetIndentLevel(tokens, line, indentKeywords) { var level = 0; // Support single-line blocks by decrementing the indent level if // an ending token is found for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; if (token.type == "keyword.control.asp" || token.type == "storage.type.function.asp") { var val = token.value.toLowerCase(); if (val in indentKeywords) { if (isSecondOfDoubleKeyword(tokens, i)) { continue; } switch (val) { case "property": case "sub": case "function": case "select": case "do": case "for": case "class": case "while": case "with": case "if": var checkToken = new RegExp("^\\s* end\\s+" + val, "i"); var singleLineCondition = /^\s*If\s+.*\s+Then(?!')\s+(?!')\S/i.test(line); if (!singleLineCondition && !checkToken.test(line)) level += indentKeywords[val]; break; default: level += indentKeywords[val]; break; } } } } // Limit the level to +/- 1 since usually users only indent one level // at a time regardless of the logical nesting level if (level < 0) { return -1; } else if (level > 0) { return 1; } else { return 0; } } this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); var level = 0; var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (state == "start") { level = getNetIndentLevel(tokens, line, this.indentKeywords); } if (level > 0) { return indent + tab; } else if (level < 0 && indent.substr(indent.length - tab.length) == tab) { // Don't do a next-line outdent if we're going to do a real outdent of this line if (!this.checkOutdent(state, line, "\n")) { return indent.substr(0, indent.length - tab.length); } } return indent; }; this.checkOutdent = function(state, line, input) { if (input != "\n" && input != "\r" && input != "\r\n") return false; var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens || !tokens.length) return false; var val = tokens[0].value.toLowerCase(); return ((tokens[0].type == "keyword.control.asp" || tokens[0].type == "storage.type.function.asp") && outdentKeywords.indexOf(val) != -1); }; this.getMatching = function(session, row, column, tokenRange) { if (row == undefined) { var pos = session.selection.lead; column = pos.column; row = pos.row; } if (tokenRange == undefined) tokenRange = true; var startToken = session.getTokenAt(row, column); if (startToken) { var val = startToken.value.toLowerCase(); if (/^\s+$/.test(val)) { column = column + val.length; startToken = session.getTokenAt(row, column); if (!startToken) { return; } val = startToken.value.toLowerCase(); } if (val in this.indentKeywords) return this.foldingRules.vbsBlock(session, row, column, tokenRange); } }; this.autoOutdent = function(state, session, row) { var line = session.getLine(row); var column = line.match(/^\s*/)[0].length; if (!column || !row) return; var startRange = this.getMatching(session, row, column + 1, false); if (!startRange || startRange.start.row == row) return; var indent = this.$getIndent(session.getLine(startRange.start.row)); if (indent.length != column) { session.replace(new Range(row, 0, row, column), indent); session.outdentRows(new Range(row + 1, 0, row + 1, 0)); } }; this.$id = "ace/mode/vbscript"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/vbscript_highlight_rules.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 7F9C9343-D48E-4E7D-BFE8-F680714DCD3E) */ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var VBScriptHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "keyword.control.asp": "If|Then|Else|ElseIf|End|While|Wend|For|To|Each|Case|Select|Return" + "|Continue|Do|Until|Loop|Next|With|Exit|Function|Property|Type|Enum|Sub|IIf|Class", "storage.type.asp": "Dim|Call|Const|Redim|Set|Let|Get|New|Randomize|Option|Explicit|Preserve|Erase|Execute|ExecuteGlobal", "storage.modifier.asp": "Private|Public|Default", "keyword.operator.asp": "Mod|And|Not|Or|Xor|As|Eqv|Imp|Is", "constant.language.asp": "Empty|False|Nothing|Null|True", "variable.language.vb.asp": "Me", "support.class.vb.asp": "RegExp", "support.class.asp": "Application|ObjectContext|Request|Response|Server|Session", "support.class.collection.asp": "Contents|StaticObjects|ClientCertificate|Cookies|Form|QueryString|ServerVariables", "support.constant.asp": "TotalBytes|Buffer|CacheControl|Charset|ContentType|Expires|ExpiresAbsolute" + "|IsClientConnected|PICS|Status|ScriptTimeout|CodePage|LCID|SessionID|Timeout", "support.function.asp": "Lock|Unlock|SetAbort|SetComplete|BinaryRead|AddHeader|AppendToLog" + "|BinaryWrite|Clear|Flush|Redirect|Write|CreateObject|HTMLEncode|MapPath|URLEncode|Abandon|Convert|Regex", "support.function.event.asp": "Application_OnEnd|Application_OnStart" + "|OnTransactionAbort|OnTransactionCommit|Session_OnEnd|Session_OnStart", "support.function.vb.asp": "Array|Add|Asc|Atn|CBool|CByte|CCur|CDate|CDbl|Chr|CInt|CLng" + "|Conversions|Cos|CreateObject|CSng|CStr|Date|DateAdd|DateDiff|DatePart|DateSerial" + "|DateValue|Day|Derived|Math|Escape|Eval|Exists|Exp|Filter|FormatCurrency" + "|FormatDateTime|FormatNumber|FormatPercent|GetLocale|GetObject|GetRef|Hex" + "|Hour|InputBox|InStr|InStrRev|Int|Fix|IsArray|IsDate|IsEmpty|IsNull|IsNumeric" + "|IsObject|Item|Items|Join|Keys|LBound|LCase|Left|Len|LoadPicture|Log|LTrim|RTrim" + "|Trim|Maths|Mid|Minute|Month|MonthName|MsgBox|Now|Oct|Remove|RemoveAll|Replace" + "|RGB|Right|Rnd|Round|ScriptEngine|ScriptEngineBuildVersion|ScriptEngineMajorVersion" + "|ScriptEngineMinorVersion|Second|SetLocale|Sgn|Sin|Space|Split|Sqr|StrComp|String|StrReverse" + "|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year" + "|AscB|AscW|ChrB|ChrW|InStrB|LeftB|LenB|MidB|RightB|Abs|GetUILanguage", "support.type.vb.asp": "vbTrue|vbFalse|vbCr|vbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString" + "|vbTab|vbVerticalTab|vbBinaryCompare|vbTextCompare|vbSunday|vbMonday|vbTuesday|vbWednesday" + "|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek|vbFirstJan1|vbFirstFourDays|vbFirstFullWeek" + "|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime|vbObjectError|vbEmpty|vbNull|vbInteger" + "|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant" + "|vbDataObject|vbDecimal|vbByte|vbArray|vbOKOnly|vbOKCancel|vbAbortRetryIgnore|vbYesNoCancel|vbYesNo" + "|vbRetryCancel|vbCritical|vbQuestion|vbExclamation|vbInformation|vbDefaultButton1|vbDefaultButton2" + "|vbDefaultButton3|vbDefaultButton4|vbApplicationModal|vbSystemModal|vbOK|vbCancel|vbAbort|vbRetry|vbIgnore|vbYes|vbNo" + "|vbUseDefault" }, "identifier", true); this.$rules = { "start": [ { token: [ "meta.ending-space" ], regex: "$" }, { token: [null], regex: "^(?=\\t)", next: "state_3" }, { token: [null], regex: "^(?= )", next: "state_4" }, { token: [ "text", "storage.type.function.asp", "text", "entity.name.function.asp", "text", "punctuation.definition.parameters.asp", "variable.parameter.function.asp", "punctuation.definition.parameters.asp" ], regex: "^(\\s*)(Function|Sub)(\\s+)([a-zA-Z_]\\w*)(\\s*)(\\()([^)]*)(\\))" }, { token: "punctuation.definition.comment.asp", regex: "'|REM(?=\\s|$)", next: "comment", caseInsensitive: true }, { token: "storage.type.asp", regex: "On\\s+Error\\s+(?:Resume\\s+Next|GoTo)\\b", caseInsensitive: true }, { token: "punctuation.definition.string.begin.asp", regex: '"', next: "string" }, { token: [ "punctuation.definition.variable.asp" ], regex: "(\\$)[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b\\s*" }, // { // token: [ // "support.type.vb.asp" // ], // regex: "(?:(?<=as )(\\b[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b))", // ERROR: This contains a lookbehind, which JS does not support :(" // }, { token: "constant.numeric.asp", 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" }, { regex: "\\w+", token: keywordMapper }, { token: ["entity.name.function.asp"], regex: "(?:(\\b[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b)(?=\\(\\)?))" }, // { // token: [ // "variable.other.asp" // ], // regex: "(?:((?<=(\\+|=|-|\\&|\\\\|/|<|>|\\(|,))\\s*\\b([a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?)\\b(?!(\\(|\\.))|\\b([a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?)\\b(?=\\s*(\\+|=|-|\\&|\\\\|/|<|>|\\(|\\)))))", // ERROR: This contains a lookbehind, which JS does not support :(" // }, { token: ["keyword.operator.asp"], regex: "\\-|\\+|\\*|\\/|\\>|\\<|\\=|\\&|\\\\|\\^" } ], "state_3": [ { token: [ "meta.odd-tab.tabs", "meta.even-tab.tabs" ], regex: "(\\t)(\\t)?" }, { token: "meta.leading-space", regex: "(?=[^\\t])", next: "start" }, { token: "meta.leading-space", regex: ".", next: "state_3" } ], "state_4": [ { token: ["meta.odd-tab.spaces", "meta.even-tab.spaces"], regex: "( )( )?" }, { token: "meta.leading-space", regex: "(?=[^ ])", next: "start" }, { defaultToken: "meta.leading-space" } ], "comment": [ { token: "comment.line.apostrophe.asp", regex: "$", next: "start" }, { defaultToken: "comment.line.apostrophe.asp" } ], "string": [ { token: "constant.character.escape.apostrophe.asp", regex: '""' }, { token: "string.quoted.double.asp", regex: '"', next: "start" }, { defaultToken: "string.quoted.double.asp" } ] }; }; oop.inherits(VBScriptHighlightRules, TextHighlightRules); exports.VBScriptHighlightRules = VBScriptHighlightRules; ================================================ FILE: src/mode/vbscript_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var VBScriptMode = require("./vbscript").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new VBScriptMode(); }, "test: getNextLineIndent": function() { assert.equal(this.mode.getNextLineIndent("start", "Class ClassName", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " Public Default Function FunctionName(param)", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " If Answer <> vbOK Then Exit Sub", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " If Condition Then", " "), " "); }, "test: checkOutdent": function() { assert.ok(this.mode.checkOutdent("start", " End If", "\n")); assert.ok(this.mode.checkOutdent("start", " Loop", "\n")); assert.equal(this.mode.checkOutdent("start", " Class blabla", "\n"), false); assert.equal(this.mode.checkOutdent("start", "", "\r"), false); }, "test: auto outdent" : function() { var session = new EditSession(["Class ClassName", " some code", " End Class"]); session.setMode(this.mode); this.mode.autoOutdent("start", session, 2); assert.equal("End Class", session.getLine(2)); }, "test: opening/ending tags matching": function() { var session = new EditSession([ 'Sub Name(attr)', ' If Condition Then ', ' some code', ' ElseIf condition2', ' another code', ' ElseIf condition3', ' another code', ' Else', ' another code', ' End If', 'End Sub' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 0); assert.range(ranges[0], 0, 0, 0, 3); assert.range(ranges[1], 10, 0, 10, 7); ranges = this.mode.getMatching(session, 10, 1); assert.range(ranges[1], 0, 0, 0, 3); assert.range(ranges[0], 10, 0, 10, 7); ranges = this.mode.getMatching(session, 1, 4); assert.range(ranges[0], 1, 3, 1, 5); assert.range(ranges[1], 9, 3, 9, 9); ranges = this.mode.getMatching(session, 9, 8); assert.range(ranges[1], 1, 3, 1, 5); assert.range(ranges[0], 9, 3, 9, 9); ranges = this.mode.getMatching(session, 3, 4); assert.range(ranges[0], 3, 3, 3, 9); assert.range(ranges[1], 5, 3, 5, 9); ranges = this.mode.getMatching(session, 5, 4); assert.range(ranges[0], 5, 3, 5, 9); assert.range(ranges[1], 7, 3, 7, 7); }, "test: single line condition couldn't have closing tag": function() { var session = new EditSession([ 'Sub Name(attr)', ' If Condition Then ', ' If Condition Then Exit Sub', ' End If', 'End Sub' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 2, 8); assert.equal(ranges, undefined); ranges = this.mode.getMatching(session, 1, 4); assert.range(ranges[0], 1, 3, 1, 5); assert.range(ranges[1], 3, 3, 3, 9); ranges = this.mode.getMatching(session, 3, 4); assert.range(ranges[1], 1, 3, 1, 5); assert.range(ranges[0], 3, 3, 3, 9); ranges = this.mode.getMatching(session, 4, 1); assert.range(ranges[1], 0, 0, 0, 3); assert.range(ranges[0], 4, 0, 4, 7); }, "test: private and public properties/subs/functions should return matching tag": function() { var session = new EditSession([ 'Class ClassName', ' Public Property Get PropertyName', ' some code', ' End Property', '', ' Private Function FunctionName(value1, value2)', ' some code', ' End Function', 'End Class' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 1, 11); assert.range(ranges[0], 1, 10, 1, 18); assert.range(ranges[1], 3, 3, 3, 15); ranges = this.mode.getMatching(session, 3, 5); assert.range(ranges[1], 1, 10, 1, 18); assert.range(ranges[0], 3, 3, 3, 15); ranges = this.mode.getMatching(session, 5, 14); assert.range(ranges[0], 5, 11, 5, 19); assert.range(ranges[1], 7, 3, 7, 15); ranges = this.mode.getMatching(session, 7, 4); assert.range(ranges[1], 5, 11, 5, 19); assert.range(ranges[0], 7, 3, 7, 15); }, "test: wrong closing/opening tag": function() { var session = new EditSession([ 'Class ClassName', ' Public Property Get PropertyName', ' some code', ' End Class', '', ' Private Property FunctionName(value1, value2)', ' some code', ' End AnyWord', 'End Class' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 1, 11); assert.equal(ranges.length, 1); assert.range(ranges[0], 3, 3, 3, 12); ranges = this.mode.getMatching(session, 7, 4); assert.equal(ranges.length, 1); assert.range(ranges[0], 5, 11, 5, 19); ranges = this.mode.getMatching(session, 0, 3); assert.range(ranges[0], 0, 0, 0, 5); assert.range(ranges[1], 8, 0, 8, 9); }, "test: Do While / Loop double keyword matching": function() { var session = new EditSession([ 'Do While condition', ' some code', 'Loop' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 0); assert.equal(ranges.length, 2); assert.range(ranges[0], 0, 0, 0, 8); assert.range(ranges[1], 2, 0, 2, 4); ranges = this.mode.getMatching(session, 0, 4); assert.equal(ranges.length, 2); assert.range(ranges[0], 0, 0, 0, 8); assert.range(ranges[1], 2, 0, 2, 4); // Cursor on whitespace between "Do" and "While" ranges = this.mode.getMatching(session, 0, 2); assert.equal(ranges.length, 2); assert.range(ranges[0], 0, 0, 0, 8); assert.range(ranges[1], 2, 0, 2, 4); }, "test: Do Until / Loop double keyword matching": function() { var session = new EditSession([ 'Do Until condition', ' some code', 'Loop' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 0); assert.equal(ranges.length, 2); assert.range(ranges[0], 0, 0, 0, 8); assert.range(ranges[1], 2, 0, 2, 4); ranges = this.mode.getMatching(session, 0, 4); assert.equal(ranges.length, 2); assert.range(ranges[0], 0, 0, 0, 8); assert.range(ranges[1], 2, 0, 2, 4); }, "test: Do / Loop Until double keyword matching": function() { var session = new EditSession([ 'Do', ' some code', 'Loop Until condition' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 0); assert.equal(ranges.length, 2); assert.range(ranges[0], 0, 0, 0, 2); assert.range(ranges[1], 2, 0, 2, 10); // "Loop Until" ranges = this.mode.getMatching(session, 2, 0); assert.equal(ranges.length, 2); assert.range(ranges[0], 2, 0, 2, 10); assert.range(ranges[1], 0, 0, 0, 2); ranges = this.mode.getMatching(session, 2, 6); assert.equal(ranges.length, 2); assert.range(ranges[0], 2, 0, 2, 10); assert.range(ranges[1], 0, 0, 0, 2); }, "test: Exit statements should not match": function() { var session = new EditSession([ 'Do While condition', ' Exit Do', ' some code', 'Loop', 'For i = 1 To 10', ' Exit For', 'Next' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 1, 4); assert.equal(ranges, undefined); // Exit Do - cursor on "Do" after "Exit" ranges = this.mode.getMatching(session, 1, 8); assert.equal(ranges, undefined); // Exit For - cursor on "Exit" ranges = this.mode.getMatching(session, 5, 4); assert.equal(ranges, undefined); // Exit For - cursor on "For" after "Exit" ranges = this.mode.getMatching(session, 5, 8); assert.equal(ranges, undefined); // Do While should still match Loop correctly ranges = this.mode.getMatching(session, 0, 0); assert.equal(ranges.length, 2); assert.range(ranges[0], 0, 0, 0, 8); assert.range(ranges[1], 3, 0, 3, 4); }, "test: getNextLineIndent with double keywords": function() { // Do While/Until - one indent, not two assert.equal(this.mode.getNextLineIndent("start", "Do While condition", " "), " "); assert.equal(this.mode.getNextLineIndent("start", "Do Until condition", " "), " "); // Exit statements - no indent change assert.equal(this.mode.getNextLineIndent("start", " Exit Do", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " Exit For", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " Exit Sub", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " Exit Function", " "), " "); assert.equal(this.mode.getNextLineIndent("start", " Exit Property", " "), " "); }, "test: nested Do loops with double keywords": function() { var session = new EditSession([ 'Do While outer', ' Do Until inner', ' some code', ' Loop', 'Loop' ]); session.setMode(this.mode); // Outer Do While -> outer Loop var ranges = this.mode.getMatching(session, 0, 0); assert.equal(ranges.length, 2); assert.range(ranges[0], 0, 0, 0, 8); assert.range(ranges[1], 4, 0, 4, 4); // Inner Do Until -> inner Loop ranges = this.mode.getMatching(session, 1, 4); assert.equal(ranges.length, 2); assert.range(ranges[0], 1, 3, 1, 11); assert.range(ranges[1], 3, 3, 3, 7); }, "test: plain Do / Loop without While/Until": function() { var session = new EditSession([ 'Do', ' some code', 'Loop' ]); session.setMode(this.mode); var ranges = this.mode.getMatching(session, 0, 0); assert.equal(ranges.length, 2); assert.range(ranges[0], 0, 0, 0, 2); assert.range(ranges[1], 2, 0, 2, 4); ranges = this.mode.getMatching(session, 2, 0); assert.equal(ranges.length, 2); assert.range(ranges[0], 2, 0, 2, 4); assert.range(ranges[1], 0, 0, 0, 2); } }; require("../test/run")(module); ================================================ FILE: src/mode/velocity.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var VelocityHighlightRules = require("./velocity_highlight_rules").VelocityHighlightRules; var FoldMode = require("./folding/velocity").FoldMode; var Mode = function() { HtmlMode.call(this); this.HighlightRules = VelocityHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, HtmlMode); (function() { this.lineCommentStart = "##"; this.blockComment = {start: "#*", end: "*#"}; this.$id = "ace/mode/velocity"; this.snippetFileId = "ace/snippets/velocity"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/velocity_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var VelocityHighlightRules = function() { HtmlHighlightRules.call(this); var builtinConstants = lang.arrayToMap( ('true|false|null').split('|') ); var builtinFunctions = lang.arrayToMap( ("_DateTool|_DisplayTool|_EscapeTool|_FieldTool|_MathTool|_NumberTool|_SerializerTool|_SortTool|_StringTool|_XPathTool").split('|') ); var builtinVariables = lang.arrayToMap( ('$contentRoot|$foreach').split('|') ); var keywords = lang.arrayToMap( ("#set|#macro|#include|#parse|" + "#if|#elseif|#else|#foreach|" + "#break|#end|#stop" ).split('|') ); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules.start.push( { token : "comment", regex : "##.*$" },{ token : "comment.block", // multi line comment regex : "#\\*", next : "vm_comment" }, { token : "string.regexp", regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single line 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 : function(value) { if (keywords.hasOwnProperty(value)) return "keyword"; else if (builtinConstants.hasOwnProperty(value)) return "constant.language"; else if (builtinVariables.hasOwnProperty(value)) return "variable.language"; else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1))) return "support.function"; else if (value == "debugger") return "invalid.deprecated"; else if(value.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*)$/)) return "variable"; return "identifier"; }, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z$#][a-zA-Z0-9_]*\\b" }, { token : "keyword.operator", regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|" }, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ); this.$rules["vm_comment"] = [ { token : "comment", // closing comment regex : "\\*#|-->", next : "start" }, { defaultToken: "comment" } ]; this.$rules["vm_start"] = [ { token: "variable", regex: "}", next: "pop" }, { token : "string.regexp", regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single line 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 : function(value) { if (keywords.hasOwnProperty(value)) return "keyword"; else if (builtinConstants.hasOwnProperty(value)) return "constant.language"; else if (builtinVariables.hasOwnProperty(value)) return "variable.language"; else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1))) return "support.function"; else if (value == "debugger") return "invalid.deprecated"; else if(value.match(/^(\$[a-zA-Z_$][a-zA-Z0-9_]*)$/)) return "variable"; return "identifier"; }, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|" }, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ]; for (var i in this.$rules) { this.$rules[i].unshift({ token: "variable", regex: "\\${", push: "vm_start" }); } this.normalizeRules(); }; oop.inherits(VelocityHighlightRules, TextHighlightRules); exports.VelocityHighlightRules = VelocityHighlightRules; ================================================ FILE: src/mode/verilog.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var VerilogHighlightRules = require("./verilog_highlight_rules").VerilogHighlightRules; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = VerilogHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$quotes = { '"': '"' }; this.$id = "ace/mode/verilog"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/verilog_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var VerilogHighlightRules = function() { var keywords = "always|and|assign|automatic|begin|buf|bufif0|bufif1|case|casex|casez|cell|cmos|config|" + "deassign|default|defparam|design|disable|edge|else|end|endcase|endconfig|endfunction|endgenerate|endmodule|" + "endprimitive|endspecify|endtable|endtask|event|for|force|forever|fork|function|generate|genvar|highz0|" + "highz1|if|ifnone|incdir|include|initial|inout|input|instance|integer|join|large|liblist|library|localparam|" + "macromodule|medium|module|nand|negedge|nmos|nor|noshowcancelled|not|notif0|notif1|or|output|parameter|pmos|" + "posedge|primitive|pull0|pull1|pulldown|pullup|pulsestyle_onevent|pulsestyle_ondetect|rcmos|real|realtime|" + "reg|release|repeat|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|showcancelled|signed|small|specify|specparam|" + "strong0|strong1|supply0|supply1|table|task|time|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|" + "unsigned|use|vectored|wait|wand|weak0|weak1|while|wire|wor|xnor|xor" + "begin|bufif0|bufif1|case|casex|casez|config|else|end|endcase|endconfig|endfunction|" + "endgenerate|endmodule|endprimitive|endspecify|endtable|endtask|for|forever|function|generate|if|ifnone|" + "macromodule|module|primitive|repeat|specify|table|task|while"; 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 : "comment.start", regex : "/\\*", next : [ { token : "comment.end", regex : "\\*/", next: "start" }, { defaultToken : "comment" } ] }, { token : "string.start", regex : '"', next : [ { token : "constant.language.escape", regex : /\\(?:[ntvfa\\"]|[0-7]{1,3}|\x[a-fA-F\d]{1,2}|)/, consumeLineEnd : true }, { token : "string.end", regex : '"|$', next: "start" }, { defaultToken : "string" } ] }, { token : "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+" } ] }; this.normalizeRules(); }; oop.inherits(VerilogHighlightRules, TextHighlightRules); exports.VerilogHighlightRules = VerilogHighlightRules; ================================================ FILE: src/mode/vhdl.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var VHDLHighlightRules = require("./vhdl_highlight_rules").VHDLHighlightRules; var Mode = function() { this.HighlightRules = VHDLHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.$id = "ace/mode/vhdl"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/vhdl_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var VHDLHighlightRules = function() { var keywords = "access|after|alias|all|architecture|assert|attribute|"+ "begin|block|body|buffer|bus|case|component|configuration|"+ "context|disconnect|downto|else|elsif|end|entity|exit|"+ "file|for|force|function|generate|generic|group|guarded|"+ "if|impure|in|inertial|inout|is|label|library|linkage|"+ "literal|loop|map|new|next|of|on|or|open|others|out|"+ "package|parameter|port|postponed|procedure|process|"+ "protected|pure|range|record|register|reject|release|"+ "report|return|select|severity|shared|signal|subtype|then|"+ "to|transport|type|unaffected|units|until|use|variable|"+ "wait|when|while|with"; var storageType = "bit|bit_vector|boolean|character|integer|line|natural|"+ "positive|real|register|signed|std_logic|"+ "std_logic_vector|string||text|time|unsigned"; var storageModifiers = "array|constant"; var keywordOperators = "abs|and|mod|nand|nor|not|rem|rol|ror|sla|sll|sra"+ "srl|xnor|xor"; var builtinConstants = ( "true|false|null" ); var keywordMapper = this.createKeywordMapper({ "keyword.operator": keywordOperators, "keyword": keywords, "constant.language": builtinConstants, "storage.modifier": storageModifiers, "storage.type": storageType }, "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 : "keyword", // pre-compiler directives regex : "\\s*(?:library|package|use)\\b" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "&|\\*|\\+|\\-|\\/|<|=|>|\\||=>|\\*\\*|:=|\\/=|>=|<=|<>" }, { token : "punctuation.operator", regex : "\\'|\\:|\\,|\\;|\\." },{ token : "paren.lparen", regex : "[[(]" }, { token : "paren.rparen", regex : "[\\])]" }, { token : "text", regex : "\\s+" } ] }; }; oop.inherits(VHDLHighlightRules, TextHighlightRules); exports.VHDLHighlightRules = VHDLHighlightRules; ================================================ FILE: src/mode/visualforce.js ================================================ /* caption: Visualforce; extensions: component,page,vfp */ "use strict"; var oop = require("../lib/oop"); var HtmlMode = require("./html").Mode; var VisualforceHighlightRules = require("./visualforce_highlight_rules").VisualforceHighlightRules; var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; var HtmlFoldMode = require("./folding/html").FoldMode; function VisualforceMode() { HtmlMode.call(this); this.HighlightRules = VisualforceHighlightRules; this.foldingRules = new HtmlFoldMode(); this.$behaviour = new XmlBehaviour(); } oop.inherits(VisualforceMode, HtmlMode); VisualforceMode.prototype.emmetConfig = { profile: "xhtml" }; exports.Mode = VisualforceMode; ================================================ FILE: src/mode/visualforce_highlight_rules.js ================================================ /* global define */ "use strict"; var oop = require("../lib/oop"); var HtmlHighlightRules = require("../mode/html_highlight_rules").HtmlHighlightRules; function string(options) { return { token: options.token + ".start", regex: options.start, push: [{ token : "constant.language.escape", regex : options.escape }, { token: options.token + ".end", regex: options.start, next: "pop" }, { defaultToken: options.token }] }; } var VisualforceHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "variable.language": "$Action|$Api|$Component|$ComponentLabel|$CurrentPage|$FieldSet|$Label|$Label|" + "$ObjectType|$Organization|$Page|$Permission|$Profile|$Resource|$SControl|" + "$Setup|$Site|$System.OriginDateTime|$User|$UserRole|" + "Site|UITheme|UIThemeDisplayed", "keyword": "", "storage.type": "", "constant.language": "true|false|null|TRUE|FALSE|NULL", "support.function": "DATE|DATEVALUE|DATETIMEVALUE|DAY|MONTH|NOW|TODAY|YEAR|BLANKVALUE|ISBLANK|" + "NULLVALUE|PRIORVALUE|AND|CASE|IF|ISCHANGED|ISNEW|ISNUMBER|NOT|OR|ABS|" + "CEILING|EXP|FLOOR|LN|LOG|MAX|MIN|MOD|ROUND|SQRT|BEGINS|BR|CASESAFEID|" + "CONTAINS|FIND|GETSESSIONID|HTMLENCODE|ISPICKVAL|JSENCODE|JSINHTMLENCODE|" + "LEFT|LEN|LOWER|LPAD|MID|RIGHT|RPAD|SUBSTITUTE|TEXT|TRIM|UPPER|URLENCODE|VALUE|" + "GETRECORDIDS|INCLUDE|LINKTO|REGEX|REQUIRESCRIPT|URLFOR|VLOOKUP|HTMLENCODE|JSENCODE|" + "JSINHTMLENCODE|URLENCODE" }, "identifier"); HtmlHighlightRules.call(this); var hbs = { token : "keyword.start", regex : "{!", push : "Visualforce" }; for (var key in this.$rules) { this.$rules[key].unshift(hbs); } this.$rules.Visualforce = [ string({ start: '"', escape: /\\[btnfr"'\\]/, token: "string", multiline: true }), string({ start: "'", escape: /\\[btnfr"'\\]/, token: "string", multiline: true }), { token: "comment.start", regex : "\\/\\*", push: [ {token : "comment.end", regex : "\\*\\/|(?=})", next : "pop"}, {defaultToken : "comment", caseInsensitive: true} ] }, { token : "keyword.end", regex : "}", next : "pop" }, { token : keywordMapper, regex : /[a-zA-Z$_\u00a1-\uffff][a-zA-Z\d$_\u00a1-\uffff]*\b/ }, { token : "keyword.operator", regex : /==|<>|!=|<=|>=|&&|\|\||[+\-*/^()=<>&]/ }, { token : "punctuation.operator", regex : /[?:,;.]/ }, { token : "paren.lparen", regex : /[\[({]/ }, { token : "paren.rparen", regex : /[\])}]/ } ]; this.normalizeRules(); }; oop.inherits(VisualforceHighlightRules, HtmlHighlightRules); exports.VisualforceHighlightRules = VisualforceHighlightRules; ================================================ FILE: src/mode/vue.js ================================================ "use strict"; var oop = require("../lib/oop"); const {FoldMode: HtmlFoldMode} = require("./folding/html"); const lang = require("../lib/lang"); const {XmlBehaviour} = require("./behaviour/xml"); const {HtmlCompletions} = require("./html_completions"); var HTMLMode = require("./html").Mode; var VueHighlightRules = require("./vue_highlight_rules").VueHighlightRules; var voidElements = [ "area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr" ]; var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"]; var Mode = function () { this.HighlightRules = VueHighlightRules; this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags)); this.$behaviour = new XmlBehaviour(); this.$completer = new HtmlCompletions(); }; oop.inherits(Mode, HTMLMode); (function () { this.blockComment = { start: "<!--", end: "-->" }; this.voidElements = lang.arrayToMap(voidElements); this.getCompletions = function (state, session, pos, prefix) { return this.$completer.getCompletions(state, session, pos, prefix); }; this.$id = "ace/mode/vue"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/vue_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var {CssHighlightRules} = require("./css_highlight_rules"); var {TypeScriptHighlightRules} = require("./typescript_highlight_rules"); var {CoffeeHighlightRules} = require("./coffee_highlight_rules"); var {HtmlHighlightRules} = require("./html_highlight_rules"); var {JavaScriptHighlightRules} = require("./javascript_highlight_rules"); var {StylusHighlightRules} = require("./stylus_highlight_rules"); var {SassHighlightRules} = require("./sass_highlight_rules"); var {ScssHighlightRules} = require("./scss_highlight_rules"); var {LessHighlightRules} = require("./less_highlight_rules"); var {Tokenizer} = require("../tokenizer"); var {SlimHighlightRules} = require("./slim_highlight_rules"); var {JadeHighlightRules} = require("./jade_highlight_rules"); var JavaScriptMode = require("./javascript").Mode; var VueHighlightRules = function (options) { /** * @param {{new(): Ace.HighlightRules}|Ace.HighlightRulesMap} HighlightRules * @param {string} tag * @param {string} value * @param {string} [attribute] */ this.embedLangRules = function (HighlightRules, tag, value, attribute) { var condition = attribute ? "(?=[^>]*" + attribute + "\\s*=\\s*['\"]" + value + "['\"]))" : "(?=\\s|>|$))"; this.$rules.start.unshift({ token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], regex: "(<)(" + tag + condition, next: [ { token: "meta.tag.punctuation.tag-close." + tag + ".xml", regex: "/?>", next: value + "-start" }, {include: "attributes"} ] }); this.$rules[tag + "-end"] = [ {include: "attributes"}, { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start", onMatch: function (value, currentState, stack) { stack.splice(0); return this.token; } } ]; this.embedRules(HighlightRules, value + "-", [ { token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], regex: "(</)(" + tag + "(?=\\s|>|$))", next: tag + "-end" }, { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[" }, { token: "string.cdata.xml", regex: "\\]\\]>" } ]); }; var vueRules = [ { include: "vue-interpolations" } ]; var VueRules = new HtmlHighlightRules().getRules(); VueRules.start = vueRules.concat(VueRules.start); VueRules["vue-interpolations"] = [ { token: "punctuation", regex: /\{\{\{?/, next: "js-interpolation-start" } ]; var self = this; VueRules.tag_stuff.unshift({//vue-directives token: "string", regex: /(?:\b(v-)|(:|@))(\[?[a-zA-Z\-.]+\]?)(?:(\:\[?[a-zA-Z\-]+\]?))?((?:\.[a-zA-Z\-]+)*)(\s*)(=)(\s*)(["'])/, onMatch: function (value, currentState, stack) { var quote = value[value.length - 1]; stack.unshift(quote, currentState); var values = new RegExp(this.regex).exec(value); if (!values) return "text"; var tokens = []; var types = [ "entity.other.attribute-name.xml", "punctuation.separator.key-value.xml", "entity.other.attribute-name.xml", "entity.other.attribute-name.xml", "entity.other.attribute-name.xml", "text", "punctuation.separator.key-value.xml", "text", "string" ]; for (var i = 0, l = types.length; i < l; i++) { if (values[i + 1]) tokens[tokens.length] = { type: types[i], value: values[i + 1] }; } return tokens; }, next: [ { token: "string", regex: /$/, next: "tag_stuff" }, { token: "string", regex: /.*/, onMatch: function (value, currentState, stack, line) { var quote = stack[0]; var parts = value.split(quote); let text = parts[0]; this.next = ""; if (parts.length > 1) { stack.shift(); var nextState = stack.shift(); var currentData = new Tokenizer(self.$rules).getLineTokens( parts.slice(1).join(quote), nextState); currentData.tokens.unshift({ type: "string", value: quote }); this.next = Array.isArray(currentData.state) ? currentData.state[currentData.state.length - 1] : currentData.state; } var data = new JavaScriptMode().getTokenizer().getLineTokens(text, "start"); var tokens = data.tokens; if (currentData) { tokens.push(...currentData.tokens); } return tokens; } } ] }, { token: "string", regex: '"', next: [ { token: "string", regex: '"|$', next: "tag_stuff" }, { include: "vue-interpolations" }, { defaultToken: "string" } ] }, { token: "string", regex: "'", next: [ { token: "string", regex: "'|$", next: "tag_stuff" }, { include: "vue-interpolations" }, { defaultToken: "string" } ] }); this.$rules = VueRules; this.embedRules(JavaScriptHighlightRules, "js-interpolation-", [ { token: "punctuation", regex: /\}\}\}?/, next: "start" } ]); this.embedLangRules(CssHighlightRules, "style", "css"); this.embedLangRules(StylusHighlightRules, "style", "stylus", "lang"); //TODO: postcss is missing: this.embedLangRules(StylusHighlightRules, "style", "lang", "postcss"); this.embedLangRules(SassHighlightRules, "style", "sass", "lang"); this.embedLangRules(ScssHighlightRules, "style", "scss", "lang"); this.embedLangRules(LessHighlightRules, "style", "less", "lang"); this.embedLangRules(TypeScriptHighlightRules, "script", "ts", "lang"); this.embedLangRules(CoffeeHighlightRules, "script", "coffee", "lang"); //TODO: this.embedLangRules(CoffeeHighlightRules, "script", "livescript", "lang"); this.embedLangRules(SlimHighlightRules, "template", "slm", "lang"); this.embedLangRules(JadeHighlightRules, "template", "jade", "lang"); //TODO: this.embedLangRules(Pug, "template", "pug", "lang"); this.embedLangRules(StylusHighlightRules, "template", "stylus", "lang"); this.normalizeRules(); }; oop.inherits(VueHighlightRules, HtmlHighlightRules); exports.VueHighlightRules = VueHighlightRules; ================================================ FILE: src/mode/wollok.js ================================================ "use strict"; var oop = require("../lib/oop"); var JavaScriptMode = require("./javascript").Mode; var WollokHighlightRules = require("./wollok_highlight_rules").WollokHighlightRules; var Mode = function() { JavaScriptMode.call(this); this.HighlightRules = WollokHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, JavaScriptMode); (function() { this.createWorker = function(session) { return null; }; this.$id = "ace/mode/wollok"; this.snippetFileId = "ace/snippets/wollok"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/wollok_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var WollokHighlightRules = function() { // taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html var keywords = ( "test|describe|package|inherits|false|import|else|or|class|and|not|native|override|program|self|try|const|var|catch|object|super|throw|if|null|return|true|new|constructor|method|mixin" ); var buildinConstants = ("null|assert|console"); var langClasses = ( "Object|Pair|String|Boolean|Number|Integer|Double|Collection|Set|List|Exception|Range" + "|StackTraceElement" ); var keywordMapper = this.createKeywordMapper({ "variable.language": "self", "keyword": keywords, "constant.language": buildinConstants, "support.function": langClasses }, "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", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "constant.numeric", // hex regex : /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/ }, { token : "constant.numeric", // float regex : /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/ }, { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "===|&&|\\*=|\\.\\.|\\*\\*|#|!|%|\\*|\\?:|\\+|\\/|,|\\+=|\\-|\\.\\.<|!==|:|\\/=|\\?\\.|\\+\\+|>|=|<|>=|=>|==|\\]|\\[|\\-=|\\->|\\||\\-\\-|<>|!=|%=|\\|" }, { token : "lparen", regex : "[[({]" }, { token : "rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment", // closing comment regex : ".*?\\*\\/", next : "start" }, { token : "comment", // comment spanning whole line regex : ".+" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; oop.inherits(WollokHighlightRules, TextHighlightRules); exports.WollokHighlightRules = WollokHighlightRules; ================================================ FILE: src/mode/xml.js ================================================ "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextMode = require("./text").Mode; var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; var XmlFoldMode = require("./folding/xml").FoldMode; var WorkerClient = require("../worker/worker_client").WorkerClient; var Mode = function() { this.HighlightRules = XmlHighlightRules; this.$behaviour = new XmlBehaviour(); this.foldingRules = new XmlFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.voidElements = lang.arrayToMap([]); this.blockComment = {start: "<!--", end: "-->"}; this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker"); worker.attachToDocument(session.getDocument()); worker.on("error", function(e) { session.setAnnotations(e.data); }); worker.on("terminate", function() { session.clearAnnotations(); }); return worker; }; this.$id = "ace/mode/xml"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/xml_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var XmlHighlightRules = function(normalize) { // http://www.w3.org/TR/REC-xml/#NT-NameChar // NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] // NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*"; this.$rules = { start : [ {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"}, { token : ["punctuation.instruction.xml", "keyword.instruction.xml"], regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction" }, {token : "comment.start.xml", regex : "<\\!--", next : "comment"}, { token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"], regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true }, {include : "tag"}, {token : "text.end-tag-open.xml", regex: "</"}, {token : "text.tag-open.xml", regex: "<"}, {include : "reference"}, {defaultToken : "text.xml"} ], processing_instruction : [{ token : "entity.other.attribute-name.decl-attribute-name.xml", regex : tagRegex }, { token : "keyword.operator.decl-attribute-equals.xml", regex : "=" }, { include: "whitespace" }, { include: "string" }, { token : "punctuation.xml-decl.xml", regex : "\\?>", next : "start" }], doctype : [ {include : "whitespace"}, {include : "string"}, {token : "xml-pe.doctype.xml", regex : ">", next : "start"}, {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"}, {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"} ], int_subset : [{ token : "text.xml", regex : "\\s+" }, { token: "punctuation.int-subset.xml", regex: "]", next: "pop" }, { token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"], regex : "(<\\!)(" + tagRegex + ")", push : [{ token : "text", regex : "\\s+" }, { token : "punctuation.markup-decl.xml", regex : ">", next : "pop" }, {include : "string"}] }], cdata : [ {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"}, {token : "text.xml", regex : "\\s+"}, {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"} ], comment : [ {token : "comment.end.xml", regex : "-->", next : "start"}, {defaultToken : "comment.xml"} ], reference : [{ token : "constant.language.escape.reference.xml", regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }], attr_reference : [{ token : "constant.language.escape.reference.attribute-value.xml", regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }], tag : [{ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"], regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")", next: [ {include : "attributes"}, {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"} ] }], tag_whitespace : [ {token : "text.tag-whitespace.xml", regex : "\\s+"} ], // for doctype and processing instructions whitespace : [ {token : "text.whitespace.xml", regex : "\\s+"} ], // for doctype and processing instructions string: [{ token : "string.xml", regex : "'", push : [ {token : "string.xml", regex: "'", next: "pop"}, {defaultToken : "string.xml"} ] }, { token : "string.xml", regex : '"', push : [ {token : "string.xml", regex: '"', next: "pop"}, {defaultToken : "string.xml"} ] }], attributes: [{ token : "entity.other.attribute-name.xml", regex : tagRegex }, { token : "keyword.operator.attribute-equals.xml", regex : "=" }, { include: "tag_whitespace" }, { include: "attribute_value" }], attribute_value: [{ token : "string.attribute-value.xml", regex : "'", push : [ {token : "string.attribute-value.xml", regex: "'", next: "pop"}, {include : "attr_reference"}, {defaultToken : "string.attribute-value.xml"} ] }, { token : "string.attribute-value.xml", regex : '"', push : [ {token : "string.attribute-value.xml", regex: '"', next: "pop"}, {include : "attr_reference"}, {defaultToken : "string.attribute-value.xml"} ] }] }; if (this.constructor === XmlHighlightRules) this.normalizeRules(); }; (function() { this.embedTagRules = function(HighlightRules, prefix, tag){ this.$rules.tag.unshift({ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], regex : "(<)(" + tag + "(?=\\s|>|$))", next: [ {include : "attributes"}, {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"} ] }); this.$rules[tag + "-end"] = [ {include : "attributes"}, {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start", onMatch : function(value, currentState, stack) { stack.splice(0); return this.token; }} ]; this.embedRules(HighlightRules, prefix, [{ token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], regex : "(</)(" + tag + "(?=\\s|>|$))", next: tag + "-end" }, { token: "string.cdata.xml", regex : "<\\!\\[CDATA\\[" }, { token: "string.cdata.xml", regex : "\\]\\]>" }]); }; }).call(TextHighlightRules.prototype); oop.inherits(XmlHighlightRules, TextHighlightRules); exports.XmlHighlightRules = XmlHighlightRules; ================================================ FILE: src/mode/xml_test.js ================================================ "use strict"; var EditSession = require("../edit_session").EditSession; var Tokenizer = require("../tokenizer").Tokenizer; var XmlMode = require("./xml").Mode; var assert = require("../test/assertions"); module.exports = { setUp : function() { this.mode = new XmlMode(); }, "test: getTokenizer() (smoke test)" : function() { var tokenizer = this.mode.getTokenizer(); assert.ok(tokenizer instanceof Tokenizer); var tokens = tokenizer.getLineTokens("<juhu>", "start").tokens; assert.equal("meta.tag.punctuation.tag-open.xml", tokens[0].type); }, "test: toggle comment lines should not do anything" : function() { var session = new EditSession([" abc", " cde", "fg"]); this.mode.toggleCommentLines("start", session, 0, 1); assert.equal([" <!-- abc-->", " <!--cde-->", "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")); } }; require("../test/run")(module); ================================================ FILE: src/mode/yaml.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var YamlHighlightRules = require("./yaml_highlight_rules").YamlHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var FoldMode = require("./folding/yaml").FoldMode; var WorkerClient = require("../worker/worker_client").WorkerClient; var Mode = function() { this.HighlightRules = YamlHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ["#"]; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); 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) { var worker = new WorkerClient(["ace"], "ace/mode/yaml_worker", "YamlWorker"); worker.attachToDocument(session.getDocument()); worker.on("annotate", function(results) { session.setAnnotations(results.data); }); worker.on("terminate", function() { session.clearAnnotations(); }); return worker; }; this.$id = "ace/mode/yaml"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/yaml_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var YamlHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : "#.*$" }, { token : "list.markup", regex : /^(?:-{3}|\.{3})\s*(?=#|$)/ }, { token : "list.markup", regex : /^\s*[\-?](?:$|\s)/ }, { token: "constant", regex: "!![\\w//]+" }, { token: "constant.language", regex: "[&\\*][a-zA-Z0-9-_]+" }, { token: ["meta.tag", "keyword"], regex: /^(\s*\w[^\s:]*?)(:(?=\s|$))/ },{ token: ["meta.tag", "keyword"], regex: /(\w[^\s:]*?)(\s*:(?=\s|$))/ }, { token : "keyword.operator", regex : "<<\\w*:\\w*" }, { token : "keyword.operator", regex : "-\\s*(?=[{])" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }, { token : "string", // multi line string start regex : /[|>][-+\d]*(?:$|\s+(?:$|#))/, onMatch: function(val, state, stack, line) { line = line.replace(/ #.*/, ""); var indent = /^ *((:\s*)?-(\s*[^|>])?)?/.exec(line)[0] .replace(/\S\s*$/, "").length; var indentationIndicator = parseInt(/\d+[\s+-]*$/.exec(line)); if (indentationIndicator) { indent += indentationIndicator - 1; this.next = "mlString"; } else { this.next = "mlStringPre"; } if (!stack.length) { stack.push(this.next); stack.push(indent); } else { stack[0] = this.next; stack[1] = indent; } return this.token; }, next : "mlString" }, { token : "string", // single quoted string regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }, { token : "constant.numeric", // float regex : /(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)(?=[^\d-\w]|$)$/ }, { token : "constant.numeric", // other number regex : /[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/ }, { token : "constant.language.boolean", regex : "\\b(?:true|false|TRUE|FALSE|True|False|yes|no)\\b" }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : /[^\s,:\[\]\{\}]+/ } ], "mlStringPre" : [ { token : "indent", regex : /^ *$/ }, { token : "indent", regex : /^ */, onMatch: function(val, state, stack) { var curIndent = stack[1]; if (curIndent >= val.length) { this.next = "start"; stack.shift(); stack.shift(); } else { stack[1] = val.length - 1; this.next = stack[0] = "mlString"; } return this.token; }, next : "mlString" }, { defaultToken : "string" } ], "mlString" : [ { token : "indent", regex : /^ *$/ }, { token : "indent", regex : /^ */, onMatch: function(val, state, stack) { var curIndent = stack[1]; if (curIndent >= val.length) { this.next = "start"; stack.splice(0); } else { this.next = "mlString"; } return this.token; }, next : "mlString" }, { token : "string", regex : '.+' } ]}; this.normalizeRules(); }; oop.inherits(YamlHighlightRules, TextHighlightRules); exports.YamlHighlightRules = YamlHighlightRules; ================================================ FILE: src/mode/zeek.js ================================================ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ZeekHighlightRules = require("./zeek_highlight_rules").ZeekHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = ZeekHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; // Extra logic goes here. this.$id = "ace/mode/zeek"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/zeek_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ZeekHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start": [ { token: "comment.line", regex: "#.*$" }, { token: "string.double", regex: /"/, next: "string-state" }, { token: "string.regexp", regex: "(/)(?=.*/)", next: "pattern-state" }, { token: ["keyword.other", "meta.preprocessor"], regex: /(@(?:load-plugin|load-sigs|load|unload))(.*$)/ }, { token: "keyword.other", regex: /@(?:DEBUG|DIR|FILENAME|deprecated|if|ifdef|ifndef|else|endif)/ }, { token: [ "keyword.other", "meta.preprocessor", "keyword.operator", "meta.preprocessor" ], regex: /(@prefixes)(\s*)(\+?=)(.*$)/ }, { token: "storage.modifier.attribute", regex: /\&\b(?:redef|priority|log|optional|default|add_func|delete_func|expire_func|read_expire|write_expire|create_expire|synchronized|persistent|rotate_interval|rotate_size|encrypt|raw_output|mergeable|error_handler|type_column|deprecated)\b/ }, { token: "constant.language", regex: /\b(?:T|F)\b/ }, { token: "constant.numeric.port", regex: /\b\d{1,5}\/(?:udp|tcp|icmp|unknown)\b/ }, { token: "constant.numeric.addr", regex: /\b(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\b/, comment: "IPv4 address" }, { token: "constant.numeric.addr", regex: /\[(?:[0-9a-fA-F]{0,4}:){2,7}(?:[0-9a-fA-F]{0,4})?(?:(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2}))?\]/, comment: "IPv6 address" }, { token: "constant.numeric.float.decimal.interval", regex: /(?:(?:\d*\.\d*(?:[eE][+-]?\d+)?|\d*[eE][+-]?\d+|\d*\.\d*)|\d+)\s*(?:day|hr|min|msec|usec|sec)s?/ }, { token: "constant.numeric.float.decimal", regex: /\d*\.\d*(?:[eE][+-]?\d+)?|\d*[eE][+-]?\d+|\d*\.\d*/ }, { token: "constant.numeric.hostname", regex: /\b[A-Za-z0-9][A-Za-z0-9\-]*(?:\.[A-Za-z0-9][A-Za-z0-9\-]*)+\b/ }, { token: "constant.numeric.integer.hexadecimal", regex: /\b0x[0-9a-fA-F]+\b/ }, { token: "constant.numeric.integer.decimal", regex: /\b\d+\b/ }, { token: "keyword.operator", regex: /==|!=|<=|<|>=|>/ }, { token: "keyword.operator", regex: /(&&)|(\|\|)|(!)/ }, { token: "keyword.operator", regex: /=|\+=|-=/ }, { token: "keyword.operator", regex: /\+\+|\+|--|-|\*|\/|%/ }, { token: "keyword.operator", regex: /&|\||\^|~/ }, { token: "keyword.operator", regex: /\b(?:in|as|is)\b/ }, { token: "punctuation.terminator", regex: /;/ }, { token: "punctuation.accessor", regex: /\??\$/ }, { token: "punctuation.accessor", regex: /::/ }, { token: "keyword.operator", regex: /\?/ }, // Unsure how to tell if colon is used as operator vs. separator. // { // token: "keyword.operator", // regex: /:/ // }, { token: "punctuation.separator", regex: /:/ }, { token: "punctuation.separator", regex: /,/ }, { token: [ "keyword.other", "meta.namespace", "entity.name.namespace" ], regex: /(module)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)/ }, { token: "keyword.other", regex: /\bexport\b/ }, { token: "keyword.control.conditional", regex: /\b(?:if|else)\b/ }, { token: "keyword.control", regex: /\b(?:for|while)\b/ }, { token: "keyword.control", regex: /\b(?:return|break|next|continue|fallthrough)\b/ }, { token: "keyword.control", regex: /\b(?:switch|default|case)\b/ }, { token: "keyword.other", regex: /\b(?:add|delete)\b/ }, { token: "keyword.other", regex: /\bprint\b/ }, { token: "keyword.control", regex: /\b(?:when|timeout|schedule)\b/ }, { token: [ "keyword.other", "meta.struct.record", "entity.name.struct.record", "meta.struct.record", "punctuation.separator", "meta.struct.record", "storage.type.struct.record" ], regex: /\b(type)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(\s*)(:)(\s*\b)(record)\b/ }, { token: [ "keyword.other", "meta.enum", "entity.name.enum", "meta.enum", "punctuation.separator", "meta.enum", "storage.type.enum" ], regex: /\b(type)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(\s*)(:)(\s*\b)(enum)\b/ }, { token: [ "keyword.other", "meta.type", "entity.name.type", "meta.type", "punctuation.separator" ], regex: /\b(type)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(\s*)(:)/ }, { token: [ "keyword.other", "meta.struct.record", "storage.type.struct.record", "meta.struct.record", "entity.name.struct.record" ], regex: /\b(redef)(\s+)(record)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\b/ }, { token: [ "keyword.other", "meta.enum", "storage.type.enum", "meta.enum", "entity.name.enum" ], regex: /\b(redef)(\s+)(enum)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\b/ }, { token: [ "storage.type", "text", "entity.name.function.event" ], regex: /\b(event)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(?=s*\()/ }, { token: [ "storage.type", "text", "entity.name.function.hook" ], regex: /\b(hook)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(?=s*\()/ }, { token: [ "storage.type", "text", "entity.name.function" ], regex: /\b(function)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(?=s*\()/ }, { token: "keyword.other", regex: /\bredef\b/ }, { token: "storage.type", regex: /\bany\b/ }, { token: "storage.type", regex: /\b(?:enum|record|set|table|vector)\b/ }, { token: [ "storage.type", "text", "keyword.operator", "text", "storage.type" ], regex: /\b(opaque)(\s+)(of)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\b/ }, { token: "keyword.operator", regex: /\bof\b/ }, { token: "storage.type", regex: /\b(?:addr|bool|count|double|file|int|interval|pattern|port|string|subnet|time)\b/ }, { token: "storage.type", regex: /\b(?:function|hook|event)\b/ }, { token: "storage.modifier", regex: /\b(?:global|local|const|option)\b/ }, { token: "entity.name.function.call", regex: /\b[A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*(?=s*\()/ }, { token: "punctuation.section.block.begin", regex: /\{/ }, { token: "punctuation.section.block.end", regex: /\}/ }, { token: "punctuation.section.brackets.begin", regex: /\[/ }, { token: "punctuation.section.brackets.end", regex: /\]/ }, { token: "punctuation.section.parens.begin", regex: /\(/ }, { token: "punctuation.section.parens.end", regex: /\)/ } ], // state: start "string-state": [ { token: "constant.character.escape", regex: /\\./ }, { token: "string.double", regex: /"/, next: "start" }, { token: "constant.other.placeholder", regex: /%-?[0-9]*(\.[0-9]+)?[DTdxsefg]/ }, { token: "string.double", regex: "." } ], // state: string-state "pattern-state": [ { token: "constant.character.escape", regex: /\\./ }, { token: "string.regexp", regex: "/", next: "start" }, { token: "string.regexp", regex: "." } ] // state: pattern-state }; this.normalizeRules(); }; ZeekHighlightRules.metaData = { fileTypes: ["bro", "zeek"], name: "Zeek", scopeName: "source.zeek" }; oop.inherits(ZeekHighlightRules, TextHighlightRules); exports.ZeekHighlightRules = ZeekHighlightRules; ================================================ FILE: src/mode/zig.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ZigHighlightRules = require("./zig_highlight_rules").ZigHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = ZigHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/zig"; }).call(Mode.prototype); exports.Mode = Mode; ================================================ FILE: src/mode/zig_highlight_rules.js ================================================ "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ZigHighlightRules = function() { this.$rules = { start: [{ include: "#dummy_main" }], "#block": [{ token: [ "storage.type.zig", "text", "punctuation.section.braces.begin.zig" ], regex: /((?:[a-zA-Z_][\w.]*|@\".+\")?)(\s*)(\{)/, push: [{ token: "punctuation.section.braces.end.zig", regex: /\}/, next: "pop" }, { include: "#dummy_main" }] }], "#character_escapes": [{ token: "constant.character.escape.newline.zig", regex: /\\n/ }, { token: "constant.character.escape.carrigereturn.zig", regex: /\\r/ }, { token: "constant.character.escape.tabulator.zig", regex: /\\t/ }, { token: "constant.character.escape.backslash.zig", regex: /\\\\/ }, { token: "constant.character.escape.single-quote.zig", regex: /\\'/ }, { token: "constant.character.escape.double-quote.zig", regex: /\\\"/ }, { token: "constant.character.escape.hexidecimal.zig", regex: /\\x[a-fA-F\d]{2}/ }, { token: "constant.character.escape.hexidecimal.zig", regex: /\\u\{[a-fA-F\d]{1,6}\}/ }], "#comments": [{ token: "comment.line.documentation.zig", regex: /\/\/[!\/](?=[^\/])/, push: [{ token: "comment.line.documentation.zig", regex: /$/, next: "pop" }, { include: "#commentContents" }, { defaultToken: "comment.line.documentation.zig" }] }, { token: "comment.line.double-slash.zig", regex: /\/\//, push: [{ token: "comment.line.double-slash.zig", regex: /$/, next: "pop" }, { include: "#commentContents" }, { defaultToken: "comment.line.double-slash.zig" }] }], "#commentContents": [{ token: "keyword.todo.zig", regex: /\b(?:TODO|FIXME|XXX|NOTE)\b:?/ }], "#constants": [{ token: "constant.language.zig", regex: /\b(?:null|undefined|true|false)\b/ }, { token: "constant.numeric.integer.zig", regex: /\b(?!\.)-?[\d_]+(?!\.)\b/ }, { token: "constant.numeric.integer.hexadecimal.zig", regex: /\b(?!\.)0x[a-fA-F\d_]+(?!\.)\b/ }, { token: "constant.numeric.integer.octal.zig", regex: /\b(?!\.)0o[0-7_]+(?!\.)\b/ }, { token: "constant.numeric.integer.binary.zig", regex: /\b(?!\.)0b[01_]+(?!\.)\b/ }, { token: "constant.numeric.float.zig", regex: /(?!\.)-?\b[\d_]+(?:\.[\d_]+)?(?:[eE][+-]?[\d_]+)?(?!\.)\b/ }, { token: "constant.numeric.float.hexadecimal.zig", regex: /(?!\.)-?\b0x[a-fA-F\d_]+(?:\.[a-fA-F\d_]+)?[pP]?(?:[+-]?[\d_]+)?(?!\.)\b/ }], "#container_decl": [{ token: "entity.name.union.zig", regex: /\b(?!\d)(?:[a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:extern|packed)?\b\s*union\s*[(\{])/ }, { token: "entity.name.struct.zig", regex: /\b(?!\d)(?:[a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:extern|packed)?\b\s*struct\s*[(\{])/ }, { token: "entity.name.enum.zig", regex: /\b(?!\d)(?:[a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:extern|packed)?\b\s*enum\s*[(\{])/ }, { token: "entity.name.error.zig", regex: /\b(?!\d)(?:[a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*error\s*[(\{])/ }, { token: [ "storage.type.error.zig", "punctuation.accessor.zig", "entity.name.error.zig" ], regex: /\b(error)(\.)([a-zA-Z_]\w*|@\".+\")/ }], "#dummy_main": [{ include: "#label" }, { include: "#function_type" }, { include: "#function_def" }, { include: "#punctuation" }, { include: "#storage_modifier" }, { include: "#container_decl" }, { include: "#constants" }, { include: "#comments" }, { include: "#strings" }, { include: "#storage" }, { include: "#keywords" }, { include: "#operators" }, { include: "#support" }, { include: "#field_decl" }, { include: "#block" }, { include: "#function_call" }, { include: "#enum_literal" }, { include: "#variables" }], "#enum_literal": [{ token: "constant.language.enum", regex: /(?!\w|\)|\?|\}|\]|\*|\.)\.(?:[a-zA-Z_]\w*\b|@\"[^\"]*\")(?!\(|\s*=[^=>])/ }], "#field_decl": [{ token: [ "variable.other.member.zig", "text", "punctuation.separator.zig", "text" ], regex: /([a-zA-Z_]\w*|@\".+\")(\s*)(:)(\s*)/, push: [{ token: [ "storage.type.zig", "text", "punctuation.separator.zig", "keyword.operator.assignment.zig" ], regex: /((?:[a-zA-Z_][\w.]*|@\".+\")?)(\s*)(?:(,)|(=)|$)/, next: "pop" }, { include: "#dummy_main" }] }], "#function_call": [{ token: "variable.function.zig", regex: /\b(?!fn)(?:[a-zA-Z_]\w*|@\".+\")(?=\s*\()/ }], "#keywords": [{ token: "keyword.control.zig", regex: /\b(?:while|for|break|return|continue|asm|defer|errdefer|unreachable)\b/ }, { token: "keyword.control.async.zig", regex: /\b(?:async|await|suspend|nosuspend|resume)\b/ }, { token: "keyword.control.conditional.zig", regex: /\b(?:if|else|switch|try|catch|orelse)\b/ }, { token: "keyword.control.import.zig", regex: /\b(?!\w)(?:@import|@cImport|@cInclude)\b/ }, { token: "keyword.other.usingnamespace.zig", regex: /\busingnamespace\b/ }], "#label": [{ token: [ "keyword.control.zig", "text", "entity.name.label.zig", "entity.name.label.zig" ], regex: /\b(break|continue)(\s*:\s*)([a-zA-Z_]\w*|@\".+\")\b|\b(?!\d)([a-zA-Z_]\w*|@\".+\")\b(?=\s*:\s*(?:\{|while\b))/ }], "#operators": [{ token: "keyword.operator.zig", regex: /\b!\b/ }, { token: "keyword.operator.logical.zig", regex: /==|(?:!|>|<)=?/ }, { token: "keyword.operator.word.zig", regex: /\b(?:and|or)\b/ }, { token: "keyword.operator.assignment.zig", regex: /(?:(?:\+|-|\*)\%?|\/|%|<<|>>|&|\|(?=[^\|])|\^)?=/ }, { token: "keyword.operator.arithmetic.zig", regex: /(?:\+|-|\*)\%?|\/(?!\/)|%/ }, { token: "keyword.operator.bitwise.zig", regex: /<<|>>|&(?=[a-zA-Z_]|@\")|\|(?=[^\|])|\^|~/ }, { token: "keyword.operator.other.zig", regex: /\+\+|\*\*|->|\.\?|\.\*|&(?=[a-zA-Z_]|@\")|\?|\|\||\.{2,3}/ }], "#param_list": [{ token: [ "variable.parameter.zig", "text", "punctuation.separator.zig", "text" ], regex: /([a-zA-Z_]\w*|@\".+\")(\s*)(:)(\s*)/, push: [{ token: [ "storage.type.zig", "text", "punctuation.separator.zig", "punctuation.section.parens.end.zig" ], regex: /((?:[a-zA-Z_][\w.]*|@\".+\")?)(\s*)(?:(,)|(\)))/, next: "pop" }, { include: "#dummy_main" }, { token: "storage.type.zig", regex: /[a-zA-Z_][\w.]*|@\".+\"/ }] }], "#punctuation": [{ token: "punctuation.separator.zig", regex: /,/ }, { token: "punctuation.terminator.zig", regex: /;/ }, { token: "punctuation.section.parens.begin.zig", regex: /\(/ }, { token: "punctuation.section.parens.end.zig", regex: /\)/ }], "#storage": [{ token: "storage.type.zig", regex: /\b(?:bool|void|noreturn|type|anyerror|anytype)\b/ }, { token: "storage.type.integer.zig", regex: /\b(?!\.)(?:[iu]\d+|[iu]size|comptime_int)\b/ }, { token: "storage.type.float.zig", regex: /\b(?:f16|f32|f64|f128|comptime_float)\b/ }, { token: "storage.type.c_compat.zig", regex: /\b(?:c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void)\b/ }, { token: [ "storage.type.zig", "text", "keyword.operator.zig", "text", "storage.type.zig" ], regex: /\b(anyframe)\b(\s*)((?:->)?)(\s*)(?:([a-zA-Z_][\w.]*|@\".+\")\b(?!\s*\())?/ }, { token: "storage.type.function.zig", regex: /\bfn\b/ }, { token: "storage.type.test.zig", regex: /\btest\b/ }, { token: "storage.type.struct.zig", regex: /\bstruct\b/ }, { token: "storage.type.enum.zig", regex: /\benum\b/ }, { token: "storage.type.union.zig", regex: /\bunion\b/ }, { token: "storage.type.error.zig", regex: /\berror\b/ }], "#storage_modifier": [{ token: "storage.modifier.zig", regex: /\b(?:const|var|extern|packed|export|pub|noalias|inline|noinline|comptime|volatile|align|linksection|threadlocal|allowzero)\b/ }], "#strings": [{ token: "string.quoted.single.zig", regex: /\'/, push: [{ token: "string.quoted.single.zig", regex: /\'/, next: "pop" }, { include: "#character_escapes" }, { token: "invalid.illegal.character.zig", regex: /\\[^\'][^\']*?/ }, { defaultToken: "string.quoted.single.zig" }] }, { token: "string.quoted.double.zig", regex: /c?\"/, push: [{ token: "string.quoted.double.zig", regex: /\"/, next: "pop" }, { include: "#character_escapes" }, { token: "invalid.illegal.character.zig", regex: /\\[^\'][^\']*?/ }, { defaultToken: "string.quoted.double.zig" }] }, { token: "string.quoted.other.zig", regex: /c?\\\\/, push: [{ token: "string.quoted.other.zig", regex: /$/, next: "pop" }, { defaultToken: "string.quoted.other.zig" }] }], "#function_type": [{ token: [ "storage.type.function.zig", "text", "punctuation.section.parens.begin.zig" ], regex: /\b(fn)(\s*)(\()/, push: [{ token: [ "text", "storage.type.zig", "text", "keyword.operator.zig", "text", "storage.type.zig" ], regex: /(\s*)(?:([a-zA-Z_]\w*|@\".+\"))?(\s*)((?:!)?)(\s*)([a-zA-Z_]\w*|@\".+\")/, next: "pop" }, { include: "#label" }, { include: "#param_list" }, { token: "storage.type.zig", regex: /[a-zA-Z_]\w*|@\".+\"/ }, { include: "#dummy_main" }, { defaultToken: "meta.function.parameters.zig" }] }], "#function_def": [{ token: [ "text", "entity.name.function", "punctuation.section.parens.begin.zig" ], regex: /(?=fn\s+)(\s+)([a-zA-Z_]\w*|@\".+\")(\()/, push: [{ token: [ "text", "storage.type.zig", "keyword.operator.zig", "text", "storage.type.zig" ], regex: /(\s*)((?:[a-zA-Z_][\w.]*|@\".+\")?)((?:!)?)(\s*)(?:([a-zA-Z_][\w.]*|@\".+\")?)/, next: "pop" }, { include: "#label" }, { include: "#param_list" }, { token: "storage.type.zig", regex: /[a-zA-Z_][\w.]*|@\".+\"/ }, { include: "#dummy_main" }] }], "#support": [{ token: "support.function.zig", regex: /\b@(?!\w|\"|[0-9])[a-zA-Z_]\w*\b/ }], "#variables": [{ token: "variable.constant.zig", regex: /\b[_A-Z][_A-Z0-9]+\b/ }, { token: "entity.name.type.zig", regex: /\b[_a-zA-Z][_a-zA-Z0-9]*_t\b/ }, { token: "entity.name.type.zig", regex: /\b[A-Z][a-zA-Z0-9]*\b/ }, { token: "variable.zig", regex: /\b[_a-zA-Z][_a-zA-Z0-9]*\b/ }] }; this.normalizeRules(); }; ZigHighlightRules.metaData = { fileTypes: ["zig"], keyEquivalent: "^~Z", name: "Zig", scopeName: "source.zig" }; oop.inherits(ZigHighlightRules, TextHighlightRules); exports.ZigHighlightRules = ZigHighlightRules; ================================================ FILE: src/mouse/default_gutter_handler.js ================================================ "use strict"; /** * @typedef {import("./mouse_handler").MouseHandler} MouseHandler */ var dom = require("../lib/dom"); var MouseEvent = require("./mouse_event").MouseEvent; var HoverTooltip = require("../tooltip").HoverTooltip; var nls = require("../config").nls; var Range = require("../range").Range; /** * @param {MouseHandler} mouseHandler * @this {MouseHandler} */ function GutterHandler(mouseHandler) { var editor = mouseHandler.editor; var gutter = editor.renderer.$gutterLayer; mouseHandler.$tooltip = new GutterTooltip(editor); mouseHandler.$tooltip.addToEditor(editor); mouseHandler.$tooltip.setDataProvider(function(e, editor) { var row = e.getDocumentPosition().row; mouseHandler.$tooltip.showTooltip(row); }); mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) { if (!editor.isFocused() || e.getButton() != 0) return; var gutterRegion = gutter.getRegion(e); if (gutterRegion == "foldWidgets") return; var row = e.getDocumentPosition().row; var selection = editor.session.selection; if (e.getShiftKey()) selection.selectTo(row, 0); else { if (e.domEvent.detail == 2) { editor.selectAll(); return e.preventDefault(); } mouseHandler.$clickSelection = editor.selection.getLineRange(row); } mouseHandler.setState("selectByLines"); mouseHandler.captureMouse(e); return e.preventDefault(); }); } exports.GutterHandler = GutterHandler; class GutterTooltip extends HoverTooltip { /** * @param {import("../editor").Editor} editor */ constructor(editor) { super(editor.container); this.id = "gt" + (++GutterTooltip.$uid); this.editor = editor; /**@type {Number | Undefined}*/ this.visibleTooltipRow; var el = this.getElement(); el.setAttribute("role", "tooltip"); el.setAttribute("id", this.id); el.style.pointerEvents = "auto"; this.idleTime = 50; this.onDomMouseMove = this.onDomMouseMove.bind(this); this.onDomMouseOut = this.onDomMouseOut.bind(this); this.setClassName("ace_gutter-tooltip"); } onDomMouseMove(domEvent) { var aceEvent = new MouseEvent(domEvent, this.editor); this.onMouseMove(aceEvent, this.editor); } onDomMouseOut(domEvent) { var aceEvent = new MouseEvent(domEvent, this.editor); this.onMouseOut(aceEvent); } addToEditor(editor) { var gutter = editor.renderer.$gutter; gutter.addEventListener("mousemove", this.onDomMouseMove); gutter.addEventListener("mouseout", this.onDomMouseOut); super.addToEditor(editor); } removeFromEditor(editor) { var gutter = editor.renderer.$gutter; gutter.removeEventListener("mousemove", this.onDomMouseMove); gutter.removeEventListener("mouseout", this.onDomMouseOut); super.removeFromEditor(editor); } destroy() { if (this.editor) { this.removeFromEditor(this.editor); } super.destroy(); } static get annotationLabels() { return { error: { singular: nls("gutter-tooltip.aria-label.error.singular", "error"), plural: nls("gutter-tooltip.aria-label.error.plural", "errors") }, security: { singular: nls("gutter-tooltip.aria-label.security.singular", "security finding"), plural: nls("gutter-tooltip.aria-label.security.plural", "security findings") }, warning: { singular: nls("gutter-tooltip.aria-label.warning.singular", "warning"), plural: nls("gutter-tooltip.aria-label.warning.plural", "warnings") }, info: { singular: nls("gutter-tooltip.aria-label.info.singular", "information message"), plural: nls("gutter-tooltip.aria-label.info.plural", "information messages") }, hint: { singular: nls("gutter-tooltip.aria-label.hint.singular", "suggestion"), plural: nls("gutter-tooltip.aria-label.hint.plural", "suggestions") } }; } /** * @param {number} row */ showTooltip(row) { var gutter = this.editor.renderer.$gutterLayer; var annotationsInRow = gutter.$annotations[row]; var annotation; if (annotationsInRow) annotation = { displayText: Array.from(annotationsInRow.displayText), type: Array.from(annotationsInRow.type) }; else annotation = {displayText: [], type: []}; // If the tooltip is for a row which has a closed fold, check whether there are // annotations in the folded lines. If so, add a summary to the list of annotations. var fold = gutter.session.getFoldLine(row); if (fold && gutter.$showFoldedAnnotations) { var annotationsInFold = {error: [], security: [], warning: [], info: [], hint: []}; var severityRank = {error: 1, security: 2, warning: 3, info: 4, hint: 5}; var mostSevereAnnotationTypeInFold; for (var i = row + 1; i <= fold.end.row; i++) { if (!gutter.$annotations[i]) continue; for (var j = 0; j < gutter.$annotations[i].text.length; j++) { var annotationType = gutter.$annotations[i].type[j]; annotationsInFold[annotationType].push(gutter.$annotations[i].text[j]); if ( !mostSevereAnnotationTypeInFold || severityRank[annotationType] < severityRank[mostSevereAnnotationTypeInFold] ) { mostSevereAnnotationTypeInFold = annotationType; } } } if (["error", "security", "warning"].includes(mostSevereAnnotationTypeInFold)) { var summaryFoldedAnnotations = `${GutterTooltip.annotationsToSummaryString( annotationsInFold )} in folded code.`; annotation.displayText.push(summaryFoldedAnnotations); annotation.type.push(mostSevereAnnotationTypeInFold + "_fold"); } } if (annotation.displayText.length === 0) return this.hide(); var annotationMessages = {error: [], security: [], warning: [], info: [], hint: []}; var iconClassName = gutter.$useSvgGutterIcons ? "ace_icon_svg" : "ace_icon"; // Construct the contents of the tooltip. for (var i = 0; i < annotation.displayText.length; i++) { var lineElement = dom.createElement("span"); var iconElement = dom.createElement("span"); iconElement.classList.add(...[`ace_${annotation.type[i]}`, iconClassName]); iconElement.setAttribute( "aria-label", `${GutterTooltip.annotationLabels[annotation.type[i].replace("_fold", "")].singular}` ); iconElement.setAttribute("role", "img"); // Set empty content to the img span to get it to show up iconElement.appendChild(dom.createTextNode(" ")); lineElement.appendChild(iconElement); lineElement.appendChild(dom.createTextNode(annotation.displayText[i])); lineElement.appendChild(dom.createElement("br")); annotationMessages[annotation.type[i].replace("_fold", "")].push(lineElement); } var tooltipElement = dom.createElement("span"); // Update the tooltip content annotationMessages.error.forEach((el) => tooltipElement.appendChild(el)); annotationMessages.security.forEach((el) => tooltipElement.appendChild(el)); annotationMessages.warning.forEach((el) => tooltipElement.appendChild(el)); annotationMessages.info.forEach((el) => tooltipElement.appendChild(el)); annotationMessages.hint.forEach((el) => tooltipElement.appendChild(el)); tooltipElement.setAttribute("aria-live", "polite"); var annotationNode = this.$findLinkedAnnotationNode(row); if (annotationNode) { annotationNode.setAttribute("aria-describedby", this.id); } var range = Range.fromPoints({row, column: 0}, {row, column: 0}); this.showForRange(this.editor, range, tooltipElement); this.visibleTooltipRow = row; this.editor._signal("showGutterTooltip", this); } $setPosition(editor, _ignoredPosition, _withMarker, range) { var gutterCell = this.$findCellByRow(range.start.row); if (!gutterCell) return; var el = gutterCell && gutterCell.element; var anchorEl = el && (el.querySelector(".ace_gutter_annotation")); if (!anchorEl) return; var r = anchorEl.getBoundingClientRect(); if (!r) return; var position = { pageX: r.right, pageY: r.top }; //we don't need marker for gutter return super.$setPosition(editor, position, false, range); } $shouldPlaceAbove(labelHeight, anchorTop, spaceBelow) { return spaceBelow < labelHeight; } $findLinkedAnnotationNode(row) { var cell = this.$findCellByRow(row); if (cell) { var element = cell.element; if (element.childNodes.length > 2) { return element.childNodes[2]; } } } $findCellByRow(row) { return this.editor.renderer.$gutterLayer.$lines.cells.find((el) => el.row === row); } hide(e) { if(!this.isOpen){ return; } this.$element.removeAttribute("aria-live"); if (this.visibleTooltipRow != undefined) { var annotationNode = this.$findLinkedAnnotationNode(this.visibleTooltipRow); if (annotationNode) { annotationNode.removeAttribute("aria-describedby"); } } this.visibleTooltipRow = undefined; this.editor._signal("hideGutterTooltip", this); super.hide(e); } static annotationsToSummaryString(annotations) { var summary = []; var annotationTypes = ["error", "security", "warning", "info", "hint"]; for (var annotationType of annotationTypes) { if (!annotations[annotationType].length) continue; var label = annotations[annotationType].length === 1 ? GutterTooltip.annotationLabels[annotationType].singular : GutterTooltip.annotationLabels[annotationType].plural; summary.push(`${annotations[annotationType].length} ${label}`); } return summary.join(", "); } /** * Check if cursor is outside gutter * @param e * @return {boolean} */ isOutsideOfText(e) { var editor = e.editor; var rect = editor.renderer.$gutter.getBoundingClientRect(); return !(e.clientX >= rect.left && e.clientX <= rect.right && e.clientY >= rect.top && e.clientY <= rect.bottom); } } GutterTooltip.$uid = 0; exports.GutterTooltip = GutterTooltip; ================================================ FILE: src/mouse/default_gutter_handler_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; require("../multi_select"); require("../theme/textmate"); var Editor = require("../editor").Editor; var Mode = require("../mode/java").Mode; var VirtualRenderer = require("../virtual_renderer").VirtualRenderer; var assert = require("../test/assertions"); var user = require("../test/user"); var lang = require("../lib/lang"); var MouseEvent = function(type, opts){ var e = document.createEvent("MouseEvents"); e.initMouseEvent(/click|wheel/.test(type) ? type : "mouse" + type, true, true, window, opts.detail, opts.x, opts.y, opts.x, opts.y, opts.ctrl, opts.alt, opts.shift, opts.meta, opts.button || 0, opts.relatedTarget); return e; }; var editor; function findVisibleTooltip() { const tooltips = document.body.querySelectorAll(".ace_gutter-tooltip"); for (let i = 0; i < tooltips.length; i++) { if (window.getComputedStyle(tooltips[i]).display === "block") { return tooltips[i]; } } return null; } module.exports = { setUp : function() { this.editor = new Editor(new VirtualRenderer()); this.editor.container.style.position = "absolute"; this.editor.container.style.height = "500px"; this.editor.container.style.width = "500px"; this.editor.container.style.left = "50px"; this.editor.container.style.top = "10px"; document.body.appendChild(this.editor.container); editor = this.editor; }, "test: gutter error tooltip" : async function(done) { var editor = this.editor; var value = ""; editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "error test", type: "error"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var annotation = lines.cells[0].element; assert.ok(/ace_error/.test(annotation.className)); var rect = annotation.getBoundingClientRect(); annotation.dispatchEvent(new MouseEvent("move", {x: rect.left + rect.width/2, y: rect.top + rect.height/2})); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/error test/.test(tooltip.textContent)); annotation.dispatchEvent(new MouseEvent("move", {x: 0, y: 0})); done(); }, "test: gutter security tooltip" : async function(done) { var editor = this.editor; var value = ""; editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "security finding test", type: "security"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var annotation = lines.cells[0].element; assert.ok(/ace_security/.test(annotation.className)); var rect = annotation.getBoundingClientRect(); annotation.dispatchEvent(new MouseEvent("move", {x: rect.left + rect.width/2, y: rect.top + rect.height/2})); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/security finding test/.test(tooltip.textContent)); done(); }, "test: gutter warning tooltip" : async function(done) { var editor = this.editor; var value = ""; editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "warning test", type: "warning"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var annotation = lines.cells[0].element; assert.ok(/ace_warning/.test(annotation.className)); var rect = annotation.getBoundingClientRect(); annotation.dispatchEvent(new MouseEvent("move", {x: rect.left + rect.width/2, y: rect.top + rect.height/2})); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/warning test/.test(tooltip.textContent)); done(); }, "test: gutter info tooltip" : async function(done) { var editor = this.editor; var value = ""; editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "info test", type: "info"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var annotation = lines.cells[0].element; assert.ok(/ace_info/.test(annotation.className)); var rect = annotation.getBoundingClientRect(); annotation.dispatchEvent(new MouseEvent("move", {x: rect.left + rect.width/2, y: rect.top + rect.height/2})); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/info test/.test(tooltip.textContent)); done(); }, "test: gutter hint tooltip" : async function(done) { var editor = this.editor; var value = ""; editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "suggestion test", type: "hint"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var annotation = lines.cells[0].element; assert.ok(/ace_hint/.test(annotation.className)); var rect = annotation.getBoundingClientRect(); annotation.dispatchEvent(new MouseEvent("move", {x: rect.left + rect.width/2, y: rect.top + rect.height/2})); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/suggestion test/.test(tooltip.textContent)); done(); }, "test: gutter svg icons" : function() { var editor = this.editor; var value = ""; editor.session.setMode(new Mode()); editor.setOption("useSvgGutterIcons", true); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, type: "error", text: "error test"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var line = lines.cells[0].element; assert.ok(/ace_gutter-cell_svg-icons/.test(line.className)); var annotation = line.childNodes[2].firstChild; assert.ok(/ace_icon_svg/.test(annotation.className)); }, "test: error show up in fold" : async function(done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("showFoldedAnnotations", true); editor.setValue(value, -1); editor.session.setAnnotations([{row: 1, column: 0, type: "error", text: "error test"}]); editor.renderer.$loop._flush(); // Fold the line containing the annotation. var lines = editor.renderer.$gutterLayer.$lines; assert.equal(lines.cells[1].element.textContent, "2"); var toggler = lines.cells[0].element.querySelector(".ace_fold-widget"); var rect = toggler.getBoundingClientRect(); if (!rect.left) rect.left = 100; // for mockdom toggler.dispatchEvent(new MouseEvent("click", {x: rect.left, y: rect.top})); editor.renderer.$loop._flush(); assert.ok(/ace_closed/.test(toggler.className)); assert.equal(lines.cells[1].element.textContent, "51"); // Annotation node should have fold class. var annotation = lines.cells[0].element.childNodes[2].firstChild; assert.ok(/ace_error_fold/.test(annotation.className)); var row = lines.cells[0].row; editor.$mouseHandler.$tooltip.showTooltip(row); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/error in folded/.test(tooltip.textContent)); done(); }, "test: security show up in fold" : async function(done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("showFoldedAnnotations", true); editor.setValue(value, -1); editor.session.setAnnotations([{row: 1, column: 0, type: "security", text: "security finding test"}]); editor.renderer.$loop._flush(); // Fold the line containing the annotation. var lines = editor.renderer.$gutterLayer.$lines; assert.equal(lines.cells[1].element.textContent, "2"); var toggler = lines.cells[0].element.querySelector(".ace_fold-widget"); var rect = toggler.getBoundingClientRect(); if (!rect.left) rect.left = 100; // for mockdom toggler.dispatchEvent(new MouseEvent("click", {x: rect.left, y: rect.top})); editor.renderer.$loop._flush(); assert.ok(/ace_closed/.test(toggler.className)); assert.equal(lines.cells[1].element.textContent, "51"); // Annotation node should have fold class. var annotation = lines.cells[0].element.childNodes[2].firstChild; assert.ok(/ace_security_fold/.test(annotation.className)); var row = lines.cells[0].row; editor.$mouseHandler.$tooltip.showTooltip(row); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/security finding in folded/.test(tooltip.textContent)); done(); }, "test: warning show up in fold" : async function(done) { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("showFoldedAnnotations", true); editor.setValue(value, -1); editor.session.setAnnotations([{row: 1, column: 0, type: "warning", text: "warning test"}]); editor.renderer.$loop._flush(); // Fold the line containing the annotation. var lines = editor.renderer.$gutterLayer.$lines; assert.equal(lines.cells[1].element.textContent, "2"); var toggler = lines.cells[0].element.querySelector(".ace_fold-widget"); var rect = toggler.getBoundingClientRect(); if (!rect.left) rect.left = 100; // for mockdom toggler.dispatchEvent(new MouseEvent("click", {x: rect.left, y: rect.top})); editor.renderer.$loop._flush(); assert.ok(/ace_closed/.test(toggler.className)); assert.equal(lines.cells[1].element.textContent, "51"); // Annotation node should have fold class. var annotation = lines.cells[0].element.childNodes[2].firstChild; assert.ok(/ace_warning_fold/.test(annotation.className)); var row = lines.cells[0].row; editor.$mouseHandler.$tooltip.showTooltip(row); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/warning in folded/.test(tooltip.textContent)); done(); }, "test: info not show up in fold" : function() { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("showFoldedAnnotations", true); editor.setValue(value, -1); editor.session.setAnnotations([{row: 1, column: 0, type: "info", text: "info test"}]); editor.renderer.$loop._flush(); // Fold the line containing the annotation. var lines = editor.renderer.$gutterLayer.$lines; assert.equal(lines.cells[1].element.textContent, "2"); var toggler = lines.cells[0].element.querySelector(".ace_fold-widget"); var rect = toggler.getBoundingClientRect(); if (!rect.left) rect.left = 100; // for mockdom toggler.dispatchEvent(new MouseEvent("click", {x: rect.left, y: rect.top})); editor.renderer.$loop._flush(); assert.ok(/ace_closed/.test(toggler.className)); assert.equal(lines.cells[1].element.textContent, "51"); // Annotation node should NOT have fold class. var annotation = lines.cells[0].element.childNodes[2]; assert.notOk(/fold/.test(annotation.className)); }, "test: hint not show up in fold" : function() { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("showFoldedAnnotations", true); editor.setValue(value, -1); editor.session.setAnnotations([{row: 1, column: 0, type: "hint", text: "suggestion test"}]); editor.renderer.$loop._flush(); // Fold the line containing the annotation. var lines = editor.renderer.$gutterLayer.$lines; assert.equal(lines.cells[1].element.textContent, "2"); var toggler = lines.cells[0].element.querySelector(".ace_fold-widget"); var rect = toggler.getBoundingClientRect(); if (!rect.left) rect.left = 100; // for mockdom toggler.dispatchEvent(new MouseEvent("click", {x: rect.left, y: rect.top})); editor.renderer.$loop._flush(); assert.ok(/ace_closed/.test(toggler.className)); assert.equal(lines.cells[1].element.textContent, "51"); // Annotation node should NOT have fold class. var annotation = lines.cells[0].element.childNodes[2]; assert.notOk(/fold/.test(annotation.className)); }, "test: severities are correctly ordered/ranked when folding": function() { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setOption("showFoldedAnnotations", true); editor.setValue(value, -1); // Rank is: Error > Security > Warning editor.session.setAnnotations([ {row: 1, column: 0, type: "warning", text: "warning test"}, {row: 1, column: 0, type: "security", text: "security finding test"}, {row: 1, column: 0, type: "error", text: "error test"} ]); editor.renderer.$loop._flush(); // Fold the line containing the annotation. var lines = editor.renderer.$gutterLayer.$lines; assert.equal(lines.cells[1].element.textContent, "2"); var firstLineGutterElement = lines.cells[0].element; var toggler = firstLineGutterElement.querySelector(".ace_fold-widget"); var rect = toggler.getBoundingClientRect(); if (!rect.left) rect.left = 100; // for mockdom toggler.dispatchEvent(new MouseEvent("click", {x: rect.left, y: rect.top})); editor.renderer.$loop._flush(); assert.ok(/ace_closed/.test(toggler.className)); assert.equal(lines.cells[1].element.textContent, "51"); // Annotation node should have Error fold class assert.ok(/ace_error_fold/.test(firstLineGutterElement.className)); assert.notOk(/ace_security_fold/.test(firstLineGutterElement.className)); assert.notOk(/ace_warning_fold/.test(firstLineGutterElement.className)); // Annotation node should have Security fold class editor.session.setAnnotations([ {row: 1, column: 0, type: "security", text: "security finding test"}, {row: 1, column: 0, type: "warning", text: "warning test"} ]); editor.renderer.$loop._flush(); assert.notOk(/ace_error_fold/.test(firstLineGutterElement.className)); assert.ok(/ace_security_fold/.test(firstLineGutterElement.className)); assert.notOk(/ace_warning_fold/.test(firstLineGutterElement.className)); // Annotation node should have Warning fold class editor.session.setAnnotations([ {row: 1, column: 0, type: "warning", text: "warning test"} ]); editor.renderer.$loop._flush(); assert.notOk(/ace_error_fold/.test(firstLineGutterElement.className)); assert.notOk(/ace_security_fold/.test(firstLineGutterElement.className)); assert.ok(/ace_warning_fold/.test(firstLineGutterElement.className)); }, "test: gutter tooltip should properly display special characters (\" ' & <)" : async function(done) { var editor = this.editor; var value = ""; editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "special characters \" ' & <", type: "error"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var annotation = lines.cells[0].element; assert.ok(/ace_error/.test(annotation.className)); var rect = annotation.getBoundingClientRect(); annotation.dispatchEvent(new MouseEvent("move", {x: rect.left + rect.width/2, y: rect.top + rect.height/2})); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/special characters " ' & </.test(tooltip.textContent)); done(); }, "test: gutter hover tooltip should remain open when pressing ctrl key combination" : async function(done) { var editor = this.editor; var value = ""; editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "error test", type: "error"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var annotation = lines.cells[0].element; assert.ok(/ace_error/.test(annotation.className)); var rect = annotation.getBoundingClientRect(); annotation.dispatchEvent(new MouseEvent("move", {x: rect.left + rect.width/2, y: rect.top + rect.height/2})); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/error test/.test(tooltip.textContent)); tooltip.focus(); user.type("Ctrl-C"); tooltip = findVisibleTooltip(); assert.ok(/error test/.test(tooltip.textContent)); // also verify if it closes when presses another key user.type("Escape"); tooltip = document.body.querySelector(".ace_gutter-tooltip"); assert.strictEqual(tooltip.style.display, "none"); done(); }, "test: gutter tooltip aria-describedby attribute": async function(done) { var editor = this.editor; var value = ""; editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.session.setAnnotations([{row: 0, column: 0, text: "error test", type: "error"}]); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var element = lines.cells[0].element; var annotation = element.childNodes[2]; assert.ok(/ace_error/.test(element.className)); var rect = element.getBoundingClientRect(); element.dispatchEvent(new MouseEvent("move", {x: rect.left + rect.width/2, y: rect.top + rect.height/2})); // Wait for the tooltip to appear after its timeout. await lang.sleep(100); editor.renderer.$loop._flush(); var tooltip = findVisibleTooltip(); assert.ok(/error test/.test(tooltip.textContent)); var ariaDescribedBy = annotation.getAttribute("aria-describedby"); assert.ok(ariaDescribedBy, "aria-describedby should be set when tooltip is shown"); assert.equal(ariaDescribedBy, tooltip.id, "aria-describedby should match tooltip id"); editor.container.dispatchEvent(new MouseEvent("wheel", {})); await lang.sleep(100); editor.renderer.$loop._flush(); assert.equal( annotation.getAttribute("aria-describedby"), "", "aria-describedby should be removed when tooltip is hidden" ); done(); }, tearDown : function() { this.editor.destroy(); document.body.removeChild(this.editor.container); } }; require("../test/run")(module); ================================================ FILE: src/mouse/default_handlers.js ================================================ "use strict"; /** * @typedef {import("./mouse_handler").MouseHandler} MouseHandler * @typedef {import("./mouse_event").MouseEvent} MouseEvent */ var useragent = require("../lib/useragent"); var DRAG_OFFSET = 0; // pixels var SCROLL_COOLDOWN_T = 550; // milliseconds class DefaultHandlers { /** * @param {MouseHandler} mouseHandler */ constructor(mouseHandler) { mouseHandler.$clickSelection = null; var editor = mouseHandler.editor; editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler)); editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(mouseHandler)); editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(mouseHandler)); editor.setDefaultHandler("quadclick", this.onQuadClick.bind(mouseHandler)); editor.setDefaultHandler("mousewheel", this.onMouseWheel.bind(mouseHandler)); var exports = ["select", "startSelect", "selectEnd", "selectAllEnd", "selectByWordsEnd", "selectByLinesEnd", "dragWait", "dragWaitEnd", "focusWait"]; exports.forEach(function(x) { mouseHandler[x] = this[x]; }, this); mouseHandler["selectByLines"] = this.extendSelectionBy.bind(mouseHandler, "getLineRange"); mouseHandler["selectByWords"] = this.extendSelectionBy.bind(mouseHandler, "getWordRange"); } /** * @param {MouseEvent} ev * @this {MouseHandler} */ onMouseDown(ev) { var inSelection = ev.inSelection(); var pos = ev.getDocumentPosition(); this.mousedownEvent = ev; var editor = this.editor; var button = ev.getButton(); if (button !== 0) { var selectionRange = editor.getSelectionRange(); var selectionEmpty = selectionRange.isEmpty(); if (selectionEmpty || button == 1) editor.selection.moveToPosition(pos); // 2: contextmenu, 1: linux paste if (button == 2) { editor.textInput.onContextMenu(ev.domEvent); if (!useragent.isMozilla) ev.preventDefault(); } // stopping event here breaks contextmenu on ff mac // not stoping breaks it on chrome mac return; } this.mousedownEvent.time = Date.now(); // if this click caused the editor to be focused should not clear the // selection if (inSelection && !editor.isFocused()) { editor.focus(); if (this.$focusTimeout && !this.$clickSelection && !editor.inMultiSelectMode) { this.setState("focusWait"); this.captureMouse(ev); return; } } this.captureMouse(ev); this.startSelect(pos, ev.domEvent._clicks > 1); return ev.preventDefault(); } /** * * @param {import("../../ace-internal").Ace.Position} [pos] * @param {boolean} [waitForClickSelection] * @this {MouseHandler} */ startSelect(pos, waitForClickSelection) { pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y); var editor = this.editor; if (!this.mousedownEvent) return; // allow double/triple click handlers to change selection if (this.mousedownEvent.getShiftKey()) editor.selection.selectToPosition(pos); else if (!waitForClickSelection) editor.selection.moveToPosition(pos); if (!waitForClickSelection) this.select(); editor.setStyle("ace_selecting"); this.setState("select"); } /** * @this {MouseHandler} */ select() { var anchor, editor = this.editor; var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y); if (this.$clickSelection) { var cmp = this.$clickSelection.comparePoint(cursor); if (cmp == -1) { anchor = this.$clickSelection.end; } else if (cmp == 1) { anchor = this.$clickSelection.start; } else { var orientedRange = calcRangeOrientation(this.$clickSelection, cursor, editor.session); cursor = orientedRange.cursor; anchor = orientedRange.anchor; } editor.selection.setSelectionAnchor(anchor.row, anchor.column); } editor.selection.selectToPosition(cursor); editor.renderer.scrollCursorIntoView(); } /** * @param {string | number} unitName * @this {MouseHandler} */ extendSelectionBy(unitName) { var anchor, editor = this.editor; var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y); var range = editor.selection[unitName](cursor.row, cursor.column); if (this.$clickSelection) { var cmpStart = this.$clickSelection.comparePoint(range.start); var cmpEnd = this.$clickSelection.comparePoint(range.end); if (cmpStart == -1 && cmpEnd <= 0) { anchor = this.$clickSelection.end; if (range.end.row != cursor.row || range.end.column != cursor.column) cursor = range.start; } else if (cmpEnd == 1 && cmpStart >= 0) { anchor = this.$clickSelection.start; if (range.start.row != cursor.row || range.start.column != cursor.column) cursor = range.end; } else if (cmpStart == -1 && cmpEnd == 1) { cursor = range.end; anchor = range.start; } else { var orientedRange = calcRangeOrientation(this.$clickSelection, cursor, editor.session); cursor = orientedRange.cursor; anchor = orientedRange.anchor; } editor.selection.setSelectionAnchor(anchor.row, anchor.column); } editor.selection.selectToPosition(cursor); editor.renderer.scrollCursorIntoView(); } /** * @this {MouseHandler} */ selectByLinesEnd() { this.$clickSelection = null; this.editor.unsetStyle("ace_selecting"); } /** * @this {MouseHandler} */ focusWait() { var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); var time = Date.now(); if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimeout) this.startSelect(this.mousedownEvent.getDocumentPosition()); } /** * @param {MouseEvent} ev * @this {MouseHandler} */ onDoubleClick(ev) { var pos = ev.getDocumentPosition(); var editor = this.editor; var session = editor.session; var range = session.getBracketRange(pos); if (range) { if (range.isEmpty()) { range.start.column--; range.end.column++; } this.setState("select"); } else { range = editor.selection.getWordRange(pos.row, pos.column); this.setState("selectByWords"); } this.$clickSelection = range; this.select(); } /** * @param {MouseEvent} ev * @this {MouseHandler} */ onTripleClick(ev) { var pos = ev.getDocumentPosition(); var editor = this.editor; this.setState("selectByLines"); var range = editor.getSelectionRange(); if (range.isMultiLine() && range.contains(pos.row, pos.column)) { this.$clickSelection = editor.selection.getLineRange(range.start.row); this.$clickSelection.end = editor.selection.getLineRange(range.end.row).end; } else { this.$clickSelection = editor.selection.getLineRange(pos.row); } this.select(); } /** * @param {MouseEvent} ev * @this {MouseHandler} */ onQuadClick(ev) { var editor = this.editor; editor.selectAll(); this.$clickSelection = editor.getSelectionRange(); this.setState("selectAll"); } /** * @param {MouseEvent} ev * @this {MouseHandler} */ onMouseWheel(ev) { if (ev.getAccelKey()) return; // shift wheel to horizontal scroll if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) { ev.wheelX = ev.wheelY; ev.wheelY = 0; } var editor = this.editor; if (!this.$lastScroll) this.$lastScroll = { t: 0, vx: 0, vy: 0, allowed: 0 }; var prevScroll = this.$lastScroll; var t = ev.domEvent.timeStamp; var dt = t - prevScroll.t; var vx = dt ? ev.wheelX / dt : prevScroll.vx; var vy = dt ? ev.wheelY / dt : prevScroll.vy; // touchbar keeps sending scroll events after touchend, if we do not stop these events, // users can't scrol editor without scrolling the parent node if (dt < SCROLL_COOLDOWN_T) { vx = (vx + prevScroll.vx) / 2; vy = (vy + prevScroll.vy) / 2; } var direction = Math.abs(vx / vy); var canScroll = false; if (direction >= 1 && editor.renderer.isScrollableBy(ev.wheelX * ev.speed, 0)) canScroll = true; if (direction <= 1 && editor.renderer.isScrollableBy(0, ev.wheelY * ev.speed)) canScroll = true; if (canScroll) { prevScroll.allowed = t; } else if (t - prevScroll.allowed < SCROLL_COOLDOWN_T) { var isSlower = Math.abs(vx) <= 1.5 * Math.abs(prevScroll.vx) && Math.abs(vy) <= 1.5 * Math.abs(prevScroll.vy); if (isSlower) { canScroll = true; prevScroll.allowed = t; } else { prevScroll.allowed = 0; } } prevScroll.t = t; prevScroll.vx = vx; prevScroll.vy = vy; if (canScroll) { editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed); return ev.stop(); } } } DefaultHandlers.prototype.selectEnd = DefaultHandlers.prototype.selectByLinesEnd; DefaultHandlers.prototype.selectAllEnd = DefaultHandlers.prototype.selectByLinesEnd; DefaultHandlers.prototype.selectByWordsEnd = DefaultHandlers.prototype.selectByLinesEnd; exports.DefaultHandlers = DefaultHandlers; function calcDistance(ax, ay, bx, by) { return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2)); } function calcRangeOrientation(range, cursor, session) { if (range.start.row == range.end.row) var cmp = 2 * cursor.column - range.start.column - range.end.column; else if (range.start.row == range.end.row - 1 && !range.start.column && !range.end.column) var cmp = 3 * cursor.column - 2 * session.getLine(range.start.row).length; else var cmp = 2 * cursor.row - range.start.row - range.end.row; if (cmp < 0) return {cursor: range.start, anchor: range.end}; else return {cursor: range.end, anchor: range.start}; } ================================================ FILE: src/mouse/dragdrop_handler.js ================================================ "use strict"; /** * @typedef {import("./mouse_handler").MouseHandler} MouseHandler */ var dom = require("../lib/dom"); var event = require("../lib/event"); var useragent = require("../lib/useragent"); var AUTOSCROLL_DELAY = 200; var SCROLL_CURSOR_DELAY = 200; var SCROLL_CURSOR_HYSTERESIS = 5; /** * @param {MouseHandler} mouseHandler */ function DragdropHandler(mouseHandler) { var editor = mouseHandler.editor; var dragImage = dom.createElement("div"); dragImage.style.cssText = "top:-100px;position:absolute;z-index:2147483647;opacity:0.5"; dragImage.textContent = "\xa0"; var exports = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"]; exports.forEach(function(x) { mouseHandler[x] = this[x]; }, this); // @ts-ignore editor.on("mousedown", this.onMouseDown.bind(mouseHandler)); var mouseTarget = editor.container; var dragSelectionMarker, x, y; var timerId, range; var dragCursor, counter = 0; var dragOperation; var isInternal; var autoScrollStartTime; var cursorMovedTime; var cursorPointOnCaretMoved; /** * @param e * @this {MouseHandler} * @return {*} */ this.onDragStart = function(e) { // webkit workaround, see this.onMouseDown if (this.cancelDrag || !mouseTarget.draggable) { var self = this; setTimeout(function(){ self.startSelect(); self.captureMouse(e); }, 0); return e.preventDefault(); } range = editor.getSelectionRange(); var dataTransfer = e.dataTransfer; dataTransfer.effectAllowed = editor.getReadOnly() ? "copy" : "copyMove"; editor.container.appendChild(dragImage); dataTransfer.setDragImage && dataTransfer.setDragImage(dragImage, 0, 0); setTimeout(function() { editor.container.removeChild(dragImage); }); // clear Opera garbage dataTransfer.clearData(); dataTransfer.setData("Text", editor.session.getTextRange()); isInternal = true; this.setState("drag"); }; /** * @param e * @this {MouseHandler} * @return {*} */ this.onDragEnd = function(e) { mouseTarget.draggable = false; isInternal = false; this.setState(null); if (!editor.getReadOnly()) { var dropEffect = e.dataTransfer.dropEffect; if (!dragOperation && dropEffect == "move") // text was dragged outside the editor editor.session.remove(editor.getSelectionRange()); editor.$resetCursorStyle(); } this.editor.unsetStyle("ace_dragging"); this.editor.renderer.setCursorStyle(""); }; /** * @param e * @this {MouseHandler} * @return {*} */ this.onDragEnter = function(e) { if (editor.getReadOnly() || !canAccept(e.dataTransfer)) return; x = e.clientX; y = e.clientY; if (!dragSelectionMarker) addDragMarker(); counter++; // dataTransfer object does not save dropEffect across events on IE, so we store it in dragOperation e.dataTransfer.dropEffect = dragOperation = getDropEffect(e); return event.preventDefault(e); }; /** * @param e * @this {MouseHandler} * @return {*} */ this.onDragOver = function(e) { if (editor.getReadOnly() || !canAccept(e.dataTransfer)) return; x = e.clientX; y = e.clientY; // Opera doesn't trigger dragenter event on drag start if (!dragSelectionMarker) { addDragMarker(); counter++; } if (onMouseMoveTimer !== null) onMouseMoveTimer = null; e.dataTransfer.dropEffect = dragOperation = getDropEffect(e); return event.preventDefault(e); }; this.onDragLeave = function(e) { counter--; if (counter <= 0 && dragSelectionMarker) { clearDragMarker(); dragOperation = null; return event.preventDefault(e); } }; /** * @param e * @this {MouseHandler} * @return {*} */ this.onDrop = function(e) { if (!dragCursor) return; var dataTransfer = e.dataTransfer; if (isInternal) { switch (dragOperation) { case "move": if (range.contains(dragCursor.row, dragCursor.column)) { // clear selection range = { start: dragCursor, end: dragCursor }; } else { // move text range = editor.moveText(range, dragCursor); } break; case "copy": // copy text range = editor.moveText(range, dragCursor, true); break; } } else { var dropData = dataTransfer.getData('Text'); range = { start: dragCursor, end: editor.session.insert(dragCursor, dropData) }; editor.focus(); dragOperation = null; } clearDragMarker(); return event.preventDefault(e); }; event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler), editor); event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler), editor); event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler), editor); event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler), editor); event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler), editor); event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler), editor); function scrollCursorIntoView(cursor, prevCursor) { var now = Date.now(); var vMovement = !prevCursor || cursor.row != prevCursor.row; var hMovement = !prevCursor || cursor.column != prevCursor.column; if (!cursorMovedTime || vMovement || hMovement) { editor.moveCursorToPosition(cursor); cursorMovedTime = now; cursorPointOnCaretMoved = {x: x, y: y}; } else { var distance = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x, y); if (distance > SCROLL_CURSOR_HYSTERESIS) { cursorMovedTime = null; } else if (now - cursorMovedTime >= SCROLL_CURSOR_DELAY) { editor.renderer.scrollCursorIntoView(); cursorMovedTime = null; } } } function autoScroll(cursor, prevCursor) { var now = Date.now(); var lineHeight = editor.renderer.layerConfig.lineHeight; var characterWidth = editor.renderer.layerConfig.characterWidth; var editorRect = editor.renderer.scroller.getBoundingClientRect(); var offsets = { x: { left: x - editorRect.left, right: editorRect.right - x }, y: { top: y - editorRect.top, bottom: editorRect.bottom - y } }; var nearestXOffset = Math.min(offsets.x.left, offsets.x.right); var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom); var scrollCursor = {row: cursor.row, column: cursor.column}; if (nearestXOffset / characterWidth <= 2) { scrollCursor.column += (offsets.x.left < offsets.x.right ? -3 : +2); } if (nearestYOffset / lineHeight <= 1) { scrollCursor.row += (offsets.y.top < offsets.y.bottom ? -1 : +1); } var vScroll = cursor.row != scrollCursor.row; var hScroll = cursor.column != scrollCursor.column; var vMovement = !prevCursor || cursor.row != prevCursor.row; if (vScroll || (hScroll && !vMovement)) { if (!autoScrollStartTime) autoScrollStartTime = now; else if (now - autoScrollStartTime >= AUTOSCROLL_DELAY) editor.renderer.scrollCursorIntoView(scrollCursor); } else { autoScrollStartTime = null; } } function onDragInterval() { var prevCursor = dragCursor; dragCursor = editor.renderer.screenToTextCoordinates(x, y); scrollCursorIntoView(dragCursor, prevCursor); autoScroll(dragCursor, prevCursor); } function addDragMarker() { range = editor.selection.toOrientedRange(); dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle()); editor.clearSelection(); if (editor.isFocused()) editor.renderer.$cursorLayer.setBlinking(false); clearInterval(timerId); onDragInterval(); timerId = setInterval(onDragInterval, 20); counter = 0; event.addListener(document, "mousemove", onMouseMove); } function clearDragMarker() { clearInterval(timerId); editor.session.removeMarker(dragSelectionMarker); dragSelectionMarker = null; editor.selection.fromOrientedRange(range); if (editor.isFocused() && !isInternal) editor.$resetCursorStyle(); range = null; dragCursor = null; counter = 0; autoScrollStartTime = null; cursorMovedTime = null; event.removeListener(document, "mousemove", onMouseMove); } // sometimes other code on the page can stop dragleave event leaving editor stuck in the drag state var onMouseMoveTimer = null; function onMouseMove() { if (onMouseMoveTimer == null) { onMouseMoveTimer = setTimeout(function() { if (onMouseMoveTimer != null && dragSelectionMarker) clearDragMarker(); }, 20); } } function canAccept(dataTransfer) { var types = dataTransfer.types; return !types || Array.prototype.some.call(types, function(type) { return type == 'text/plain' || type == 'Text'; }); } function getDropEffect(e) { var copyAllowed = ['copy', 'copymove', 'all', 'uninitialized']; var moveAllowed = ['move', 'copymove', 'linkmove', 'all', 'uninitialized']; var copyModifierState = useragent.isMac ? e.altKey : e.ctrlKey; // IE throws error while dragging from another app var effectAllowed = "uninitialized"; try { effectAllowed = e.dataTransfer.effectAllowed.toLowerCase(); } catch (e) {} var dropEffect = "none"; if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0) dropEffect = "copy"; else if (moveAllowed.indexOf(effectAllowed) >= 0) dropEffect = "move"; else if (copyAllowed.indexOf(effectAllowed) >= 0) dropEffect = "copy"; return dropEffect; } } /** * @this {MouseHandler} */ (function() { /** * @this {MouseHandler & this} */ this.dragWait = function() { var interval = Date.now() - this.mousedownEvent.time; if (interval > this.editor.getDragDelay()) this.startDrag(); }; /** * @this {MouseHandler & this} */ this.dragWaitEnd = function() { var target = this.editor.container; target.draggable = false; this.startSelect(this.mousedownEvent.getDocumentPosition()); this.selectEnd(); }; /** * @this {MouseHandler & this} */ this.dragReadyEnd = function(e) { this.editor.$resetCursorStyle(); this.editor.unsetStyle("ace_dragging"); this.editor.renderer.setCursorStyle(""); this.dragWaitEnd(); }; /** * @this {MouseHandler & this} */ this.startDrag = function(){ this.cancelDrag = false; var editor = this.editor; var target = editor.container; target.draggable = true; editor.renderer.$cursorLayer.setBlinking(false); editor.setStyle("ace_dragging"); var cursorStyle = useragent.isWin ? "default" : "move"; editor.renderer.setCursorStyle(cursorStyle); this.setState("dragReady"); }; /** * @this {MouseHandler & this} */ this.onMouseDrag = function(e) { var target = this.editor.container; if (useragent.isIE && this.state == "dragReady") { // IE does not handle [draggable] attribute set after mousedown var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); if (distance > 3) // @ts-ignore target.dragDrop(); } if (this.state === "dragWait") { var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); if (distance > 0) { target.draggable = false; this.startSelect(this.mousedownEvent.getDocumentPosition()); } } }; /** * @this {MouseHandler & this} */ this.onMouseDown = function(e) { if (!this.$dragEnabled) return; this.mousedownEvent = e; var editor = this.editor; var inSelection = e.inSelection(); var button = e.getButton(); var clickCount = e.domEvent.detail || 1; if (clickCount === 1 && button === 0 && inSelection) { if (e.editor.inMultiSelectMode && (e.getAccelKey() || e.getShiftKey())) return; this.mousedownEvent.time = Date.now(); var eventTarget = e.domEvent.target || e.domEvent.srcElement; if ("unselectable" in eventTarget) eventTarget.unselectable = "on"; if (editor.getDragDelay()) { // https://code.google.com/p/chromium/issues/detail?id=286700 if (useragent.isWebKit) { this.cancelDrag = true; var mouseTarget = editor.container; mouseTarget.draggable = true; } this.setState("dragWait"); } else { this.startDrag(); } this.captureMouse(e, this.onMouseDrag.bind(this)); // TODO: a better way to prevent default handler without preventing browser default action e.defaultPrevented = true; } }; }).call(DragdropHandler.prototype); function calcDistance(ax, ay, bx, by) { return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2)); } exports.DragdropHandler = DragdropHandler; ================================================ FILE: src/mouse/fold_handler.js ================================================ "use strict"; var dom = require("../lib/dom"); class FoldHandler { constructor(editor) { editor.on("click", function(e) { var position = e.getDocumentPosition(); var session = editor.session; // If the user clicked on a fold, then expand it. var fold = session.getFoldAt(position.row, position.column, 1); if (fold) { if (e.getAccelKey()) session.removeFold(fold); else session.expandFold(fold); e.stop(); } var target = e.domEvent && e.domEvent.target; if (target && dom.hasCssClass(target, "ace_inline_button")) { if (dom.hasCssClass(target, "ace_toggle_wrap")) { session.setOption("wrap", !session.getUseWrapMode()); editor.renderer.scrollCursorIntoView(); } } }); editor.on("gutterclick", function(e) { var gutterRegion = editor.renderer.$gutterLayer.getRegion(e); if (gutterRegion == "foldWidgets") { var row = e.getDocumentPosition().row; var session = editor.session; if (session.foldWidgets && session.foldWidgets[row]) editor.session.onFoldWidgetClick(row, e); if (!editor.isFocused()) editor.focus(); e.stop(); } }); editor.on("gutterdblclick", function(e) { var gutterRegion = editor.renderer.$gutterLayer.getRegion(e); if (gutterRegion == "foldWidgets") { var row = e.getDocumentPosition().row; var session = editor.session; var data = session.getParentFoldRangeData(row, true); var range = data.range || data.firstRange; if (range) { row = range.start.row; var fold = session.getFoldAt(row, session.getLine(row).length, 1); if (fold) { session.removeFold(fold); } else { session.addFold("...", range); editor.renderer.scrollCursorIntoView({row: range.start.row, column: 0}); } } e.stop(); } }); } } exports.FoldHandler = FoldHandler; ================================================ FILE: src/mouse/mouse_event.js ================================================ "use strict"; var event = require("../lib/event"); var useragent = require("../lib/useragent"); /* * Custom Ace mouse event */ class MouseEvent { constructor(domEvent, editor) { /** @type {number} */this.speed; /** @type {number} */this.wheelX; /** @type {number} */this.wheelY; this.domEvent = domEvent; this.editor = editor; this.x = this.clientX = domEvent.clientX; this.y = this.clientY = domEvent.clientY; this.$pos = null; this.$inSelection = null; this.propagationStopped = false; this.defaultPrevented = false; } stopPropagation() { event.stopPropagation(this.domEvent); this.propagationStopped = true; } preventDefault() { event.preventDefault(this.domEvent); this.defaultPrevented = true; } stop() { this.stopPropagation(); this.preventDefault(); } /** * Get the document position below the mouse cursor * * @return {Object} 'row' and 'column' of the document position */ getDocumentPosition() { if (this.$pos) return this.$pos; this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY); return this.$pos; } /** * Get the relative position within the gutter. * * @return {Number} 'row' within the gutter. */ getGutterRow() { var documentRow = this.getDocumentPosition().row; var screenRow = this.editor.session.documentToScreenRow(documentRow, 0); var screenTopRow = this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row, 0); return screenRow - screenTopRow; } /** * Check if the mouse cursor is inside of the text selection * * @return {Boolean} whether the mouse cursor is inside of the selection */ inSelection() { if (this.$inSelection !== null) return this.$inSelection; var editor = this.editor; var selectionRange = editor.getSelectionRange(); if (selectionRange.isEmpty()) this.$inSelection = false; else { var pos = this.getDocumentPosition(); this.$inSelection = selectionRange.contains(pos.row, pos.column); } return this.$inSelection; } /** * Get the clicked mouse button * * @return {Number} 0 for left button, 1 for middle button, 2 for right button */ getButton() { return event.getButton(this.domEvent); } /** * @return {Boolean} whether the shift key was pressed when the event was emitted */ getShiftKey() { return this.domEvent.shiftKey; } getAccelKey() { return useragent.isMac ? this.domEvent.metaKey : this.domEvent.ctrlKey; } } exports.MouseEvent = MouseEvent; ================================================ FILE: src/mouse/mouse_handler.js ================================================ "use strict"; /** * @typedef {import("../editor").Editor} Editor */ var event = require("../lib/event"); var useragent = require("../lib/useragent"); var DefaultHandlers = require("./default_handlers").DefaultHandlers; var DefaultGutterHandler = require("./default_gutter_handler").GutterHandler; var MouseEvent = require("./mouse_event").MouseEvent; var DragdropHandler = require("./dragdrop_handler").DragdropHandler; var addTouchListeners = require("./touch_handler").addTouchListeners; var config = require("../config"); class MouseHandler { /** * @param {Editor} editor */ constructor(editor) { /** @type {boolean} */this.$dragDelay; /** @type {boolean} */this.$dragEnabled; /** @type {boolean} */this.$mouseMoved; /** @type {MouseEvent} */this.mouseEvent; /** @type {number} */this.$focusTimeout; var _self = this; this.editor = editor; new DefaultHandlers(this); new DefaultGutterHandler(this); new DragdropHandler(this); var focusEditor = function(e) { // because we have to call event.preventDefault() any window on ie and iframes // on other browsers do not get focus, so we have to call window.focus() here var windowBlurred = !document.hasFocus || !document.hasFocus() || !editor.isFocused() && document.activeElement == (editor.textInput && editor.textInput.getElement()); if (windowBlurred) window.focus(); editor.focus(); // Without this editor is blurred after double click setTimeout(function () { if (!editor.isFocused()) editor.focus(); }); }; var mouseTarget = editor.renderer.getMouseEventTarget(); event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"), editor); event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"), editor); event.addMultiMouseDownListener([ mouseTarget, editor.renderer.scrollBarV && editor.renderer.scrollBarV.inner, editor.renderer.scrollBarH && editor.renderer.scrollBarH.inner, editor.textInput && editor.textInput.getElement() ].filter(Boolean), [400, 300, 250], this, "onMouseEvent", editor); event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"), editor); addTouchListeners(editor.container, editor); var gutterEl = editor.renderer.$gutter; event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"), editor); event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"), editor); event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"), editor); event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"), editor); event.addListener(mouseTarget, "mousedown", focusEditor, editor); event.addListener(gutterEl, "mousedown", focusEditor, editor); if (useragent.isIE && editor.renderer.scrollBarV) { event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor, editor); event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor, editor); } editor.on("mousemove", function(e){ if (_self.state || _self.$dragDelay || !_self.$dragEnabled) return; var character = editor.renderer.screenToTextCoordinates(e.x, e.y); var range = editor.session.selection.getRange(); var renderer = editor.renderer; if (!range.isEmpty() && range.insideStart(character.row, character.column)) { renderer.setCursorStyle("default"); } else { renderer.setCursorStyle(""); } }, //@ts-expect-error TODO: seems mistyping - should be boolean editor); } onMouseEvent(name, e) { if (!this.editor.session) return; this.editor._emit(name, new MouseEvent(e, this.editor)); } onMouseMove(name, e) { // optimization, because mousemove doesn't have a default handler. var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove; if (!listeners || !listeners.length) return; this.editor._emit(name, new MouseEvent(e, this.editor)); } /** * @param {any} name * @param {{ wheelX: number; wheelY: number; }} e */ onMouseWheel(name, e) { var mouseEvent = new MouseEvent(e, this.editor); //@ts-expect-error TODO: couldn't find this property init in the ace codebase mouseEvent.speed = this.$scrollSpeed * 2; mouseEvent.wheelX = e.wheelX; mouseEvent.wheelY = e.wheelY; this.editor._emit(name, mouseEvent); } setState(state) { this.state = state; } /** * * @param {MouseEvent} ev * @param [mouseMoveHandler] * @return {ReturnType<typeof setTimeout> | undefined} */ captureMouse(ev, mouseMoveHandler) { this.x = ev.x; this.y = ev.y; this.isMousePressed = true; // do not move textarea during selection var editor = this.editor; var renderer = this.editor.renderer; renderer.$isMousePressed = true; var self = this; var continueCapture = true; var onMouseMove = function(e) { if (!e) return; // if editor is loaded inside iframe, and mouseup event is outside // we won't recieve it, so we cancel on first mousemove without button if (useragent.isWebKit && !e.which && self.releaseMouse) return self.releaseMouse(); self.x = e.clientX; self.y = e.clientY; mouseMoveHandler && mouseMoveHandler(e); self.mouseEvent = new MouseEvent(e, self.editor); self.$mouseMoved = true; }; var onCaptureEnd = function(e) { editor.off("beforeEndOperation", onOperationEnd); continueCapture = false; if (editor.session) onCaptureUpdate(); self[self.state + "End"] && self[self.state + "End"](e); self.state = ""; self.isMousePressed = renderer.$isMousePressed = false; if (renderer.$keepTextAreaAtCursor) renderer.$moveTextAreaToCursor(); self.$onCaptureMouseMove = self.releaseMouse = null; e && self.onMouseEvent("mouseup", e); editor.endOperation(); }; var onCaptureUpdate = function() { self[self.state] && self[self.state](); self.$mouseMoved = false; }; var onCaptureInterval = function() { if (continueCapture) { onCaptureUpdate(); event.nextFrame(onCaptureInterval); } }; if (useragent.isOldIE && ev.domEvent.type == "dblclick") { return setTimeout(function() {onCaptureEnd(ev);}); } var onOperationEnd = function(e) { if (!self.releaseMouse) return; // some touchpads fire mouseup event after a slight delay, // which can cause problems if user presses a keyboard shortcut quickly if (editor.curOp.command.name && editor.curOp.selectionChanged) { self[self.state + "End"] && self[self.state + "End"](); self.state = ""; self.releaseMouse(); } }; editor.on("beforeEndOperation", onOperationEnd); editor.startOperation({command: {name: "mouse"}}); self.$onCaptureMouseMove = onMouseMove; self.releaseMouse = event.capture(this.editor.container, onMouseMove, onCaptureEnd); onCaptureInterval(); } cancelContextMenu() { var stop = function(e) { if (e && e.domEvent && e.domEvent.type != "contextmenu") return; this.editor.off("nativecontextmenu", stop); if (e && e.domEvent) event.stopEvent(e.domEvent); }.bind(this); setTimeout(stop, 10); this.editor.on("nativecontextmenu", stop); } destroy() { if (this.releaseMouse) this.releaseMouse(); if (this.$tooltip) this.$tooltip.destroy(); } } MouseHandler.prototype.releaseMouse = null; config.defineOptions(MouseHandler.prototype, "mouseHandler", { scrollSpeed: {initialValue: 2}, dragDelay: {initialValue: (useragent.isMac ? 150 : 0)}, dragEnabled: {initialValue: true}, focusTimeout: {initialValue: 0}, }); exports.MouseHandler = MouseHandler; ================================================ FILE: src/mouse/mouse_handler_test.js ================================================ if (typeof process !== "undefined") { require("../test/mockdom"); } "use strict"; require("../multi_select"); require("../theme/textmate"); var Editor = require("../editor").Editor; var Mode = require("../mode/java").Mode; var VirtualRenderer = require("../virtual_renderer").VirtualRenderer; var assert = require("../test/assertions"); var lang = require("../lib/lang"); var MouseEvent = function(type, opts){ var e = document.createEvent("MouseEvents"); e.initMouseEvent(/click|wheel/.test(type) ? type : "mouse" + type, true, true, window, opts.detail, opts.x, opts.y, opts.x, opts.y, opts.ctrl, opts.alt, opts.shift, opts.meta, opts.button || 0, opts.relatedTarget); return e; }; var WheelEvent = function(opts) { var e = new MouseEvent("wheel", opts); e.DOM_DELTA_PIXEL = 0; e.DOM_DELTA_LINE = 1; e.DOM_DELTA_PAGE = 2; e.deltaMode = e["DOM_DELTA_" + opts.mode.toUpperCase()]; e.deltaX = opts.x || 0; e.deltaY = opts.y || 0; return e; }; function sendTouchEvent(type, opts, editor) { var e = new window.CustomEvent("touch" + type, {bubbles: true, cancelable: true}); Object.defineProperties(e, Object.getOwnPropertyDescriptors(opts)); editor.container.dispatchEvent(e); } function touchPos(row, column) { var pos = editor.renderer.textToScreenCoordinates(row, column); var h = editor.renderer.lineHeight / 2; return {clientX: pos.pageX, clientY: pos.pageY + h}; } var editor; module.exports = { setUp : function() { this.editor = new Editor(new VirtualRenderer()); this.editor.session.setValue("Juhu kinners!"); this.editor.container.style.position = "absolute"; this.editor.container.style.height = "500px"; this.editor.container.style.width = "500px"; this.editor.container.style.left = "50px"; this.editor.container.style.top = "10px"; document.body.appendChild(this.editor.container); editor = this.editor; }, "test: double tap. issue #956" : function() { // mouse up fired immediately after mouse down this.editor.resize(true); var pos = this.editor.renderer.textToScreenCoordinates(0, 1); var target = this.editor.renderer.getMouseEventTarget(); target.dispatchEvent(MouseEvent("down", {x: pos.pageX, y: pos.pageY})); target.dispatchEvent(MouseEvent("up", {x: pos.pageX, y: pos.pageY})); target.dispatchEvent(MouseEvent("down", {x: pos.pageX, y: pos.pageY, detail: 2})); target.dispatchEvent(MouseEvent("up", {x: pos.pageX, y: pos.pageY, detail: 2})); assert.equal(this.editor.getSelectedText(), "Juhu"); target.dispatchEvent(MouseEvent("down", {x: pos.pageX, y: pos.pageY})); target.dispatchEvent(MouseEvent("up", {x: pos.pageX, y: pos.pageY})); assert.equal(this.editor.getSelectedText(), ""); }, "test: multiselect" : function() { var target = this.editor.renderer.getMouseEventTarget(); this.editor.session.setValue("xyz\n\nabc efg"); this.editor.resize(true); var pos = this.editor.renderer.textToScreenCoordinates(0, 1); target.dispatchEvent(MouseEvent("down", {x: pos.pageX, y: pos.pageY})); target.dispatchEvent(MouseEvent("up", {x: pos.pageX, y: pos.pageY})); pos = this.editor.renderer.textToScreenCoordinates(0, 2); target.dispatchEvent(MouseEvent("down", {x: pos.pageX, y: pos.pageY, ctrl: true})); target.dispatchEvent(MouseEvent("up", {x: pos.pageX, y: pos.pageY})); var selection = "Range: [0/2] -> [0/2],Range: [0/1] -> [0/1]"; assert.equal(this.editor.selection.toJSON() + "", selection); pos = this.editor.renderer.textToScreenCoordinates(2, 2); target.dispatchEvent(MouseEvent("down", {x: pos.pageX, y: pos.pageY, detail: 2, ctrl: true})); target.dispatchEvent(MouseEvent("up", {x: pos.pageX, y: pos.pageY, detail: 2, ctrl: true})); selection = "Range: [2/0] -> [2/3]," + selection; assert.equal(this.editor.selection.toJSON() + "", selection); var pos = this.editor.renderer.textToScreenCoordinates(0, 1); target.dispatchEvent(MouseEvent("down", {x: pos.pageX, y: pos.pageY, ctrl: true})); target.dispatchEvent(MouseEvent("up", {x: pos.pageX, y: pos.pageY, ctrl: true})); selection = selection.split(",").slice(0, -1).join(","); assert.equal(this.editor.selection.toJSON() + "", selection); var pos1 = this.editor.renderer.textToScreenCoordinates(0, 2); var pos2 = this.editor.renderer.textToScreenCoordinates(2, 2); target.dispatchEvent(MouseEvent("down", {x: pos1.pageX, y: pos1.pageY, alt: true})); target.dispatchEvent(MouseEvent("move", {x: pos2.pageX, y: pos2.pageY + 1, alt: true})); target.dispatchEvent(MouseEvent("up", {x: pos2.pageX, y: pos2.pageY + 1, alt: true})); assert.equal(this.editor.selection.toJSON() + "", "Range: [2/2] -> [2/2],Range: [1/0] -> [1/0],Range: [0/2] -> [0/2]"); }, "test: gutter" : function() { var editor = this.editor; var value = "x {" + "\n".repeat(50) + "}"; value = value.repeat(50); editor.session.setMode(new Mode()); editor.setValue(value, -1); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var toggler = lines.cells[0].element.childNodes[1]; var rect = toggler.getBoundingClientRect(); if (!rect.left) rect.left = 100; // for mockdom toggler.dispatchEvent(MouseEvent("down", {x: rect.left, y: rect.top})); toggler.dispatchEvent(MouseEvent("up", {x: rect.left, y: rect.top})); toggler.dispatchEvent(MouseEvent("click", {x: rect.left, y: rect.top})); editor.renderer.$loop._flush(); assert.ok(/ace_gutter-active-line/.test(lines.cells[0].element.className)); assert.ok(/ace_closed/.test(toggler.className)); editor.execCommand("golinedown"); editor.renderer.$loop._flush(); assert.notOk(/ace_gutter-active-line/.test(lines.cells[0].element.className)); assert.ok(/ace_gutter-active-line/.test(lines.cells[1].element.className)); assert.equal(lines.cells[1].element.textContent, "51"); // wheel event on toggler var e = WheelEvent({mode: "pixel", y: 100}); toggler.dispatchEvent(e); editor.renderer.$loop._flush(); assert.ok(parseInt(lines.cells[0].element.textContent) > 1); }, "test: gutter click on wrapped line" : function() { var editor = this.editor; var value = "x {\n" + " abc".repeat(100) + "\n}"; value = value.repeat(10); editor.setValue(value, -1); editor.setOption("wrap", 40); editor.renderer.$loop._flush(); var lines = editor.renderer.$gutterLayer.$lines; var toggler = lines.cells[1].element; var rect = toggler.getBoundingClientRect(); editor.isFocused = () => true; editor.focus(); assert.position(editor.getCursorPosition(), 0, 0); toggler.dispatchEvent(MouseEvent("down", {x: rect.left, y: rect.top + rect.height / 2})); editor.renderer.$loop._flush(); assert.position(editor.getCursorPosition(), 1, 0); toggler.dispatchEvent(MouseEvent("up", {x: rect.left, y: rect.top + rect.height})); editor.renderer.$loop._flush(); assert.position(editor.getCursorPosition(), 2, 0); }, "test: wheel" : function() { var editor = this.editor; var lines = editor.renderer.$gutterLayer.$lines; editor.setValue("\n".repeat(100), -1); editor.renderer.$loop._flush(); assert.ok(parseInt(lines.cells[0].element.textContent) == 1); var e = WheelEvent({mode: "line", y: 2}); editor.container.dispatchEvent(e); editor.renderer.$loop._flush(); assert.ok(parseInt(lines.cells[0].element.textContent) > 1); e = WheelEvent({mode: "line", y: -2}); editor.container.dispatchEvent(e); editor.renderer.$loop._flush(); assert.ok(parseInt(lines.cells[0].element.textContent) == 1); e = WheelEvent({mode: "page", y: 1}); editor.container.dispatchEvent(e); editor.renderer.$loop._flush(); assert.ok(parseInt(lines.cells[0].element.textContent) > 10); }, "test: touch" : async function(done) { var editor = this.editor; var value = "x {" + "\n abc".repeat(10) + "\n}"; value = value.repeat(10); editor.setValue(value, -1); editor.setOption("maxLines", 10); editor.setOption("enableMobileMenu", false); editor.renderer.$loop._flush(); window.editor = editor; window.sendTouchEvent = sendTouchEvent; // single tap moves cursor sendTouchEvent("start", {touches: [touchPos(2, 1)]}, editor); sendTouchEvent("end", {touches: [touchPos(2, 1)]}, editor); editor.renderer.$loop._flush(); assert.position(editor.getCursorPosition(), 2, 1); // two finger tap allows to zoom sendTouchEvent("start", {touches: [touchPos(5, 5), touchPos(6, 6)]}, editor); sendTouchEvent("end", {touches: [touchPos(5, 5)]}, editor); editor.renderer.$loop._flush(); assert.position(editor.getCursorPosition(), 2, 1); // tap and drag near cursor selects sendTouchEvent("start", {touches: [touchPos(2, 1)]}, editor); sendTouchEvent("move", {touches: [touchPos(2, 3)]}, editor); sendTouchEvent("move", {touches: [touchPos(2, 4)]}, editor); sendTouchEvent("end", {touches: [touchPos(2, 3)]}, editor); editor.renderer.$loop._flush(); assert.equal(editor.getSelectedText(), " ab"); // double tap selects the word sendTouchEvent("start", {touches: [touchPos(3, 3)]}, editor); sendTouchEvent("move", {touches: [touchPos(3, 3)]}, editor); sendTouchEvent("end", {touches: [touchPos(3, 3)]}, editor); sendTouchEvent("start", {touches: [touchPos(3, 3)]}, editor); sendTouchEvent("move", {touches: [touchPos(3, 3)]}, editor); sendTouchEvent("end", {touches: [touchPos(3, 3)]}, editor); editor.renderer.$loop._flush(); assert.equal(editor.getSelectedText(), "abc"); // there shouldn't be any mobile menu at that point var menu = editor.container.querySelector(".ace_mobile-menu"); assert.ok(menu == undefined); editor.setOption("enableMobileMenu", true); sendTouchEvent("end", {touches: [touchPos(3, 3)]}, editor); editor.renderer.$loop._flush(); menu = editor.container.querySelector(".ace_mobile-menu"); assert.ok(menu != undefined); // mobile menu works sendTouchEvent("start", {touches: [touchPos(3, 3)]}, {container: menu}); sendTouchEvent("end", {touches: [touchPos(3, 3)]}, {container: menu}); var button = editor.container.querySelectorAll(".ace_mobile-button")[1]; sendTouchEvent("start", {touches: [touchPos(3, 3)]}, {container: button}); sendTouchEvent("end", {touches: [touchPos(3, 3)]}, {container: button}); assert.equal(editor.getSelectedText(), ""); // tap and drag in other places scrolls sendTouchEvent("start", {touches: [touchPos(8, 3)]}, editor); sendTouchEvent("move", {touches: [touchPos(8, 3)]}, editor); await lang.sleep(2); sendTouchEvent("move", {touches: [touchPos(1, 3)]}, editor); sendTouchEvent("end", {touches: [touchPos(1, 3)]}, editor); editor.renderer.$loop._flush(); assert.equal(editor.renderer.getFirstFullyVisibleRow(), 7); // editor animates scrolling await lang.sleep(50); assert.notOk(menu.clientHeight); assert.ok(editor.renderer.getFirstFullyVisibleRow() > 7); done(); }, "test: touch selection with scrollMargin" : function() { editor.renderer.setScrollMargin(50, 50, 0, 15); editor.setValue("Juhu Kinners!"); editor.renderer.$loop._flush(); var pos = editor.renderer.textToScreenCoordinates(0, 0); assert.equal(pos.pageY - editor.container.getBoundingClientRect().top, 50); sendTouchEvent("start", {touches: [touchPos(0, 0)]}, editor); sendTouchEvent("move", {touches: [touchPos(0, 5)]}, editor); editor.renderer.$loop._flush(); sendTouchEvent("end", {touches: [touchPos(0, 5)]}, editor); editor.renderer.$loop._flush(); sendTouchEvent("start", {touches: [touchPos(0, 12)]}, editor); sendTouchEvent("move", {touches: [touchPos(0, 8)]}, editor); editor.renderer.$loop._flush(); sendTouchEvent("end", {touches: [touchPos(0, 8)]}, editor); assert.equal(editor.getSelectedText(), "Kin"); }, "test: destroy while mouse is pressed": function() { assert.ok(!this.editor.$mouseHandler.releaseMouse); var target = this.editor.renderer.getMouseEventTarget(); target.dispatchEvent(MouseEvent("down", {x: 0, y: 0})); assert.ok(this.editor.$mouseHandler.releaseMouse); this.editor.destroy(); assert.ok(!this.editor.$mouseHandler.releaseMouse); }, tearDown : function() { this.editor.destroy(); document.body.removeChild(this.editor.container); } }; require("../test/run")(module); ================================================ FILE: src/mouse/multi_select_handler.js ================================================ var event = require("../lib/event"); var useragent = require("../lib/useragent"); // mouse function isSamePoint(p1, p2) { return p1.row == p2.row && p1.column == p2.column; } function onMouseDown(e) { var ev = e.domEvent; var alt = ev.altKey; var shift = ev.shiftKey; var ctrl = ev.ctrlKey; var accel = e.getAccelKey(); var button = e.getButton(); if (ctrl && useragent.isMac) button = ev.button; if (e.editor.inMultiSelectMode && button == 2) { e.editor.textInput.onContextMenu(e.domEvent); return; } if (!ctrl && !alt && !accel) { if (button === 0 && e.editor.inMultiSelectMode) e.editor.exitMultiSelectMode(); return; } if (button !== 0) return; var editor = e.editor; var selection = editor.selection; var isMultiSelect = editor.inMultiSelectMode; var pos = e.getDocumentPosition(); var cursor = selection.getCursor(); var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor)); var mouseX = e.x, mouseY = e.y; var onMouseSelection = function(e) { mouseX = e.clientX; mouseY = e.clientY; }; var session = editor.session; var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY); var screenCursor = screenAnchor; var selectionMode; if (editor.$mouseHandler.$enableJumpToDef) { if (ctrl && alt || accel && alt) selectionMode = shift ? "block" : "add"; else if (alt && editor.$blockSelectEnabled) selectionMode = "block"; } else { if (accel && !alt) { selectionMode = "add"; if (!isMultiSelect && shift) return; } else if (alt && editor.$blockSelectEnabled) { selectionMode = "block"; } } if (selectionMode && useragent.isMac && ev.ctrlKey) { editor.$mouseHandler.cancelContextMenu(); } if (selectionMode == "add") { if (!isMultiSelect && inSelection) return; // dragging if (!isMultiSelect) { var range = selection.toOrientedRange(); editor.addSelectionMarker(range); } var oldRange = selection.rangeList.rangeAtPoint(pos); editor.inVirtualSelectionMode = true; if (shift) { oldRange = null; range = selection.ranges[0] || range; editor.removeSelectionMarker(range); } editor.once("mouseup", function() { var tmpSel = selection.toOrientedRange(); if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor)) selection.substractPoint(tmpSel.cursor); else { if (shift) { selection.substractPoint(range.cursor); } else if (range) { editor.removeSelectionMarker(range); selection.addRange(range); } selection.addRange(tmpSel); } editor.inVirtualSelectionMode = false; }); } else if (selectionMode == "block") { e.stop(); editor.inVirtualSelectionMode = true; var initialRange; var rectSel = []; var blockSelect = function() { var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY); var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column, newCursor.offsetX); if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead)) return; screenCursor = newCursor; editor.selection.moveToPosition(cursor); editor.renderer.scrollCursorIntoView(); editor.removeSelectionMarkers(rectSel); rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor); if (editor.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty()) rectSel[0] = editor.$mouseHandler.$clickSelection.clone(); rectSel.forEach(editor.addSelectionMarker, editor); editor.updateSelectionMarkers(); }; if (isMultiSelect && !accel) { selection.toSingleRange(); } else if (!isMultiSelect && accel) { initialRange = selection.toOrientedRange(); editor.addSelectionMarker(initialRange); } if (shift) screenAnchor = session.documentToScreenPosition(selection.lead); else selection.moveToPosition(pos); screenCursor = {row: -1, column: -1}; var onMouseSelectionEnd = function(e) { blockSelect(); clearInterval(timerId); editor.removeSelectionMarkers(rectSel); if (!rectSel.length) rectSel = [selection.toOrientedRange()]; if (initialRange) { editor.removeSelectionMarker(initialRange); selection.toSingleRange(initialRange); } for (var i = 0; i < rectSel.length; i++) selection.addRange(rectSel[i]); editor.inVirtualSelectionMode = false; editor.$mouseHandler.$clickSelection = null; }; var onSelectionInterval = blockSelect; event.capture(editor.container, onMouseSelection, onMouseSelectionEnd); var timerId = setInterval(function() {onSelectionInterval();}, 20); return e.preventDefault(); } } exports.onMouseDown = onMouseDown; ================================================ FILE: src/mouse/touch_handler.js ================================================ "use strict"; var MouseEvent = require("./mouse_event").MouseEvent; var event = require("../lib/event"); var dom = require("../lib/dom"); exports.addTouchListeners = function(el, editor) { var mode = "scroll"; var startX; var startY; var touchStartT; var lastT; var longTouchTimer; var animationTimer; var animationSteps = 0; var pos; var clickCount = 0; var vX = 0; var vY = 0; var pressed; var contextMenu; function createContextMenu() { var clipboard = window.navigator && window.navigator.clipboard; var isOpen = false; var updateMenu = function() { var selected = editor.getCopyText(); var hasUndo = editor.session.getUndoManager().hasUndo(); contextMenu.replaceChild( dom.buildDom(isOpen ? ["span", !selected && canExecuteCommand("selectall") && ["span", { class: "ace_mobile-button", action: "selectall" }, "Select All"], selected && canExecuteCommand("copy") && ["span", { class: "ace_mobile-button", action: "copy" }, "Copy"], selected && canExecuteCommand("cut") && ["span", { class: "ace_mobile-button", action: "cut" }, "Cut"], clipboard && canExecuteCommand("paste") && ["span", { class: "ace_mobile-button", action: "paste" }, "Paste"], hasUndo && canExecuteCommand("undo") && ["span", { class: "ace_mobile-button", action: "undo" }, "Undo"], canExecuteCommand("find") && ["span", { class: "ace_mobile-button", action: "find" }, "Find"], canExecuteCommand("openCommandPalette") && ["span", { class: "ace_mobile-button", action: "openCommandPalette" }, "Palette"] ] : ["span"]), contextMenu.firstChild ); }; var canExecuteCommand = function (/** @type {string} */ cmd) { return editor.commands.canExecute(cmd, editor); }; var handleClick = function(e) { var action = e.target.getAttribute("action"); if (action == "more" || !isOpen) { isOpen = !isOpen; return updateMenu(); } if (action == "paste") { clipboard.readText().then(function (text) { editor.execCommand(action, text); }); } else if (action) { if (action == "cut" || action == "copy") { if (clipboard) clipboard.writeText(editor.getCopyText()); else document.execCommand("copy"); } editor.execCommand(action); } contextMenu.firstChild.style.display = "none"; isOpen = false; if (action != "openCommandPalette") editor.focus(); }; contextMenu = dom.buildDom(["div", { class: "ace_mobile-menu", onclick: handleClick }, ["span"], ["span", { class: "ace_mobile-button", action: "more" }, "..."] ], editor.container); contextMenu.addEventListener("touchstart", function(e) { mode = "menu"; e.stopPropagation(); e.preventDefault(); editor.textInput.focus(); }); contextMenu.addEventListener("touchend", function(e) { e.stopPropagation(); e.preventDefault(); handleClick(e); }); } function showContextMenu() { if (!editor.getOption("enableMobileMenu")) { if (contextMenu) { hideContextMenu(); } return; } if (!contextMenu) createContextMenu(); var cursor = editor.selection.cursor; var pagePos = editor.renderer.textToScreenCoordinates(cursor.row, cursor.column); var leftOffset = editor.renderer.textToScreenCoordinates(0, 0).pageX; var scrollLeft = editor.renderer.scrollLeft; var rect = editor.container.getBoundingClientRect(); contextMenu.style.top = pagePos.pageY - rect.top - 3 + "px"; if (pagePos.pageX - rect.left < rect.width - 70) { contextMenu.style.left = ""; contextMenu.style.right = "10px"; } else { contextMenu.style.right = ""; contextMenu.style.left = leftOffset + scrollLeft - rect.left + "px"; } contextMenu.style.display = ""; contextMenu.firstChild.style.display = "none"; editor.on("input", hideContextMenu); } function hideContextMenu(e) { if (contextMenu) contextMenu.style.display = "none"; editor.off("input", hideContextMenu); } function handleLongTap() { longTouchTimer = null; clearTimeout(longTouchTimer); var range = editor.selection.getRange(); var inSelection = range.contains(pos.row, pos.column); if (range.isEmpty() || !inSelection) { editor.selection.moveToPosition(pos); editor.selection.selectWord(); } mode = "wait"; showContextMenu(); } function switchToSelectionMode() { longTouchTimer = null; clearTimeout(longTouchTimer); editor.selection.moveToPosition(pos); var range = clickCount >= 2 ? editor.selection.getLineRange(pos.row) : editor.session.getBracketRange(pos); if (range && !range.isEmpty()) { editor.selection.setRange(range); } else { editor.selection.selectWord(); } mode = "wait"; } event.addListener(el, "contextmenu", function(e) { if (!pressed) return; var textarea = editor.textInput.getElement(); textarea.focus(); }, editor); event.addListener(el, "touchstart", function (e) { var touches = e.touches; if (longTouchTimer || touches.length > 1) { clearTimeout(longTouchTimer); longTouchTimer = null; touchStartT = -1; mode = "zoom"; return; } pressed = editor.$mouseHandler.isMousePressed = true; var h = editor.renderer.layerConfig.lineHeight; var w = editor.renderer.layerConfig.lineHeight; var t = e.timeStamp; lastT = t; var touchObj = touches[0]; var x = touchObj.clientX; var y = touchObj.clientY; // reset clickCount if the new touch is far from the old one if (Math.abs(startX - x) + Math.abs(startY - y) > h) touchStartT = -1; startX = e.clientX = x; startY = e.clientY = y; vX = vY = 0; var ev = new MouseEvent(e, editor); pos = ev.getDocumentPosition(); if (t - touchStartT < 500 && touches.length == 1 && !animationSteps) { clickCount++; e.preventDefault(); e.button = 0; switchToSelectionMode(); } else { clickCount = 0; var cursor = editor.selection.cursor; var anchor = editor.selection.isEmpty() ? cursor : editor.selection.anchor; var cursorPos = editor.renderer.$cursorLayer.getPixelPosition(cursor, true); var anchorPos = editor.renderer.$cursorLayer.getPixelPosition(anchor, true); var rect = editor.renderer.scroller.getBoundingClientRect(); var offsetTop = editor.renderer.layerConfig.offset; var offsetLeft = editor.renderer.scrollLeft; var weightedDistance = function(x, y) { x = x / w; y = y / h - 0.75; return x * x + y * y; }; if (e.clientX < rect.left) { mode = "zoom"; return; } var diff1 = weightedDistance( e.clientX - rect.left - cursorPos.left + offsetLeft, e.clientY - rect.top - cursorPos.top + offsetTop ); var diff2 = weightedDistance( e.clientX - rect.left - anchorPos.left + offsetLeft, e.clientY - rect.top - anchorPos.top + offsetTop ); if (diff1 < 3.5 && diff2 < 3.5) mode = diff1 > diff2 ? "cursor" : "anchor"; if (diff2 < 3.5) mode = "anchor"; else if (diff1 < 3.5) mode = "cursor"; else mode = "scroll"; longTouchTimer = setTimeout(handleLongTap, 450); } touchStartT = t; }, editor); event.addListener(el, "touchend", function (e) { pressed = editor.$mouseHandler.isMousePressed = false; if (animationTimer) clearInterval(animationTimer); if (mode == "zoom") { mode = ""; animationSteps = 0; } else if (longTouchTimer) { editor.selection.moveToPosition(pos); animationSteps = 0; showContextMenu(); } else if (mode == "scroll") { animate(); hideContextMenu(); } else { showContextMenu(); } clearTimeout(longTouchTimer); longTouchTimer = null; }, editor); event.addListener(el, "touchmove", function (e) { if (longTouchTimer) { clearTimeout(longTouchTimer); longTouchTimer = null; } var touches = e.touches; if (touches.length > 1 || mode == "zoom") return; var touchObj = touches[0]; var wheelX = startX - touchObj.clientX; var wheelY = startY - touchObj.clientY; if (mode == "wait") { if (wheelX * wheelX + wheelY * wheelY > 4) mode = "cursor"; else return e.preventDefault(); } startX = touchObj.clientX; startY = touchObj.clientY; e.clientX = touchObj.clientX; e.clientY = touchObj.clientY; var t = e.timeStamp; var dt = t - lastT; lastT = t; if (mode == "scroll") { var mouseEvent = new MouseEvent(e, editor); mouseEvent.speed = 1; mouseEvent.wheelX = wheelX; mouseEvent.wheelY = wheelY; if (10 * Math.abs(wheelX) < Math.abs(wheelY)) wheelX = 0; if (10 * Math.abs(wheelY) < Math.abs(wheelX)) wheelY = 0; if (dt != 0) { vX = wheelX / dt; vY = wheelY / dt; } editor._emit("mousewheel", mouseEvent); if (!mouseEvent.propagationStopped) { vX = vY = 0; } } else { var ev = new MouseEvent(e, editor); var pos = ev.getDocumentPosition(); if (mode == "cursor") editor.selection.moveCursorToPosition(pos); else if (mode == "anchor") editor.selection.setSelectionAnchor(pos.row, pos.column); editor.renderer.scrollCursorIntoView(pos); e.preventDefault(); } }, editor); function animate() { animationSteps += 60; animationTimer = setInterval(function() { if (animationSteps-- <= 0) { clearInterval(animationTimer); animationTimer = null; } if (Math.abs(vX) < 0.01) vX = 0; if (Math.abs(vY) < 0.01) vY = 0; if (animationSteps < 20) vX = 0.9 * vX; if (animationSteps < 20) vY = 0.9 * vY; var oldScrollTop = editor.session.getScrollTop(); editor.renderer.scrollBy(10 * vX, 10 * vY); if (oldScrollTop == editor.session.getScrollTop()) animationSteps = 0; }, 10); } }; ================================================ FILE: src/multi_select.js ================================================ /** * @typedef {import("./anchor").Anchor} Anchor * @typedef {import("../ace-internal").Ace.Point} Point * @typedef {import("../ace-internal").Ace.ScreenCoordinates} ScreenCoordinates */ var RangeList = require("./range_list").RangeList; var Range = require("./range").Range; var Selection = require("./selection").Selection; var onMouseDown = require("./mouse/multi_select_handler").onMouseDown; var event = require("./lib/event"); var lang = require("./lib/lang"); var commands = require("./commands/multi_select_commands"); exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands); // Todo: session.find or editor.findVolatile that returns range var Search = require("./search").Search; var search = new Search(); /** * @param {EditSession} session * @param {string | RegExp} needle * @param {number} dir */ function find(session, needle, dir) { search.$options.wrap = true; search.$options.needle = needle; search.$options.backwards = dir == -1; return search.find(session); } // extend EditSession var EditSession = require("./edit_session").EditSession; (function() { /** * @this {EditSession} */ this.getSelectionMarkers = function() { return this.$selectionMarkers; }; }).call(EditSession.prototype); // extend Selection (function() { // list of ranges in reverse addition order this.ranges = null; // automatically sorted list of ranges /**@type {RangeList | null} */ this.rangeList = null; /** * Adds a range to a selection by entering multiselect mode, if necessary. * @param {Range} range The new range to add * @param {Boolean} $blockChangeEvents Whether or not to block changing events * @this {Selection} **/ this.addRange = function(range, $blockChangeEvents) { if (!range) return; if (!this.inMultiSelectMode && this.rangeCount === 0) { var oldRange = this.toOrientedRange(); this.rangeList.add(oldRange); this.rangeList.add(range); if (this.rangeList.ranges.length != 2) { this.rangeList.removeAll(); return $blockChangeEvents || this.fromOrientedRange(range); } this.rangeList.removeAll(); this.rangeList.add(oldRange); this.$onAddRange(oldRange); } if (!range.cursor) range.cursor = range.end; var removed = this.rangeList.add(range); this.$onAddRange(range); if (removed.length) this.$onRemoveRange(removed); if (this.rangeCount > 1 && !this.inMultiSelectMode) { this._signal("multiSelect"); this.inMultiSelectMode = true; this.session.$undoSelect = false; this.rangeList.attach(this.session); } return $blockChangeEvents || this.fromOrientedRange(range); }; /** * @param {Range} [range] * @this {Selection} **/ this.toSingleRange = function(range) { range = range || this.ranges[0]; var removed = this.rangeList.removeAll(); if (removed.length) this.$onRemoveRange(removed); range && this.fromOrientedRange(range); }; /** * Removes a Range containing pos (if it exists). * @param {Point} pos The position to remove, as a `{row, column}` object * @this {Selection} **/ this.substractPoint = function(pos) { var removed = this.rangeList.substractPoint(pos); if (removed) { this.$onRemoveRange(removed); return removed[0]; } }; /** * Merges overlapping ranges ensuring consistency after changes * @this {Selection} **/ this.mergeOverlappingRanges = function() { var removed = this.rangeList.merge(); if (removed.length) this.$onRemoveRange(removed); }; /** * @param {Range} range * @this {Selection} */ this.$onAddRange = function(range) { this.rangeCount = this.rangeList.ranges.length; this.ranges.unshift(range); this._signal("addRange", {range: range}); }; /** * @param {Range[]} removed * @this {Selection} */ this.$onRemoveRange = function(removed) { this.rangeCount = this.rangeList.ranges.length; if (this.rangeCount == 1 && this.inMultiSelectMode) { var lastRange = this.rangeList.ranges.pop(); removed.push(lastRange); this.rangeCount = 0; } for (var i = removed.length; i--; ) { var index = this.ranges.indexOf(removed[i]); this.ranges.splice(index, 1); } this._signal("removeRange", {ranges: removed}); if (this.rangeCount === 0 && this.inMultiSelectMode) { this.inMultiSelectMode = false; this._signal("singleSelect"); this.session.$undoSelect = true; // @ts-expect-error TODO: possible bug, no args in parameters this.rangeList.detach(this.session); } lastRange = lastRange || this.ranges[0]; if (lastRange && !lastRange.isEqual(this.getRange())) this.fromOrientedRange(lastRange); }; /** * adds multicursor support to selection * @this {Selection} */ this.$initRangeList = function() { if (this.rangeList) return; this.rangeList = new RangeList(); this.ranges = []; this.rangeCount = 0; }; /** * Returns a concatenation of all the ranges. * @returns {Range[]} * @this {Selection} **/ this.getAllRanges = function() { return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()]; }; /** * Splits all the ranges into lines. * @this {Selection} **/ this.splitIntoLines = function () { var ranges = this.ranges.length ? this.ranges : [this.getRange()]; var newRanges = []; for (var i = 0; i < ranges.length; i++) { var range = ranges[i]; var row = range.start.row; var endRow = range.end.row; if (row === endRow) { newRanges.push(range.clone()); } else { newRanges.push(new Range(row, range.start.column, row, this.session.getLine(row).length)); while (++row < endRow) newRanges.push(this.getLineRange(row, true)); newRanges.push(new Range(endRow, 0, endRow, range.end.column)); } if (i == 0 && !this.isBackwards()) newRanges = newRanges.reverse(); } this.toSingleRange(); for (var i = newRanges.length; i--;) this.addRange(newRanges[i]); }; /** * @this {Selection} */ this.joinSelections = function () { var ranges = this.rangeList.ranges; var lastRange = ranges[ranges.length - 1]; var range = Range.fromPoints(ranges[0].start, lastRange.end); this.toSingleRange(); this.setSelectionRange(range, lastRange.cursor == lastRange.start); }; /** * @this {Selection} **/ this.toggleBlockSelection = function () { if (this.rangeCount > 1) { var ranges = this.rangeList.ranges; var lastRange = ranges[ranges.length - 1]; var range = Range.fromPoints(ranges[0].start, lastRange.end); this.toSingleRange(); this.setSelectionRange(range, lastRange.cursor == lastRange.start); } else { var cursor = this.session.documentToScreenPosition(this.cursor); var anchor = this.session.documentToScreenPosition(this.anchor); var rectSel = this.rectangularRangeBlock(cursor, anchor); // @ts-expect-error TODO: possible bug rectSel.forEach(this.addRange, this); } }; /** * Gets list of ranges composing rectangular block on the screen * * @param {ScreenCoordinates} screenCursor The cursor to use * @param {ScreenCoordinates} screenAnchor The anchor to use * @param {Boolean} [includeEmptyLines] If true, this includes ranges inside the block which are empty due to clipping * @returns {Range[]} * @this {Selection} **/ this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) { var rectSel = []; var xBackwards = screenCursor.column < screenAnchor.column; if (xBackwards) { var startColumn = screenCursor.column; var endColumn = screenAnchor.column; var startOffsetX = screenCursor.offsetX; var endOffsetX = screenAnchor.offsetX; } else { var startColumn = screenAnchor.column; var endColumn = screenCursor.column; var startOffsetX = screenAnchor.offsetX; var endOffsetX = screenCursor.offsetX; } var yBackwards = screenCursor.row < screenAnchor.row; if (yBackwards) { var startRow = screenCursor.row; var endRow = screenAnchor.row; } else { var startRow = screenAnchor.row; var endRow = screenCursor.row; } if (startColumn < 0) startColumn = 0; if (startRow < 0) startRow = 0; if (startRow == endRow) includeEmptyLines = true; var docEnd; for (var row = startRow; row <= endRow; row++) { var range = Range.fromPoints( this.session.screenToDocumentPosition(row, startColumn, startOffsetX), this.session.screenToDocumentPosition(row, endColumn, endOffsetX) ); if (range.isEmpty()) { if (docEnd && isSamePoint(range.end, docEnd)) break; docEnd = range.end; } range.cursor = xBackwards ? range.start : range.end; rectSel.push(range); } if (yBackwards) rectSel.reverse(); if (!includeEmptyLines) { var end = rectSel.length - 1; while (rectSel[end].isEmpty() && end > 0) end--; if (end > 0) { var start = 0; while (rectSel[start].isEmpty()) start++; } for (var i = end; i >= start; i--) { if (rectSel[i].isEmpty()) rectSel.splice(i, 1); } } return rectSel; }; }).call(Selection.prototype); // extend Editor var Editor = require("./editor").Editor; (function() { /** * * Updates the cursor and marker layers. * @method Editor.updateSelectionMarkers * @this {Editor} **/ this.updateSelectionMarkers = function() { this.renderer.updateCursor(); this.renderer.updateBackMarkers(); }; /** * Adds the selection and cursor. * @param {Range & {marker?}} orientedRange A range containing a cursor * @returns {Range & {marker?}} * @this {Editor} **/ this.addSelectionMarker = function(orientedRange) { if (!orientedRange.cursor) orientedRange.cursor = orientedRange.end; var style = this.getSelectionStyle(); orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style); this.session.$selectionMarkers.push(orientedRange); this.session.selectionMarkerCount = this.session.$selectionMarkers.length; return orientedRange; }; /** * Removes the selection marker. * @param {Range & {marker?}} range The selection range added with [[Editor.addSelectionMarker `addSelectionMarker()`]]. * @this {Editor} **/ this.removeSelectionMarker = function(range) { if (!range.marker) return; this.session.removeMarker(range.marker); var index = this.session.$selectionMarkers.indexOf(range); if (index != -1) this.session.$selectionMarkers.splice(index, 1); this.session.selectionMarkerCount = this.session.$selectionMarkers.length; }; /** * @param {(Range & {marker?})[]} ranges * @this {Editor} */ this.removeSelectionMarkers = function(ranges) { var markerList = this.session.$selectionMarkers; for (var i = ranges.length; i--; ) { var range = ranges[i]; if (!range.marker) continue; this.session.removeMarker(range.marker); var index = markerList.indexOf(range); if (index != -1) markerList.splice(index, 1); } this.session.selectionMarkerCount = markerList.length; }; /** * @param e * @this {Editor} */ this.$onAddRange = function(e) { this.addSelectionMarker(e.range); this.renderer.updateCursor(); this.renderer.updateBackMarkers(); }; /** * @param e * @this {Editor} */ this.$onRemoveRange = function(e) { this.removeSelectionMarkers(e.ranges); this.renderer.updateCursor(); this.renderer.updateBackMarkers(); }; /** * @param e * @this {Editor} */ this.$onMultiSelect = function(e) { if (this.inMultiSelectMode) return; this.inMultiSelectMode = true; this.setStyle("ace_multiselect"); this.keyBinding.addKeyboardHandler(commands.keyboardHandler); this.commands.setDefaultHandler("exec", this.$onMultiSelectExec); this.renderer.updateCursor(); this.renderer.updateBackMarkers(); }; /** * @param e * @this {Editor} */ this.$onSingleSelect = function(e) { if (this.session.multiSelect.inVirtualMode) return; this.inMultiSelectMode = false; this.unsetStyle("ace_multiselect"); this.keyBinding.removeKeyboardHandler(commands.keyboardHandler); this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec); this.renderer.updateCursor(); this.renderer.updateBackMarkers(); this._emit("changeSelection"); }; /** * @param e * @this {Editor} */ this.$onMultiSelectExec = function(e) { var command = e.command; var editor = e.editor; if (!editor.multiSelect) return; if (!command.multiSelectAction) { var result = command.exec(editor, e.args || {}); editor.multiSelect.addRange(editor.multiSelect.toOrientedRange()); editor.multiSelect.mergeOverlappingRanges(); } else if (command.multiSelectAction == "forEach") { result = editor.forEachSelection(command, e.args); } else if (command.multiSelectAction == "forEachLine") { result = editor.forEachSelection(command, e.args, true); } else if (command.multiSelectAction == "single") { editor.exitMultiSelectMode(); result = command.exec(editor, e.args || {}); } else { result = command.multiSelectAction(editor, e.args || {}); } return result; }; /** * Executes a command for each selection range. * @param {any} cmd The command to execute * @param {String} [args] Any arguments for the command * @param {Object|true} [options] * @this {Editor} **/ this.forEachSelection = function(cmd, args, options) { if (this.inVirtualSelectionMode) return; var keepOrder = options && options.keepOrder; var $byLines = options == true || options && options.$byLines; var session = this.session; var selection = this.selection; var rangeList = selection.rangeList; var ranges = (keepOrder ? selection : rangeList).ranges; var result; if (!ranges.length) return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {}); var reg = selection._eventRegistry; selection._eventRegistry = {}; var tmpSel = new Selection(session); this.inVirtualSelectionMode = true; for (var i = ranges.length; i--;) { if ($byLines) { while (i > 0 && ranges[i].start.row == ranges[i - 1].end.row) i--; } tmpSel.fromOrientedRange(ranges[i]); tmpSel.index = i; this.selection = session.selection = tmpSel; var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {}); if (!result && cmdResult !== undefined) result = cmdResult; tmpSel.toOrientedRange(ranges[i]); } tmpSel.detach(); this.selection = session.selection = selection; this.inVirtualSelectionMode = false; selection._eventRegistry = reg; selection.mergeOverlappingRanges(); if (selection.ranges[0]) selection.fromOrientedRange(selection.ranges[0]); var anim = this.renderer.$scrollAnimation; this.onCursorChange(); this.onSelectionChange(); if (anim && anim.from == anim.to) this.renderer.animateScrolling(anim.from); return result; }; /** * Removes all the selections except the last added one. * @this {Editor} **/ this.exitMultiSelectMode = function() { if (!this.inMultiSelectMode || this.inVirtualSelectionMode) return; this.multiSelect.toSingleRange(); }; /** * @this {Editor} * @return {string} */ this.getSelectedText = function() { var text = ""; if (this.inMultiSelectMode && !this.inVirtualSelectionMode) { var ranges = this.multiSelect.rangeList.ranges; var buf = []; for (var i = 0; i < ranges.length; i++) { buf.push(this.session.getTextRange(ranges[i])); } var nl = this.session.getDocument().getNewLineCharacter(); text = buf.join(nl); if (text.length == (buf.length - 1) * nl.length) text = ""; } else if (!this.selection.isEmpty()) { text = this.session.getTextRange(this.getSelectionRange()); } return text; }; /** * @param e * @param {Anchor} anchor * @this {Editor} */ this.$checkMultiselectChange = function(e, anchor) { if (this.inMultiSelectMode && !this.inVirtualSelectionMode) { var range = this.multiSelect.ranges[0]; if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor) return; var pos = anchor == this.multiSelect.anchor ? range.cursor == range.start ? range.end : range.start : range.cursor; if (pos.row != anchor.row || this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column) this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()); else this.multiSelect.mergeOverlappingRanges(); } }; /** * Finds and selects all the occurrences of `needle`. * @param {String} [needle] The text to find * @param {Partial<import("../ace-internal").Ace.SearchOptions>} [options] The search options * @param {Boolean} [additive] keeps * * @returns {Number} The cumulative count of all found matches * @this {Editor} **/ this.findAll = function(needle, options, additive) { options = options || {}; options.needle = needle || options.needle; if (options.needle == undefined) { var range = this.selection.isEmpty() ? this.selection.getWordRange() : this.selection.getRange(); options.needle = this.session.getTextRange(range); } this.$search.set(options); var ranges = this.$search.findAll(this.session); if (!ranges.length) return 0; var selection = this.multiSelect; if (!additive) selection.toSingleRange(ranges[0]); for (var i = ranges.length; i--; ) selection.addRange(ranges[i], true); // keep old selection as primary if possible if (range && selection.rangeList.rangeAtPoint(range.start)) selection.addRange(range, true); return ranges.length; }; /** * Adds a cursor above or below the active cursor. * * @param {Number} dir The direction of lines to select: -1 for up, 1 for down * @param {Boolean} [skip] If `true`, removes the active selection range * * @this {Editor} */ this.selectMoreLines = function(dir, skip) { var range = this.selection.toOrientedRange(); var isBackwards = range.cursor == range.end; var screenLead = this.session.documentToScreenPosition(range.cursor); if (this.selection.$desiredColumn) screenLead.column = this.selection.$desiredColumn; var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column); if (!range.isEmpty()) { var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start); var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column); } else { var anchor = lead; } if (isBackwards) { /**@type {Range & {desiredColumn?: number}}*/ var newRange = Range.fromPoints(lead, anchor); newRange.cursor = newRange.start; } else { /**@type {Range & {desiredColumn?: number}}*/ var newRange = Range.fromPoints(anchor, lead); newRange.cursor = newRange.end; } newRange.desiredColumn = screenLead.column; if (!this.selection.inMultiSelectMode) { this.selection.addRange(range); } else { if (skip) var toRemove = range.cursor; } this.selection.addRange(newRange); if (toRemove) this.selection.substractPoint(toRemove); }; /** * Transposes the selected ranges. * @param {Number} dir The direction to rotate selections * @this {Editor} **/ this.transposeSelections = function(dir) { var session = this.session; var sel = session.multiSelect; var all = sel.ranges; for (var i = all.length; i--; ) { var range = all[i]; if (range.isEmpty()) { let tmp = session.getWordRange(range.start.row, range.start.column); range.start.row = tmp.start.row; range.start.column = tmp.start.column; range.end.row = tmp.end.row; range.end.column = tmp.end.column; } } sel.mergeOverlappingRanges(); var words = []; for (var i = all.length; i--; ) { var range = all[i]; words.unshift(session.getTextRange(range)); } if (dir < 0) words.unshift(words.pop()); else words.push(words.shift()); for (var i = all.length; i--; ) { var range = all[i]; var tmp = range.clone(); session.replace(range, words[i]); range.start.row = tmp.start.row; range.start.column = tmp.start.column; } sel.fromOrientedRange(sel.ranges[0]); }; /** * Finds the next occurrence of text in an active selection and adds it to the selections. * @param {Number} dir The direction of lines to select: -1 for up, 1 for down * @param {Boolean} [skip] If `true`, removes the active selection range * @param {Boolean} [stopAtFirst] * @this {Editor} **/ this.selectMore = function(dir, skip, stopAtFirst) { var session = this.session; var sel = session.multiSelect; var range = sel.toOrientedRange(); if (range.isEmpty()) { range = session.getWordRange(range.start.row, range.start.column); range.cursor = dir == -1 ? range.start : range.end; this.multiSelect.addRange(range); if (stopAtFirst) return; } var needle = session.getTextRange(range); var newRange = find(session, needle, dir); if (newRange) { newRange.cursor = dir == -1 ? newRange.start : newRange.end; this.session.unfold(newRange); this.multiSelect.addRange(newRange); this.renderer.scrollCursorIntoView(null, 0.5); } if (skip) this.multiSelect.substractPoint(range.cursor); }; /** * Aligns the cursors or selected text. * @this {Editor} **/ this.alignCursors = function() { var session = this.session; var sel = session.multiSelect; var ranges = sel.ranges; // filter out ranges on same row var row = -1; var sameRowRanges = ranges.filter(function(r) { if (r.cursor.row == row) return true; row = r.cursor.row; }); if (!ranges.length || sameRowRanges.length == ranges.length - 1) { var range = this.selection.getRange(); var fr = range.start.row, lr = range.end.row; var guessRange = fr == lr; if (guessRange) { var max = this.session.getLength(); var line; do { line = this.session.getLine(lr); } while (/[=:]/.test(line) && ++lr < max); do { line = this.session.getLine(fr); } while (/[=:]/.test(line) && --fr > 0); if (fr < 0) fr = 0; if (lr >= max) lr = max - 1; } var lines = this.session.removeFullLines(fr, lr); lines = this.$reAlignText(lines, guessRange); this.session.insert({row: fr, column: 0}, lines.join("\n") + "\n"); if (!guessRange) { range.start.column = 0; range.end.column = lines[lines.length - 1].length; } this.selection.setRange(range); } else { sameRowRanges.forEach(function(r) { sel.substractPoint(r.cursor); }); var maxCol = 0; var minSpace = Infinity; var spaceOffsets = ranges.map(function(r) { var p = r.cursor; var line = session.getLine(p.row); var spaceOffset = line.substr(p.column).search(/\S/g); if (spaceOffset == -1) spaceOffset = 0; if (p.column > maxCol) maxCol = p.column; if (spaceOffset < minSpace) minSpace = spaceOffset; return spaceOffset; }); ranges.forEach(function(r, i) { var p = r.cursor; var l = maxCol - p.column; var d = spaceOffsets[i] - minSpace; if (l > d) session.insert(p, lang.stringRepeat(" ", l - d)); else session.remove(new Range(p.row, p.column, p.row, p.column - l + d)); r.start.column = r.end.column = maxCol; r.start.row = r.end.row = p.row; r.cursor = r.end; }); sel.fromOrientedRange(ranges[0]); this.renderer.updateCursor(); this.renderer.updateBackMarkers(); } }; /** * @param {string[]} lines * @param {boolean} [forceLeft] * @return {*} * @this {Editor} */ this.$reAlignText = function(lines, forceLeft) { var isLeftAligned = true, isRightAligned = true; var startW, textW, endW; return lines.map(function(line) { var m = line.match(/(\s*)(.*?)(\s*)([=:].*)/); if (!m) return [line]; if (startW == null) { startW = m[1].length; textW = m[2].length; endW = m[3].length; return m; } if (startW + textW + endW != m[1].length + m[2].length + m[3].length) isRightAligned = false; if (startW != m[1].length) isLeftAligned = false; if (startW > m[1].length) startW = m[1].length; if (textW < m[2].length) textW = m[2].length; if (endW > m[3].length) endW = m[3].length; return m; }).map(forceLeft ? alignLeft : isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign); function spaces(n) { return lang.stringRepeat(" ", n); } function alignLeft(m) { return !m[2] ? m[0] : spaces(startW) + m[2] + spaces(textW - m[2].length + endW) + m[4].replace(/^([=:])\s+/, "$1 "); } function alignRight(m) { return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2] + spaces(endW) + m[4].replace(/^([=:])\s+/, "$1 "); } function unAlign(m) { return !m[2] ? m[0] : spaces(startW) + m[2] + spaces(endW) + m[4].replace(/^([=:])\s+/, "$1 "); } }; }).call(Editor.prototype); /** @param {Point} p1 @param {Point} p2 */ function isSamePoint(p1, p2) { return p1.row == p2.row && p1.column == p2.column; } /** * patch * adds multicursor support to a session * @this {Editor} * @type {(e: any) => void} */ exports.onSessionChange = function(e) { var session = e.session; if (session && !session.multiSelect) { session.$selectionMarkers = []; session.selection.$initRangeList(); session.multiSelect = session.selection; } this.multiSelect = session && session.multiSelect; var oldSession = e.oldSession; if (oldSession) { oldSession.multiSelect.off("addRange", this.$onAddRange); oldSession.multiSelect.off("removeRange", this.$onRemoveRange); oldSession.multiSelect.off("multiSelect", this.$onMultiSelect); oldSession.multiSelect.off("singleSelect", this.$onSingleSelect); oldSession.multiSelect.lead.off("change", this.$checkMultiselectChange); oldSession.multiSelect.anchor.off("change", this.$checkMultiselectChange); } if (session) { session.multiSelect.on("addRange", this.$onAddRange); session.multiSelect.on("removeRange", this.$onRemoveRange); session.multiSelect.on("multiSelect", this.$onMultiSelect); session.multiSelect.on("singleSelect", this.$onSingleSelect); session.multiSelect.lead.on("change", this.$checkMultiselectChange); session.multiSelect.anchor.on("change", this.$checkMultiselectChange); } if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) { if (session.selection.inMultiSelectMode) this.$onMultiSelect(); else this.$onSingleSelect(); } }; // MultiSelect(editor) // adds multiple selection support to the editor // (note: should be called only once for each editor instance) /** * @param {Editor} editor */ function MultiSelect(editor) { if (editor.$multiselectOnSessionChange) return; editor.$onAddRange = editor.$onAddRange.bind(editor); editor.$onRemoveRange = editor.$onRemoveRange.bind(editor); editor.$onMultiSelect = editor.$onMultiSelect.bind(editor); editor.$onSingleSelect = editor.$onSingleSelect.bind(editor); editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor); editor.$checkMultiselectChange = editor.$checkMultiselectChange.bind(editor); editor.$multiselectOnSessionChange(editor); editor.on("changeSession", editor.$multiselectOnSessionChange); editor.on("mousedown", onMouseDown); editor.commands.addCommands(commands.defaultCommands); addAltCursorListeners(editor); } /** * @param {Editor} editor */ function addAltCursorListeners(editor){ if (!editor.textInput) return; var el = editor.textInput.getElement(); var altCursor = false; event.addListener(el, "keydown", function(e) { var altDown = e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey); if (editor.$blockSelectEnabled && altDown) { if (!altCursor) { editor.renderer.setMouseCursor("crosshair"); altCursor = true; } } else if (altCursor) { reset(); } }, editor); event.addListener(el, "keyup", reset, editor); event.addListener(el, "blur", reset, editor); function reset(e) { if (altCursor) { editor.renderer.setMouseCursor(""); altCursor = false; // TODO disable menu popping up // e && e.preventDefault() } } } exports.MultiSelect = MultiSelect; require("./config").defineOptions(Editor.prototype, "editor", { enableMultiselect: { /** * @param {boolean} val * @this {Editor} */ set: function(val) { MultiSelect(this); if (val) { this.on("mousedown", onMouseDown); } else { this.off("mousedown", onMouseDown); } }, value: true }, enableBlockSelect: { set: function(val) { this.$blockSelectEnabled = val; }, value: true } }); ================================================ FILE: src/multi_select_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "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 UndoManager = require("./undomanager").UndoManager; 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 + ""); }; 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 testSelection(editor, data) { assert.equal(getSelection(editor) + "", data + ""); } 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: isBackwards } : { start: start, end: end, isBackwards: isBackwards }; })); } module.exports = { name: "ACE multi_select.js", "test: multiselect editing": function() { var doc = new EditSession([ "w1.w2", " wtt.w", " wtt.w" ]); editor = new Editor(new MockRenderer(), doc); editor.navigateFileEnd(); exec("selectMoreBefore", 3); assert.ok(editor.inMultiSelectMode); assert.equal(editor.selection.getAllRanges().length, 4); var newLine = editor.session.getDocument().getNewLineCharacter(); var copyText = "wwww".split("").join(newLine); assert.equal(editor.getCopyText(), copyText); exec("insertstring", 1, "a"); exec("backspace", 2); assert.equal(editor.session.getValue(), "w1.w2\ntt\ntt"); assert.equal(editor.selection.getAllRanges().length, 4); exec("selectall"); assert.ok(!editor.inMultiSelectMode); //assert.equal(editor.selection.getAllRanges().length, 1); }, "test: multiselect navigation": function() { var doc = new EditSession([ "w1.w2", " wtt.w", " wtt.we" ]); editor = new Editor(new MockRenderer(), doc); editor.selectMoreLines(1); testRanges("Range: [0/0] -> [0/0],Range: [1/0] -> [1/0]"); assert.ok(editor.inMultiSelectMode); exec("golinedown"); exec("gotolineend"); testRanges("Range: [1/9] -> [1/9],Range: [2/10] -> [2/10]"); exec("selectwordleft"); testRanges("Range: [1/8] -> [1/9],Range: [2/8] -> [2/10]"); exec("golinedown", 2); assert.ok(!editor.inMultiSelectMode); }, "test: multiselect session change": function() { var doc = new EditSession([ "w1.w2", " wtt.w", " wtt.w" ]); editor = new Editor(new MockRenderer(), doc); editor.selectMoreLines(1); testRanges("Range: [0/0] -> [0/0],Range: [1/0] -> [1/0]"); assert.ok(editor.inMultiSelectMode); var doc2 = new EditSession(["w1"]); editor.setSession(doc2); assert.ok(!editor.inMultiSelectMode); editor.setSession(doc); assert.ok(editor.inMultiSelectMode); }, "test: multiselect addRange": function() { var doc = new EditSession([ "w1.w2", " wtt.w", " wtt.w" ]); editor = new Editor(new MockRenderer(), doc); var selection = editor.selection; var range1 = new Range(0, 2, 0, 4); editor.selection.fromOrientedRange(range1); var range2 = new Range(0, 3, 0, 4); selection.addRange(range2); assert.ok(!editor.inMultiSelectMode); assert.ok(range2.isEqual(editor.selection.getRange())); var range3 = new Range(0, 1, 0, 1); selection.addRange(range3); assert.ok(editor.inMultiSelectMode); testRanges([range3, range2]); var range4 = new Range(0, 0, 4, 0); selection.addRange(range4); assert.ok(!editor.inMultiSelectMode); }, "test: multiselect paste": function() { editor = new Editor(new MockRenderer()); editor.setValue("l1\nl2\nl3", -1); editor.selection.selectDown(); editor.$handlePaste(""); assert.equal("l2\nl3", editor.getValue()); editor.setValue("l1\nl2\nl3", -1); editor.selectMoreLines(1); editor.$handlePaste("x\n"); assert.equal("x\nl1\nx\nl2\nl3", editor.getValue()); editor.execCommand("gotolineend"); editor.$handlePaste("\ny"); assert.equal("x\nl1\ny\nx\nl2\ny\nl3", editor.getValue()); editor.selectMoreLines(-1); editor.$handlePaste("4\n5\n6"); assert.equal("x\nl1\ny4\nx\nl52\ny6\nl3", editor.getValue()); editor.$handlePaste("7\n\n8"); assert.equal("x\nl1\ny47\nx\nl52\ny68\nl3", editor.getValue()); editor.execCommand("selectleft"); editor.execCommand("selectleft"); editor.$handlePaste("t\nz"); assert.equal("x\nl1\nyt\nz\nx\nt\nz2\nyt\nz\nl3", editor.getValue()); editor.setValue("l1\nl2\nl3", -1); editor.selectMoreLines(1); editor.selectMoreLines(1); editor.$handlePaste("a\nb\nc\nd"); assert.equal("a\nb\nc\ndl1\na\nb\nc\ndl2\na\nb\nc\ndl3", editor.getValue()); }, "test: onPaste in command with multiselect": function() { var doc = new EditSession(["l1", "l2"]); editor = new Editor(new MockRenderer(), doc); editor.commands.addCommand({ name: 'insertfoo', exec: function(ed) { ed.onPaste('foo'); }, multiSelectAction: "forEach" }); var selection = editor.selection; var range1 = new Range(0,2,0,2); var range2 = new Range(1,2,1,2); selection.fromOrientedRange(range1); selection.addRange(range2); editor.execCommand('insertfoo'); assert.equal('l1foo\nl2foo', editor.getValue()); }, "test multiselect move lines": function() { editor = new Editor(new MockRenderer()); editor.setValue("l1\nl2\nl3\nl4", -1); setSelection(editor, [[0,2],[1,2],[2,2],[3,2]]); exec("copylinesdown"); assert.equal(editor.getValue(),"l1\nl1\nl2\nl2\nl3\nl3\nl4\nl4"); testSelection(editor, [[1,2],[3,2],[5,2],[7,2]]); exec("copylinesup"); assert.equal(editor.getValue(),"l1\nl1\nl1\nl2\nl2\nl2\nl3\nl3\nl3\nl4\nl4\nl4"); testSelection(editor, [[1,2],[4,2],[7,2],[10,2]]); exec("removeline"); assert.equal(editor.getValue(),"l1\nl1\nl2\nl2\nl3\nl3\nl4\nl4"); testSelection(editor, [[1,0],[3,0],[5,0],[7,0]]); setSelection(editor, [[1,2],[1,1,1,0],[3,0,3,1],[5,0,5,1],[7,0,7,1]]); exec("copylinesdown"); exec("copylinesup"); assert.equal(editor.getValue(),"l1\nl1\nl1\nl1\nl2\nl2\nl2\nl2\nl3\nl3\nl3\nl3\nl4\nl4\nl4\nl4"); testSelection(editor, [[2,2],[2,1,2,0],[6,0,6,1],[10,0,10,1],[14,0,14,1]]); exec("movelinesdown", 12); assert.equal(editor.getValue(),"l1\nl1\nl1\nl2\nl2\nl2\nl3\nl3\nl3\nl4\nl4\nl4\nl1\nl2\nl3\nl4"); testSelection(editor, [[12,2],[12,1,12,0],[13,0,13,1],[14,0,14,1],[15,0,15,1]]); exec("movelinesup", 12); assert.equal(editor.getValue(),"l1\nl2\nl3\nl4\nl1\nl1\nl1\nl2\nl2\nl2\nl3\nl3\nl3\nl4\nl4\nl4"); testSelection(editor, [[0,2],[0,1,0,0],[1,0,1,1],[2,0,2,1],[3,0,3,1]]); }, "test multiselect fromJSON/toJSON": function() { var doc = new EditSession(["l1", "l2"]); editor = new Editor(new MockRenderer(), doc); var selection = editor.selection; var before = selection.toJSON(); var range1 = new Range(0,2,0,2); var range2 = new Range(1,2,1,2); selection.fromOrientedRange(range1); selection.addRange(range2); var after = selection.toJSON(); selection.fromJSON(before); assert.ok(!selection.isEqual(after)); assert.ok(selection.isEqual(before)); selection.fromJSON(after); assert.ok(!selection.isEqual(before)); assert.ok(selection.isEqual(after)); }, "test multiselect align": function() { var doc = new EditSession(["l1", "l2", "l3"]); doc.setUndoManager(new UndoManager()); editor = new Editor(new MockRenderer(), doc); var selection = editor.selection; selection.addRange(new Range(1,0,1,0)); selection.addRange(new Range(2,2,2,2)); editor.execCommand("alignCursors"); assert.equal(' l1\n l2\nl3', editor.getValue()); doc.markUndoGroup(); editor.execCommand("undo"); assert.equal('l1\nl2\nl3', editor.getValue()); }, "test multiselect transpose": function() { editor = new Editor(new MockRenderer()); editor.setValue("ay caramba"); var selection = editor.selection; selection.fromJSON([new Range(0,3,0,10), new Range(0,0,0,2)]); editor.execCommand("transposeletters"); assert.equal('caramba ay', editor.getValue()); editor.execCommand("transposeletters"); assert.ok(!editor.getSelectionRange().isEmpty()); assert.equal('ay caramba', editor.getValue()); }, "test select next": function() { editor = new Editor(new MockRenderer()); editor.setValue("a\na\na", 1); editor.execCommand("selectMoreBefore"); editor.execCommand("selectMoreBefore"); testSelection(editor, [[0,1,0,0],[1,1,1,0],[2,1,2,0]]); assert.equal(editor.session.$highlightLineMarker.start.row, 0); }, "test multiSelect delete": function() { editor.setValue("\n" + "a\nb\nc/\n".repeat(4), -1); exec("selectdown", 4); exec("selectleft", 2); exec("selectMoreAfter", 3); exec("del", 1); assert.equal(editor.getValue(), "////\n"); testSelection(editor, [[0,3],[0,2],[0,1],[0,0]]); exec("selectright", 1); exec("insertstring", 1, "a"); assert.equal(editor.getValue(), "aaaa\n"); testSelection(editor, [[0,4],[0,3],[0,2],[0,1]]); editor.setValue("w1.w2\n\n 0\n1\n2\n3\n4\n5\n6\n qwe\n\n\n\n\n\n"); editor.selection.fromJSON([ new Range(2,4,9,7), new Range(0,3,0,4), new Range(0,0,0,1) ]); editor.session.remove(new Range(4,0,5,0)); testSelection(editor, [[2,4,8,7],[0,3,0,4],[0,0,0,1]]); }, "test splitIntoLines": function() { var session = new EditSession(["l1", "l2", "l3"]); var selection = session.selection; editor = new Editor(new MockRenderer(), session); selection.moveTo(0, 0); selection.selectDown(); selection.splitIntoLines(); assert.equal(editor.selection.ranges + "", "Range: [1/0] -> [1/0],Range: [0/0] -> [0/2]", 2); selection.selectAll(); assert.equal(editor.selection.rangeCount, 0); selection.splitIntoLines(); assert.equal(editor.selection.rangeCount, 3); editor.execCommand("gotolineend"); editor.execCommand("addLineAfter"); editor.execCommand("insertstring", "x"); editor.execCommand("selectup"); editor.execCommand("splitSelectionIntoLines"); assert.equal(editor.selection.rangeCount, 6); assert.equal(editor.selection.cursor.row, 4); editor.execCommand("toggleSplitSelectionIntoLines"); assert.equal(editor.selection.getAllRanges() + "", "Range: [0/1] -> [5/1]"); editor.setValue(""); assert.equal(editor.selection.inMultiSelectMode, false); assert.equal(editor.selection.rangeCount, 0); } }; require("./test/run")(module); ================================================ FILE: src/occur.js ================================================ "use strict"; /** * @typedef {import("./editor").Editor} Editor * @typedef {import("../ace-internal").Ace.Point} Point * @typedef {import("../ace-internal").Ace.SearchOptions} SearchOptions */ var oop = require("./lib/oop"); var Search = require("./search").Search; var EditSession = require("./edit_session").EditSession; var SearchHighlight = require("./search_highlight").SearchHighlight; /** * Finds all lines matching a search term in the current [[Document * `Document`]] and displays them instead of the original `Document`. Keeps * track of the mapping between the occur doc and the original doc. **/ class Occur extends Search { /** * Enables occur mode. expects that `options.needle` is a search term. * This search term is used to filter out all the lines that include it * and these are then used as the content of a new [[Document * `Document`]]. The current cursor position of editor will be translated * so that the cursor is on the matching row/column as it was before. * @param {Editor} editor * @param {Object} options options.needle should be a String * @return {Boolean} Whether occur activation was successful * **/ enter(editor, options) { if (!options.needle) return false; var pos = editor.getCursorPosition(); this.displayOccurContent(editor, options); var translatedPos = this.originalToOccurPosition(editor.session, pos); editor.moveCursorToPosition(translatedPos); return true; } /** * Disables occur mode. Resets the [[Sessions `EditSession`]] [[Document * `Document`]] back to the original doc. If options.translatePosition is * truthy also maps the [[Editors `Editor`]] cursor position accordingly. * @param {Editor} editor * @param {Object} options options.translatePosition * @return {Boolean} Whether occur deactivation was successful * **/ exit(editor, options) { var pos = options.translatePosition && editor.getCursorPosition(); var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos); this.displayOriginalContent(editor); if (translatedPos) editor.moveCursorToPosition(translatedPos); return true; } /** * @param {EditSession} sess * @param {RegExp} regexp */ highlight(sess, regexp) { var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker( new SearchHighlight(null, "ace_occur-highlight", "text")); hl.setRegexp(regexp); sess._emit("changeBackMarker"); // force highlight layer redraw } /** * @param {Editor} editor * @param {Partial<SearchOptions>} options */ displayOccurContent(editor, options) { // this.setSession(session || new EditSession("")) this.$originalSession = editor.session; var found = this.matchingLines(editor.session, options); var lines = found.map(function(foundLine) { return foundLine.content; }); /**@type {EditSession}*/ var occurSession = new EditSession(lines.join('\n')); occurSession.$occur = this; occurSession.$occurMatchingLines = found; editor.setSession(occurSession); this.$useEmacsStyleLineStart = this.$originalSession.$useEmacsStyleLineStart; occurSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart; this.highlight(occurSession, options.re); occurSession._emit('changeBackMarker'); } /** * @param {Editor} editor */ displayOriginalContent(editor) { editor.setSession(this.$originalSession); this.$originalSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart; } /** * Translates the position from the original document to the occur lines in * the document or the beginning if the doc {row: 0, column: 0} if not * found. * @param {EditSession} session The occur session * @param {Point} pos The position in the original document * @return {Point} position in occur doc **/ originalToOccurPosition(session, pos) { var lines = session.$occurMatchingLines; var nullPos = {row: 0, column: 0}; if (!lines) return nullPos; for (var i = 0; i < lines.length; i++) { if (lines[i].row === pos.row) return {row: i, column: pos.column}; } return nullPos; } /** * Translates the position from the occur document to the original document * or `pos` if not found. * @param {EditSession} session The occur session * @param {Point} pos The position in the occur session document * @return {Point} position **/ occurToOriginalPosition(session, pos) { var lines = session.$occurMatchingLines; if (!lines || !lines[pos.row]) return pos; return {row: lines[pos.row].row, column: pos.column}; } /** * @param {EditSession} session * @param {Partial<SearchOptions>} options */ matchingLines(session, options) { options = oop.mixin({}, options); if (!session || !options.needle) return []; var search = new Search(); search.set(options); return search.findAll(session).reduce(function(lines, range) { var row = range.start.row; var last = lines[lines.length-1]; return last && last.row === row ? lines : lines.concat({row: row, content: session.getLine(row)}); }, []); } } var dom = require('./lib/dom'); dom.importCssString(".ace_occur-highlight {\n\ border-radius: 4px;\n\ background-color: rgba(87, 255, 8, 0.25);\n\ position: absolute;\n\ z-index: 4;\n\ box-sizing: border-box;\n\ box-shadow: 0 0 4px rgb(91, 255, 50);\n\ }\n\ .ace_dark .ace_occur-highlight {\n\ background-color: rgb(80, 140, 85);\n\ box-shadow: 0 0 4px rgb(60, 120, 70);\n\ }\n", "incremental-occur-highlighting", false); exports.Occur = Occur; ================================================ FILE: src/occur_test.js ================================================ "use strict"; var EditSession = require("./edit_session").EditSession; var Editor = require("./editor").Editor; var MockRenderer = require("./test/mockrenderer").MockRenderer; var Range = require("./range").Range; var assert = require("./test/assertions"); var Occur = require("./occur").Occur; var occurStartCommand = require("./commands/occur_commands").occurStartCommand; var editor, occur; module.exports = { name: "ACE occur.js", setUp: function() { var session = new EditSession(''); editor = new Editor(new MockRenderer(), session); occur = new Occur(); }, "test: find lines matching" : function() { editor.session.insert({row: 0, column: 0}, 'abc\ndef\nxyz\nbcxbc'); var result = occur.matchingLines(editor.session, {needle: 'bc'}), expected = [{row: 0, content: 'abc'}, {row: 3, content: 'bcxbc'}]; assert.deepEqual(result, expected); }, "test: display occurrences" : function() { var text = 'abc\ndef\nxyz\nbcx\n'; editor.session.insert({row: 0, column: 0}, text); occur.displayOccurContent(editor, {needle: 'bc'}); assert.equal(editor.getValue(), 'abc\nbcx'); occur.displayOriginalContent(editor); assert.equal(editor.getValue(), text); }, "test: original position from occur doc" : function() { var text = 'abc\ndef\nxyz\nbcx\n'; editor.session.insert({row: 0, column: 0}, text); occur.displayOccurContent(editor, {needle: 'bc'}); assert.equal(editor.getValue(), 'abc\nbcx'); var pos = occur.occurToOriginalPosition(editor.session, {row: 1, column: 2}); assert.position(pos, 3, 2); }, "test: occur command" : function() { // setup var text = 'hel\nlo\n\nwo\nrld\n'; editor.session.insert({row: 0, column: 0}, text); editor.commands.addCommand(occurStartCommand); // run occur for lines including 'o' editor.execCommand('occur', {needle: 'o'}); assert.equal(editor.getValue(), 'lo\nwo'); // command install OK? // assert.ok(editor.getReadOnly(), 'occur doc not marked as read only'); assert.ok(editor.getKeyboardHandler().isOccurHandler, 'no occur handler installed'); assert.ok(editor.commands.byName.occurexit, 'no exitoccur command installed'); // exit occur editor.execCommand('occurexit'); assert.equal(editor.getValue(), text); // editor state cleaned up? // assert.ok(!editor.getReadOnly(), 'original doc is marked as read only'); assert.ok(!editor.getKeyboardHandler().isOccurHandler, 'occur handler installed after detach'); assert.ok(!editor.commands.byName.occurexit, 'exitoccur installed after exiting occur'); }, "test: occur navigation" : function() { // setup var text = 'hel\nlo\n\nwo\nrld\n'; editor.session.insert({row: 0, column: 0}, text); editor.commands.addCommand(occurStartCommand); editor.moveCursorToPosition({row: 1, column: 1}); // run occur for lines including 'o' editor.execCommand('occur', {needle: 'o'}); assert.equal(editor.getValue(), 'lo\nwo'); assert.position(editor.getCursorPosition(), 0, 1, 'original -> occur pos'); // move to second line and accept editor.moveCursorToPosition({row: 1, column: 1}); editor.execCommand('occuraccept'); assert.position(editor.getCursorPosition(), 3, 1, 'occur -> original pos'); }, "test: recursive occur" : function() { // setup var text = 'x\nabc1\nx\nabc2\n'; editor.session.insert({row: 0, column: 0}, text); editor.commands.addCommand(occurStartCommand); // orig -> occur1 editor.execCommand('occur', {needle: 'abc'}); assert.equal(editor.getValue(), 'abc1\nabc2', "orig -> occur1"); // occur1 -> occur2 editor.execCommand('occur', {needle: '2'}); assert.equal(editor.getValue(), 'abc2', "occur1 -> occur2"); // occur2 -> occur1 editor.execCommand('occurexit'); assert.equal(editor.getValue(), 'abc1\nabc2', "occur2 -> occur1"); // occur1 -> orig editor.execCommand('occurexit'); assert.equal(editor.getValue(), text, "occur1 -> orig"); } }; require("./test/run")(module); ================================================ FILE: src/placeholder.js ================================================ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession */ var Range = require("./range").Range; var EventEmitter = require("./lib/event_emitter").EventEmitter; var oop = require("./lib/oop"); class PlaceHolder { /** * @param {EditSession} session * @param {Number} length * @param {import("../ace-internal").Ace.Point} pos * @param {any[]} others * @param {String} mainClass * @param {String} othersClass **/ constructor(session, length, pos, others, mainClass, othersClass) { var _self = this; this.length = length; this.session = session; this.doc = session.getDocument(); this.mainClass = mainClass; this.othersClass = othersClass; this.$onUpdate = this.onUpdate.bind(this); this.doc.on("change", this.$onUpdate, true); this.$others = others; this.$onCursorChange = function() { setTimeout(function() { _self.onCursorChange(); }); }; this.$pos = pos; // Used for reset var undoStack = session.getUndoManager().$undoStack || session.getUndoManager()["$undostack"] || {length: -1}; this.$undoStackDepth = undoStack.length; this.setup(); session.selection.on("changeCursor", this.$onCursorChange); } /** * PlaceHolder.setup() * * TODO * **/ setup() { var _self = this; var doc = this.doc; var session = this.session; this.selectionBefore = session.selection.toJSON(); if (session.selection.inMultiSelectMode) session.selection.toSingleRange(); this.pos = doc.createAnchor(this.$pos.row, this.$pos.column); var pos = this.pos; pos.$insertRight = true; pos.detach(); pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false); this.others = []; this.$others.forEach(function(other) { var anchor = doc.createAnchor(other.row, other.column); anchor.$insertRight = true; anchor.detach(); _self.others.push(anchor); }); session.setUndoSelect(false); } /** * PlaceHolder.showOtherMarkers() * * TODO * **/ showOtherMarkers() { if (this.othersActive) return; var session = this.session; var _self = this; this.othersActive = true; this.others.forEach(function(anchor) { anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false); }); } /** * PlaceHolder.hideOtherMarkers() * * Hides all over markers in the [[EditSession `EditSession`]] that are not the currently selected one. * **/ hideOtherMarkers() { if (!this.othersActive) return; this.othersActive = false; for (var i = 0; i < this.others.length; i++) { this.session.removeMarker(this.others[i].markerId); } } /** * PlaceHolder@onUpdate(e) * * Emitted when the place holder updates. * @param {import("../ace-internal").Ace.Delta} delta * @internal */ onUpdate(delta) { if (this.$updating) return this.updateAnchors(delta); var range = delta; if (range.start.row !== range.end.row) return; if (range.start.row !== this.pos.row) return; this.$updating = true; var lengthDiff = delta.action === "insert" ? range.end.column - range.start.column : range.start.column - range.end.column; var inMainRange = range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1; var distanceFromStart = range.start.column - this.pos.column; this.updateAnchors(delta); if (inMainRange) this.length += lengthDiff; if (inMainRange && !this.session.$fromUndo) { if (delta.action === 'insert') { for (var i = this.others.length - 1; i >= 0; i--) { var otherPos = this.others[i]; var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart}; this.doc.insertMergedLines(newPos, delta.lines); } } else if (delta.action === 'remove') { for (var i = this.others.length - 1; i >= 0; i--) { var otherPos = this.others[i]; var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart}; this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff)); } } } this.$updating = false; this.updateMarkers(); } /** * @param {import("../ace-internal").Ace.Delta} delta */ updateAnchors(delta) { this.pos.onChange(delta); for (var i = this.others.length; i--;) this.others[i].onChange(delta); this.updateMarkers(); } updateMarkers() { if (this.$updating) return; var _self = this; var session = this.session; var updateMarker = function(pos, className) { session.removeMarker(pos.markerId); pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column+_self.length), className, null, false); }; updateMarker(this.pos, this.mainClass); for (var i = this.others.length; i--;) updateMarker(this.others[i], this.othersClass); } /** * PlaceHolder@onCursorChange(e) * * Emitted when the cursor changes. * @param {any} [event] * @internal */ onCursorChange(event) { if (this.$updating || !this.session) return; var pos = this.session.selection.getCursor(); if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) { this.showOtherMarkers(); this._emit("cursorEnter", event); } else { this.hideOtherMarkers(); this._emit("cursorLeave", event); } } /** * PlaceHolder.detach() * * TODO * **/ detach() { this.session.removeMarker(this.pos && this.pos.markerId); this.hideOtherMarkers(); this.doc.off("change", this.$onUpdate); this.session.selection.off("changeCursor", this.$onCursorChange); this.session.setUndoSelect(true); this.session = null; } /** * PlaceHolder.cancel() * * TODO * **/ cancel() { if (this.$undoStackDepth === -1) return; var undoManager = this.session.getUndoManager(); var undosRequired = (undoManager.$undoStack || undoManager["$undostack"]).length - this.$undoStackDepth; for (var i = 0; i < undosRequired; i++) { undoManager.undo(this.session, true); } if (this.selectionBefore) this.session.selection.fromJSON(this.selectionBefore); } } oop.implement(PlaceHolder.prototype, EventEmitter); exports.PlaceHolder = PlaceHolder; ================================================ FILE: src/placeholder_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "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 JavaScriptMode = require("./mode/javascript").Mode; var PlaceHolder = require("./placeholder").PlaceHolder; var UndoManager = require("./undomanager").UndoManager; var lang = require("./lib/lang"); require("./multi_select"); module.exports = { "test: simple at the end appending of text": function () { var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]); editor.moveCursorTo(0, 5); editor.insert('b'); assert.equal(session.doc.getValue(), "var ab = 10;\nconsole.log(ab, ab);"); editor.insert('cd'); assert.equal(session.doc.getValue(), "var abcd = 10;\nconsole.log(abcd, abcd);"); editor.remove('left'); editor.remove('left'); editor.remove('left'); assert.equal(session.doc.getValue(), "var a = 10;\nconsole.log(a, a);"); }, "test: inserting text outside placeholder": function () { var session = new EditSession("var a = 10;\nconsole.log(a, a);\n", new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]); editor.moveCursorTo(2, 0); editor.insert('b'); assert.equal(session.doc.getValue(), "var a = 10;\nconsole.log(a, a);\nb"); }, "test: insertion at the beginning": async function (next) { var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); var p = new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]); editor.moveCursorTo(0, 4); editor.insert('$'); assert.equal(session.doc.getValue(), "var $a = 10;\nconsole.log($a, $a);"); editor.moveCursorTo(0, 4); // Have to put this in a setTimeout because the anchor is only fixed later. await lang.sleep(20); editor.insert('v'); assert.equal(session.doc.getValue(), "var v$a = 10;\nconsole.log(v$a, v$a);"); next(); }, "test: detaching placeholder": function () { var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); var p = new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]); editor.moveCursorTo(0, 5); editor.insert('b'); assert.equal(session.doc.getValue(), "var ab = 10;\nconsole.log(ab, ab);"); p.detach(); editor.insert('cd'); assert.equal(session.doc.getValue(), "var abcd = 10;\nconsole.log(ab, ab);"); }, "test: events": function () { var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); var p = new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]); var entered = false; var left = false; p.on("cursorEnter", function () { entered = true; }); p.on("cursorLeave", function () { left = true; }); editor.moveCursorTo(0, 0); editor.moveCursorTo(0, 4); p.onCursorChange(); // Have to do this by hand because moveCursorTo doesn't trigger the event assert.ok(entered); editor.moveCursorTo(1, 0); p.onCursorChange(); // Have to do this by hand because moveCursorTo doesn't trigger the event assert.ok(left); }, "test: cancel": async function (next) { var session = new EditSession("var a = 10;\nconsole.log(a, a);", new JavaScriptMode()); session.setUndoManager(new UndoManager()); var editor = new Editor(new MockRenderer(), session); var p = new PlaceHolder(session, 1, {row: 0, column: 4}, [{row: 1, column: 12}, {row: 1, column: 15}]); editor.moveCursorTo(0, 5); editor.insert('b'); editor.insert('cd'); editor.remove('left'); assert.equal(session.doc.getValue(), "var abc = 10;\nconsole.log(abc, abc);"); // Wait a little for the changes to enter the undo stack await lang.sleep(80); p.cancel(); assert.equal(session.doc.getValue(), "var a = 10;\nconsole.log(a, a);"); next(); } }; require("./test/run")(module); ================================================ FILE: src/range.js ================================================ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession * @typedef {import("../ace-internal").Ace.IRange} IRange * @typedef {import("../ace-internal").Ace.Point} Point */ /** * 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. **/ class Range { /** * Creates a new `Range` object with the given starting and ending rows and columns. * @param {Number} [startRow] The starting row * @param {Number} [startColumn] The starting column * @param {Number} [endRow] The ending row * @param {Number} [endColumn] The ending column * @constructor **/ constructor(startRow, startColumn, endRow, endColumn) { /**@type {Point}*/ this.start = { row: startRow, column: startColumn }; /**@type {Point}*/ this.end = { row: endRow, column: endColumn }; } /** * Returns `true` if and only if the starting row and column, and ending row and column, are equivalent to those given by `range`. * @param {IRange} range A range to check against * @return {Boolean} **/ isEqual(range) { return this.start.row === range.start.row && this.end.row === range.end.row && this.start.column === range.start.column && this.end.column === range.end.column; } /** * Returns a string containing the range's row and column information, given like this: * ``` * [start.row/start.column] -> [end.row/end.column] * ``` * @return {String} **/ toString() { return ("Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + 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: * ```javascript * this.start.row <= row <= this.end.row && * this.start.column <= column <= this.end.column * ``` * @param {Number} row A row to check for * @param {Number} column A column to check for * @returns {Boolean} * @related [[Range.compare]] **/ contains(row, column) { return this.compare(row, column) == 0; } /** * Compares `this` range (A) with another range (B). * @param {IRange} range A range to compare with * @related [[Range.compare]] * @returns {Number} This method returns one of the following numbers: * * `-2`: (B) is in front of (A), and doesn't intersect with (A) * * `-1`: (B) begins before (A) but ends inside of (A) * * `0`: (B) is completely inside of (A) * * `+1`: (B) begins inside of (A) but ends outside of (A) * * `+2`: (B) is after (A) and doesn't intersect with (A) * * `42`: FTW state: (B) ends in (A) but starts outside of (A) **/ compareRange(range) { var cmp, end = range.end, start = range.start; cmp = this.compare(end.row, end.column); if (cmp == 1) { cmp = this.compare(start.row, start.column); if (cmp == 1) { return 2; } else if (cmp == 0) { return 1; } else { return 0; } } else if (cmp == -1) { return -2; } else { cmp = this.compare(start.row, start.column); if (cmp == -1) { return -1; } else if (cmp == 1) { return 42; } else { return 0; } } } /** * Compares the row and column of `p` with the starting and ending [[Point]]'s of the calling range (by calling [[Range.compare]]). * @param {Point} p A point to compare with * @related [[Range.compare]] * @returns {Number} **/ comparePoint(p) { return this.compare(p.row, p.column); } /** * Checks the start and end [[Point]]'s of `range` and compares them to the calling range. Returns `true` if the `range` is contained within the caller's range. * @param {IRange} range A range to compare with * @returns {Boolean} * @related [[Range.comparePoint]] **/ containsRange(range) { return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0; } /** * Returns `true` if passed in `range` intersects with the one calling this method. * @param {IRange} range A range to compare with * @returns {Boolean} **/ intersects(range) { var cmp = this.compareRange(range); return (cmp == -1 || cmp == 0 || cmp == 1); } /** * Returns `true` if the caller's ending row is the same as `row`, and if the caller's ending column is the same as `column`. * @param {Number} row A row to compare with * @param {Number} column A column to compare with * @returns {Boolean} **/ isEnd(row, column) { return this.end.row == row && this.end.column == column; } /** * Returns `true` if the caller's starting row is the same as `row`, and if the caller's starting column is the same as `column`. * @param {Number} row A row to compare with * @param {Number} column A column to compare with * @returns {Boolean} **/ isStart(row, column) { return this.start.row == row && this.start.column == column; } /** * Sets the starting row and column for the range. * @param {Number|Point} row A row to set * @param {Number} [column] A column to set * **/ setStart(row, column) { if (typeof row == "object") { this.start.column = row.column; this.start.row = row.row; } else { this.start.row = row; this.start.column = column; } } /** * Sets the starting row and column for the range. * @param {Number|Point} row A row to set * @param {Number} [column] A column to set * **/ setEnd(row, column) { if (typeof row == "object") { this.end.column = row.column; this.end.row = row.row; } else { this.end.row = row; this.end.column = column; } } /** * Returns `true` if the `row` and `column` are within the given range. * @param {Number} row A row to compare with * @param {Number} column A column to compare with * @returns {Boolean} * @related [[Range.compare]] **/ inside(row, column) { if (this.compare(row, column) == 0) { if (this.isEnd(row, column) || this.isStart(row, column)) { return false; } else { return true; } } return false; } /** * Returns `true` if the `row` and `column` are within the given range's starting [[Point]]. * @param {Number} row A row to compare with * @param {Number} column A column to compare with * @returns {Boolean} * @related [[Range.compare]] **/ insideStart(row, column) { if (this.compare(row, column) == 0) { if (this.isEnd(row, column)) { return false; } else { return true; } } return false; } /** * Returns `true` if the `row` and `column` are within the given range's ending [[Point]]. * @param {Number} row A row to compare with * @param {Number} column A column to compare with * @returns {Boolean} * @related [[Range.compare]] * **/ insideEnd(row, column) { if (this.compare(row, column) == 0) { if (this.isStart(row, column)) { return false; } else { return true; } } return false; } /** * Compares the `row` and `column` with the starting and ending [[Point]]'s of the calling range. * @param {Number} row A row to compare with * @param {Number} column A column to compare with * @returns {Number} This method returns one of the following numbers: * * `1` if `row` is greater than the calling range * * `-1` if `row` is less then the calling range * * `0` otherwise * * If the starting row of the calling range is equal to `row`, and: * * `column` is greater than or equal to the calling range's starting column, this returns `0` * * Otherwise, it returns -1 * * If the ending row of the calling range is equal to `row`, and: * * `column` is less than or equal to the calling range's ending column, this returns `0` * * Otherwise, it returns 1 **/ compare(row, column) { if (!this.isMultiLine()) { if (row === this.start.row) { return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0); } } if (row < this.start.row) return -1; if (row > this.end.row) return 1; if (this.start.row === row) return column >= this.start.column ? 0 : -1; if (this.end.row === row) return column <= this.end.column ? 0 : 1; return 0; } /** * Compares the `row` and `column` with the starting and ending [[Point]]'s of the calling range. * @param {Number} row A row to compare with * @param {Number} column A column to compare with * @returns {Number} This method returns one of the following numbers: * * `-1` if calling range's starting column and calling range's starting row are equal `row` and `column` * * Otherwise, it returns the value after calling [[Range.compare `compare()`]]. **/ compareStart(row, column) { if (this.start.row == row && this.start.column == column) { return -1; } else { return this.compare(row, column); } } /** * Compares the `row` and `column` with the starting and ending [[Point]]'s of the calling range. * @param {Number} row A row to compare with * @param {Number} column A column to compare with * @returns {Number} This method returns one of the following numbers: * * `1` if calling range's ending column and calling range's ending row are equal `row` and `column`. * * Otherwise, it returns the value after calling [[Range.compare `compare()`]]. */ compareEnd(row, column) { if (this.end.row == row && this.end.column == column) { return 1; } else { return this.compare(row, column); } } /** * Compares the `row` and `column` with the start and end [[Point]]'s of the calling range. * @param {Number} row A row to compare with * @param {Number} column A column to compare with * @returns {Number} This method returns one of the following numbers: * * `1` if the ending row of the calling range is equal to `row`, and the ending column of the calling range is equal to `column` * * `-1` if the starting row of the calling range is equal to `row`, and the starting column of the calling range is equal to `column` * * Otherwise, it returns the value after calling [[Range.compare `compare()`]]. **/ compareInside(row, column) { if (this.end.row == row && this.end.column == column) { return 1; } else if (this.start.row == row && this.start.column == column) { return -1; } else { return this.compare(row, column); } } /** * Returns the part of the current `Range` that occurs within the boundaries of `firstRow` and `lastRow` as a new `Range` object. * @param {Number} firstRow The starting row * @param {Number} lastRow The ending row * @returns {Range} **/ clipRows(firstRow, lastRow) { if (this.end.row > lastRow) var end = {row: lastRow + 1, column: 0}; else if (this.end.row < firstRow) var end = {row: firstRow, column: 0}; if (this.start.row > lastRow) var start = {row: lastRow + 1, column: 0}; else if (this.start.row < firstRow) var start = {row: firstRow, column: 0}; return Range.fromPoints(start || this.start, end || this.end); } /** * Changes the `row` and `column` for the calling range for both the starting and ending [[Point]]'s. * @param {Number} row A new row to extend to * @param {Number} column A new column to extend to * @returns {Range} The original range with the new row **/ extend(row, column) { var cmp = this.compare(row, column); if (cmp == 0) return this; else if (cmp == -1) var start = {row: row, column: column}; else var end = {row: row, column: column}; return Range.fromPoints(start || this.start, end || this.end); } /** * Returns `true` if the calling range is empty (starting [[Point]] == ending [[Point]]). * @returns {Boolean} **/ isEmpty() { return (this.start.row === this.end.row && this.start.column === this.end.column); } /** * Returns `true` if the range spans across multiple lines. * @returns {Boolean} **/ isMultiLine() { return (this.start.row !== this.end.row); } /** * Returns a duplicate of the calling range. * @returns {Range} **/ clone() { return Range.fromPoints(this.start, this.end); } /** * Returns a range containing the starting and ending rows of the original range, but with a column value of `0`. * @returns {Range} **/ collapseRows() { if (this.end.column == 0) return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0); else return new Range(this.start.row, 0, this.end.row, 0); } /** * Given the current `Range`, this function converts those starting and ending [[Point]]'s into screen positions, and then returns a new `Range` object. * @param {EditSession} session The `EditSession` to retrieve coordinates from * @returns {Range} **/ toScreenRange(session) { var screenPosStart = session.documentToScreenPosition(this.start); var screenPosEnd = session.documentToScreenPosition(this.end); return new Range( screenPosStart.row, screenPosStart.column, screenPosEnd.row, screenPosEnd.column ); } /** * Shift the calling range by `row` and `column` values. * @param {Number} row * @param {Number} column * @experimental */ moveBy(row, column) { this.start.row += row; this.start.column += column; this.end.row += row; this.end.column += column; } } /** * Creates and returns a new `Range` based on the `start` [[Point]] and `end` [[Point]] of the given parameters. * @param {Point} start A starting point to use * @param {Point} end An ending point to use * @returns {Range} **/ Range.fromPoints = function(start, end) { return new Range(start.row, start.column, end.row, end.column); }; /** * Compares `p1` and `p2` [[Point]]'s, useful for sorting * @param {Point} p1 * @param {Point} p2 * @returns {Number} */ Range.comparePoints = function(p1, p2) { return p1.row - p2.row || p1.column - p2.column; }; exports.Range = Range; ================================================ FILE: src/range_list.js ================================================ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession * @typedef {import("../ace-internal").Ace.Point} Point */ var Range = require("./range").Range; var comparePoints = Range.comparePoints; class RangeList { constructor() { this.ranges = []; this.$bias = 1; } /** * @param {Point} pos * @param {boolean} [excludeEdges] * @param {number} [startIndex] * @return {number} */ pointIndex(pos, excludeEdges, startIndex) { var list = this.ranges; for (var i = startIndex || 0; i < list.length; i++) { var range = list[i]; var cmpEnd = comparePoints(pos, range.end); if (cmpEnd > 0) continue; var cmpStart = comparePoints(pos, range.start); if (cmpEnd === 0) return excludeEdges && cmpStart !== 0 ? -i-2 : i; if (cmpStart > 0 || (cmpStart === 0 && !excludeEdges)) return i; return -i-1; } return -i - 1; } /** * @param {Range} range */ add(range) { var excludeEdges = !range.isEmpty(); var startIndex = this.pointIndex(range.start, excludeEdges); if (startIndex < 0) startIndex = -startIndex - 1; var endIndex = this.pointIndex(range.end, excludeEdges, startIndex); if (endIndex < 0) endIndex = -endIndex - 1; else endIndex++; return this.ranges.splice(startIndex, endIndex - startIndex, range); } /** * @param {Range[]} list */ addList(list) { var removed = []; for (var i = list.length; i--; ) { removed.push.apply(removed, this.add(list[i])); } return removed; } /** * @param {Point} pos */ substractPoint(pos) { var i = this.pointIndex(pos); if (i >= 0) return this.ranges.splice(i, 1); } // merge overlapping ranges merge() { var removed = []; var list = this.ranges; list = list.sort(function(a, b) { return comparePoints(a.start, b.start); }); var next = list[0], range; for (var i = 1; i < list.length; i++) { range = next; next = list[i]; var cmp = comparePoints(range.end, next.start); if (cmp < 0) continue; if (cmp == 0 && !range.isEmpty() && !next.isEmpty()) continue; if (comparePoints(range.end, next.end) < 0) { range.end.row = next.end.row; range.end.column = next.end.column; } list.splice(i, 1); removed.push(next); next = range; i--; } this.ranges = list; return removed; } /** * @param {number} row * @param {number} column */ contains(row, column) { return this.pointIndex({row: row, column: column}) >= 0; } /** * @param {Point} pos */ containsPoint(pos) { return this.pointIndex(pos) >= 0; } /** * @param {Point} pos */ rangeAtPoint(pos) { var i = this.pointIndex(pos); if (i >= 0) return this.ranges[i]; } /** * @param {number} startRow * @param {number} endRow */ clipRows(startRow, endRow) { var list = this.ranges; if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow) return []; var startIndex = this.pointIndex({row: startRow, column: 0}); if (startIndex < 0) startIndex = -startIndex - 1; //@ts-expect-error TODO: potential wrong argument var endIndex = this.pointIndex({row: endRow, column: 0}, startIndex); if (endIndex < 0) endIndex = -endIndex - 1; var clipped = []; for (var i = startIndex; i < endIndex; i++) { clipped.push(list[i]); } return clipped; } removeAll() { return this.ranges.splice(0, this.ranges.length); } /** * @param {EditSession} session */ attach(session) { if (this.session) this.detach(); this.session = session; this.onChange = this.$onChange.bind(this); this.session.on('change', this.onChange); } detach() { if (!this.session) return; this.session.removeListener('change', this.onChange); this.session = null; } /** * @param {import("../ace-internal").Ace.Delta} delta */ $onChange(delta) { var start = delta.start; var end = delta.end; var startRow = start.row; var endRow = end.row; var ranges = this.ranges; for (var i = 0, n = ranges.length; i < n; i++) { var r = ranges[i]; if (r.end.row >= startRow) break; } if (delta.action == "insert") { var lineDif = endRow - startRow; var colDiff = -start.column + end.column; for (; i < n; i++) { var r = ranges[i]; if (r.start.row > startRow) break; if (r.start.row == startRow && r.start.column >= start.column) { if (r.start.column == start.column && this.$bias <= 0) { // do nothing } else { r.start.column += colDiff; r.start.row += lineDif; } } if (r.end.row == startRow && r.end.column >= start.column) { if (r.end.column == start.column && this.$bias < 0) { continue; } // special handling for the case when two ranges share an edge if (r.end.column == start.column && colDiff > 0 && i < n - 1) { if (r.end.column > r.start.column && r.end.column == ranges[i+1].start.column) r.end.column -= colDiff; } r.end.column += colDiff; r.end.row += lineDif; } } } else { var lineDif = startRow - endRow; var colDiff = start.column - end.column; for (; i < n; i++) { var r = ranges[i]; if (r.start.row > endRow) break; if (r.end.row < endRow && ( startRow < r.end.row || startRow == r.end.row && start.column < r.end.column ) ) { r.end.row = startRow; r.end.column = start.column; } else if (r.end.row == endRow) { if (r.end.column <= end.column) { if (lineDif || r.end.column > start.column) { r.end.column = start.column; r.end.row = start.row; } } else { r.end.column += colDiff; r.end.row += lineDif; } } else if (r.end.row > endRow) { r.end.row += lineDif; } if (r.start.row < endRow && ( startRow < r.start.row || startRow == r.start.row && start.column < r.start.column ) ) { r.start.row = startRow; r.start.column = start.column; } else if (r.start.row == endRow) { if (r.start.column <= end.column) { if (lineDif || r.start.column > start.column) { r.start.column = start.column; r.start.row = start.row; } } else { r.start.column += colDiff; r.start.row += lineDif; } } else if (r.start.row > endRow) { r.start.row += lineDif; } } } if (lineDif != 0 && i < n) { for (; i < n; i++) { var r = ranges[i]; r.start.row += lineDif; r.end.row += lineDif; } } } } RangeList.prototype.comparePoints = comparePoints; exports.RangeList = RangeList; ================================================ FILE: src/range_list_test.js ================================================ "use strict"; var Range = require("./range").Range; var RangeList = require("./range_list").RangeList; var EditSession = require("./edit_session").EditSession; var assert = require("./test/assertions"); function flatten(rangeList) { var points = []; rangeList.ranges.forEach(function(r) { points.push(r.start.row, r.start.column, r.end.row, r.end.column); }); return points; } function testRangeList(rangeList, points) { assert.equal("" + flatten(rangeList), "" + points); } module.exports = { name: "ACE range_list.js", "test: rangeList pointIndex": function() { var rangeList = new RangeList(); rangeList.ranges = [ new Range(1,2,3,4), new Range(4,2,5,4), new Range(8,8,9,9) ]; assert.equal(rangeList.pointIndex({row: 0, column: 1}), -1); assert.equal(rangeList.pointIndex({row: 1, column: 2}), 0); assert.equal(rangeList.pointIndex({row: 1, column: 3}), 0); assert.equal(rangeList.pointIndex({row: 3, column: 4}), 0); assert.equal(rangeList.pointIndex({row: 4, column: 1}), -2); assert.equal(rangeList.pointIndex({row: 5, column: 1}), 1); assert.equal(rangeList.pointIndex({row: 8, column: 9}), 2); assert.equal(rangeList.pointIndex({row: 18, column: 9}), -4); }, "test: rangeList pointIndex excludeEdges": function() { var rangeList = new RangeList(); rangeList.ranges = [ new Range(1,2,3,4), new Range(4,2,5,4), new Range(8,8,9,9), new Range(10,10,10,10) ]; assert.equal(rangeList.pointIndex({row: 0, column: 1}, true), -1); assert.equal(rangeList.pointIndex({row: 1, column: 2}, true), -1); assert.equal(rangeList.pointIndex({row: 1, column: 3}, true), 0); assert.equal(rangeList.pointIndex({row: 3, column: 4}, true), -2); assert.equal(rangeList.pointIndex({row: 4, column: 1}, true), -2); assert.equal(rangeList.pointIndex({row: 5, column: 1}, true), 1); assert.equal(rangeList.pointIndex({row: 8, column: 9}, true), 2); assert.equal(rangeList.pointIndex({row: 10, column: 10}, true), 3); assert.equal(rangeList.pointIndex({row: 18, column: 9}, true), -5); }, "test: rangeList add": function() { var rangeList = new RangeList(); rangeList.addList([ new Range(9,0,9,1), new Range(1,2,3,4), new Range(8,8,9,9), new Range(4,2,5,4), new Range(3,20,3,24), new Range(6,6,7,7) ]); assert.equal(rangeList.ranges.length, 5); rangeList.add(new Range(1,2,3,5)); assert.range(rangeList.ranges[0], 1,2,3,5); assert.equal(rangeList.ranges.length, 5); rangeList.add(new Range(7,7,7,7)); assert.range(rangeList.ranges[3], 7,7,7,7); rangeList.add(new Range(7,8,7,8)); assert.range(rangeList.ranges[4], 7,8,7,8); }, "test: rangeList add empty": function() { var rangeList = new RangeList(); rangeList.addList([ new Range(7,10,7,10), new Range(9,10,9,10), new Range(8,10,8,10) ]); assert.equal(rangeList.ranges.length, 3); rangeList.add(new Range(9,10,9,10)); testRangeList(rangeList, [7,10,7,10,8,10,8,10,9,10,9,10]); }, "test: rangeList merge": function() { var rangeList = new RangeList(); rangeList.addList([ new Range(1,2,3,4), new Range(4,2,5,4), new Range(6,6,7,7), new Range(8,8,9,9) ]); var removed = []; assert.equal(rangeList.ranges.length, 4); rangeList.ranges[1].end.row = 7; removed = rangeList.merge(); assert.equal(removed.length, 1); assert.range(rangeList.ranges[1], 4,2,7,7); assert.equal(rangeList.ranges.length, 3); rangeList.ranges[0].end.row = 10; removed = rangeList.merge(); assert.range(rangeList.ranges[0], 1,2,10,4); assert.equal(removed.length, 2); assert.equal(rangeList.ranges.length, 1); rangeList.ranges.push(new Range(10,10,10,10)); rangeList.ranges.push(new Range(10,10,10,10)); removed = rangeList.merge(); assert.equal(rangeList.ranges.length, 2); }, "test: rangeList remove": function() { var rangeList = new RangeList(); var list = [ new Range(1,2,3,4), new Range(4,2,5,4), new Range(6,6,7,7), new Range(8,8,9,9) ]; rangeList.addList(list); assert.equal(rangeList.ranges.length, 4); rangeList.substractPoint({row: 1, column: 2}); assert.equal(rangeList.ranges.length, 3); rangeList.substractPoint({row: 6, column: 7}); assert.equal(rangeList.ranges.length, 2); } }; require("./test/run")(module); ================================================ FILE: src/range_test.js ================================================ "use strict"; var Range = require("./range").Range; var EditSession = require("./edit_session").EditSession; var assert = require("./test/assertions"); module.exports = { name: "ACE range.js", "test: create range": function() { var range = new Range(1,2,3,4); assert.equal(range.start.row, 1); assert.equal(range.start.column, 2); assert.equal(range.end.row, 3); assert.equal(range.end.column, 4); }, "test: create from points": function() { var range = Range.fromPoints({row: 1, column: 2}, {row:3, column:4}); assert.equal(range.start.row, 1); assert.equal(range.start.column, 2); assert.equal(range.end.row, 3); assert.equal(range.end.column, 4); }, "test: clip to rows": function() { assert.range(new Range(0, 20, 100, 30).clipRows(10, 30), 10, 0, 31, 0); assert.range(new Range(0, 20, 30, 10).clipRows(10, 30), 10, 0, 30, 10); var range = new Range(0, 20, 3, 10); var range = range.clipRows(10, 30); assert.ok(range.isEmpty()); assert.range(range, 10, 0, 10, 0); }, "test: isEmpty": function() { var range = new Range(1, 2, 1, 2); assert.ok(range.isEmpty()); var range = new Range(1, 2, 1, 6); assert.notOk(range.isEmpty()); }, "test: is multi line": function() { var range = new Range(1, 2, 1, 6); assert.notOk(range.isMultiLine()); var range = new Range(1, 2, 2, 6); assert.ok(range.isMultiLine()); }, "test: clone": function() { var range = new Range(1, 2, 3, 4); var clone = range.clone(); assert.position(clone.start, 1, 2); assert.position(clone.end, 3, 4); clone.start.column = 20; assert.position(range.start, 1, 2); clone.end.column = 20; assert.position(range.end, 3, 4); }, "test: contains for multi line ranges": function() { var range = new Range(1, 10, 5, 20); assert.ok(range.contains(1, 10)); assert.ok(range.contains(2, 0)); assert.ok(range.contains(3, 100)); assert.ok(range.contains(5, 19)); assert.ok(range.contains(5, 20)); assert.notOk(range.contains(1, 9)); assert.notOk(range.contains(0, 0)); assert.notOk(range.contains(5, 21)); }, "test: contains for single line ranges": function() { var range = new Range(1, 10, 1, 20); assert.ok(range.contains(1, 10)); assert.ok(range.contains(1, 15)); assert.ok(range.contains(1, 20)); assert.notOk(range.contains(0, 9)); assert.notOk(range.contains(2, 9)); assert.notOk(range.contains(1, 9)); assert.notOk(range.contains(1, 21)); }, "test: extend range": function() { var range = new Range(2, 10, 2, 30); var range = range.extend(2, 5); assert.range(range, 2, 5, 2, 30); var range = range.extend(2, 35); assert.range(range, 2, 5, 2, 35); var range = range.extend(2, 15); assert.range(range, 2, 5, 2, 35); var range = range.extend(1, 4); assert.range(range, 1, 4, 2, 35); var range = range.extend(6, 10); assert.range(range, 1, 4, 6, 10); }, "test: collapse rows" : function() { var range = new Range(0, 2, 1, 2); assert.range(range.collapseRows(), 0, 0, 1, 0); var range = new Range(2, 2, 3, 1); assert.range(range.collapseRows(), 2, 0, 3, 0); var range = new Range(2, 2, 3, 0); assert.range(range.collapseRows(), 2, 0, 2, 0); var range = new Range(2, 0, 2, 0); assert.range(range.collapseRows(), 2, 0, 2, 0); }, "test: to screen range" : function() { var session = new EditSession([ "juhu", "12\t\t34", "ぁぁa", "\t\t34" ]); var range = new Range(0, 0, 0, 3); assert.range(range.toScreenRange(session), 0, 0, 0, 3); var range = new Range(1, 1, 1, 3); assert.range(range.toScreenRange(session), 1, 1, 1, 4); var range = new Range(2, 1, 2, 2); assert.range(range.toScreenRange(session), 2, 2, 2, 4); var range = new Range(3, 0, 3, 4); assert.range(range.toScreenRange(session), 3, 0, 3, 10); } }; require("./test/run")(module); ================================================ FILE: src/renderloop.js ================================================ "use strict"; var event = require("./lib/event"); /** * Batches changes (that force something to be redrawn) in the background. **/ class RenderLoop { constructor(onRender, win) { this.onRender = onRender; this.pending = false; this.changes = 0; this.$recursionLimit = 2; this.window = win || window; var _self = this; this._flush = function (ts) { _self.pending = false; var changes = _self.changes; if (changes) { event.blockIdle(100); _self.changes = 0; _self.onRender(changes); } if (_self.changes) { if (_self.$recursionLimit-- < 0) return; _self.schedule(); } else { _self.$recursionLimit = 2; } }; } schedule(change) { this.changes = this.changes | change; if (this.changes && !this.pending) { event.nextFrame(this._flush); this.pending = true; } } clear(change) { var changes = this.changes; this.changes = 0; return changes; } } exports.RenderLoop = RenderLoop; ================================================ FILE: src/scrollbar.js ================================================ "use strict"; var oop = require("./lib/oop"); var dom = require("./lib/dom"); var event = require("./lib/event"); var EventEmitter = require("./lib/event_emitter").EventEmitter; // on ie maximal element height is smaller than what we get from 4-5K line document // so scrollbar doesn't work, as a workaround we do not set height higher than MAX_SCROLL_H // and rescale scrolltop var MAX_SCROLL_H = 0x8000; /** * An abstract class representing a native scrollbar control. **/ class Scrollbar { /** * Creates a new `ScrollBar`. `parent` is the owner of the scroll bar. * @param {Element} parent A DOM element * @param {string} classSuffix **/ constructor(parent, classSuffix) { this.element = dom.createElement("div"); this.element.className = "ace_scrollbar ace_scrollbar" + classSuffix; this.element.tabIndex = -1; this.inner = dom.createElement("div"); this.inner.className = "ace_scrollbar-inner"; // on safari scrollbar is not shown for empty elements this.inner.textContent = "\xa0"; this.element.appendChild(this.inner); parent.appendChild(this.element); this.setVisible(false); this.skipEvent = false; // @ts-expect-error event.addListener(this.element, "scroll", this.onScroll.bind(this)); event.addListener(this.element, "mousedown", event.preventDefault); } setVisible(isVisible) { this.element.style.display = isVisible ? "" : "none"; this.isVisible = isVisible; this.coeff = 1; } } oop.implement(Scrollbar.prototype, EventEmitter); /** * Represents a vertical scroll bar. **/ class VScrollBar extends Scrollbar { /** * Creates a new `VScrollBar`. `parent` is the owner of the scroll bar. * @param {Element} parent A DOM element * @param {Object} renderer An editor renderer **/ constructor(parent, renderer) { super(parent, '-v'); this.scrollTop = 0; this.scrollHeight = 0; // in OSX lion the scrollbars appear to have no width. In this case resize the // element to show the scrollbar but still pretend that the scrollbar has a width // of 0px // in Firefox 6+ scrollbar is hidden if element has the same width as scrollbar // make element a little bit wider to retain scrollbar when page is zoomed renderer.$scrollbarWidth = this.width = dom.scrollbarWidth(parent.ownerDocument); this.inner.style.width = this.element.style.width = (this.width || 15) + 5 + "px"; this.$minWidth = 0; } /** * Emitted when the scroll bar, well, scrolls. * @event scroll * @internal **/ onScroll() { if (!this.skipEvent) { this.scrollTop = this.element.scrollTop; if (this.coeff != 1) { var h = this.element.clientHeight / this.scrollHeight; this.scrollTop = this.scrollTop * (1 - h) / (this.coeff - h); } this._emit("scroll", {data: this.scrollTop}); } this.skipEvent = false; } /** * Returns the width of the scroll bar. * @returns {Number} **/ getWidth() { return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0); } /** * Sets the height of the scroll bar, in pixels. * @param {Number} height The new height **/ setHeight(height) { this.element.style.height = height + "px"; } /** * Sets the scroll height of the scroll bar, in pixels. * @param {Number} height The new scroll height **/ setScrollHeight(height) { this.scrollHeight = height; if (height > MAX_SCROLL_H) { this.coeff = MAX_SCROLL_H / height; height = MAX_SCROLL_H; } else if (this.coeff != 1) { this.coeff = 1; } this.inner.style.height = height + "px"; } /** * Sets the scroll top of the scroll bar. * @param {Number} scrollTop The new scroll top **/ setScrollTop(scrollTop) { // on chrome 17+ for small zoom levels after calling this function // this.element.scrollTop != scrollTop which makes page to scroll up. if (this.scrollTop != scrollTop) { this.skipEvent = true; this.scrollTop = scrollTop; this.element.scrollTop = scrollTop * this.coeff; } } } /** * Sets the inner height of the scroll bar, in pixels. * @param {Number} height The new inner height * @deprecated Use setScrollHeight instead **/ VScrollBar.prototype.setInnerHeight = VScrollBar.prototype.setScrollHeight; /** * Represents a horisontal scroll bar. **/ class HScrollBar extends Scrollbar { /** * Creates a new `HScrollBar`. `parent` is the owner of the scroll bar. * @param {Element} parent A DOM element * @param {Object} renderer An editor renderer **/ constructor(parent, renderer) { super(parent, '-h'); this.scrollLeft = 0; // in OSX lion the scrollbars appear to have no width. In this case resize the // element to show the scrollbar but still pretend that the scrollbar has a width // of 0px // in Firefox 6+ scrollbar is hidden if element has the same width as scrollbar // make element a little bit wider to retain scrollbar when page is zoomed this.height = renderer.$scrollbarWidth; this.inner.style.height = this.element.style.height = (this.height || 15) + 5 + "px"; } /** * Emitted when the scroll bar, well, scrolls. * @event scroll * @internal **/ onScroll() { if (!this.skipEvent) { this.scrollLeft = this.element.scrollLeft; this._emit("scroll", {data: this.scrollLeft}); } this.skipEvent = false; } /** * Returns the height of the scroll bar. * @returns {Number} **/ getHeight() { return this.isVisible ? this.height : 0; } /** * Sets the width of the scroll bar, in pixels. * @param {Number} width The new width **/ setWidth(width) { this.element.style.width = width + "px"; } /** * Sets the inner width of the scroll bar, in pixels. * @param {Number} width The new inner width * @deprecated Use setScrollWidth instead **/ setInnerWidth(width) { this.inner.style.width = width + "px"; } /** * Sets the scroll width of the scroll bar, in pixels. * @param {Number} width The new scroll width **/ setScrollWidth(width) { this.inner.style.width = width + "px"; } /** * Sets the scroll left of the scroll bar. * @param {Number} scrollLeft The new scroll left **/ setScrollLeft(scrollLeft) { // on chrome 17+ for small zoom levels after calling this function // this.element.scrollTop != scrollTop which makes page to scroll up. if (this.scrollLeft != scrollLeft) { this.skipEvent = true; this.scrollLeft = this.element.scrollLeft = scrollLeft; } } } exports.ScrollBar = VScrollBar; // backward compatibility exports.ScrollBarV = VScrollBar; // backward compatibility exports.ScrollBarH = HScrollBar; // backward compatibility exports.VScrollBar = VScrollBar; exports.HScrollBar = HScrollBar; ================================================ FILE: src/scrollbar_custom.js ================================================ "use strict"; var oop = require("./lib/oop"); var dom = require("./lib/dom"); var event = require("./lib/event"); var EventEmitter = require("./lib/event_emitter").EventEmitter; dom.importCssString(`.ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{ position: absolute; background: rgba(128, 128, 128, 0.6); -moz-box-sizing: border-box; box-sizing: border-box; border: 1px solid #bbb; border-radius: 2px; z-index: 8; } .ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h { position: absolute; z-index: 6; background: none; overflow: hidden!important; } .ace_editor>.ace_sb-v { z-index: 6; right: 0; top: 0; width: 12px; } .ace_editor>.ace_sb-v div { z-index: 8; right: 0; width: 100%; } .ace_editor>.ace_sb-h { bottom: 0; left: 0; height: 12px; } .ace_editor>.ace_sb-h div { bottom: 0; height: 100%; } .ace_editor>.ace_sb_grabbed { z-index: 8; background: #000; }`, "ace_scrollbar.css", false); /** * An abstract class representing a native scrollbar control. **/ class ScrollBar { /** * Creates a new `ScrollBar`. `parent` is the owner of the scroll bar. * @param {Element} parent A DOM element * @param {string} classSuffix **/ constructor(parent, classSuffix) { this.element = dom.createElement("div"); this.element.className = "ace_sb" + classSuffix; this.inner = dom.createElement("div"); this.inner.className = ""; this.element.appendChild(this.inner); this.VScrollWidth = 12; this.HScrollHeight = 12; parent.appendChild(this.element); this.setVisible(false); this.skipEvent = false; event.addMultiMouseDownListener(this.element, [500, 300, 300], this, "onMouseDown"); } setVisible(isVisible) { this.element.style.display = isVisible ? "" : "none"; this.isVisible = isVisible; this.coeff = 1; } } oop.implement(ScrollBar.prototype, EventEmitter); /** * Represents a vertical scroll bar. * @class VScrollBar **/ /** * Creates a new `VScrollBar`. `parent` is the owner of the scroll bar. * @param {Element} parent A DOM element * @param {Object} renderer An editor renderer * * @constructor **/ class VScrollBar extends ScrollBar { constructor(parent, renderer) { super(parent, '-v'); this.scrollTop = 0; this.scrollHeight = 0; this.parent = parent; this.width = this.VScrollWidth; this.renderer = renderer; this.inner.style.width = this.element.style.width = (this.width || 15) + "px"; this.$minWidth = 0; } /** * Emitted when the scroll thumb dragged or scrollbar canvas clicked. * @internal **/ onMouseDown(eType, e) { if (eType !== "mousedown") return; if (event.getButton(e) !== 0 || e.detail === 2) { return; } if (e.target === this.inner) { var self = this; var mousePageY = e.clientY; var onMouseMove = function (e) { mousePageY = e.clientY; }; var onMouseUp = function () { clearInterval(timerId); }; var startY = e.clientY; var startTop = this.thumbTop; var onScrollInterval = function () { if (mousePageY === undefined) return; var scrollTop = self.scrollTopFromThumbTop(startTop + mousePageY - startY); if (scrollTop === self.scrollTop) return; self._emit("scroll", {data: scrollTop}); }; event.capture(this.inner, onMouseMove, onMouseUp); var timerId = setInterval(onScrollInterval, 20); return event.preventDefault(e); } var top = e.clientY - this.element.getBoundingClientRect().top - this.thumbHeight / 2; this._emit("scroll", {data: this.scrollTopFromThumbTop(top)}); return event.preventDefault(e); } getHeight() { return this.height; } /** * Returns new top for scroll thumb * @param {Number}thumbTop * @returns {Number} **/ scrollTopFromThumbTop(thumbTop) { var scrollTop = thumbTop * (this.pageHeight - this.viewHeight) / (this.slideHeight - this.thumbHeight); scrollTop = scrollTop >> 0; if (scrollTop < 0) { scrollTop = 0; } else if (scrollTop > this.pageHeight - this.viewHeight) { scrollTop = this.pageHeight - this.viewHeight; } return scrollTop; } /** * Returns the width of the scroll bar. * @returns {Number} **/ getWidth() { return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0); } /** * Sets the height of the scroll bar, in pixels. * @param {Number} height The new height **/ setHeight(height) { this.height = Math.max(0, height); this.slideHeight = this.height; this.viewHeight = this.height; this.setScrollHeight(this.pageHeight, true); } /** * Sets the inner and scroll height of the scroll bar, in pixels. * @param {Number} height The new inner height * * @param {boolean} force Forcely update height **/ setScrollHeight(height, force) { if (this.pageHeight === height && !force) return; this.pageHeight = height; this.thumbHeight = this.slideHeight * this.viewHeight / this.pageHeight; if (this.thumbHeight > this.slideHeight) this.thumbHeight = this.slideHeight; if (this.thumbHeight < 15) this.thumbHeight = 15; this.inner.style.height = this.thumbHeight + "px"; if (this.scrollTop > (this.pageHeight - this.viewHeight)) { this.scrollTop = (this.pageHeight - this.viewHeight); if (this.scrollTop < 0) this.scrollTop = 0; this._emit("scroll", {data: this.scrollTop}); } } /** * Sets the scroll top of the scroll bar. * @param {Number} scrollTop The new scroll top **/ setScrollTop(scrollTop) { this.scrollTop = scrollTop; if (scrollTop < 0) scrollTop = 0; this.thumbTop = scrollTop * (this.slideHeight - this.thumbHeight) / (this.pageHeight - this.viewHeight); this.inner.style.top = this.thumbTop + "px"; } } VScrollBar.prototype.setInnerHeight = VScrollBar.prototype.setScrollHeight; /** * Represents a horizontal scroll bar. **/ class HScrollBar extends ScrollBar { /** * Creates a new `HScrollBar`. `parent` is the owner of the scroll bar. * @param {Element} parent A DOM element * @param {Object} renderer An editor renderer **/ constructor(parent, renderer) { super(parent, '-h'); this.scrollLeft = 0; this.scrollWidth = 0; this.height = this.HScrollHeight; this.inner.style.height = this.element.style.height = (this.height || 12) + "px"; this.renderer = renderer; } /** * Emitted when the scroll thumb dragged or scrollbar canvas clicked. * @internal **/ onMouseDown(eType, e) { if (eType !== "mousedown") return; if (event.getButton(e) !== 0 || e.detail === 2) { return; } if (e.target === this.inner) { var self = this; var mousePageX = e.clientX; var onMouseMove = function (e) { mousePageX = e.clientX; }; var onMouseUp = function () { clearInterval(timerId); }; var startX = e.clientX; var startLeft = this.thumbLeft; var onScrollInterval = function () { if (mousePageX === undefined) return; var scrollLeft = self.scrollLeftFromThumbLeft(startLeft + mousePageX - startX); if (scrollLeft === self.scrollLeft) return; self._emit("scroll", {data: scrollLeft}); }; event.capture(this.inner, onMouseMove, onMouseUp); var timerId = setInterval(onScrollInterval, 20); return event.preventDefault(e); } var left = e.clientX - this.element.getBoundingClientRect().left - this.thumbWidth / 2; this._emit("scroll", {data: this.scrollLeftFromThumbLeft(left)}); return event.preventDefault(e); } /** * Returns the height of the scroll bar. * @returns {Number} **/ getHeight() { return this.isVisible ? this.height : 0; } /** * Returns new left for scroll thumb * @param {Number} thumbLeft * @returns {Number} **/ scrollLeftFromThumbLeft(thumbLeft) { var scrollLeft = thumbLeft * (this.pageWidth - this.viewWidth) / (this.slideWidth - this.thumbWidth); scrollLeft = scrollLeft >> 0; if (scrollLeft < 0) { scrollLeft = 0; } else if (scrollLeft > this.pageWidth - this.viewWidth) { scrollLeft = this.pageWidth - this.viewWidth; } return scrollLeft; } /** * Sets the width of the scroll bar, in pixels. * @param {Number} width The new width **/ setWidth(width) { this.width = Math.max(0, width); this.element.style.width = this.width + "px"; this.slideWidth = this.width; this.viewWidth = this.width; this.setScrollWidth(this.pageWidth, true); } /** * Sets the inner and scroll width of the scroll bar, in pixels. * @param {Number} width The new inner width * @param {boolean} force Forcely update width **/ setScrollWidth(width, force) { if (this.pageWidth === width && !force) return; this.pageWidth = width; this.thumbWidth = this.slideWidth * this.viewWidth / this.pageWidth; if (this.thumbWidth > this.slideWidth) this.thumbWidth = this.slideWidth; if (this.thumbWidth < 15) this.thumbWidth = 15; this.inner.style.width = this.thumbWidth + "px"; if (this.scrollLeft > (this.pageWidth - this.viewWidth)) { this.scrollLeft = (this.pageWidth - this.viewWidth); if (this.scrollLeft < 0) this.scrollLeft = 0; this._emit("scroll", {data: this.scrollLeft}); } } /** * Sets the scroll left of the scroll bar. * @param {Number} scrollLeft The new scroll left **/ setScrollLeft(scrollLeft) { this.scrollLeft = scrollLeft; if (scrollLeft < 0) scrollLeft = 0; this.thumbLeft = scrollLeft * (this.slideWidth - this.thumbWidth) / (this.pageWidth - this.viewWidth); this.inner.style.left = (this.thumbLeft) + "px"; } } HScrollBar.prototype.setInnerWidth = HScrollBar.prototype.setScrollWidth; exports.ScrollBar = VScrollBar; // backward compatibility exports.ScrollBarV = VScrollBar; // backward compatibility exports.ScrollBarH = HScrollBar; // backward compatibility exports.VScrollBar = VScrollBar; exports.HScrollBar = HScrollBar; ================================================ FILE: src/scrollbar_test.js ================================================ if (typeof process !== "undefined") { require("./test/mockdom"); } "use strict"; var assert = require("./test/assertions"); var VirtualRenderer = require("./virtual_renderer").VirtualRenderer; var Editor = require("./editor").Editor; var lang = require("./lib/lang"); var MouseEvent = function (type, opts) { var e = document.createEvent("MouseEvents"); e.initMouseEvent(/click|wheel/.test(type) ? type : "mouse" + type, true, true, window, opts.detail, opts.x, opts.y, opts.x, opts.y, opts.ctrl, opts.alt, opts.shift, opts.meta, opts.button || 0, opts.relatedTarget ); return e; }; var WheelEvent = function (opts) { var e = new MouseEvent("wheel", opts); e.DOM_DELTA_PIXEL = 0; e.DOM_DELTA_LINE = 1; e.DOM_DELTA_PAGE = 2; e.deltaMode = e["DOM_DELTA_" + opts.mode.toUpperCase()]; e.deltaX = opts.x || 0; e.deltaY = opts.y || 0; return e; }; var editor = null; var renderer = null; module.exports = { name: "ACE scrollbar_custom.js", setUp: function () { if (editor) editor.destroy(); var el = document.createElement("div"); el.style.left = "20px"; el.style.top = "30px"; el.style.width = "300px"; el.style.height = "100px"; document.body.appendChild(el); renderer = new VirtualRenderer(el); renderer.scrollHeight = 50; renderer.layerConfig.maxHeight = 200; renderer.layerConfig.lineHeight = 14; editor = new Editor(renderer); editor.on("destroy", function () { document.body.removeChild(el); }); editor.setOptions({ customScrollbar: true }); // TODO remove this when onresize doesn't recreate custom scrollbar renderer.$loop._flush(); }, tearDown: function () { editor && editor.destroy(); editor = null; }, "test: vertical scrolling": function () { editor.setValue("a" + "\n".repeat(100) + "b" + "\nxxxxxx", -1); renderer.$loop._flush(); renderer.scrollBarV.element.dispatchEvent(MouseEvent("down", { x: 0, y: 80, button: 0 })); renderer.$loop._flush(); var thumbTop = renderer.scrollBarV.thumbTop; assert.ok(thumbTop > 0); editor.container.dispatchEvent(WheelEvent({ mode: "line", y: 50 })); renderer.$loop._flush(); assert.ok(renderer.scrollBarV.thumbTop > thumbTop); }, "test: dragging vertical scroll thumb": async function (done) { editor.setValue("a" + "\n".repeat(100) + "b" + "\nxxxxxx", -1); renderer.$loop._flush(); renderer.scrollBarV.inner.dispatchEvent(MouseEvent("down", { x: 5, y: 10, button: 0 })); renderer.$loop._flush(); renderer.scrollBarV.inner.dispatchEvent(MouseEvent("move", { x: 5, y: 80, button: 0 })); await lang.sleep(200); assert.ok(renderer.scrollBarV.thumbTop > 0); done(); }, "test: horizontal scrolling": function () { assert.ok(!renderer.scrollBarH.isVisible); editor.setValue("a".repeat(1000), -1); renderer.$loop._flush(); assert.ok(renderer.scrollBarH.isVisible); renderer.scrollBarH.element.dispatchEvent(MouseEvent("down", { x: 80, y: 0, button: 0 })); renderer.$loop._flush(); assert.ok(renderer.scrollBarH.thumbLeft > 0); }, "test: dragging horizontal scroll thumb": async function (done) { editor.setValue("a".repeat(1000), -1); renderer.$loop._flush(); renderer.scrollBarH.inner.dispatchEvent(MouseEvent("down", { x: 5, y: 5, button: 0 })); renderer.$loop._flush(); renderer.scrollBarH.inner.dispatchEvent(MouseEvent("move", { x: 80, y: 5, button: 0 })); await lang.sleep(200); assert.ok(renderer.scrollBarH.thumbLeft > 0); done(); } }; require("./test/run")(module); ================================================ FILE: src/search.js ================================================ "use strict"; /** * @typedef {import("./edit_session").EditSession} EditSession * @typedef {import("../ace-internal").Ace.SearchOptions} SearchOptions */ var lang = require("./lib/lang"); var oop = require("./lib/oop"); var Range = require("./range").Range; /** * A class designed to handle all sorts of text searches within a [[Document `Document`]]. **/ class Search { constructor() { /**@type {Partial<SearchOptions>}*/ this.$options = {}; } /** * Sets the search options via the `options` parameter. * @param {Partial<SearchOptions>} options An object containing all the new search properties * @returns {Search} * @chainable **/ set(options) { oop.mixin(this.$options, options); return this; } /** * [Returns an object containing all the search options.]{: #Search.getOptions} * @returns {Partial<SearchOptions>} **/ getOptions() { return lang.copyObject(this.$options); } /** * Sets the search options via the `options` parameter. * @param {Partial<SearchOptions>} options object containing all the search propertie * @related Search.set **/ setOptions(options) { this.$options = options; } /** * Searches for `options.needle`. If found, this method returns the [[Range `Range`]] where the text first occurs. If `options.backwards` is `true`, the search goes backwards in the session. * @param {EditSession} session The session to search with * @returns {Range | null | false} **/ find(session) { var options = this.$options; var iterator = this.$matchIterator(session, options); if (!iterator) return false; var firstRange = null; iterator.forEach(function(sr, sc, er, ec) { firstRange = new Range(sr, sc, er, ec); if (sc == ec && options.start && /**@type{Range}*/(options.start).start && options.skipCurrent != false && firstRange.isEqual(/**@type{Range}*/(options.start)) ) { firstRange = null; return false; } return true; }); return firstRange; } /** * Searches for all occurrances `options.needle`. If found, this method returns an array of [[Range `Range`s]] where the text first occurs. If `options.backwards` is `true`, the search goes backwards in the session. * @param {EditSession} session The session to search with * @returns {Range[]} **/ findAll(session) { var options = this.$options; if (!options.needle) return []; this.$assembleRegExp(options); var range = options.range; var lines = range ? session.getLines(range.start.row, range.end.row) : session.doc.getAllLines(); var ranges = []; var re = options.re; if (options.$isMultiLine) { var len = re.length; var maxRow = lines.length - len; var prevRange; outer: for (var row = re.offset || 0; row <= maxRow; row++) { for (var j = 0; j < len; j++) if (lines[row + j].search(re[j]) == -1) continue outer; var startLine = lines[row]; var line = lines[row + len - 1]; var startIndex = startLine.length - startLine.match(re[0])[0].length; var endIndex = line.match(re[len - 1])[0].length; if (prevRange && prevRange.end.row === row && prevRange.end.column > startIndex ) { continue; } ranges.push(prevRange = new Range( row, startIndex, row + len - 1, endIndex )); if (len > 2) row = row + len - 2; } } else { for (var matches, i = 0; i < lines.length; i++) { if (this.$isMultilineSearch(options)) { var lng = lines.length - 1; matches = this.$multiLineForward(session, re, i, lng); if (matches) { var end_row = matches.endRow <= lng ? matches.endRow - 1 : lng; if (end_row > i) i = end_row; ranges.push(new Range(matches.startRow, matches.startCol, matches.endRow, matches.endCol)); } } else { matches = lang.getMatchOffsets(lines[i], re); for (var j = 0; j < matches.length; j++) { var match = matches[j]; ranges.push(new Range(i, match.offset, i, match.offset + match.length)); } } } } if (range) { var startColumn = range.start.column; var endColumn = range.end.column; var i = 0, j = ranges.length - 1; while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == 0) i++; var endRow = range.end.row - range.start.row; while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == endRow) j--; ranges = ranges.slice(i, j + 1); for (i = 0, j = ranges.length; i < j; i++) { ranges[i].start.row += range.start.row; ranges[i].end.row += range.start.row; } } return ranges; } parseReplaceString(replaceString) { var CharCode = { DollarSign: 36, Ampersand: 38, Digit0: 48, Digit1: 49, Digit9: 57, Backslash: 92, n: 110, t: 116 }; var replacement = ''; for (var i = 0, len = replaceString.length; i < len; i++) { var chCode = replaceString.charCodeAt(i); if (chCode === CharCode.Backslash) { // move to next char i++; if (i >= len) { // string ends with a \ replacement += "\\"; break; } var nextChCode = replaceString.charCodeAt(i); switch (nextChCode) { case CharCode.Backslash: // \\ => inserts a "\" replacement += "\\"; break; case CharCode.n: // \n => inserts a LF replacement += "\n"; break; case CharCode.t: // \t => inserts a TAB replacement += "\t"; break; } continue; } if (chCode === CharCode.DollarSign) { // move to next char i++; if (i >= len) { // string ends with a $ replacement += "$"; break; } const nextChCode = replaceString.charCodeAt(i); if (nextChCode === CharCode.DollarSign) { // $$ => inserts a "$" replacement += "$$"; continue; } if (nextChCode === CharCode.Digit0 || nextChCode === CharCode.Ampersand) { // replace $0 to $&, making it compatible with JavaScript // $0 and $& => inserts the matched substring. replacement += "$&"; continue; } if (CharCode.Digit1 <= nextChCode && nextChCode <= CharCode.Digit9) { // $n replacement += "$" + replaceString[i]; continue; } } replacement += replaceString[i]; } return replacement || replaceString; } /** * Searches for `options.needle` in `input`, and, if found, replaces it with `replacement`. * @param {String} input The text to search in * @param {any} replacement The replacing text * + (String): If `options.regExp` is `true`, this function returns `input` with the replacement already made. Otherwise, this function just returns `replacement`.<br/> * If `options.needle` was not found, this function returns `null`. * * * @returns {String} **/ replace(input, replacement) { var options = this.$options; var re = this.$assembleRegExp(options); if (options.$isMultiLine) return replacement; if (!re) return; /** * Convert all line ending variations to Unix-style = \n * Windows (\r\n), MacOS Classic (\r), and Unix (\n) */ var mtSearch = this.$isMultilineSearch(options); if (mtSearch) input = input.replace(/\r\n|\r|\n/g, "\n"); var match = re.exec(input); if (!match || (!mtSearch && match[0].length != input.length)) return null; replacement = options.regExp ? this.parseReplaceString(replacement) : replacement.replace(/\$/g, "$$$$"); replacement = input.replace(re, replacement); if (options.preserveCase) { replacement = replacement.split(""); for (var i = Math.min(input.length, input.length); i--; ) { var ch = input[i]; if (ch && ch.toLowerCase() != ch) replacement[i] = replacement[i].toUpperCase(); else replacement[i] = replacement[i].toLowerCase(); } replacement = replacement.join(""); } return replacement; } /** * * @param {Partial<SearchOptions>} options * @param {boolean} [$disableFakeMultiline] * @return {RegExp|boolean|*[]|*} */ $assembleRegExp(options, $disableFakeMultiline) { if (options.needle instanceof RegExp) return options.re = options.needle; var needle = options.needle; if (!options.needle) return options.re = false; if (!options.regExp) needle = lang.escapeRegExp(needle); var modifier = options.caseSensitive ? "gm" : "gmi"; try { new RegExp(needle, "u"); options.$supportsUnicodeFlag = true; modifier += "u"; } catch (e) { options.$supportsUnicodeFlag = false; //left for backward compatibility with previous versions for cases like /ab\{2}/gu } if (options.wholeWord) needle = addWordBoundary(needle, options); options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle); if (options.$isMultiLine) return options.re = this.$assembleMultilineRegExp(needle, modifier); try { /**@type {RegExp|false}*/ var re = new RegExp(needle, modifier); } catch(e) { re = false; } return options.re = re; } /** * @param {string} needle * @param {string} modifier */ $assembleMultilineRegExp(needle, modifier) { var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n"); var re = []; for (var i = 0; i < parts.length; i++) try { re.push(new RegExp(parts[i], modifier)); } catch(e) { return false; } return re; } $isMultilineSearch(options) { return options.re && /\\r\\n|\\r|\\n/.test(options.re.source) && options.regExp && !options.$isMultiLine; } $multiLineForward(session, re, start, last) { var line, chunk = chunkEnd(session, start); for (var row = start; row <= last;) { for (var i = 0; i < chunk; i++) { if (row > last) break; var next = session.getLine(row++); line = line == null ? next : line + "\n" + next; } var match = re.exec(line); re.lastIndex = 0; if (match) { var beforeMatch = line.slice(0, match.index).split("\n"); var matchedText = match[0].split("\n"); var startRow = start + beforeMatch.length - 1; var startCol = beforeMatch[beforeMatch.length - 1].length; var endRow = startRow + matchedText.length - 1; var endCol = matchedText.length == 1 ? startCol + matchedText[0].length : matchedText[matchedText.length - 1].length; return { startRow: startRow, startCol: startCol, endRow: endRow, endCol: endCol }; } } return null; } $multiLineBackward(session, re, endIndex, start, first) { var line, chunk = chunkEnd(session, start), endMargin = session.getLine(start).length - endIndex; for (var row = start; row >= first;) { for (var i = 0; i < chunk && row >= first; i++) { var next = session.getLine(row--); line = line == null ? next : next + "\n" + line; } var match = multiLineBackwardMatch(line, re, endMargin); if (match) { var beforeMatch = line.slice(0, match.index).split("\n"); var matchedText = match[0].split("\n"); var startRow = row + beforeMatch.length; var startCol = beforeMatch[beforeMatch.length - 1].length; var endRow = startRow + matchedText.length - 1; var endCol = matchedText.length == 1 ? startCol + matchedText[0].length : matchedText[matchedText.length - 1].length; return { startRow: startRow, startCol: startCol, endRow: endRow, endCol: endCol }; } } return null; } /** * @param {EditSession} session */ $matchIterator(session, options) { var re = this.$assembleRegExp(options); if (!re) return false; var mtSearch = this.$isMultilineSearch(options); var mtForward = this.$multiLineForward; var mtBackward = this.$multiLineBackward; var backwards = options.backwards == true; var skipCurrent = options.skipCurrent != false; var supportsUnicodeFlag = re.unicode; var range = options.range; var start = options.start; if (!start) start = range ? range[backwards ? "end" : "start"] : session.selection.getRange(); if (start.start) start = start[skipCurrent != backwards ? "end" : "start"]; var firstRow = range ? range.start.row : 0; var lastRow = range ? range.end.row : session.getLength() - 1; if (backwards) { var forEach = function(callback) { var row = start.row; if (forEachInLine(row, start.column, callback)) return; for (row--; row >= firstRow; row--) if (forEachInLine(row, Number.MAX_VALUE, callback)) return; if (options.wrap == false) return; for (row = lastRow, firstRow = start.row; row >= firstRow; row--) if (forEachInLine(row, Number.MAX_VALUE, callback)) return; }; } else { var forEach = function(callback) { var row = start.row; if (forEachInLine(row, start.column, callback)) return; for (row = row + 1; row <= lastRow; row++) if (forEachInLine(row, 0, callback)) return; if (options.wrap == false) return; for (row = firstRow, lastRow = start.row; row <= lastRow; row++) if (forEachInLine(row, 0, callback)) return; }; } if (options.$isMultiLine) { var len = re.length; var forEachInLine = function(row, offset, callback) { var startRow = backwards ? row - len + 1 : row; if (startRow < 0 || startRow + len > session.getLength()) return; var line = session.getLine(startRow); var startIndex = line.search(re[0]); if (!backwards && startIndex < offset || startIndex === -1) return; for (var i = 1; i < len; i++) { line = session.getLine(startRow + i); if (line.search(re[i]) == -1) return; } var endIndex = line.match(re[len - 1])[0].length; if (backwards && endIndex > offset) return; if (callback(startRow, startIndex, startRow + len - 1, endIndex)) return true; }; } else if (backwards) { var forEachInLine = function(row, endIndex, callback) { if (mtSearch) { var pos = mtBackward(session, re, endIndex, row, firstRow); if (!pos) return false; if (callback(pos.startRow, pos.startCol, pos.endRow, pos.endCol)) return true; } else { var line = session.getLine(row); var matches = []; var m, last = 0; re.lastIndex = 0; while((m = re.exec(line))) { var length = m[0].length; last = m.index; if (!length) { if (last >= line.length) break; re.lastIndex = last += lang.skipEmptyMatch(line, last, supportsUnicodeFlag); } if (m.index + length > endIndex) break; matches.push(m.index, length); } for (var i = matches.length - 1; i >= 0; i -= 2) { var column = matches[i - 1]; var length = matches[i]; if (callback(row, column, row, column + length)) return true; } } }; } else { var forEachInLine = function(row, startIndex, callback) { re.lastIndex = startIndex; if (mtSearch) { var pos = mtForward(session, re, row, lastRow); if (pos) { var end_row = pos.endRow <= lastRow ? pos.endRow - 1 : lastRow; if (end_row > row) row = end_row; } if (!pos) return false; if (callback(pos.startRow, pos.startCol, pos.endRow, pos.endCol)) return true; } else { var line = session.getLine(row); var last; var m; while((m = re.exec(line))) { var length = m[0].length; last = m.index; if (callback(row, last, row, last + length)) return true; if (!length) { re.lastIndex = last += lang.skipEmptyMatch(line, last, supportsUnicodeFlag); if (last >= line.length) return false; } } } }; } return {forEach: forEach}; } } /** * * @param {string} needle * @param {Partial<SearchOptions>} options * @return {string} */ function addWordBoundary(needle, options) { let supportsLookbehind = lang.supportsLookbehind(); function wordBoundary(c, firstChar = true) { let wordRegExp = supportsLookbehind && options.$supportsUnicodeFlag ? new RegExp("[\\p{L}\\p{N}_]","u") : new RegExp("\\w"); if (wordRegExp.test(c) || options.regExp) { if (supportsLookbehind && options.$supportsUnicodeFlag) { if (firstChar) return "(?<=^|[^\\p{L}\\p{N}_])"; return "(?=[^\\p{L}\\p{N}_]|$)"; } return "\\b"; } return ""; } let needleArray = Array.from(needle); let firstChar = needleArray[0]; let lastChar = needleArray[needleArray.length - 1]; return wordBoundary(firstChar) + needle + wordBoundary(lastChar, false); } function multiLineBackwardMatch(line, re, endMargin) { var match = null; var from = 0; while (from <= line.length) { re.lastIndex = from; var newMatch = re.exec(line); if (!newMatch) break; var end = newMatch.index + newMatch[0].length; if (end > line.length - endMargin) break; if (!match || end > match.index + match[0].length) match = newMatch; from = newMatch.index + 1; } return match; } function chunkEnd(session, start) { var base = 5000, startPosition = { row: start, column: 0 }, startIndex = session.doc.positionToIndex(startPosition), targetIndex = startIndex + base, targetPosition = session.doc.indexToPosition(targetIndex), targetLine = targetPosition.row; return targetLine + 1; } exports.Search = Search; ================================================ FILE: src/search_highlight.js ================================================ "use strict"; /** * @typedef {import("./layer/marker").Marker} Marker * @typedef {import("./edit_session").EditSession} EditSession */ var lang = require("./lib/lang"); var Range = require("./range").Range; class SearchHighlight { /** * @param {any} regExp * @param {string} clazz */ constructor(regExp, clazz, type = "text") { this.setRegexp(regExp); this.clazz = clazz; this.type = type; this.docLen = 0; } setRegexp(regExp) { if (this.regExp+"" == regExp+"") return; this.regExp = regExp; this.cache = []; } /** * @param {any} html * @param {Marker} markerLayer * @param {EditSession} session * @param {Partial<import("../ace-internal").Ace.LayerConfig>} config */ update(html, markerLayer, session, config) { if (!this.regExp) return; var start = config.firstRow; var end = config.lastRow; var renderedMarkerRanges = {}; var _search = session.$editor && session.$editor.$search; var mtSearch = _search && _search.$isMultilineSearch(session.$editor.getLastSearchOptions()); for (var i = start; i <= end; i++) { var ranges = this.cache[i]; if (ranges == null || session.getValue().length != this.docLen) { if (mtSearch) { ranges = []; var match = _search.$multiLineForward(session, this.regExp, i, end); if (match) { var end_row = match.endRow <= end ? match.endRow - 1 : end; if (end_row > i) i = end_row; ranges.push(new Range(match.startRow, match.startCol, match.endRow, match.endCol)); } if (ranges.length > this.MAX_RANGES) ranges = ranges.slice(0, this.MAX_RANGES); } else { ranges = lang.getMatchOffsets(session.getLine(i), this.regExp); if (ranges.length > this.MAX_RANGES) ranges = ranges.slice(0, this.MAX_RANGES); ranges = ranges.map(function(match) { return new Range(i, match.offset, i, match.offset + match.length); }); } this.cache[i] = ranges.length ? ranges : ""; } if (ranges.length === 0) continue; for (var j = ranges.length; j --; ) { var rangeToAddMarkerTo = ranges[j].toScreenRange(session); var rangeAsString = rangeToAddMarkerTo.toString(); if (renderedMarkerRanges[rangeAsString]) continue; renderedMarkerRanges[rangeAsString] = true; markerLayer.drawSingleLineMarker( html, rangeToAddMarkerTo, this.clazz, config); } } this.docLen = session.getValue().length; } } // needed to prevent long lines from freezing the browser SearchHighlight.prototype.MAX_RANGES = 500; exports.SearchHighlight = SearchHighlight; ================================================ FILE: src/search_test.js ================================================ "use strict"; var EditSession = require("./edit_session").EditSession; var MockRenderer = require("./test/mockrenderer").MockRenderer; var Editor = require("./editor").Editor; var Search = require("./search").Search; var assert = require("./test/assertions"); var Range = require("./range").Range; module.exports = { "test: configure the search object" : function() { var search = new Search(); search.set({ needle: "juhu" }); }, "test: find simple text in document" : function() { var session = new EditSession(["juhu kinners 123", "456"]); var search = new Search().set({ needle: "kinners" }); var range = search.find(session); assert.position(range.start, 0, 5); assert.position(range.end, 0, 12); }, "test: find simple text in next line" : function() { var session = new EditSession(["abc", "juhu kinners 123", "456"]); var search = new Search().set({ needle: "kinners" }); var range = search.find(session); assert.position(range.start, 1, 5); assert.position(range.end, 1, 12); }, "test: find text starting at cursor position" : function() { var session = new EditSession(["juhu kinners", "juhu kinners 123"]); session.getSelection().moveCursorTo(0, 6); var search = new Search().set({ needle: "kinners" }); var range = search.find(session); assert.position(range.start, 1, 5); assert.position(range.end, 1, 12); }, "test: wrap search is on by default" : function() { var session = new EditSession(["abc", "juhu kinners 123", "456"]); session.getSelection().moveCursorTo(2, 1); var search = new Search().set({ needle: "kinners" }); assert.notEqual(search.find(session), null); }, "test: wrap search should wrap at file end" : function() { var session = new EditSession(["abc", "juhu kinners 123", "456"]); session.getSelection().moveCursorTo(2, 1); var search = new Search().set({ needle: "kinners", wrap: true }); var range = search.find(session); assert.position(range.start, 1, 5); assert.position(range.end, 1, 12); }, "test: wrap search should find needle even if it starts inside it" : function() { var session = new EditSession(["abc", "juhu kinners 123", "456"]); session.getSelection().moveCursorTo(6, 1); var search = new Search().set({ needle: "kinners", wrap: true }); var range = search.find(session); assert.position(range.start, 1, 5); assert.position(range.end, 1, 12); }, "test: wrap search with no match should return 'null'": function() { var session = new EditSession(["abc", "juhu kinners 123", "456"]); session.getSelection().moveCursorTo(2, 1); var search = new Search().set({ needle: "xyz", wrap: true }); assert.equal(search.find(session), null); }, "test: case sensitive is by default off": function() { var session = new EditSession(["abc", "juhu kinners 123", "456"]); var search = new Search().set({ needle: "JUHU" }); assert.range(search.find(session), 1, 0, 1, 4); }, "test: case sensitive search": function() { var session = new EditSession(["abc", "juhu kinners 123", "456"]); var search = new Search().set({ needle: "KINNERS", caseSensitive: true }); var range = search.find(session); assert.equal(range, null); }, "test: whole word search should not match inside of words": function() { var session = new EditSession(["juhukinners", "juhu kinners 123", "456"]); var search = new Search().set({ needle: "kinners", wholeWord: true }); var range = search.find(session); assert.position(range.start, 1, 5); assert.position(range.end, 1, 12); }, "test: fallback to nonUnicode mode on edge cases": function() { var session = new EditSession([ /* eslint-disable no-octal-escape*/ "string with \xa9 symbol", // test octal escape sequence "bracket ab{2}" // test lone quantifier brackets ]); var search = new Search().set({ needle: "\\251", regExp: true }); var range = search.find(session); assert.position(range.start, 0, 12); assert.position(range.end, 0, 13); search.set({ needle: "ab\\{2}" }); range = search.find(session); assert.position(range.start, 1, 8); assert.position(range.end, 1, 13); }, "test: whole word search should not match inside of words with unicode": function() { var session = new EditSession(["𝓗ello𝓦orld", "𝓗ello 𝓦orld 123", "456"]); var search = new Search().set({ needle: "𝓗ello", wholeWord: true }); var range = search.find(session); assert.position(range.start, 1, 0); assert.position(range.end, 1, 6); }, "test: return to unicode mode when possible": function() { var session = new EditSession(["𝓕oo"]); var search = new Search().set({ needle: "}", regExp: true }); search.find(session); search.set({ needle: "." }); var range = search.find(session); assert.position(range.start, 0, 0); assert.position(range.end, 0, 2); }, "test: empty match before surrogate pair": function() { var session = new EditSession(["𝓕oo"]); var search = new Search().set({ needle: "()", regExp: true, start: new Range(0, 0, 0, 0) }); var range = search.find(session); assert.position(range.start, 0, 2); assert.position(range.end, 0, 2); }, "test: find backwards": function() { var session = new EditSession(["juhu juhu juhu juhu"]); session.getSelection().moveCursorTo(0, 10); var search = new Search().set({ needle: "juhu", backwards: true }); var range = search.find(session); assert.position(range.start, 0, 5); assert.position(range.end, 0, 9); }, "test: find in selection": function() { var session = new EditSession(["juhu", "juhu", "juhu", "juhu"]); session.getSelection().setSelectionAnchor(1, 0); session.getSelection().selectTo(3, 5); var search = new Search().set({ needle: "juhu", wrap: true, range: session.getSelection().getRange() }); var range = search.find(session); assert.position(range.start, 1, 0); assert.position(range.end, 1, 4); search = new Search().set({ needle: "juhu", wrap: true, range: session.getSelection().getRange() }); session.getSelection().setSelectionAnchor(0, 2); session.getSelection().selectTo(3, 2); var range = search.find(session); assert.position(range.start, 1, 0); assert.position(range.end, 1, 4); }, "test: find backwards in selection": function() { var session = new EditSession(["juhu", "juhu", "juhu", "juhu"]); session.getSelection().setSelectionAnchor(0, 2); session.getSelection().selectTo(3, 2); var search = new Search().set({ needle: "juhu", wrap: true, backwards: true, range: session.getSelection().getRange() }); var range = search.find(session); assert.position(range.start, 2, 0); assert.position(range.end, 2, 4); search = new Search().set({ needle: "juhu", wrap: true, range: session.getSelection().getRange() }); session.getSelection().setSelectionAnchor(0, 2); session.getSelection().selectTo(1, 2); var range = search.find(session); assert.position(range.start, 1, 0); assert.position(range.end, 1, 4); }, "test: edge case - match directly before the cursor" : function() { var session = new EditSession(["123", "123", "juhu"]); var search = new Search().set({ needle: "juhu", wrap: true }); session.getSelection().moveCursorTo(2, 5); var range = search.find(session); assert.position(range.start, 2, 0); assert.position(range.end, 2, 4); }, "test: edge case - match backwards directly after the cursor" : function() { var session = new EditSession(["123", "123", "juhu"]); var search = new Search().set({ needle: "juhu", wrap: true, backwards: true }); session.getSelection().moveCursorTo(2, 0); var range = search.find(session); assert.position(range.start, 2, 0); assert.position(range.end, 2, 4); }, "test: find using a regular expression" : function() { var session = new EditSession(["abc123 123 cd", "abc"]); var search = new Search().set({ needle: "\\d+", regExp: true }); var range = search.find(session); assert.position(range.start, 0, 3); assert.position(range.end, 0, 6); }, "test: find using a regular expression and whole word" : function() { var session = new EditSession(["abc123 123 cd", "abc"]); var search = new Search().set({ needle: "\\d+\\b", regExp: true, wholeWord: true }); var range = search.find(session); assert.position(range.start, 0, 7); assert.position(range.end, 0, 10); }, "test: use regular expressions with capture groups": function() { var session = new EditSession([" ab: 12px", " <h1 abc"]); var search = new Search().set({ needle: "(\\d+)", regExp: true }); var range = search.find(session); assert.position(range.start, 0, 6); assert.position(range.end, 0, 8); }, "test: find all matches in selection" : function() { var session = new EditSession(["juhu", "juhu", "juhu", "juhu"]); session.getSelection().setSelectionAnchor(0, 2); session.getSelection().selectTo(3, 2); var search = new Search().set({ needle: "uh", wrap: true, range: session.getSelection().getRange() }); var ranges = search.findAll(session); assert.equal(ranges.length, 2); assert.position(ranges[0].start, 1, 1); assert.position(ranges[0].end, 1, 3); assert.position(ranges[1].start, 2, 1); assert.position(ranges[1].end, 2, 3); }, "test: find all multiline matches" : function() { var session = new EditSession(["juhu", "juhu", "juhu", "juhu"]); var search = new Search().set({ needle: "hu\nju", wrap: true }); var ranges = search.findAll(session); assert.equal(ranges.length, 3); assert.position(ranges[0].start, 0, 2); assert.position(ranges[0].end, 1, 2); assert.position(ranges[1].start, 1, 2); assert.position(ranges[1].end, 2, 2); }, "test: replace() should return the replacement if the input matches the needle" : function() { var search = new Search().set({ needle: "juhu" }); assert.equal(search.replace("juhu", "kinners"), "kinners"); assert.equal(search.replace("", "kinners"), null); assert.equal(search.replace(" juhu", "kinners"), null); // case sensitivity assert.equal(search.replace("Juhu", "kinners"), "kinners"); search.set({caseSensitive: true}); assert.equal(search.replace("Juhu", "kinners"), null); // regexp replacement }, "test: replace with a RegExp search" : function() { var search = new Search().set({ needle: "\\d+", regExp: true }); assert.equal(search.replace("123", "kinners"), "kinners"); assert.equal(search.replace("01234", "kinners"), "kinners"); assert.equal(search.replace("", "kinners"), null); assert.equal(search.replace("a12", "kinners"), null); assert.equal(search.replace("12a", "kinners"), null); }, "test: replace with RegExp match and capture groups" : function() { var search = new Search().set({ needle: "ab((\\d)\\d)", regExp: true }); assert.equal(search.replace("ab12", "cd$1"), "cd12"); assert.equal(search.replace("ab56", "pr$17$2"), "pr5675"); assert.equal(search.replace("ab12", "-$&-"), "-ab12-"); assert.equal(search.replace("ab12", "_$0_"), "_ab12_"); search.set({ needle: "(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)" }); assert.equal(search.replace("abcdefghijkl", "$2$9$7_$11$9$4_$8$9$4$5_$10$1$3$11_$6$12$1$7_$13"), "big_kid_hide_jack_flag_a3"); }, "test: replace() should correctly handle $$ in the replacement string": function () { var search = new Search().set({ needle: "example" }); // Expecting $$ to be preserved in the output assert.equal(search.replace("example", "$test"), "$test"); assert.equal(search.replace("example", "$$test"), "$$test"); assert.equal(search.replace("example", "$$$test"), "$$$test"); assert.equal(search.replace("example", "$$$$test"), "$$$$test"); search.set({ regExp: true, needle: "(example)" }); // Tests that $1 is replaced by the text that matches the capturing group. assert.equal(search.replace("example", "$1test"), "exampletest"); assert.equal(search.replace("example", "$"), "$"); assert.equal(search.replace("example", "$$"), "$"); assert.equal(search.replace("example", "$$$"), "$$"); assert.equal(search.replace("example", "$$$$"), "$$"); assert.equal(search.replace("example", "$$$$$"), "$$$"); assert.equal(search.replace("example", "$$$$$$"), "$$$"); assert.equal(search.replace("example", "$$$$$$$"), "$$$$"); search.set({ regExp: false }); // Tests that without regular expression, "$1test" is treated as a literal string with $ escape. assert.equal(search.replace("(example)", "$1test"), "$1test"); }, "test: replace() should correctly handle \\\\ in the replacement string": function () { var search = new Search().set({ needle: "example" }); // Expecting \\ to be preserved in the output assert.equal(search.replace("example", "\\test"), "\\test"); assert.equal(search.replace("example", "\\\\test"), "\\\\test"); assert.equal(search.replace("example", "\\\\\\test"), "\\\\\\test"); search.set({ regExp: true }); assert.equal(search.replace("example", "\\"), "\\"); assert.equal(search.replace("example", "\\\\"), "\\"); assert.equal(search.replace("example", "\\\\\\"), "\\\\"); assert.equal(search.replace("example", "\\\\\\\\"), "\\\\"); assert.equal(search.replace("example", "\\\\\\\\\\"), "\\\\\\"); assert.equal(search.replace("example", "\\\\\\\\\\\\"), "\\\\\\"); assert.equal(search.replace("example", "\\\\\\\\\\\\\\"), "\\\\\\\\"); }, "test: find all using regular expresion containing $" : function() { var session = new EditSession(["a", " b", "c ", "d"]); var search = new Search().set({ needle: "[ ]+$", regExp: true, wrap: true }); session.getSelection().moveCursorTo(1, 2); var ranges = search.findAll(session); assert.equal(ranges.length, 1); assert.position(ranges[0].start, 2, 1); assert.position(ranges[0].end, 2, 2); }, "test: find all matches in a line" : function() { var session = new EditSession("foo bar foo baz foobar foo"); var search = new Search().set({ needle: "foo", wrap: true, wholeWord: true }); session.getSelection().moveCursorTo(0, 4); var ranges = search.findAll(session); assert.equal(ranges.length, 3); assert.position(ranges[0].start, 0, 0); assert.position(ranges[0].end, 0, 3); assert.position(ranges[1].start, 0, 8); assert.position(ranges[1].end, 0, 11); assert.position(ranges[2].start, 0, 23); assert.position(ranges[2].end, 0, 26); }, "test: find all matches in a line backwards" : function() { var session = new EditSession("foo bar foo baz foobar foo"); var search = new Search().set({ needle: "foo", wrap: true, wholeWord: true, backwards: true }); session.getSelection().moveCursorTo(0, 13); var ranges = search.findAll(session); assert.equal(ranges.length, 3); assert.position(ranges[2].start, 0, 23); assert.position(ranges[2].end, 0, 26); assert.position(ranges[1].start, 0, 8); assert.position(ranges[1].end, 0, 11); assert.position(ranges[0].start, 0, 0); assert.position(ranges[0].end, 0, 3); }, "test: find next empty range" : function() { var session = new EditSession("foo foobar foo"); var editor = new Editor(new MockRenderer(), session); var options = { needle: "o*", wrap: true, regExp: true, backwards: false }; var positions = [4, 5.2, 7, 8, 9, 10, 11, 12.2, 14, 0, 1.2, 3]; session.selection.moveCursorTo(0, 3); for (var i = 0; i < positions.length; i++) { editor.find(options); var range = editor.selection.getRange(); var start = range.start.column; var len = range.end.column - start; assert.equal(start + 0.1 * len, positions[i]); } options.backwards = true; positions = [1.2, 0, 12.2, 11, 10, 9, 8, 7, 5.2, 4, 3, 1.2, 0]; for (var i = 0; i < positions.length; i++) { editor.find(options); var range = editor.selection.getRange(); var start = range.start.column; var len = range.end.column - start; assert.equal(start + 0.1 * len, positions[i]); } }, "test: repeating text": function() { var session = new EditSession("tttttt\ntttttt\ntttttt\ntttttt\ntttttt\ntttttt"); var editor = new Editor(new MockRenderer(), session); var options = { needle: "^", wrap: true, regExp: true, backwards: false }; function check(sl, sc, el, ec) { editor.find(options); var range = editor.selection.getRange(); assert.range(range, sl, sc, el, ec); } session.selection.moveCursorTo(1, 3); check(2, 0, 2, 0); options.needle = "tttt\ntttt"; check(2, 2, 3, 4); check(4, 2, 5, 4); check(0, 2, 1, 4); options.backwards = true; check(4, 2, 5, 4); check(2, 2, 3, 4); check(0, 2, 1, 4); check(4, 2, 5, 4); }, "test: find all matches in a range" : function() { var session = new EditSession([ "", " var myVar1 = 1; var myVar2 = 2; var myVar3 = 3;", " var myVar4 = 4; var myVar5 = 5; var myVar6 = 6;" ]); var search = new Search().set({ needle: "var", backwards: true, caseSensitive: true, range: {start: {row: 1, column: 20}, end: {row: 2, column: 22}}, wholeWord: false, regExp: false }); var ranges = search.findAll(session); assert.equal(ranges.length, 3); assert.position(ranges[0].start, 1, 20); assert.position(ranges[0].end, 1, 23); assert.position(ranges[1].start, 1, 36); assert.position(ranges[1].end, 1, 39); assert.position(ranges[2].start, 2, 4); assert.position(ranges[2].end, 2, 7); }, "test: find all line breaks (\\r\\n, \\n) using regular expression" : function() { var session = new EditSession('\nfunction foo(items, nada) {\n for (var i=0; i<items.length; i++) {\n alert(items[i] + "juhu\\n");\n }\t/* Real Tab */\n\n\n\n\n}\n\n\n// test search/replace line break with regexp\r\n\r\n\t\t\t\t\n'); var search = new Search().set({ needle: "\\n", regExp: true, wrap: true }); var ranges = search.findAll(session); assert.equal(ranges.length, 15); search.set({ needle: "\\n{2,}" }); ranges = search.findAll(session); assert.equal(ranges.length, 3); search.set({ needle: "\\n\\s+" }); ranges = search.findAll(session); assert.equal(ranges.length, 6); search.set({ needle: "\\)\\s\\{\\n\\s+" }); ranges = search.findAll(session); assert.equal(ranges.length, 2); search.set({ needle: "\\n+" }); ranges = search.findAll(session); assert.equal(ranges.length, 8); assert.position(ranges[0].start, 0, 0); assert.position(ranges[0].end, 1, 0); assert.position(ranges[1].start, 1, 27); assert.position(ranges[1].end, 2, 0); assert.position(ranges[2].start, 2, 40); assert.position(ranges[2].end, 3, 0); assert.position(ranges[3].start, 3, 35); assert.position(ranges[3].end, 4, 0); assert.position(ranges[4].start, 4, 20); assert.position(ranges[4].end, 9, 0); assert.position(ranges[5].start, 9, 1); assert.position(ranges[5].end, 12, 0); assert.position(ranges[6].start, 12, 45); assert.position(ranges[6].end, 14, 0); assert.position(ranges[7].start, 14, 4); assert.position(ranges[7].end, 15, 0); }, "test: find line breaks backwards using regex" : function() { var session = new EditSession('\nfunction foo(items, nada) {\n for (var i=0; i<items.length; i++) {\n alert(items[i] + "juhu\\n");\n }\t/* Real Tab */\n\n\n\n\n}\n\n\n// test search/replace line break with regexp\r\n\r\n\t\t\t\t\n'); session.getSelection().moveCursorTo(2, 5); var search = new Search().set({ needle: "\\n", regExp: true, wrap: true, backwards: true }); var range = search.find(session); // Should find the first newline to the left of the cursor assert.position(range.start, 1, 27); assert.position(range.end, 2, 0); }, "test: replace with line breaks (\\n) and TAB (\\t) using regular expression" : function() { var search = new Search().set({ needle: "with", regExp: true, wrap: true }); assert.equal(search.replace("with", "\n// $0"), "\n// with"); assert.equal(search.replace("with", "\t-\t$0"), "\t-\twith"); search.set({ needle: "(\\n+)" }); assert.equal(search.replace("\n", ""), ""); assert.equal(search.replace("\n", "\t"), "\t"); assert.equal(search.replace("\n\n\n", "\n"), "\n"); assert.equal(search.replace("\n\t\n\n", "\t$1"), "\t\n\t\t\n\n"); assert.equal(search.replace("\r\n /* CRLF */", "\n"), "\n /* CRLF */"); } }; require("./test/run")(module); ================================================ FILE: src/selection.js ================================================ "use strict"; var oop = require("./lib/oop"); var lang = require("./lib/lang"); var EventEmitter = require("./lib/event_emitter").EventEmitter; var Range = require("./range").Range; /** * @typedef {import("./edit_session").EditSession} EditSession * @typedef {import("./anchor").Anchor} Anchor * @typedef {import("../ace-internal").Ace.Point} Point */ class Selection { /** * Creates a new `Selection` object. * @param {EditSession} session The session to use * @constructor **/ constructor(session) { /**@type {EditSession}*/ this.session = session; /**@type {import("./document").Document}*/ this.doc = session.getDocument(); this.clearSelection(); /**@type {Anchor}*/ this.cursor = this.lead = this.doc.createAnchor(0, 0); /**@type {Anchor}*/ this.anchor = this.doc.createAnchor(0, 0); this.$silent = false; var self = this; this.cursor.on("change", function(e) { self.$cursorChanged = true; if (!self.$silent) self._emit("changeCursor"); if (!self.$isEmpty && !self.$silent) self._emit("changeSelection"); if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column) self.$desiredColumn = null; }); this.anchor.on("change", function() { self.$anchorChanged = true; if (!self.$isEmpty && !self.$silent) self._emit("changeSelection"); }); } /** * Returns `true` if the selection is empty. * @returns {Boolean} **/ isEmpty() { return this.$isEmpty || ( this.anchor.row == this.lead.row && this.anchor.column == this.lead.column ); } /** * Returns `true` if the selection is a multi-line. * @returns {Boolean} **/ isMultiLine() { return !this.$isEmpty && this.anchor.row != this.cursor.row; } /** * Returns an object containing the `row` and `column` current position of the cursor. * @returns {Point} **/ getCursor() { return this.lead.getPosition(); } /** * Sets the row and column position of the anchor. This function also emits the `'changeSelection'` event. * @param {Number} row The new row * @param {Number} column The new column * **/ setAnchor(row, column) { this.$isEmpty = false; this.anchor.setPosition(row, column); } /** * Returns an object containing the `row` and `column` of the calling selection anchor. * * @returns {Point} * @related Anchor.getPosition **/ getAnchor() { if (this.$isEmpty) return this.getSelectionLead(); return this.anchor.getPosition(); } /** * Returns an object containing the `row` and `column` of the calling selection lead. * @returns {Object} **/ getSelectionLead() { return this.lead.getPosition(); } /** * Returns `true` if the selection is going backwards in the document. * @returns {Boolean} **/ isBackwards() { var anchor = this.anchor; var lead = this.lead; return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column)); } /** * [Returns the [[Range]] for the selected text.]{: #Selection.getRange} * @returns {Range} **/ getRange() { var anchor = this.anchor; var lead = this.lead; if (this.$isEmpty) return Range.fromPoints(lead, lead); return this.isBackwards() ? Range.fromPoints(lead, anchor) : Range.fromPoints(anchor, lead); } /** * [Empties the selection (by de-selecting it). This function also emits the `'changeSelection'` event.]{: #Selection.clearSelection} **/ clearSelection() { if (!this.$isEmpty) { this.$isEmpty = true; this._emit("changeSelection"); } } /** * Selects all the text in the document. **/ selectAll() { this.$setSelection(0, 0, Number.MAX_VALUE, Number.MAX_VALUE); } /** * Sets the selection to the provided range. * @param {import("../ace-internal").Ace.IRange} range The range of text to select * @param {Boolean} [reverse] Indicates if the range should go backwards (`true`) or not **/ setRange(range, reverse) { var start = reverse ? range.end : range.start; var end = reverse ? range.start : range.end; this.$setSelection(start.row, start.column, end.row, end.column); } /** * @param {number} anchorRow * @param {number} anchorColumn * @param {number} cursorRow * @param {number} cursorColumn */ $setSelection(anchorRow, anchorColumn, cursorRow, cursorColumn) { if (this.$silent) return; var wasEmpty = this.$isEmpty; var wasMultiselect = this.inMultiSelectMode; this.$silent = true; this.$cursorChanged = this.$anchorChanged = false; this.anchor.setPosition(anchorRow, anchorColumn); this.cursor.setPosition(cursorRow, cursorColumn); this.$isEmpty = !Range.comparePoints(this.anchor, this.cursor); this.$silent = false; if (this.$cursorChanged) this._emit("changeCursor"); if (this.$cursorChanged || this.$anchorChanged || wasEmpty != this.$isEmpty || wasMultiselect) this._emit("changeSelection"); } $moveSelection(mover) { var lead = this.lead; if (this.$isEmpty) this.setSelectionAnchor(lead.row, lead.column); mover.call(this); } /** * Moves the selection cursor to the indicated row and column. * @param {Number} row The row to select to * @param {Number} column The column to select to **/ selectTo(row, column) { this.$moveSelection(function() { this.moveCursorTo(row, column); }); } /** * Moves the selection cursor to the row and column indicated by `pos`. * @param {Point} pos An object containing the row and column **/ selectToPosition(pos) { this.$moveSelection(function() { this.moveCursorToPosition(pos); }); } /** * Moves the selection cursor to the indicated row and column. * @param {Number} row The row to select to * @param {Number} column The column to select to **/ moveTo(row, column) { this.clearSelection(); this.moveCursorTo(row, column); } /** * Moves the selection cursor to the row and column indicated by `pos`. * @param {Object} pos An object containing the row and column **/ moveToPosition(pos) { this.clearSelection(); this.moveCursorToPosition(pos); } /** * Moves the selection up one row. **/ selectUp() { this.$moveSelection(this.moveCursorUp); } /** * Moves the selection down one row. **/ selectDown() { this.$moveSelection(this.moveCursorDown); } /** * Moves the selection right one column. **/ selectRight() { this.$moveSelection(this.moveCursorRight); } /** * Moves the selection left one column. **/ selectLeft() { this.$moveSelection(this.moveCursorLeft); } /** * Moves the selection to the beginning of the current line. **/ selectLineStart() { this.$moveSelection(this.moveCursorLineStart); } /** * Moves the selection to the end of the current line. **/ selectLineEnd() { this.$moveSelection(this.moveCursorLineEnd); } /** * Moves the selection to the end of the file. **/ selectFileEnd() { this.$moveSelection(this.moveCursorFileEnd); } /** * Moves the selection to the start of the file. **/ selectFileStart() { this.$moveSelection(this.moveCursorFileStart); } /** * Moves the selection to the first word on the right. **/ selectWordRight() { this.$moveSelection(this.moveCursorWordRight); } /** * Moves the selection to the first word on the left. **/ selectWordLeft() { this.$moveSelection(this.moveCursorWordLeft); } /** * Moves the selection to highlight the entire word. * @related EditSession.getWordRange **/ getWordRange(row, column) { if (typeof column == "undefined") { var cursor = row || this.lead; row = cursor.row; column = cursor.column; } return this.session.getWordRange(row, column); } /** * Selects an entire word boundary. **/ selectWord() { this.setSelectionRange(this.getWordRange()); } /** * Selects a word, including its right whitespace. * @related EditSession.getAWordRange **/ selectAWord() { var cursor = this.getCursor(); var range = this.session.getAWordRange(cursor.row, cursor.column); this.setSelectionRange(range); } getLineRange(row, excludeLastChar) { var rowStart = typeof row == "number" ? row : this.lead.row; var rowEnd; var foldLine = this.session.getFoldLine(rowStart); if (foldLine) { rowStart = foldLine.start.row; rowEnd = foldLine.end.row; } else { rowEnd = rowStart; } if (excludeLastChar === true) return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length); else return new Range(rowStart, 0, rowEnd + 1, 0); } /** * Selects the entire line. **/ selectLine() { this.setSelectionRange(this.getLineRange()); } /** * Moves the cursor up one row. **/ moveCursorUp() { this.moveCursorBy(-1, 0); } /** * Moves the cursor down one row. **/ moveCursorDown() { this.moveCursorBy(1, 0); } /** * * Returns `true` if moving the character next to the cursor in the specified direction is a soft tab. * @param {Point} cursor the current cursor position * @param {Number} tabSize the tab size * @param {Number} direction 1 for right, -1 for left */ wouldMoveIntoSoftTab(cursor, tabSize, direction) { var start = cursor.column; var end = cursor.column + tabSize; if (direction < 0) { start = cursor.column - tabSize; end = cursor.column; } return this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(start, end).split(" ").length-1 == tabSize; } /** * Moves the cursor left one column. **/ moveCursorLeft() { var cursor = this.lead.getPosition(), fold; if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) { this.moveCursorTo(fold.start.row, fold.start.column); } else if (cursor.column === 0) { // cursor is a line (start if (cursor.row > 0) { this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length); } } else { var tabSize = this.session.getTabSize(); if (this.wouldMoveIntoSoftTab(cursor, tabSize, -1) && !this.session.getNavigateWithinSoftTabs()) { this.moveCursorBy(0, -tabSize); } else { this.moveCursorBy(0, -1); } } } /** * Moves the cursor right one column. **/ moveCursorRight() { var cursor = this.lead.getPosition(), fold; if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) { this.moveCursorTo(fold.end.row, fold.end.column); } else if (this.lead.column == this.doc.getLine(this.lead.row).length) { if (this.lead.row < this.doc.getLength() - 1) { this.moveCursorTo(this.lead.row + 1, 0); } } else { var tabSize = this.session.getTabSize(); /** * @type {Point} */ var cursor = this.lead; if (this.wouldMoveIntoSoftTab(cursor, tabSize, 1) && !this.session.getNavigateWithinSoftTabs()) { this.moveCursorBy(0, tabSize); } else { this.moveCursorBy(0, 1); } } } /** * Moves the cursor to the start of the line. **/ moveCursorLineStart() { var row = this.lead.row; var column = this.lead.column; var screenRow = this.session.documentToScreenRow(row, column); // Determ the doc-position of the first character at the screen line. var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0); // Determ the line var beforeCursor = this.session.getDisplayLine( row, null, firstColumnPosition.row, firstColumnPosition.column ); var leadingSpace = beforeCursor.match(/^\s*/); // TODO find better way for emacs mode to override selection behaviors if (leadingSpace[0].length != column && !this.session.$useEmacsStyleLineStart) firstColumnPosition.column += leadingSpace[0].length; this.moveCursorToPosition(firstColumnPosition); } /** * Moves the cursor to the end of the line. **/ moveCursorLineEnd() { var lead = this.lead; var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column); if (this.lead.column == lineEnd.column) { var line = this.session.getLine(lineEnd.row); if (lineEnd.column == line.length) { var textEnd = line.search(/\s+$/); if (textEnd > 0) lineEnd.column = textEnd; } } this.moveCursorTo(lineEnd.row, lineEnd.column); } /** * Moves the cursor to the end of the file. **/ moveCursorFileEnd() { var row = this.doc.getLength() - 1; var column = this.doc.getLine(row).length; this.moveCursorTo(row, column); } /** * Moves the cursor to the start of the file. **/ moveCursorFileStart() { this.moveCursorTo(0, 0); } /** * Moves the cursor to the word on the right. **/ moveCursorLongWordRight() { var row = this.lead.row; var column = this.lead.column; var line = this.doc.getLine(row); var rightOfCursor = line.substring(column); this.session.nonTokenRe.lastIndex = 0; this.session.tokenRe.lastIndex = 0; // skip folds var fold = this.session.getFoldAt(row, column, 1); if (fold) { this.moveCursorTo(fold.end.row, fold.end.column); return; } // first skip space if (this.session.nonTokenRe.exec(rightOfCursor)) { column += this.session.nonTokenRe.lastIndex; this.session.nonTokenRe.lastIndex = 0; rightOfCursor = line.substring(column); } // if at line end proceed with next line if (column >= line.length) { this.moveCursorTo(row, line.length); this.moveCursorRight(); if (row < this.doc.getLength() - 1) this.moveCursorWordRight(); return; } // advance to the end of the next token if (this.session.tokenRe.exec(rightOfCursor)) { column += this.session.tokenRe.lastIndex; this.session.tokenRe.lastIndex = 0; } this.moveCursorTo(row, column); } /** * * Moves the cursor to the word on the left. **/ moveCursorLongWordLeft() { var row = this.lead.row; var column = this.lead.column; // skip folds var fold; if (fold = this.session.getFoldAt(row, column, -1)) { this.moveCursorTo(fold.start.row, fold.start.column); return; } var str = this.session.getFoldStringAt(row, column, -1); if (str == null) { str = this.doc.getLine(row).substring(0, column); } var leftOfCursor = lang.stringReverse(str); this.session.nonTokenRe.lastIndex = 0; this.session.tokenRe.lastIndex = 0; // skip whitespace if (this.session.nonTokenRe.exec(leftOfCursor)) { column -= this.session.nonTokenRe.lastIndex; leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex); this.session.nonTokenRe.lastIndex = 0; } // if at begin of the line proceed in line above if (column <= 0) { this.moveCursorTo(row, 0); this.moveCursorLeft(); if (row > 0) this.moveCursorWordLeft(); return; } // move to the begin of the word if (this.session.tokenRe.exec(leftOfCursor)) { column -= this.session.tokenRe.lastIndex; this.session.tokenRe.lastIndex = 0; } this.moveCursorTo(row, column); } $shortWordEndIndex(rightOfCursor) { var index = 0, ch; var whitespaceRe = /\s/; var tokenRe = this.session.tokenRe; tokenRe.lastIndex = 0; if (this.session.tokenRe.exec(rightOfCursor)) { index = this.session.tokenRe.lastIndex; } else { while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch)) index ++; if (index < 1) { tokenRe.lastIndex = 0; while ((ch = rightOfCursor[index]) && !tokenRe.test(ch)) { tokenRe.lastIndex = 0; index ++; if (whitespaceRe.test(ch)) { if (index > 2) { index--; break; } else { while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch)) index ++; if (index > 2) break; } } } } } tokenRe.lastIndex = 0; return index; } moveCursorShortWordRight() { var row = this.lead.row; var column = this.lead.column; var line = this.doc.getLine(row); var rightOfCursor = line.substring(column); var fold = this.session.getFoldAt(row, column, 1); if (fold) return this.moveCursorTo(fold.end.row, fold.end.column); if (column == line.length) { var l = this.doc.getLength(); do { row++; rightOfCursor = this.doc.getLine(row); } while (row < l && /^\s*$/.test(rightOfCursor)); if (!/^\s+/.test(rightOfCursor)) rightOfCursor = ""; column = 0; } var index = this.$shortWordEndIndex(rightOfCursor); this.moveCursorTo(row, column + index); } moveCursorShortWordLeft() { var row = this.lead.row; var column = this.lead.column; var fold; if (fold = this.session.getFoldAt(row, column, -1)) return this.moveCursorTo(fold.start.row, fold.start.column); var line = this.session.getLine(row).substring(0, column); if (column === 0) { do { row--; line = this.doc.getLine(row); } while (row > 0 && /^\s*$/.test(line)); column = line.length; if (!/\s+$/.test(line)) line = ""; } var leftOfCursor = lang.stringReverse(line); var index = this.$shortWordEndIndex(leftOfCursor); return this.moveCursorTo(row, column - index); } moveCursorWordRight() { if (this.session.$selectLongWords) this.moveCursorLongWordRight(); else this.moveCursorShortWordRight(); } moveCursorWordLeft() { if (this.session.$selectLongWords) this.moveCursorLongWordLeft(); else this.moveCursorShortWordLeft(); } /** * Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document. * @param {Number} rows The number of rows to move by * @param {Number} chars The number of characters to move by * * @related EditSession.documentToScreenPosition **/ moveCursorBy(rows, chars) { var screenPos = this.session.documentToScreenPosition( this.lead.row, this.lead.column ); var offsetX; if (chars === 0) { if (rows !== 0) { if (this.session.$bidiHandler.isBidiRow(screenPos.row, this.lead.row)) { offsetX = this.session.$bidiHandler.getPosLeft(screenPos.column); screenPos.column = Math.round(offsetX / this.session.$bidiHandler.charWidths[0]); } else { offsetX = screenPos.column * this.session.$bidiHandler.charWidths[0]; } } if (this.$desiredColumn) screenPos.column = this.$desiredColumn; else this.$desiredColumn = screenPos.column; } if (rows != 0 && this.session.lineWidgets && this.session.lineWidgets[this.lead.row]) { var widget = this.session.lineWidgets[this.lead.row]; if (rows < 0) rows -= widget.rowsAbove || 0; else if (rows > 0) rows += widget.rowCount - (widget.rowsAbove || 0); } var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX); if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) { } // move the cursor and update the desired column this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0); } /** * Moves the selection to the position indicated by its `row` and `column`. * @param {Point} position The position to move to **/ moveCursorToPosition(position) { this.moveCursorTo(position.row, position.column); } /** * 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.]{: #preventUpdateBoolDesc} * @param {Number} row The row to move to * @param {Number} column The column to move to * @param {Boolean} [keepDesiredColumn] [If `true`, the cursor move does not respect the previous column]{: #preventUpdateBool} **/ moveCursorTo(row, column, keepDesiredColumn) { // Ensure the row/column is not inside of a fold. var fold = this.session.getFoldAt(row, column, 1); if (fold) { row = fold.start.row; column = fold.start.column; } this.$keepDesiredColumnOnChange = true; var line = this.session.getLine(row); // do not allow putting cursor in the middle of surrogate pairs if (/[\uDC00-\uDFFF]/.test(line.charAt(column)) && line.charAt(column - 1)) { if (this.lead.row == row && this.lead.column == column + 1) column = column - 1; else column = column + 1; } this.lead.setPosition(row, column); this.$keepDesiredColumnOnChange = false; if (!keepDesiredColumn) this.$desiredColumn = null; } /** * Moves the cursor to the screen position indicated by row and column. {:preventUpdateBoolDesc} * @param {Number} row The row to move to * @param {Number} column The column to move to * @param {Boolean} keepDesiredColumn {:preventUpdateBool} **/ moveCursorToScreen(row, column, keepDesiredColumn) { var pos = this.session.screenToDocumentPosition(row, column); this.moveCursorTo(pos.row, pos.column, keepDesiredColumn); } // remove listeners from document detach() { this.lead.detach(); this.anchor.detach(); } /** * @param {Range & {desiredColumn?: number}} range */ fromOrientedRange(range) { this.setSelectionRange(range, range.cursor == range.start); this.$desiredColumn = range.desiredColumn || this.$desiredColumn; } /** * @param {Range & {desiredColumn?: number}} [range] */ toOrientedRange(range) { var r = this.getRange(); if (range) { range.start.column = r.start.column; range.start.row = r.start.row; range.end.column = r.end.column; range.end.row = r.end.row; } else { range = r; } range.cursor = this.isBackwards() ? range.start : range.end; range.desiredColumn = this.$desiredColumn; return range; } /** * Saves the current cursor position and calls `func` that can change the cursor * postion. The result is the range of the starting and eventual cursor position. * Will reset the cursor position. * @param {Function} func The callback that should change the cursor position * @returns {Range} **/ getRangeOfMovements(func) { var start = this.getCursor(); try { func(this); var end = this.getCursor(); return Range.fromPoints(start, end); } catch(e) { return Range.fromPoints(start, start); } finally { this.moveCursorToPosition(start); } } /** * * @returns {Range|Range[]} */ toJSON() { if (this.rangeCount) { /**@type{Range|Range[]}*/var data = this.ranges.map(function(r) { var r1 = r.clone(); r1.isBackwards = r.cursor == r.start; return r1; }); } else { /**@type{Range|Range[]}*/var data = this.getRange(); data.isBackwards = this.isBackwards(); } return data; } /** * * @param data */ fromJSON(data) { if (data.start == undefined) { if (this.rangeList && data.length > 1) { this.toSingleRange(data[0]); for (var i = data.length; i--; ) { var r = Range.fromPoints(data[i].start, data[i].end); if (data[i].isBackwards) r.cursor = r.start; this.addRange(r, true); } return; } else { data = data[0]; } } if (this.rangeList) this.toSingleRange(data); this.setSelectionRange(data, data.isBackwards); } /** * * @param data * @return {boolean} */ isEqual(data) { if ((data.length || this.rangeCount) && data.length != this.rangeCount) return false; if (!data.length || !this.ranges) return this.getRange().isEqual(data); for (var i = this.ranges.length; i--; ) { if (!this.ranges[i].isEqual(data[i])) return false; } return true; } } /** * Left for backward compatibility * @deprecated */ Selection.prototype.setSelectionAnchor = Selection.prototype.setAnchor; /** * Left for backward compatibility * @deprecated */ Selection.prototype.getSelectionAnchor = Selection.prototype.getAnchor; Selection.prototype.setSelectionRange = Selection.prototype.setRange; oop.implement(Selection.prototype, EventEmitter); exports.Selection = Selection; ================================================ FILE: src/selection_test.js ================================================ "use strict"; var LineWidgets = require("./line_widgets").LineWidgets; var EditSession = require("./edit_session").EditSession; var assert = require("./test/assertions"); var Range = require("./range").Range; module.exports = { createSession : 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: selectAll" : function() { var session = this.createSession(10, 10); var selection = session.selection; session.selection.selectAll(); assert.position(selection.getAnchor(), 0, 0); assert.position(selection.getCursor(), 9, 10); assert.position(selection.getRange().end, 9, 10); assert.position(selection.getRange().start, 0, 0); }, "test: move cursor to end of file should place the cursor on last row and column" : function() { var session = this.createSession(200, 10); var selection = session.getSelection(); selection.moveCursorFileEnd(); assert.position(selection.getCursor(), 199, 10); }, "test: moveCursor to start of file should place the cursor on the first row and column" : function() { var session = this.createSession(200, 10); var selection = session.getSelection(); selection.moveCursorFileStart(); assert.position(selection.getCursor(), 0, 0); }, "test: move selection lead to end of file" : function() { var session = this.createSession(200, 10); var selection = session.getSelection(); selection.moveCursorTo(100, 5); selection.selectFileEnd(); var range = selection.getRange(); assert.position(range.start, 100, 5); assert.position(range.end, 199, 10); }, "test: move selection lead to start of file" : function() { var session = this.createSession(200, 10); var selection = session.getSelection(); selection.moveCursorTo(100, 5); selection.selectFileStart(); var range = selection.getRange(); assert.position(range.start, 0, 0); assert.position(range.end, 100, 5); }, "test: move cursor word right" : function() { var session = new EditSession([ "ab", " Juhu Kinners (abc, 12)", " cde" ].join("\n")); var selection = session.getSelection(); session.$selectLongWords = true; selection.moveCursorDown(); assert.position(selection.getCursor(), 1, 0); selection.moveCursorWordRight(); assert.position(selection.getCursor(), 1, 5); selection.moveCursorWordRight(); assert.position(selection.getCursor(), 1, 13); selection.moveCursorWordRight(); assert.position(selection.getCursor(), 1, 18); selection.moveCursorWordRight(); assert.position(selection.getCursor(), 1, 22); // wrap line selection.moveCursorWordRight(); assert.position(selection.getCursor(), 2, 4); selection.moveCursorWordRight(); assert.position(selection.getCursor(), 2, 4); }, "test: select word right if cursor in word" : function() { var session = new EditSession("Juhu Kinners"); var selection = session.getSelection(); selection.moveCursorTo(0, 2); selection.moveCursorWordRight(); assert.position(selection.getCursor(), 0, 4); }, "test: moveCursor word left" : function() { var session = new EditSession([ "ab", " Juhu Kinners (abc, 12)", " cde" ].join("\n")); var selection = session.getSelection(); session.$selectLongWords = true; selection.moveCursorDown(); selection.moveCursorLineEnd(); assert.position(selection.getCursor(), 1, 23); selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 1, 20); selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 1, 15); selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 1, 6); selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 1, 1); // wrap line selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 0, 0); selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 0, 0); }, "test: moveCursor word left with umlauts" : function() { var session = new EditSession(" Fuß Füße"); session.$selectLongWords = true; var selection = session.getSelection(); selection.moveCursorTo(0, 9); selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 0, 5); selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 0, 1); }, "test: select word left if cursor in word" : function() { var session = new EditSession("Juhu Kinners"); var selection = session.getSelection(); session.$selectLongWords = true; selection.moveCursorTo(0, 8); selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 0, 5); }, "test: select word right and select" : function() { var session = new EditSession("Juhu Kinners"); var selection = session.getSelection(); selection.moveCursorTo(0, 0); selection.selectWordRight(); var range = selection.getRange(); assert.position(range.start, 0, 0); assert.position(range.end, 0, 4); }, "test: select word left and select" : function() { var session = new EditSession("Juhu Kinners"); var selection = session.getSelection(); selection.moveCursorTo(0, 3); selection.selectWordLeft(); var range = selection.getRange(); assert.position(range.start, 0, 0); assert.position(range.end, 0, 3); }, "test: select word with cursor in word should select the word" : function() { var session = new EditSession("Juhu Kinners 123"); var selection = session.getSelection(); selection.moveCursorTo(0, 8); selection.selectWord(); var range = selection.getRange(); assert.position(range.start, 0, 5); assert.position(range.end, 0, 12); }, "test: select word with cursor in word including right whitespace should select the word" : function() { var session = new EditSession("Juhu Kinners 123"); var selection = session.getSelection(); selection.moveCursorTo(0, 8); selection.selectAWord(); var range = selection.getRange(); assert.position(range.start, 0, 5); assert.position(range.end, 0, 18); }, "test: select word with cursor betwen white space and word should select the word" : function() { var session = new EditSession("Juhu Kinners"); var selection = session.getSelection(); session.$selectLongWords = true; selection.moveCursorTo(0, 4); selection.selectWord(); var range = selection.getRange(); assert.position(range.start, 0, 0); assert.position(range.end, 0, 4); selection.moveCursorTo(0, 5); selection.selectWord(); var range = selection.getRange(); assert.position(range.start, 0, 5); assert.position(range.end, 0, 12); }, "test: select word with cursor in white space should select white space" : function() { var session = new EditSession("Juhu Kinners"); var selection = session.getSelection(); session.$selectLongWords = true; selection.moveCursorTo(0, 5); selection.selectWord(); var range = selection.getRange(); assert.position(range.start, 0, 4); assert.position(range.end, 0, 6); }, "test: moving cursor should fire a 'changeCursor' event" : function() { var session = new EditSession("Juhu Kinners"); var selection = session.getSelection(); session.$selectLongWords = true; selection.moveCursorTo(0, 5); var called = false; selection.addEventListener("changeCursor", function() { called = true; }); selection.moveCursorTo(0, 6); assert.ok(called); }, "test: calling setCursor with the same position should not fire an event": function() { var session = new EditSession("Juhu Kinners"); var selection = session.getSelection(); session.$selectLongWords = true; selection.moveCursorTo(0, 5); var called = false; selection.addEventListener("changeCursor", function() { called = true; }); selection.moveCursorTo(0, 5); assert.notOk(called); }, "test: moveWordright should move past || and [": function() { var session = new EditSession("||foo["); var selection = session.getSelection(); session.$selectLongWords = true; // Move behind ||foo selection.moveCursorWordRight(); assert.position(selection.getCursor(), 0, 5); // Move behind [ selection.moveCursorWordRight(); assert.position(selection.getCursor(), 0, 6); }, "test: moveWordLeft should move past || and [": function() { var session = new EditSession("||foo["); var selection = session.getSelection(); session.$selectLongWords = true; selection.moveCursorTo(0, 6); // Move behind [foo selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 0, 2); // Move behind || selection.moveCursorWordLeft(); assert.position(selection.getCursor(), 0, 0); }, "test: move cursor to line start should move cursor to end of the indentation first": function() { var session = new EditSession("12\n Juhu\n12"); var selection = session.getSelection(); selection.moveCursorTo(1, 6); selection.moveCursorLineStart(); assert.position(selection.getCursor(), 1, 4); }, "test: move cursor to line start when the cursor is at the end of the indentation should move cursor to column 0": function() { var session = new EditSession("12\n Juhu\n12"); var selection = session.getSelection(); selection.moveCursorTo(1, 4); selection.moveCursorLineStart(); assert.position(selection.getCursor(), 1, 0); }, "test: move cursor to line start when the cursor is at column 0 should move cursor to the end of the indentation": function() { var session = new EditSession("12\n Juhu\n12"); var selection = session.getSelection(); selection.moveCursorTo(1, 0); selection.moveCursorLineStart(); assert.position(selection.getCursor(), 1, 4); }, // Eclipse style "test: move cursor to line start when the cursor is before the initial indentation should move cursor to the end of the indentation": function() { var session = new EditSession("12\n Juhu\n12"); var selection = session.getSelection(); selection.moveCursorTo(1, 2); selection.moveCursorLineStart(); assert.position(selection.getCursor(), 1, 4); }, "test go line up when in the middle of the first line should go to document start": function() { var session = new EditSession("juhu kinners"); var selection = session.getSelection(); selection.moveCursorTo(0, 4); selection.moveCursorUp(); assert.position(selection.getCursor(), 0, 0); }, "test: (wrap) go line up when in the middle of the first line should go to document start": function() { var session = new EditSession("juhu kinners"); session.setWrapLimitRange(5, 5); session.adjustWrapLimit(80); var selection = session.getSelection(); selection.moveCursorTo(0, 4); selection.moveCursorUp(); assert.position(selection.getCursor(), 0, 0); }, "test go line down when in the middle of the last line should go to document end": function() { var session = new EditSession("juhu kinners"); var selection = session.getSelection(); selection.moveCursorTo(0, 4); selection.moveCursorDown(); assert.position(selection.getCursor(), 0, 12); }, "test (wrap) go line down when in the middle of the last line should go to document end": function() { var session = new EditSession("juhu kinners"); session.setWrapLimitRange(8, 8); session.adjustWrapLimit(80); var selection = session.getSelection(); selection.moveCursorTo(0, 10); selection.moveCursorDown(); assert.position(selection.getCursor(), 0, 12); }, "test go line up twice and then once down when in the second should go back to the previous column": function() { var session = new EditSession("juhu\nkinners"); var selection = session.getSelection(); selection.moveCursorTo(1, 4); selection.moveCursorUp(); selection.moveCursorUp(); selection.moveCursorDown(); assert.position(selection.getCursor(), 1, 4); }, "test (keyboard navigation) when curLine is not EOL and targetLine is all whitespace new column should be current column": function() { var session = new EditSession("function (a) {\n \n}"); var selection = session.getSelection(); selection.moveCursorTo(2, 0); selection.moveCursorUp(); assert.position(selection.getCursor(), 1, 0); }, "test (keyboard navigation) when curLine is EOL and targetLine is shorter than current column, new column should be targetLine's EOL": function() { var session = new EditSession("function (a) {\n \n}"); var selection = session.getSelection(); selection.moveCursorTo(0, 14); selection.moveCursorDown(); assert.position(selection.getCursor(), 1, 4); }, "test fromJSON/toJSON": function() { var copy = function(data) { return JSON.parse(JSON.stringify(data)); }; var session = new EditSession("function (a) {\n \n}"); var selection = session.getSelection(); selection.moveCursorTo(0, 14); selection.moveCursorDown(); assert.position(selection.getCursor(), 1, 4); var data = selection.toJSON(); selection.moveCursorDown(); assert.position(selection.getCursor(), 2, 1); assert.ok(!selection.isEqual(data)); var nCursor = 0; var nSelection = 0; selection.on("changeCursor", function() { nCursor++; }); selection.on("changeSelection", function() { nSelection++; }); selection.fromJSON(copy(data)); assert.equal(nCursor, 1); assert.equal(nSelection, 1); assert.position(selection.getCursor(), 1, 4); assert.ok(selection.isEqual(data)); data.end.column = 10; selection.fromJSON(copy(data)); assert.equal(nCursor, 1); assert.equal(nSelection, 1); data.end.column = 4; assert.ok(selection.isEqual(data)); data.start.row = 0; selection.fromJSON(copy(data)); assert.equal(nCursor, 1); assert.equal(nSelection, 2); assert.ok(selection.isEqual(data)); data.isBackwards = true; selection.fromJSON(copy(data)); assert.equal(nCursor, 2); assert.equal(nSelection, 3); assert.ok(selection.isEqual(data)); selection.moveTo(0, 0); nCursor = nSelection = 0; selection.selectAll(); assert.equal(nCursor, 1); assert.equal(nSelection, 1); selection.moveCursorRight(); selection.clearSelection(); nCursor = nSelection = 0; selection.selectAll(); assert.equal(nCursor, 0); assert.equal(nSelection, 1); }, "test setRange inside fold": function() { var session = new EditSession("-\n-fold-\n-"); var selection = session.getSelection(); session.addFold(".", new Range(0, 1, 2, 0)); selection.setRange(new Range(1, 1, 1, 5)); assert.equal(session.getTextRange(), "fold"); }, "test navigate around line widgets": function() { var session = new EditSession(["a", "b", "", "c", "d"]); session.widgetManager = new LineWidgets(session); var selection = session.getSelection(); session.widgetManager.addLineWidget({ row: 0, rowCount: 5, rowsAbove: 2 }); session.widgetManager.addLineWidget({ row: 1, rowCount: 3, rowsAbove: 1 }); session.widgetManager.addLineWidget({ row: 3, rowCount: 4 }); assert.position(session.documentToScreenPosition(3, 1), 11, 1); session.selection.moveCursorLineEnd(); session.selection.moveCursorUp(); assert.position(selection.cursor, 0, 0); session.selection.moveCursorDown(); assert.position(selection.cursor, 1, 1); session.selection.moveCursorDown(); assert.position(selection.cursor, 2, 0); session.selection.moveCursorDown(); assert.position(selection.cursor, 3, 1); session.selection.moveCursorUp(); assert.position(selection.cursor, 2, 0); session.selection.moveCursorUp(); assert.position(selection.cursor, 1, 1); }, "test selectLine": function() { var session = new EditSession(" text -\n-fold- \n-"); var selection = session.getSelection(); selection.selectLine(); assert.range(selection.getRange(), 0, 0, 1, 0); selection.clearSelection(); assert.position(selection.getAnchor(), 1, 0); selection.moveCursorLineEnd(); assert.position(selection.getAnchor(), 1, 9); selection.moveCursorLineEnd(); assert.position(selection.getAnchor(), 1, 6); selection.selectLineStart(); assert.range(selection.getRange(), 1, 0, 1, 6); } }; require("./test/run")(module); ================================================ FILE: src/snippets/abc.js ================================================ "use strict"; exports.snippetText = require("./abc.snippets"); exports.scope = "abc"; ================================================ FILE: src/snippets/abc.snippets.js ================================================ module.exports = ` snippet zupfnoter.print %%%%hn.print {"startpos": \${1:pos_y}, "t":"\${2:title}", "v":[\${3:voices}], "s":[[\${4:syncvoices}1,2]], "f":[\${5:flowlines}], "sf":[\${6:subflowlines}], "j":[\${7:jumplines}]} snippet zupfnoter.note %%%%hn.note {"pos": [\${1:pos_x},\${2:pos_y}], "text": "\${3:text}", "style": "\${4:style}"} snippet zupfnoter.annotation %%%%hn.annotation {"id": "\${1:id}", "pos": [\${2:pos}], "text": "\${3:text}"} snippet zupfnoter.lyrics %%%%hn.lyrics {"pos": [\${1:x_pos},\${2:y_pos}]} snippet zupfnoter.legend %%%%hn.legend {"pos": [\${1:x_pos},\${2:y_pos}]} snippet zupfnoter.target "^:\${1:target}" snippet zupfnoter.goto "^@\${1:target}@\${2:distance}" snippet zupfnoter.annotationref "^#\${1:target}" snippet zupfnoter.annotation "^!\${1:text}@\${2:x_offset},\${3:y_offset}" `; ================================================ FILE: src/snippets/actionscript.js ================================================ "use strict"; exports.snippetText = require("./actionscript.snippets"); exports.scope = "actionscript"; ================================================ FILE: src/snippets/actionscript.snippets.js ================================================ module.exports = `snippet main package { import flash.display.*; import flash.Events.*; public class Main extends Sprite { public function Main ( ) { trace("start"); stage.scaleMode = StageScaleMode.NO_SCALE; stage.addEventListener(Event.RESIZE, resizeListener); } private function resizeListener (e:Event):void { trace("The application window changed size!"); trace("New width: " + stage.stageWidth); trace("New height: " + stage.stageHeight); } } } snippet class \${1:public|internal} class \${2:name} \${3:extends } { public function \$2 ( ) { ("start"); } } snippet all package name { \${1:public|internal|final} class \${2:name} \${3:extends } { private|public| static const FOO = "abc"; private|public| static var BAR = "abc"; // class initializer - no JIT !! one time setup if Cababilities.os == "Linux|MacOS" { FOO = "other"; } // constructor: public function \$2 ( ){ super2(); trace("start"); } public function name (a, b...){ super.name(..); lable:break } } } function A(){ // A can only be accessed within this file } snippet switch switch(\${1}){ case \${2}: \${3} break; default: } snippet case case \${1}: \${2} break; snippet package package \${1:package}{ \${2} } snippet wh while \${1:cond}{ \${2} } snippet do do { \${2} } while (\${1:cond}) snippet while while \${1:cond}{ \${2} } snippet for enumerate names for (\${1:var} in \${2:object}){ \${3} } snippet for enumerate values for each (\${1:var} in \${2:object}){ \${3} } snippet get_set function get \${1:name} { return \${2} } function set \$1 (newValue) { \${3} } snippet interface interface name { function method(\${1}):\${2:returntype}; } snippet try try { \${1} } catch (error:ErrorType) { \${2} } finally { \${3} } # For Loop (same as c.snippet) snippet for for (..) {..} for (\${2:i} = 0; \$2 < \${1:count}; \$2\${3:++}) { \${4:/* code */} } # Custom For Loop snippet forr for (\${1:i} = \${2:0}; \${3:\$1 < 10}; \$1\${4:++}) { \${5:/* code */} } # If Condition snippet if if (\${1:/* condition */}) { \${2:/* code */} } snippet el else { \${1} } # Ternary conditional snippet t \${1:/* condition */} ? \${2:a} : \${3:b} snippet fun function \${1:function_name}(\${2})\${3} { \${4:/* code */} } # FlxSprite (usefull when using the flixel library) snippet FlxSprite package { import org.flixel.* public class \${1:ClassName} extends \${2:FlxSprite} { public function \$1(\${3: X:Number, Y:Number}):void { super(X,Y); \${4: //code...} } override public function update():void { super.update(); \${5: //code...} } } } `; ================================================ FILE: src/snippets/c_cpp.js ================================================ "use strict"; exports.snippetText = require("./c_cpp.snippets"); exports.scope = "c_cpp"; ================================================ FILE: src/snippets/c_cpp.snippets.js ================================================ module.exports = `## STL Collections # std::array snippet array std::array<\${1:T}, \${2:N}> \${3};\${4} # std::vector snippet vector std::vector<\${1:T}> \${2};\${3} # std::deque snippet deque std::deque<\${1:T}> \${2};\${3} # std::forward_list snippet flist std::forward_list<\${1:T}> \${2};\${3} # std::list snippet list std::list<\${1:T}> \${2};\${3} # std::set snippet set std::set<\${1:T}> \${2};\${3} # std::map snippet map std::map<\${1:Key}, \${2:T}> \${3};\${4} # std::multiset snippet mset std::multiset<\${1:T}> \${2};\${3} # std::multimap snippet mmap std::multimap<\${1:Key}, \${2:T}> \${3};\${4} # std::unordered_set snippet uset std::unordered_set<\${1:T}> \${2};\${3} # std::unordered_map snippet umap std::unordered_map<\${1:Key}, \${2:T}> \${3};\${4} # std::unordered_multiset snippet umset std::unordered_multiset<\${1:T}> \${2};\${3} # std::unordered_multimap snippet ummap std::unordered_multimap<\${1:Key}, \${2:T}> \${3};\${4} # std::stack snippet stack std::stack<\${1:T}> \${2};\${3} # std::queue snippet queue std::queue<\${1:T}> \${2};\${3} # std::priority_queue snippet pqueue std::priority_queue<\${1:T}> \${2};\${3} ## ## Access Modifiers # private snippet pri private # protected snippet pro protected # public snippet pub public # friend snippet fr friend # mutable snippet mu mutable ## ## Class # class snippet cl class \${1:\`Filename('\$1', 'name')\`} { public: \$1(\${2}); ~\$1(); private: \${3:/* data */} }; # member function implementation snippet mfun \${4:void} \${1:\`Filename('\$1', 'ClassName')\`}::\${2:memberFunction}(\${3}) { \${5:/* code */} } # namespace snippet ns namespace \${1:\`Filename('', 'my')\`} { \${2} } /* namespace \$1 */ ## ## Input/Output # std::cout snippet cout std::cout << \${1} << std::endl;\${2} # std::cin snippet cin std::cin >> \${1};\${2} ## ## Iteration # for i snippet fori for (int \${2:i} = 0; \$2 < \${1:count}; \$2\${3:++}) { \${4:/* code */} }\${5} # foreach snippet fore for (\${1:auto} \${2:i} : \${3:container}) { \${4:/* code */} }\${5} # iterator snippet iter for (\${1:std::vector}<\${2:type}>::\${3:const_iterator} \${4:i} = \${5:container}.begin(); \$4 != \$5.end(); ++\$4) { \${6} }\${7} # auto iterator snippet itera for (auto \${1:i} = \$1.begin(); \$1 != \$1.end(); ++\$1) { \${2:std::cout << *\$1 << std::endl;} }\${3} ## ## Lambdas # lamda (one line) snippet ld [\${1}](\${2}){\${3:/* code */}}\${4} # lambda (multi-line) snippet lld [\${1}](\${2}){ \${3:/* code */} }\${4} `; ================================================ FILE: src/snippets/clojure.js ================================================ "use strict"; exports.snippetText = require("./clojure.snippets"); exports.scope = "clojure"; ================================================ FILE: src/snippets/clojure.snippets.js ================================================ module.exports = `snippet comm (comment \${1} ) snippet condp (condp \${1:pred} \${2:expr} \${3}) snippet def (def \${1}) snippet defm (defmethod \${1:multifn} "\${2:doc-string}" \${3:dispatch-val} [\${4:args}] \${5}) snippet defmm (defmulti \${1:name} "\${2:doc-string}" \${3:dispatch-fn}) snippet defma (defmacro \${1:name} "\${2:doc-string}" \${3:dispatch-fn}) snippet defn (defn \${1:name} "\${2:doc-string}" [\${3:arg-list}] \${4}) snippet defp (defprotocol \${1:name} \${2}) snippet defr (defrecord \${1:name} [\${2:fields}] \${3:protocol} \${4}) snippet deft (deftest \${1:name} (is (= \${2:assertion}))) \${3}) snippet is (is (= \${1} \${2})) snippet defty (deftype \${1:Name} [\${2:fields}] \${3:Protocol} \${4}) snippet doseq (doseq [\${1:elem} \${2:coll}] \${3}) snippet fn (fn [\${1:arg-list}] \${2}) snippet if (if \${1:test-expr} \${2:then-expr} \${3:else-expr}) snippet if-let (if-let [\${1:result} \${2:test-expr}] (\${3:then-expr} \$1) (\${4:else-expr})) snippet imp (:import [\${1:package}]) & {:keys [\${1:keys}] :or {\${2:defaults}}} snippet let (let [\${1:name} \${2:expr}] \${3}) snippet letfn (letfn [(\${1:name) [\${2:args}] \${3})]) snippet map (map \${1:func} \${2:coll}) snippet mapl (map #(\${1:lambda}) \${2:coll}) snippet met (\${1:name} [\${2:this} \${3:args}] \${4}) snippet ns (ns \${1:name} \${2}) snippet dotimes (dotimes [_ 10] (time (dotimes [_ \${1:times}] \${2}))) snippet pmethod (\${1:name} [\${2:this} \${3:args}]) snippet refer (:refer-clojure :exclude [\${1}]) snippet require (:require [\${1:namespace} :as [\${2}]]) snippet use (:use [\${1:namespace} :only [\${2}]]) snippet print (println \${1}) snippet reduce (reduce \${1:(fn [p n] \${3})} \${2}) snippet when (when \${1:test} \${2:body}) snippet when-let (when-let [\${1:result} \${2:test}] \${3:body}) `; ================================================ FILE: src/snippets/coffee.js ================================================ "use strict"; exports.snippetText = require("./coffee.snippets"); exports.scope = "coffee"; ================================================ FILE: src/snippets/coffee.snippets.js ================================================ module.exports = `# Closure loop snippet forindo for \${1:name} in \${2:array} do (\$1) -> \${3:// body} # Array comprehension snippet fora for \${1:name} in \${2:array} \${3:// body...} # Object comprehension snippet foro for \${1:key}, \${2:value} of \${3:object} \${4:// body...} # Range comprehension (inclusive) snippet forr for \${1:name} in [\${2:start}..\${3:finish}] \${4:// body...} snippet forrb for \${1:name} in [\${2:start}..\${3:finish}] by \${4:step} \${5:// body...} # Range comprehension (exclusive) snippet forrex for \${1:name} in [\${2:start}...\${3:finish}] \${4:// body...} snippet forrexb for \${1:name} in [\${2:start}...\${3:finish}] by \${4:step} \${5:// body...} # Function snippet fun (\${1:args}) -> \${2:// body...} # Function (bound) snippet bfun (\${1:args}) => \${2:// body...} # Class snippet cla class .. class \${1:\`substitute(Filename(), '\\(_\\|^\\)\\(.\\)', '\\u\\2', 'g')\`} \${2} snippet cla class .. constructor: .. class \${1:\`substitute(Filename(), '\\(_\\|^\\)\\(.\\)', '\\u\\2', 'g')\`} constructor: (\${2:args}) -> \${3} \${4} snippet cla class .. extends .. class \${1:\`substitute(Filename(), '\\(_\\|^\\)\\(.\\)', '\\u\\2', 'g')\`} extends \${2:ParentClass} \${3} snippet cla class .. extends .. constructor: .. class \${1:\`substitute(Filename(), '\\(_\\|^\\)\\(.\\)', '\\u\\2', 'g')\`} extends \${2:ParentClass} constructor: (\${3:args}) -> \${4} \${5} # If snippet if if \${1:condition} \${2:// body...} # If __ Else snippet ife if \${1:condition} \${2:// body...} else \${3:// body...} # Else if snippet elif else if \${1:condition} \${2:// body...} # Ternary If snippet ifte if \${1:condition} then \${2:value} else \${3:other} # Unless snippet unl \${1:action} unless \${2:condition} # Switch snippet swi switch \${1:object} when \${2:value} \${3:// body...} # Log snippet log console.log \${1} # Try __ Catch snippet try try \${1} catch \${2:error} \${3} # Require snippet req \${2:\$1} = require '\${1:sys}'\${3} # Export snippet exp \${1:root} = exports ? this `; ================================================ FILE: src/snippets/csound_document.js ================================================ "use strict"; exports.snippetText = require("./csound_document.snippets"); exports.scope = "csound_document"; ================================================ FILE: src/snippets/csound_document.snippets.js ================================================ module.exports = `# <CsoundSynthesizer> snippet synth <CsoundSynthesizer> <CsInstruments> \${1} </CsInstruments> <CsScore> e </CsScore> </CsoundSynthesizer> `; ================================================ FILE: src/snippets/csound_orchestra.js ================================================ "use strict"; exports.snippetText = require("./csound_orchestra.snippets"); exports.scope = "csound_orchestra"; ================================================ FILE: src/snippets/csound_orchestra.snippets.js ================================================ module.exports = `# else snippet else else \${1:/* statements */} # elseif snippet elseif elseif \${1:/* condition */} then \${2:/* statements */} # if snippet if if \${1:/* condition */} then \${2:/* statements */} endif # instrument block snippet instr instr \${1:name} \${2:/* statements */} endin # i-time while loop snippet iwhile i\${1:Index} = \${2:0} while i\${1:Index} < \${3:/* count */} do \${4:/* statements */} i\${1:Index} += 1 od # k-rate while loop snippet kwhile k\${1:Index} = \${2:0} while k\${1:Index} < \${3:/* count */} do \${4:/* statements */} k\${1:Index} += 1 od # opcode snippet opcode opcode \${1:name}, \${2:/* output types */ 0}, \${3:/* input types */ 0} \${4:/* statements */} endop # until loop snippet until until \${1:/* condition */} do \${2:/* statements */} od # while loop snippet while while \${1:/* condition */} do \${2:/* statements */} od `; ================================================ FILE: src/snippets/css.js ================================================ "use strict"; exports.snippetText = require("./css.snippets"); exports.scope = "css"; ================================================ FILE: src/snippets/css.snippets.js ================================================ module.exports = `snippet . \${1} { \${2} } snippet ! !important snippet bdi:m+ -moz-border-image: url(\${1}) \${2:0} \${3:0} \${4:0} \${5:0} \${6:stretch} \${7:stretch}; snippet bdi:m -moz-border-image: \${1}; snippet bdrz:m -moz-border-radius: \${1}; snippet bxsh:m+ -moz-box-shadow: \${1:0} \${2:0} \${3:0} #\${4:000}; snippet bxsh:m -moz-box-shadow: \${1}; snippet bdi:w+ -webkit-border-image: url(\${1}) \${2:0} \${3:0} \${4:0} \${5:0} \${6:stretch} \${7:stretch}; snippet bdi:w -webkit-border-image: \${1}; snippet bdrz:w -webkit-border-radius: \${1}; snippet bxsh:w+ -webkit-box-shadow: \${1:0} \${2:0} \${3:0} #\${4:000}; snippet bxsh:w -webkit-box-shadow: \${1}; snippet @f @font-face { font-family: \${1}; src: url(\${2}); } snippet @i @import url(\${1}); snippet @m @media \${1:print} { \${2} } snippet bg+ background: #\${1:FFF} url(\${2}) \${3:0} \${4:0} \${5:no-repeat}; snippet bga background-attachment: \${1}; snippet bga:f background-attachment: fixed; snippet bga:s background-attachment: scroll; snippet bgbk background-break: \${1}; snippet bgbk:bb background-break: bounding-box; snippet bgbk:c background-break: continuous; snippet bgbk:eb background-break: each-box; snippet bgcp background-clip: \${1}; snippet bgcp:bb background-clip: border-box; snippet bgcp:cb background-clip: content-box; snippet bgcp:nc background-clip: no-clip; snippet bgcp:pb background-clip: padding-box; snippet bgc background-color: #\${1:FFF}; snippet bgc:t background-color: transparent; snippet bgi background-image: url(\${1}); snippet bgi:n background-image: none; snippet bgo background-origin: \${1}; snippet bgo:bb background-origin: border-box; snippet bgo:cb background-origin: content-box; snippet bgo:pb background-origin: padding-box; snippet bgpx background-position-x: \${1}; snippet bgpy background-position-y: \${1}; snippet bgp background-position: \${1:0} \${2:0}; snippet bgr background-repeat: \${1}; snippet bgr:n background-repeat: no-repeat; snippet bgr:x background-repeat: repeat-x; snippet bgr:y background-repeat: repeat-y; snippet bgr:r background-repeat: repeat; snippet bgz background-size: \${1}; snippet bgz:a background-size: auto; snippet bgz:ct background-size: contain; snippet bgz:cv background-size: cover; snippet bg background: \${1}; snippet bg:ie filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='\${1}',sizingMethod='\${2:crop}'); snippet bg:n background: none; snippet bd+ border: \${1:1px} \${2:solid} #\${3:000}; snippet bdb+ border-bottom: \${1:1px} \${2:solid} #\${3:000}; snippet bdbc border-bottom-color: #\${1:000}; snippet bdbi border-bottom-image: url(\${1}); snippet bdbi:n border-bottom-image: none; snippet bdbli border-bottom-left-image: url(\${1}); snippet bdbli:c border-bottom-left-image: continue; snippet bdbli:n border-bottom-left-image: none; snippet bdblrz border-bottom-left-radius: \${1}; snippet bdbri border-bottom-right-image: url(\${1}); snippet bdbri:c border-bottom-right-image: continue; snippet bdbri:n border-bottom-right-image: none; snippet bdbrrz border-bottom-right-radius: \${1}; snippet bdbs border-bottom-style: \${1}; snippet bdbs:n border-bottom-style: none; snippet bdbw border-bottom-width: \${1}; snippet bdb border-bottom: \${1}; snippet bdb:n border-bottom: none; snippet bdbk border-break: \${1}; snippet bdbk:c border-break: close; snippet bdcl border-collapse: \${1}; snippet bdcl:c border-collapse: collapse; snippet bdcl:s border-collapse: separate; snippet bdc border-color: #\${1:000}; snippet bdci border-corner-image: url(\${1}); snippet bdci:c border-corner-image: continue; snippet bdci:n border-corner-image: none; snippet bdf border-fit: \${1}; snippet bdf:c border-fit: clip; snippet bdf:of border-fit: overwrite; snippet bdf:ow border-fit: overwrite; snippet bdf:r border-fit: repeat; snippet bdf:sc border-fit: scale; snippet bdf:sp border-fit: space; snippet bdf:st border-fit: stretch; snippet bdi border-image: url(\${1}) \${2:0} \${3:0} \${4:0} \${5:0} \${6:stretch} \${7:stretch}; snippet bdi:n border-image: none; snippet bdl+ border-left: \${1:1px} \${2:solid} #\${3:000}; snippet bdlc border-left-color: #\${1:000}; snippet bdli border-left-image: url(\${1}); snippet bdli:n border-left-image: none; snippet bdls border-left-style: \${1}; snippet bdls:n border-left-style: none; snippet bdlw border-left-width: \${1}; snippet bdl border-left: \${1}; snippet bdl:n border-left: none; snippet bdlt border-length: \${1}; snippet bdlt:a border-length: auto; snippet bdrz border-radius: \${1}; snippet bdr+ border-right: \${1:1px} \${2:solid} #\${3:000}; snippet bdrc border-right-color: #\${1:000}; snippet bdri border-right-image: url(\${1}); snippet bdri:n border-right-image: none; snippet bdrs border-right-style: \${1}; snippet bdrs:n border-right-style: none; snippet bdrw border-right-width: \${1}; snippet bdr border-right: \${1}; snippet bdr:n border-right: none; snippet bdsp border-spacing: \${1}; snippet bds border-style: \${1}; snippet bds:ds border-style: dashed; snippet bds:dtds border-style: dot-dash; snippet bds:dtdtds border-style: dot-dot-dash; snippet bds:dt border-style: dotted; snippet bds:db border-style: double; snippet bds:g border-style: groove; snippet bds:h border-style: hidden; snippet bds:i border-style: inset; snippet bds:n border-style: none; snippet bds:o border-style: outset; snippet bds:r border-style: ridge; snippet bds:s border-style: solid; snippet bds:w border-style: wave; snippet bdt+ border-top: \${1:1px} \${2:solid} #\${3:000}; snippet bdtc border-top-color: #\${1:000}; snippet bdti border-top-image: url(\${1}); snippet bdti:n border-top-image: none; snippet bdtli border-top-left-image: url(\${1}); snippet bdtli:c border-corner-image: continue; snippet bdtli:n border-corner-image: none; snippet bdtlrz border-top-left-radius: \${1}; snippet bdtri border-top-right-image: url(\${1}); snippet bdtri:c border-top-right-image: continue; snippet bdtri:n border-top-right-image: none; snippet bdtrrz border-top-right-radius: \${1}; snippet bdts border-top-style: \${1}; snippet bdts:n border-top-style: none; snippet bdtw border-top-width: \${1}; snippet bdt border-top: \${1}; snippet bdt:n border-top: none; snippet bdw border-width: \${1}; snippet bd border: \${1}; snippet bd:n border: none; snippet b bottom: \${1}; snippet b:a bottom: auto; snippet bxsh+ box-shadow: \${1:0} \${2:0} \${3:0} #\${4:000}; snippet bxsh box-shadow: \${1}; snippet bxsh:n box-shadow: none; snippet bxz box-sizing: \${1}; snippet bxz:bb box-sizing: border-box; snippet bxz:cb box-sizing: content-box; snippet cps caption-side: \${1}; snippet cps:b caption-side: bottom; snippet cps:t caption-side: top; snippet cl clear: \${1}; snippet cl:b clear: both; snippet cl:l clear: left; snippet cl:n clear: none; snippet cl:r clear: right; snippet cp clip: \${1}; snippet cp:a clip: auto; snippet cp:r clip: rect(\${1:0} \${2:0} \${3:0} \${4:0}); snippet c color: #\${1:000}; snippet ct content: \${1}; snippet ct:a content: attr(\${1}); snippet ct:cq content: close-quote; snippet ct:c content: counter(\${1}); snippet ct:cs content: counters(\${1}); snippet ct:ncq content: no-close-quote; snippet ct:noq content: no-open-quote; snippet ct:n content: normal; snippet ct:oq content: open-quote; snippet coi counter-increment: \${1}; snippet cor counter-reset: \${1}; snippet cur cursor: \${1}; snippet cur:a cursor: auto; snippet cur:c cursor: crosshair; snippet cur:d cursor: default; snippet cur:ha cursor: hand; snippet cur:he cursor: help; snippet cur:m cursor: move; snippet cur:p cursor: pointer; snippet cur:t cursor: text; snippet d display: \${1}; snippet d:mib display: -moz-inline-box; snippet d:mis display: -moz-inline-stack; snippet d:b display: block; snippet d:cp display: compact; snippet d:ib display: inline-block; snippet d:itb display: inline-table; snippet d:i display: inline; snippet d:li display: list-item; snippet d:n display: none; snippet d:ri display: run-in; snippet d:tbcp display: table-caption; snippet d:tbc display: table-cell; snippet d:tbclg display: table-column-group; snippet d:tbcl display: table-column; snippet d:tbfg display: table-footer-group; snippet d:tbhg display: table-header-group; snippet d:tbrg display: table-row-group; snippet d:tbr display: table-row; snippet d:tb display: table; snippet ec empty-cells: \${1}; snippet ec:h empty-cells: hide; snippet ec:s empty-cells: show; snippet exp expression() snippet fl float: \${1}; snippet fl:l float: left; snippet fl:n float: none; snippet fl:r float: right; snippet f+ font: \${1:1em} \${2:Arial},\${3:sans-serif}; snippet fef font-effect: \${1}; snippet fef:eb font-effect: emboss; snippet fef:eg font-effect: engrave; snippet fef:n font-effect: none; snippet fef:o font-effect: outline; snippet femp font-emphasize-position: \${1}; snippet femp:a font-emphasize-position: after; snippet femp:b font-emphasize-position: before; snippet fems font-emphasize-style: \${1}; snippet fems:ac font-emphasize-style: accent; snippet fems:c font-emphasize-style: circle; snippet fems:ds font-emphasize-style: disc; snippet fems:dt font-emphasize-style: dot; snippet fems:n font-emphasize-style: none; snippet fem font-emphasize: \${1}; snippet ff font-family: \${1}; snippet ff:c font-family: \${1:'Monotype Corsiva','Comic Sans MS'},cursive; snippet ff:f font-family: \${1:Capitals,Impact},fantasy; snippet ff:m font-family: \${1:Monaco,'Courier New'},monospace; snippet ff:ss font-family: \${1:Helvetica,Arial},sans-serif; snippet ff:s font-family: \${1:Georgia,'Times New Roman'},serif; snippet fza font-size-adjust: \${1}; snippet fza:n font-size-adjust: none; snippet fz font-size: \${1}; snippet fsm font-smooth: \${1}; snippet fsm:aw font-smooth: always; snippet fsm:a font-smooth: auto; snippet fsm:n font-smooth: never; snippet fst font-stretch: \${1}; snippet fst:c font-stretch: condensed; snippet fst:e font-stretch: expanded; snippet fst:ec font-stretch: extra-condensed; snippet fst:ee font-stretch: extra-expanded; snippet fst:n font-stretch: normal; snippet fst:sc font-stretch: semi-condensed; snippet fst:se font-stretch: semi-expanded; snippet fst:uc font-stretch: ultra-condensed; snippet fst:ue font-stretch: ultra-expanded; snippet fs font-style: \${1}; snippet fs:i font-style: italic; snippet fs:n font-style: normal; snippet fs:o font-style: oblique; snippet fv font-variant: \${1}; snippet fv:n font-variant: normal; snippet fv:sc font-variant: small-caps; snippet fw font-weight: \${1}; snippet fw:b font-weight: bold; snippet fw:br font-weight: bolder; snippet fw:lr font-weight: lighter; snippet fw:n font-weight: normal; snippet f font: \${1}; snippet h height: \${1}; snippet h:a height: auto; snippet l left: \${1}; snippet l:a left: auto; snippet lts letter-spacing: \${1}; snippet lh line-height: \${1}; snippet lisi list-style-image: url(\${1}); snippet lisi:n list-style-image: none; snippet lisp list-style-position: \${1}; snippet lisp:i list-style-position: inside; snippet lisp:o list-style-position: outside; snippet list list-style-type: \${1}; snippet list:c list-style-type: circle; snippet list:dclz list-style-type: decimal-leading-zero; snippet list:dc list-style-type: decimal; snippet list:d list-style-type: disc; snippet list:lr list-style-type: lower-roman; snippet list:n list-style-type: none; snippet list:s list-style-type: square; snippet list:ur list-style-type: upper-roman; snippet lis list-style: \${1}; snippet lis:n list-style: none; snippet mb margin-bottom: \${1}; snippet mb:a margin-bottom: auto; snippet ml margin-left: \${1}; snippet ml:a margin-left: auto; snippet mr margin-right: \${1}; snippet mr:a margin-right: auto; snippet mt margin-top: \${1}; snippet mt:a margin-top: auto; snippet m margin: \${1}; snippet m:4 margin: \${1:0} \${2:0} \${3:0} \${4:0}; snippet m:3 margin: \${1:0} \${2:0} \${3:0}; snippet m:2 margin: \${1:0} \${2:0}; snippet m:0 margin: 0; snippet m:a margin: auto; snippet mah max-height: \${1}; snippet mah:n max-height: none; snippet maw max-width: \${1}; snippet maw:n max-width: none; snippet mih min-height: \${1}; snippet miw min-width: \${1}; snippet op opacity: \${1}; snippet op:ie filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=\${1:100}); snippet op:ms -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=\${1:100})'; snippet orp orphans: \${1}; snippet o+ outline: \${1:1px} \${2:solid} #\${3:000}; snippet oc outline-color: \${1:#000}; snippet oc:i outline-color: invert; snippet oo outline-offset: \${1}; snippet os outline-style: \${1}; snippet ow outline-width: \${1}; snippet o outline: \${1}; snippet o:n outline: none; snippet ovs overflow-style: \${1}; snippet ovs:a overflow-style: auto; snippet ovs:mq overflow-style: marquee; snippet ovs:mv overflow-style: move; snippet ovs:p overflow-style: panner; snippet ovs:s overflow-style: scrollbar; snippet ovx overflow-x: \${1}; snippet ovx:a overflow-x: auto; snippet ovx:h overflow-x: hidden; snippet ovx:s overflow-x: scroll; snippet ovx:v overflow-x: visible; snippet ovy overflow-y: \${1}; snippet ovy:a overflow-y: auto; snippet ovy:h overflow-y: hidden; snippet ovy:s overflow-y: scroll; snippet ovy:v overflow-y: visible; snippet ov overflow: \${1}; snippet ov:a overflow: auto; snippet ov:h overflow: hidden; snippet ov:s overflow: scroll; snippet ov:v overflow: visible; snippet pb padding-bottom: \${1}; snippet pl padding-left: \${1}; snippet pr padding-right: \${1}; snippet pt padding-top: \${1}; snippet p padding: \${1}; snippet p:4 padding: \${1:0} \${2:0} \${3:0} \${4:0}; snippet p:3 padding: \${1:0} \${2:0} \${3:0}; snippet p:2 padding: \${1:0} \${2:0}; snippet p:0 padding: 0; snippet pgba page-break-after: \${1}; snippet pgba:aw page-break-after: always; snippet pgba:a page-break-after: auto; snippet pgba:l page-break-after: left; snippet pgba:r page-break-after: right; snippet pgbb page-break-before: \${1}; snippet pgbb:aw page-break-before: always; snippet pgbb:a page-break-before: auto; snippet pgbb:l page-break-before: left; snippet pgbb:r page-break-before: right; snippet pgbi page-break-inside: \${1}; snippet pgbi:a page-break-inside: auto; snippet pgbi:av page-break-inside: avoid; snippet pos position: \${1}; snippet pos:a position: absolute; snippet pos:f position: fixed; snippet pos:r position: relative; snippet pos:s position: static; snippet q quotes: \${1}; snippet q:en quotes: '\\201C' '\\201D' '\\2018' '\\2019'; snippet q:n quotes: none; snippet q:ru quotes: '\\00AB' '\\00BB' '\\201E' '\\201C'; snippet rz resize: \${1}; snippet rz:b resize: both; snippet rz:h resize: horizontal; snippet rz:n resize: none; snippet rz:v resize: vertical; snippet r right: \${1}; snippet r:a right: auto; snippet tbl table-layout: \${1}; snippet tbl:a table-layout: auto; snippet tbl:f table-layout: fixed; snippet tal text-align-last: \${1}; snippet tal:a text-align-last: auto; snippet tal:c text-align-last: center; snippet tal:l text-align-last: left; snippet tal:r text-align-last: right; snippet ta text-align: \${1}; snippet ta:c text-align: center; snippet ta:l text-align: left; snippet ta:r text-align: right; snippet td text-decoration: \${1}; snippet td:l text-decoration: line-through; snippet td:n text-decoration: none; snippet td:o text-decoration: overline; snippet td:u text-decoration: underline; snippet te text-emphasis: \${1}; snippet te:ac text-emphasis: accent; snippet te:a text-emphasis: after; snippet te:b text-emphasis: before; snippet te:c text-emphasis: circle; snippet te:ds text-emphasis: disc; snippet te:dt text-emphasis: dot; snippet te:n text-emphasis: none; snippet th text-height: \${1}; snippet th:a text-height: auto; snippet th:f text-height: font-size; snippet th:m text-height: max-size; snippet th:t text-height: text-size; snippet ti text-indent: \${1}; snippet ti:- text-indent: -9999px; snippet tj text-justify: \${1}; snippet tj:a text-justify: auto; snippet tj:d text-justify: distribute; snippet tj:ic text-justify: inter-cluster; snippet tj:ii text-justify: inter-ideograph; snippet tj:iw text-justify: inter-word; snippet tj:k text-justify: kashida; snippet tj:t text-justify: tibetan; snippet to+ text-outline: \${1:0} \${2:0} #\${3:000}; snippet to text-outline: \${1}; snippet to:n text-outline: none; snippet tr text-replace: \${1}; snippet tr:n text-replace: none; snippet tsh+ text-shadow: \${1:0} \${2:0} \${3:0} #\${4:000}; snippet tsh text-shadow: \${1}; snippet tsh:n text-shadow: none; snippet tt text-transform: \${1}; snippet tt:c text-transform: capitalize; snippet tt:l text-transform: lowercase; snippet tt:n text-transform: none; snippet tt:u text-transform: uppercase; snippet tw text-wrap: \${1}; snippet tw:no text-wrap: none; snippet tw:n text-wrap: normal; snippet tw:s text-wrap: suppress; snippet tw:u text-wrap: unrestricted; snippet t top: \${1}; snippet t:a top: auto; snippet va vertical-align: \${1}; snippet va:bl vertical-align: baseline; snippet va:b vertical-align: bottom; snippet va:m vertical-align: middle; snippet va:sub vertical-align: sub; snippet va:sup vertical-align: super; snippet va:tb vertical-align: text-bottom; snippet va:tt vertical-align: text-top; snippet va:t vertical-align: top; snippet v visibility: \${1}; snippet v:c visibility: collapse; snippet v:h visibility: hidden; snippet v:v visibility: visible; snippet whsc white-space-collapse: \${1}; snippet whsc:ba white-space-collapse: break-all; snippet whsc:bs white-space-collapse: break-strict; snippet whsc:k white-space-collapse: keep-all; snippet whsc:l white-space-collapse: loose; snippet whsc:n white-space-collapse: normal; snippet whs white-space: \${1}; snippet whs:n white-space: normal; snippet whs:nw white-space: nowrap; snippet whs:pl white-space: pre-line; snippet whs:pw white-space: pre-wrap; snippet whs:p white-space: pre; snippet wid widows: \${1}; snippet w width: \${1}; snippet w:a width: auto; snippet wob word-break: \${1}; snippet wob:ba word-break: break-all; snippet wob:bs word-break: break-strict; snippet wob:k word-break: keep-all; snippet wob:l word-break: loose; snippet wob:n word-break: normal; snippet wos word-spacing: \${1}; snippet wow word-wrap: \${1}; snippet wow:no word-wrap: none; snippet wow:n word-wrap: normal; snippet wow:s word-wrap: suppress; snippet wow:u word-wrap: unrestricted; snippet z z-index: \${1}; snippet z:a z-index: auto; snippet zoo zoom: 1; `; ================================================ FILE: src/snippets/dart.js ================================================ "use strict"; exports.snippetText = require("./dart.snippets"); exports.scope = "dart"; ================================================ FILE: src/snippets/dart.snippets.js ================================================ module.exports = `snippet lib library \${1}; \${2} snippet im import '\${1}'; \${2} snippet pa part '\${1}'; \${2} snippet pao part of \${1}; \${2} snippet main void main() { \${1:/* code */} } snippet st static \${1} snippet fi final \${1} snippet re return \${1} snippet br break; snippet th throw \${1} snippet cl class \${1:\`Filename("", "untitled")\`} \${2} snippet imp implements \${1} snippet ext extends \${1} snippet if if (\${1:true}) { \${2} } snippet ife if (\${1:true}) { \${2} } else { \${3} } snippet el else snippet sw switch (\${1}) { \${2} } snippet cs case \${1}: \${2} snippet de default: \${1} snippet for for (var \${2:i} = 0, len = \${1:things}.length; \$2 < len; \${3:++}\$2) { \${4:\$1[\$2]} } snippet fore for (final \${2:item} in \${1:itemList}) { \${3:/* code */} } snippet wh while (\${1:/* condition */}) { \${2:/* code */} } snippet dowh do { \${2:/* code */} } while (\${1:/* condition */}); snippet as assert(\${1:/* condition */}); snippet try try { \${2} } catch (\${1:Exception e}) { } snippet tryf try { \${2} } catch (\${1:Exception e}) { } finally { } `; ================================================ FILE: src/snippets/diff.js ================================================ "use strict"; exports.snippetText = require("./diff.snippets"); exports.scope = "diff"; ================================================ FILE: src/snippets/diff.snippets.js ================================================ module.exports = `# DEP-3 (http://dep.debian.net/deps/dep3/) style patch header snippet header DEP-3 style header Description: \${1} Origin: \${2:vendor|upstream|other}, \${3:url of the original patch} Bug: \${4:url in upstream bugtracker} Forwarded: \${5:no|not-needed|url} Author: \${6:\`g:snips_author\`} Reviewed-by: \${7:name and email} Last-Update: \${8:\`strftime("%Y-%m-%d")\`} Applied-Upstream: \${9:upstream version|url|commit} `; ================================================ FILE: src/snippets/django.js ================================================ "use strict"; exports.snippetText = require("./django.snippets"); exports.scope = "django"; ================================================ FILE: src/snippets/django.snippets.js ================================================ module.exports = `# Model Fields # Note: Optional arguments are using defaults that match what Django will use # as a default, e.g. with max_length fields. Doing this as a form of self # documentation and to make it easy to know whether you should override the # default or not. # Note: Optional arguments that are booleans will use the opposite since you # can either not specify them, or override them, e.g. auto_now_add=False. snippet auto \${1:FIELDNAME} = models.AutoField(\${2}) snippet bool \${1:FIELDNAME} = models.BooleanField(\${2:default=True}) snippet char \${1:FIELDNAME} = models.CharField(max_length=\${2}\${3:, blank=True}) snippet comma \${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=\${2}\${3:, blank=True}) snippet date \${1:FIELDNAME} = models.DateField(\${2:auto_now_add=True, auto_now=True}\${3:, blank=True, null=True}) snippet datetime \${1:FIELDNAME} = models.DateTimeField(\${2:auto_now_add=True, auto_now=True}\${3:, blank=True, null=True}) snippet decimal \${1:FIELDNAME} = models.DecimalField(max_digits=\${2}, decimal_places=\${3}) snippet email \${1:FIELDNAME} = models.EmailField(max_length=\${2:75}\${3:, blank=True}) snippet file \${1:FIELDNAME} = models.FileField(upload_to=\${2:path/for/upload}\${3:, max_length=100}) snippet filepath \${1:FIELDNAME} = models.FilePathField(path=\${2:"/abs/path/to/dir"}\${3:, max_length=100}\${4:, match="*.ext"}\${5:, recursive=True}\${6:, blank=True, }) snippet float \${1:FIELDNAME} = models.FloatField(\${2}) snippet image \${1:FIELDNAME} = models.ImageField(upload_to=\${2:path/for/upload}\${3:, height_field=height, width_field=width}\${4:, max_length=100}) snippet int \${1:FIELDNAME} = models.IntegerField(\${2}) snippet ip \${1:FIELDNAME} = models.IPAddressField(\${2}) snippet nullbool \${1:FIELDNAME} = models.NullBooleanField(\${2}) snippet posint \${1:FIELDNAME} = models.PositiveIntegerField(\${2}) snippet possmallint \${1:FIELDNAME} = models.PositiveSmallIntegerField(\${2}) snippet slug \${1:FIELDNAME} = models.SlugField(max_length=\${2:50}\${3:, blank=True}) snippet smallint \${1:FIELDNAME} = models.SmallIntegerField(\${2}) snippet text \${1:FIELDNAME} = models.TextField(\${2:blank=True}) snippet time \${1:FIELDNAME} = models.TimeField(\${2:auto_now_add=True, auto_now=True}\${3:, blank=True, null=True}) snippet url \${1:FIELDNAME} = models.URLField(\${2:verify_exists=False}\${3:, max_length=200}\${4:, blank=True}) snippet xml \${1:FIELDNAME} = models.XMLField(schema_path=\${2:None}\${3:, blank=True}) # Relational Fields snippet fk \${1:FIELDNAME} = models.ForeignKey(\${2:OtherModel}\${3:, related_name=''}\${4:, limit_choices_to=}\${5:, to_field=''}) snippet m2m \${1:FIELDNAME} = models.ManyToManyField(\${2:OtherModel}\${3:, related_name=''}\${4:, limit_choices_to=}\${5:, symmetrical=False}\${6:, through=''}\${7:, db_table=''}) snippet o2o \${1:FIELDNAME} = models.OneToOneField(\${2:OtherModel}\${3:, parent_link=True}\${4:, related_name=''}\${5:, limit_choices_to=}\${6:, to_field=''}) # Code Skeletons snippet form class \${1:FormName}(forms.Form): """\${2:docstring}""" \${3} snippet model class \${1:ModelName}(models.Model): """\${2:docstring}""" \${3} class Meta: \${4} def __unicode__(self): \${5} def save(self, force_insert=False, force_update=False): \${6} @models.permalink def get_absolute_url(self): return ('\${7:view_or_url_name}' \${8}) snippet modeladmin class \${1:ModelName}Admin(admin.ModelAdmin): \${2} admin.site.register(\$1, \$1Admin) snippet tabularinline class \${1:ModelName}Inline(admin.TabularInline): model = \$1 snippet stackedinline class \${1:ModelName}Inline(admin.StackedInline): model = \$1 snippet r2r return render_to_response('\${1:template.html}', { \${2} }\${3:, context_instance=RequestContext(request)} ) `; ================================================ FILE: src/snippets/drools.js ================================================ "use strict"; exports.snippetText = require("./drools.snippets"); exports.scope = "drools"; ================================================ FILE: src/snippets/drools.snippets.js ================================================ module.exports = ` snippet rule rule "\${1?:rule_name}" when \${2:// when...} then \${3:// then...} end snippet query query \${1?:query_name} \${2:// find} end snippet declare declare \${1?:type_name} \${2:// attributes} end `; ================================================ FILE: src/snippets/edifact.js ================================================ "use strict"; exports.snippetText = require("./edifact.snippets"); exports.scope = "edifact"; ================================================ FILE: src/snippets/edifact.snippets.js ================================================ module.exports = `## Access Modifiers snippet u UN snippet un UNB snippet pr private ## ## Annotations snippet before @Before static void \${1:intercept}(\${2:args}) { \${3} } snippet mm @ManyToMany \${1} snippet mo @ManyToOne \${1} snippet om @OneToMany\${1:(cascade=CascadeType.ALL)} \${2} snippet oo @OneToOne \${1} ## ## Basic Java packages and import snippet im import snippet j.b java.beans. snippet j.i java.io. snippet j.m java.math. snippet j.n java.net. snippet j.u java.util. ## ## Class snippet cl class \${1:\`Filename("", "untitled")\`} \${2} snippet in interface \${1:\`Filename("", "untitled")\`} \${2:extends Parent}\${3} snippet tc public class \${1:\`Filename()\`} extends \${2:TestCase} ## ## Class Enhancements snippet ext extends snippet imp implements ## ## Comments snippet /* /* * \${1} */ ## ## Constants snippet co static public final \${1:String} \${2:var} = \${3};\${4} snippet cos static public final String \${1:var} = "\${2}";\${3} ## ## Control Statements snippet case case \${1}: \${2} snippet def default: \${2} snippet el else snippet elif else if (\${1}) \${2} snippet if if (\${1}) \${2} snippet sw switch (\${1}) { \${2} } ## ## Create a Method snippet m \${1:void} \${2:method}(\${3}) \${4:throws }\${5} ## ## Create a Variable snippet v \${1:String} \${2:var}\${3: = null}\${4};\${5} ## ## Enhancements to Methods, variables, classes, etc. snippet ab abstract snippet fi final snippet st static snippet sy synchronized ## ## Error Methods snippet err System.err.print("\${1:Message}"); snippet errf System.err.printf("\${1:Message}", \${2:exception}); snippet errln System.err.println("\${1:Message}"); ## ## Exception Handling snippet as assert \${1:test} : "\${2:Failure message}";\${3} snippet ca catch(\${1:Exception} \${2:e}) \${3} snippet thr throw snippet ths throws snippet try try { \${3} } catch(\${1:Exception} \${2:e}) { } snippet tryf try { \${3} } catch(\${1:Exception} \${2:e}) { } finally { } ## ## Find Methods snippet findall List<\${1:listName}> \${2:items} = \${1}.findAll();\${3} snippet findbyid \${1:var} \${2:item} = \${1}.findById(\${3});\${4} ## ## Javadocs snippet /** /** * \${1} */ snippet @au @author \`system("grep \\\`id -un\\\` /etc/passwd | cut -d \\":\\" -f5 | cut -d \\",\\" -f1")\` snippet @br @brief \${1:Description} snippet @fi @file \${1:\`Filename()\`}.java snippet @pa @param \${1:param} snippet @re @return \${1:param} ## ## Logger Methods snippet debug Logger.debug(\${1:param});\${2} snippet error Logger.error(\${1:param});\${2} snippet info Logger.info(\${1:param});\${2} snippet warn Logger.warn(\${1:param});\${2} ## ## Loops snippet enfor for (\${1} : \${2}) \${3} snippet for for (\${1}; \${2}; \${3}) \${4} snippet wh while (\${1}) \${2} ## ## Main method snippet main public static void main (String[] args) { \${1:/* code */} } ## ## Print Methods snippet print System.out.print("\${1:Message}"); snippet printf System.out.printf("\${1:Message}", \${2:args}); snippet println System.out.println(\${1}); ## ## Render Methods snippet ren render(\${1:param});\${2} snippet rena renderArgs.put("\${1}", \${2});\${3} snippet renb renderBinary(\${1:param});\${2} snippet renj renderJSON(\${1:param});\${2} snippet renx renderXml(\${1:param});\${2} ## ## Setter and Getter Methods snippet set \${1:public} void set\${3:}(\${2:String} \${4:}){ this.\$4 = \$4; } snippet get \${1:public} \${2:String} get\${3:}(){ return this.\${4:}; } ## ## Terminate Methods or Loops snippet re return snippet br break; ## ## Test Methods snippet t public void test\${1:Name}() throws Exception { \${2} } snippet test @Test public void test\${1:Name}() throws Exception { \${2} } ## ## Utils snippet Sc Scanner ## ## Miscellaneous snippet action public static void \${1:index}(\${2:args}) { \${3} } snippet rnf notFound(\${1:param});\${2} snippet rnfin notFoundIfNull(\${1:param});\${2} snippet rr redirect(\${1:param});\${2} snippet ru unauthorized(\${1:param});\${2} snippet unless (unless=\${1:param});\${2} `; ================================================ FILE: src/snippets/erlang.js ================================================ "use strict"; exports.snippetText = require("./erlang.snippets"); exports.scope = "erlang"; ================================================ FILE: src/snippets/erlang.snippets.js ================================================ module.exports = `# module and export all snippet mod -module(\${1:\`Filename('', 'my')\`}). -compile([export_all]). start() -> \${2} stop() -> ok. # define directive snippet def -define(\${1:macro}, \${2:body}).\${3} # export directive snippet exp -export([\${1:function}/\${2:arity}]). # include directive snippet inc -include("\${1:file}").\${2} # behavior directive snippet beh -behaviour(\${1:behaviour}).\${2} # if expression snippet if if \${1:guard} -> \${2:body} end # case expression snippet case case \${1:expression} of \${2:pattern} -> \${3:body}; end # anonymous function snippet fun fun (\${1:Parameters}) -> \${2:body} end\${3} # try...catch snippet try try \${1} catch \${2:_:_} -> \${3:got_some_exception} end # record directive snippet rec -record(\${1:record}, { \${2:field}=\${3:value}}).\${4} # todo comment snippet todo %% TODO: \${1} ## Snippets below (starting with '%') are in EDoc format. ## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details # doc comment snippet %d %% @doc \${1} # end of doc comment snippet %e %% @end # specification comment snippet %s %% @spec \${1} # private function marker snippet %p %% @private # OTP application snippet application -module(\${1:\`Filename('', 'my')\`}). -behaviour(application). -export([start/2, stop/1]). start(_Type, _StartArgs) -> case \${2:root_supervisor}:start_link() of {ok, Pid} -> {ok, Pid}; Other -> {error, Other} end. stop(_State) -> ok. # OTP supervisor snippet supervisor -module(\${1:\`Filename('', 'my')\`}). -behaviour(supervisor). %% API -export([start_link/0]). %% Supervisor callbacks -export([init/1]). -define(SERVER, ?MODULE). start_link() -> supervisor:start_link({local, ?SERVER}, ?MODULE, []). init([]) -> Server = {\${2:my_server}, {\$2, start_link, []}, permanent, 2000, worker, [\$2]}, Children = [Server], RestartStrategy = {one_for_one, 0, 1}, {ok, {RestartStrategy, Children}}. # OTP gen_server snippet gen_server -module(\${1:\`Filename('', 'my')\`}). -behaviour(gen_server). %% API -export([ start_link/0 ]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -define(SERVER, ?MODULE). -record(state, {}). %%%=================================================================== %%% API %%%=================================================================== start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). %%%=================================================================== %%% gen_server callbacks %%%=================================================================== init([]) -> {ok, #state{}}. handle_call(_Request, _From, State) -> Reply = ok, {reply, Reply, State}. handle_cast(_Msg, State) -> {noreply, State}. handle_info(_Info, State) -> {noreply, State}. terminate(_Reason, _State) -> ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. %%%=================================================================== %%% Internal functions %%%=================================================================== `; ================================================ FILE: src/snippets/fsl.js ================================================ "use strict"; exports.snippetText = require("./fsl.snippets"); exports.scope = "fsl"; ================================================ FILE: src/snippets/fsl.snippets.js ================================================ module.exports = `snippet header machine_name : ""; machine_author : ""; machine_license : MIT; machine_comment : ""; machine_language : en; machine_version : 1.0.0; fsl_version : 1.0.0; start_states : []; `; ================================================ FILE: src/snippets/gobstones.js ================================================ "use strict"; exports.snippetText = require("./gobstones.snippets"); exports.scope = "gobstones"; ================================================ FILE: src/snippets/gobstones.snippets.js ================================================ module.exports = `# scope: gobstones # program snippet program program { \${1:// cuerpo...} } # interactive program snippet interactive program interactive program { \${1:INIT} -> { \${2:// cuerpo...} } \${3:TIMEOUT(\${4:5000}) -> { \${5:// cuerpo...} } \${6:K_ENTER} -> { \${7:// cuerpo...} } _ -> {} } # procedure snippet procedure procedure \${1:Nombre}(\${2:parametros}) { \${3:// cuerpo...} } # function snippet function function \${1:nombre}(\${2:parametros}) { return (\${3:expresión..}) } # return snippet return return (\${1:expresión...}) # type snippet type type \${1:Nombre} # is variant snippet is variant is variant { case \${1:NombreDelValor1} {} case \${2:NombreDelValor2} {} case \${3:NombreDelValor3} {} case \${4:NombreDelValor4} {} } # is record snippet is record is record { field \${1:campo1} // \${2:Tipo} field \${3:campo2} // \${4:Tipo} field \${5:campo3} // \${6:Tipo} field \${7:campo4} // \${8:Tipo} } # type _ is variant snippet type _ is variant type \${1:Nombre} is variant { case \${2:NombreDelValor1} {} case \${3:NombreDelValor2} {} case \${4:NombreDelValor3} {} case \${5:NombreDelValor4} {} } # type _ is record snippet type _ is record type \${1:Nombre} is record { field \${2:campo1} // \${3:Tipo} field \${4:campo2} // \${5:Tipo} field \${6:campo3} // \${7:Tipo} field \${8:campo4} // \${9:Tipo} } # repeat snippet repeat repeat \${1:cantidad} { \${2:// cuerpo...} } # foreach snippet foreach foreach \${1:índice} in \${2:lista} { \${3:// cuerpo...} } # while snippet while while (\${1?:condición}) { \${2:// cuerpo...} } # if snippet if if (\${1?:condición}) { \${2:// cuerpo...} } # elseif snippet elseif elseif (\${1?:condición}) { \${2:// cuerpo...} } # else snippet else else { \${1:// cuerpo...} } # if (con else) snippet if (con else) if (\${1:condición}) { \${2:// cuerpo...} } else { \${3:// cuerpo....} } # if (con elseif) snippet if (con elseif) if (\${1:condición}) { \${2:// cuerpo...} } elseif (\${3:condición}) { \${4:// cuerpo...} } # if (con elseif y else) snippet if (con elseif y else) if (\${1:condición}) { \${2:// cuerpo...} } elseif (\${3:condición}) { \${4:// cuerpo...} } else { \${5:// cuerpo....} } # if (con 3 elseif) snippet if (con 3 elseif) if (\${1:condición}) { \${2:// cuerpo...} } elseif (\${3:condición}) { \${4:// cuerpo...} } elseif (\${5:condición}) { \${6:// cuerpo...} } elseif (\${7:condición}) { \${8:// cuerpo...} } # choose (2 valores) snippet choose (2 valores) choose \${1:Valor1} when (\${2:condición}) \${3:Valor2} otherwise # choose (2 valores y boom) snippet choose (2 valores y boom) choose \${1:Valor1} when (\${2:condición}) \${3:Valor2} when (\${4:condición}) \${5:Valor3} when (\${6:condición}) \${7:Valor4} when (\${8:condición}) boom("\${9:No es un valor válido}") otherwise # matching (4 valores) snippet matching (4 valores) matching (\${1:variable}) select \${2:Valor1} on \${3:opción1} \${4:Valor2} on \${5:opción2} \${6:Valor3} on \${7:opción3} \${8:Valor4} on \${9:opción4} boom("\${10:No es un valor válido}") otherwise # select (4 casos) snippet select (4 casos) select \${1:Valor1} on (\${2:opción1}) \${3:Valor2} on (\${4:opción2}) \${5:Valor3} on (\${6:opción3}) \${7:Valor4} on (\${8:opción4}) boom("\${9:No es un valor válido}") otherwise # switch snippet switch switch (\${1:variable}) { \${2:Valor1} -> {\${3:// cuerpo...}} \${4:Valor2} -> {\${5:// cuerpo...}} \${6:Valor3} -> {\${7:// cuerpo...}} \${8:Valor4} -> {\${9:// cuerpo...}} _ -> {\${10:// cuerpo...}} } # Poner snippet Poner Poner(\${1:color}) # Sacar snippet Sacar Sacar(\${1:color}) # Mover snippet Mover Mover(\${1:dirección}) # IrAlBorde snippet IrAlBorde IrAlBorde(\${1:dirección}) # VaciarTablero snippet VaciarTablero VaciarTablero() # BOOM snippet BOOM BOOM("\${1:Mensaje de error}") # hayBolitas snippet hayBolitas hayBolitas(\${1:color}) # nroBolitas snippet nroBolitas nroBolitas(\${1:color}) # puedeMover snippet puedeMover puedeMover(\${1:dirección}) # siguiente snippet siguiente siguiente(\${1:color|dirección}) # previo snippet previo previo(\${1:color|dirección}) # opuesto snippet opuesto opuesto(\${1:dirección}) # minDir snippet minDir minDir() # maxDir snippet maxDir maxDir() # minColor snippet minColor minDir() # maxColor snippet maxColor maxDir() # minBool snippet minBool minBool() # maxBool snippet maxBool maxBool() # primero snippet primero primero(\${1:lista}) # sinElPrimero snippet sinElPrimero sinElPrimero(\${1:lista}) # esVacía snippet esVacía esVacía(\${1:lista}) # boom snippet boom boom("\${1:Mensaje de error}") # Azul snippet Azul Azul # Negro snippet Negro Negro # Rojo snippet Rojo Rojo # Verde snippet Verde Verde # Norte snippet Norte Norte # Este snippet Este Este # Sur snippet Sur Sur # Oeste snippet Oeste Oeste # True snippet True True # False snippet False False # INIT snippet INIT INIT -> {\$1:// cuerpo...} # TIMEOUT snippet TIMEOUT TIMEOUT(\${1:5000}) -> {\$2:// cuerpo...} # K_A snippet K_A K_A -> { \${1://cuerpo...} } # K_CTRL_A snippet K_CTRL_A K_CTRL_A -> { \${1://cuerpo...} } # K_ALT_A snippet K_ALT_A K_ALT_A -> { \${1://cuerpo...} } # K_SHIFT_A snippet K_SHIFT_A K_SHIFT_A -> { \${1://cuerpo...} } # K_CTRL_ALT_A snippet K_CTRL_ALT_A K_CTRL_ALT_A -> { \${1://cuerpo...} } # K_CTRL_SHIFT_A snippet K_CTRL_SHIFT_A K_CTRL_SHIFT_A -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_A snippet K_CTRL_ALT_SHIFT_A K_CTRL_ALT_SHIFT_A -> { \${1://cuerpo...} } # K_B snippet K_B K_B -> { \${1://cuerpo...} } # K_CTRL_B snippet K_CTRL_B K_CTRL_B -> { \${1://cuerpo...} } # K_ALT_B snippet K_ALT_B K_ALT_B -> { \${1://cuerpo...} } # K_SHIFT_B snippet K_SHIFT_B K_SHIFT_B -> { \${1://cuerpo...} } # K_CTRL_ALT_B snippet K_CTRL_ALT_B K_CTRL_ALT_B -> { \${1://cuerpo...} } # K_CTRL_SHIFT_B snippet K_CTRL_SHIFT_B K_CTRL_SHIFT_B -> { \${1://cuerpo...} } # K_ALT_SHIFT_C snippet K_ALT_SHIFT_C K_ALT_SHIFT_C -> { \${1://cuerpo...} } # K_CTRL_BLT_SHIFT_B snippet K_CTRL_BLT_SHIFT_B K_CTRL_ALT_SHIFT_B -> { \${1://cuerpo...} } # K_C snippet K_C K_C -> { \${1://cuerpo...} } # K_CTRL_C snippet K_CTRL_C K_CTRL_C -> { \${1://cuerpo...} } # K_ALT_C snippet K_ALT_C K_ALT_C -> { \${1://cuerpo...} } # K_SHIFT_C snippet K_SHIFT_C K_SHIFT_C -> { \${1://cuerpo...} } # K_CTRL_ALT_C snippet K_CTRL_ALT_C K_CTRL_ALT_C -> { \${1://cuerpo...} } # K_CTRL_SHIFT_C snippet K_CTRL_SHIFT_C K_CTRL_SHIFT_C -> { \${1://cuerpo...} } # K_ALT_SHIFT_C snippet K_ALT_SHIFT_C K_ALT_SHIFT_C -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_C snippet K_CTRL_ALT_SHIFT_C K_CTRL_ALT_SHIFT_C -> { \${1://cuerpo...} } # K_D snippet K_D K_D -> { \${1://cuerpo...} } # K_CTRL_D snippet K_CTRL_D K_CTRL_D -> { \${1://cuerpo...} } # K_ALT_D snippet K_ALT_D K_DLT_D -> { \${1://cuerpo...} } # K_SHIFT_D snippet K_SHIFT_D K_SHIFT_D -> { \${1://cuerpo...} } # K_CTRL_ALT_D snippet K_CTRL_ALT_D K_CTRL_DLT_D -> { \${1://cuerpo...} } # K_CTRL_SHIFT_D snippet K_CTRL_SHIFT_D K_CTRL_SHIFT_D -> { \${1://cuerpo...} } # K_ALT_SHIFT_D snippet K_ALT_SHIFT_D K_ALT_SHIFT_D -> { \${1://cuerpo...} } # K_CTRL_DLT_SHIFT_D snippet K_CTRL_DLT_SHIFT_D K_CTRL_ALT_SHIFT_D -> { \${1://cuerpo...} } # K_E snippet K_E K_E -> { \${1://cuerpo...} } # K_CTRL_E snippet K_CTRL_E K_CTRL_E -> { \${1://cuerpo...} } # K_ALT_E snippet K_ALT_E K_ALT_E -> { \${1://cuerpo...} } # K_SHIFT_E snippet K_SHIFT_E K_SHIFT_E -> { \${1://cuerpo...} } # K_CTRL_ALT_E snippet K_CTRL_ALT_E K_CTRL_ALT_E -> { \${1://cuerpo...} } # K_CTRL_SHIFT_E snippet K_CTRL_SHIFT_E K_CTRL_SHIFT_E -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_E snippet K_CTRL_ALT_SHIFT_E K_CTRL_ALT_SHIFT_E -> { \${1://cuerpo...} } # K_F snippet K_F K_F -> { \${1://cuerpo...} } # K_CTRL_F snippet K_CTRL_F K_CTRL_F -> { \${1://cuerpo...} } # K_ALT_F snippet K_ALT_F K_ALT_F -> { \${1://cuerpo...} } # K_SHIFT_F snippet K_SHIFT_F K_SHIFT_F -> { \${1://cuerpo...} } # K_CTRL_ALT_F snippet K_CTRL_ALT_F K_CTRL_ALT_F -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F snippet K_CTRL_SHIFT_F K_CTRL_SHIFT_F -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F snippet K_CTRL_ALT_SHIFT_F K_CTRL_ALT_SHIFT_F -> { \${1://cuerpo...} } # K_G snippet K_G K_G -> { \${1://cuerpo...} } # K_CTRL_G snippet K_CTRL_G K_CTRL_G -> { \${1://cuerpo...} } # K_ALT_G snippet K_ALT_G K_ALT_G -> { \${1://cuerpo...} } # K_SHIFT_G snippet K_SHIFT_G K_SHIFT_G -> { \${1://cuerpo...} } # K_CTRL_ALT_G snippet K_CTRL_ALT_G K_CTRL_ALT_G -> { \${1://cuerpo...} } # K_CTRL_SHIFT_G snippet K_CTRL_SHIFT_G K_CTRL_SHIFT_G -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_G snippet K_CTRL_ALT_SHIFT_G K_CTRL_ALT_SHIFT_G -> { \${1://cuerpo...} } # K_H snippet K_H K_H -> { \${1://cuerpo...} } # K_CTRL_H snippet K_CTRL_H K_CTRL_H -> { \${1://cuerpo...} } # K_ALT_H snippet K_ALT_H K_ALT_H -> { \${1://cuerpo...} } # K_SHIFT_H snippet K_SHIFT_H K_SHIFT_H -> { \${1://cuerpo...} } # K_CTRL_ALT_H snippet K_CTRL_ALT_H K_CTRL_ALT_H -> { \${1://cuerpo...} } # K_CTRL_SHIFT_H snippet K_CTRL_SHIFT_H K_CTRL_SHIFT_H -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_H snippet K_CTRL_ALT_SHIFT_H K_CTRL_ALT_SHIFT_H -> { \${1://cuerpo...} } # K_I snippet K_I K_I -> { \${1://cuerpo...} } # K_CTRL_I snippet K_CTRL_I K_CTRL_I -> { \${1://cuerpo...} } # K_ALT_I snippet K_ALT_I K_ALT_I -> { \${1://cuerpo...} } # K_SHIFT_I snippet K_SHIFT_I K_SHIFT_I -> { \${1://cuerpo...} } # K_CTRL_ALT_I snippet K_CTRL_ALT_I K_CTRL_ALT_I -> { \${1://cuerpo...} } # K_CTRL_SHIFT_I snippet K_CTRL_SHIFT_I K_CTRL_SHIFT_I -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_I snippet K_CTRL_ALT_SHIFT_I K_CTRL_ALT_SHIFT_I -> { \${1://cuerpo...} } # K_J snippet K_J K_J -> { \${1://cuerpo...} } # K_CTRL_J snippet K_CTRL_J K_CTRL_J -> { \${1://cuerpo...} } # K_ALT_J snippet K_ALT_J K_ALT_J -> { \${1://cuerpo...} } # K_SHIFT_J snippet K_SHIFT_J K_SHIFT_J -> { \${1://cuerpo...} } # K_CTRL_ALT_J snippet K_CTRL_ALT_J K_CTRL_ALT_J -> { \${1://cuerpo...} } # K_CTRL_SHIFT_J snippet K_CTRL_SHIFT_J K_CTRL_SHIFT_J -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_J snippet K_CTRL_ALT_SHIFT_J K_CTRL_ALT_SHIFT_J -> { \${1://cuerpo...} } # K_K snippet K_K K_K -> { \${1://cuerpo...} } # K_CTRL_K snippet K_CTRL_K K_CTRL_K -> { \${1://cuerpo...} } # K_ALT_K snippet K_ALT_K K_ALT_K -> { \${1://cuerpo...} } # K_SHIFT_K snippet K_SHIFT_K K_SHIFT_K -> { \${1://cuerpo...} } # K_CTRL_ALT_K snippet K_CTRL_ALT_K K_CTRL_ALT_K -> { \${1://cuerpo...} } # K_CTRL_SHIFT_K snippet K_CTRL_SHIFT_K K_CTRL_SHIFT_K -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_K snippet K_CTRL_ALT_SHIFT_K K_CTRL_ALT_SHIFT_K -> { \${1://cuerpo...} } # K_L snippet K_L K_L -> { \${1://cuerpo...} } # K_CTRL_L snippet K_CTRL_L K_CTRL_L -> { \${1://cuerpo...} } # K_ALT_L snippet K_ALT_L K_ALT_L -> { \${1://cuerpo...} } # K_SHIFT_L snippet K_SHIFT_L K_SHIFT_L -> { \${1://cuerpo...} } # K_CTRL_ALT_L snippet K_CTRL_ALT_L K_CTRL_ALT_L -> { \${1://cuerpo...} } # K_CTRL_SHIFT_L snippet K_CTRL_SHIFT_L K_CTRL_SHIFT_L -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_L snippet K_CTRL_ALT_SHIFT_L K_CTRL_ALT_SHIFT_L -> { \${1://cuerpo...} } # K_M snippet K_M K_M -> { \${1://cuerpo...} } # K_CTRL_M snippet K_CTRL_M K_CTRL_M -> { \${1://cuerpo...} } # K_ALT_M snippet K_ALT_M K_ALT_M -> { \${1://cuerpo...} } # K_SHIFT_M snippet K_SHIFT_M K_SHIFT_M -> { \${1://cuerpo...} } # K_CTRL_ALT_M snippet K_CTRL_ALT_M K_CTRL_ALT_M -> { \${1://cuerpo...} } # K_CTRL_SHIFT_M snippet K_CTRL_SHIFT_M K_CTRL_SHIFT_M -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_M snippet K_CTRL_ALT_SHIFT_M K_CTRL_ALT_SHIFT_M -> { \${1://cuerpo...} } # K_N snippet K_N K_N -> { \${1://cuerpo...} } # K_CTRL_N snippet K_CTRL_N K_CTRL_N -> { \${1://cuerpo...} } # K_ALT_N snippet K_ALT_N K_ALT_N -> { \${1://cuerpo...} } # K_SHIFT_N snippet K_SHIFT_N K_SHIFT_N -> { \${1://cuerpo...} } # K_CTRL_ALT_N snippet K_CTRL_ALT_N K_CTRL_ALT_N -> { \${1://cuerpo...} } # K_CTRL_SHIFT_N snippet K_CTRL_SHIFT_N K_CTRL_SHIFT_N -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_N snippet K_CTRL_ALT_SHIFT_N K_CTRL_ALT_SHIFT_N -> { \${1://cuerpo...} } # K_Ñ snippet K_Ñ K_Ñ -> { \${1://cuerpo...} } # K_CTRL_Ñ snippet K_CTRL_Ñ K_CTRL_Ñ -> { \${1://cuerpo...} } # K_ALT_Ñ snippet K_ALT_Ñ K_ALT_Ñ -> { \${1://cuerpo...} } # K_SHIFT_Ñ snippet K_SHIFT_Ñ K_SHIFT_Ñ -> { \${1://cuerpo...} } # K_CTRL_ALT_Ñ snippet K_CTRL_ALT_Ñ K_CTRL_ALT_Ñ -> { \${1://cuerpo...} } # K_CTRL_SHIFT_Ñ snippet K_CTRL_SHIFT_Ñ K_CTRL_SHIFT_Ñ -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_Ñ snippet K_CTRL_ALT_SHIFT_Ñ K_CTRL_ALT_SHIFT_Ñ -> { \${1://cuerpo...} } # K_O snippet K_O K_O -> { \${1://cuerpo...} } # K_CTRL_O snippet K_CTRL_O K_CTRL_O -> { \${1://cuerpo...} } # K_ALT_O snippet K_ALT_O K_ALT_O -> { \${1://cuerpo...} } # K_SHIFT_O snippet K_SHIFT_O K_SHIFT_O -> { \${1://cuerpo...} } # K_CTRL_ALT_O snippet K_CTRL_ALT_O K_CTRL_ALT_O -> { \${1://cuerpo...} } # K_CTRL_SHIFT_O snippet K_CTRL_SHIFT_O K_CTRL_SHIFT_O -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_O snippet K_CTRL_ALT_SHIFT_O K_CTRL_ALT_SHIFT_O -> { \${1://cuerpo...} } # K_P snippet K_P K_P -> { \${1://cuerpo...} } # K_CTRL_P snippet K_CTRL_P K_CTRL_P -> { \${1://cuerpo...} } # K_ALT_P snippet K_ALT_P K_ALT_P -> { \${1://cuerpo...} } # K_SHIFT_P snippet K_SHIFT_P K_SHIFT_P -> { \${1://cuerpo...} } # K_CTRL_ALT_P snippet K_CTRL_ALT_P K_CTRL_ALT_P -> { \${1://cuerpo...} } # K_CTRL_SHIFT_P snippet K_CTRL_SHIFT_P K_CTRL_SHIFT_P -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_P snippet K_CTRL_ALT_SHIFT_P K_CTRL_ALT_SHIFT_P -> { \${1://cuerpo...} } # K_Q snippet K_Q K_Q -> { \${1://cuerpo...} } # K_CTRL_Q snippet K_CTRL_Q K_CTRL_Q -> { \${1://cuerpo...} } # K_ALT_Q snippet K_ALT_Q K_ALT_Q -> { \${1://cuerpo...} } # K_SHIFT_Q snippet K_SHIFT_Q K_SHIFT_Q -> { \${1://cuerpo...} } # K_CTRL_ALT_Q snippet K_CTRL_ALT_Q K_CTRL_ALT_Q -> { \${1://cuerpo...} } # K_CTRL_SHIFT_Q snippet K_CTRL_SHIFT_Q K_CTRL_SHIFT_Q -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_Q snippet K_CTRL_ALT_SHIFT_Q K_CTRL_ALT_SHIFT_Q -> { \${1://cuerpo...} } # K_R snippet K_R K_R -> { \${1://cuerpo...} } # K_CTRL_R snippet K_CTRL_R K_CTRL_R -> { \${1://cuerpo...} } # K_ALT_R snippet K_ALT_R K_ALT_R -> { \${1://cuerpo...} } # K_SHIFT_R snippet K_SHIFT_R K_SHIFT_R -> { \${1://cuerpo...} } # K_CTRL_ALT_R snippet K_CTRL_ALT_R K_CTRL_ALT_R -> { \${1://cuerpo...} } # K_CTRL_SHIFT_R snippet K_CTRL_SHIFT_R K_CTRL_SHIFT_R -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_R snippet K_CTRL_ALT_SHIFT_R K_CTRL_ALT_SHIFT_R -> { \${1://cuerpo...} } # K_S snippet K_S K_S -> { \${1://cuerpo...} } # K_CTRL_S snippet K_CTRL_S K_CTRL_S -> { \${1://cuerpo...} } # K_ALT_S snippet K_ALT_S K_ALT_S -> { \${1://cuerpo...} } # K_SHIFT_S snippet K_SHIFT_S K_SHIFT_S -> { \${1://cuerpo...} } # K_CTRL_ALT_S snippet K_CTRL_ALT_S K_CTRL_ALT_S -> { \${1://cuerpo...} } # K_CTRL_SHIFT_S snippet K_CTRL_SHIFT_S K_CTRL_SHIFT_S -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_S snippet K_CTRL_ALT_SHIFT_S K_CTRL_ALT_SHIFT_S -> { \${1://cuerpo...} } # K_T snippet K_T K_T -> { \${1://cuerpo...} } # K_CTRL_T snippet K_CTRL_T K_CTRL_T -> { \${1://cuerpo...} } # K_ALT_T snippet K_ALT_T K_ALT_T -> { \${1://cuerpo...} } # K_SHIFT_T snippet K_SHIFT_T K_SHIFT_T -> { \${1://cuerpo...} } # K_CTRL_ALT_T snippet K_CTRL_ALT_T K_CTRL_ALT_T -> { \${1://cuerpo...} } # K_CTRL_SHIFT_T snippet K_CTRL_SHIFT_T K_CTRL_SHIFT_T -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_T snippet K_CTRL_ALT_SHIFT_T K_CTRL_ALT_SHIFT_T -> { \${1://cuerpo...} } # K_U snippet K_U K_U -> { \${1://cuerpo...} } # K_CTRL_U snippet K_CTRL_U K_CTRL_U -> { \${1://cuerpo...} } # K_ALT_U snippet K_ALT_U K_ALT_U -> { \${1://cuerpo...} } # K_SHIFT_U snippet K_SHIFT_U K_SHIFT_U -> { \${1://cuerpo...} } # K_CTRL_ALT_U snippet K_CTRL_ALT_U K_CTRL_ALT_U -> { \${1://cuerpo...} } # K_CTRL_SHIFT_U snippet K_CTRL_SHIFT_U K_CTRL_SHIFT_U -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_U snippet K_CTRL_ALT_SHIFT_U K_CTRL_ALT_SHIFT_U -> { \${1://cuerpo...} } # K_V snippet K_V K_V -> { \${1://cuerpo...} } # K_CTRL_V snippet K_CTRL_V K_CTRL_V -> { \${1://cuerpo...} } # K_ALT_V snippet K_ALT_V K_ALT_V -> { \${1://cuerpo...} } # K_SHIFT_V snippet K_SHIFT_V K_SHIFT_V -> { \${1://cuerpo...} } # K_CTRL_ALT_V snippet K_CTRL_ALT_V K_CTRL_ALT_V -> { \${1://cuerpo...} } # K_CTRL_SHIFT_V snippet K_CTRL_SHIFT_V K_CTRL_SHIFT_V -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_V snippet K_CTRL_ALT_SHIFT_V K_CTRL_ALT_SHIFT_V -> { \${1://cuerpo...} } # K_W snippet K_W K_W -> { \${1://cuerpo...} } # K_CTRL_W snippet K_CTRL_W K_CTRL_W -> { \${1://cuerpo...} } # K_ALT_W snippet K_ALT_W K_ALT_W -> { \${1://cuerpo...} } # K_SHIFT_W snippet K_SHIFT_W K_SHIFT_W -> { \${1://cuerpo...} } # K_CTRL_ALT_W snippet K_CTRL_ALT_W K_CTRL_ALT_W -> { \${1://cuerpo...} } # K_CTRL_SHIFT_W snippet K_CTRL_SHIFT_W K_CTRL_SHIFT_W -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_W snippet K_CTRL_ALT_SHIFT_W K_CTRL_ALT_SHIFT_W -> { \${1://cuerpo...} } # K_X snippet K_X K_X -> { \${1://cuerpo...} } # K_CTRL_X snippet K_CTRL_X K_CTRL_X -> { \${1://cuerpo...} } # K_ALT_X snippet K_ALT_X K_ALT_X -> { \${1://cuerpo...} } # K_SHIFT_X snippet K_SHIFT_X K_SHIFT_X -> { \${1://cuerpo...} } # K_CTRL_ALT_X snippet K_CTRL_ALT_X K_CTRL_ALT_X -> { \${1://cuerpo...} } # K_CTRL_SHIFT_X snippet K_CTRL_SHIFT_X K_CTRL_SHIFT_X -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_X snippet K_CTRL_ALT_SHIFT_X K_CTRL_ALT_SHIFT_X -> { \${1://cuerpo...} } # K_Y snippet K_Y K_Y -> { \${1://cuerpo...} } # K_CTRL_Y snippet K_CTRL_Y K_CTRL_Y -> { \${1://cuerpo...} } # K_ALT_Y snippet K_ALT_Y K_ALT_Y -> { \${1://cuerpo...} } # K_SHIFT_Y snippet K_SHIFT_Y K_SHIFT_Y -> { \${1://cuerpo...} } # K_CTRL_ALT_Y snippet K_CTRL_ALT_Y K_CTRL_ALT_Y -> { \${1://cuerpo...} } # K_CTRL_SHIFT_Y snippet K_CTRL_SHIFT_Y K_CTRL_SHIFT_Y -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_Y snippet K_CTRL_ALT_SHIFT_Y K_CTRL_ALT_SHIFT_Y -> { \${1://cuerpo...} } # K_Z snippet K_Z K_Z -> { \${1://cuerpo...} } # K_CTRL_Z snippet K_CTRL_Z K_CTRL_Z -> { \${1://cuerpo...} } # K_ALT_Z snippet K_ALT_Z K_ALT_Z -> { \${1://cuerpo...} } # K_SHIFT_Z snippet K_SHIFT_Z K_SHIFT_Z -> { \${1://cuerpo...} } # K_CTRL_ALT_Z snippet K_CTRL_ALT_Z K_CTRL_ALT_Z -> { \${1://cuerpo...} } # K_CTRL_SHIFT_Z snippet K_CTRL_SHIFT_Z K_CTRL_SHIFT_Z -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_Z snippet K_CTRL_ALT_SHIFT_Z K_CTRL_ALT_SHIFT_Z -> { \${1://cuerpo...} } # K_0 snippet K_0 K_0 -> { \${1://cuerpo...} } # K_CTRL_0 snippet K_CTRL_0 K_CTRL_0 -> { \${1://cuerpo...} } # K_ALT_0 snippet K_ALT_0 K_ALT_0 -> { \${1://cuerpo...} } # K_SHIFT_0 snippet K_SHIFT_0 K_SHIFT_0 -> { \${1://cuerpo...} } # K_CTRL_ALT_0 snippet K_CTRL_ALT_0 K_CTRL_ALT_0 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_0 snippet K_CTRL_SHIFT_0 K_CTRL_SHIFT_0 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_0 snippet K_CTRL_ALT_SHIFT_0 K_CTRL_ALT_SHIFT_0 -> { \${1://cuerpo...} } # K_1 snippet K_1 K_1 -> { \${1://cuerpo...} } # K_CTRL_1 snippet K_CTRL_1 K_CTRL_1 -> { \${1://cuerpo...} } # K_ALT_1 snippet K_ALT_1 K_ALT_1 -> { \${1://cuerpo...} } # K_SHIFT_1 snippet K_SHIFT_1 K_SHIFT_1 -> { \${1://cuerpo...} } # K_CTRL_ALT_1 snippet K_CTRL_ALT_1 K_CTRL_ALT_1 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_1 snippet K_CTRL_SHIFT_1 K_CTRL_SHIFT_1 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_1 snippet K_CTRL_ALT_SHIFT_1 K_CTRL_ALT_SHIFT_1 -> { \${1://cuerpo...} } # K_2 snippet K_2 K_2 -> { \${1://cuerpo...} } # K_CTRL_2 snippet K_CTRL_2 K_CTRL_2 -> { \${1://cuerpo...} } # K_ALT_2 snippet K_ALT_2 K_ALT_2 -> { \${1://cuerpo...} } # K_SHIFT_2 snippet K_SHIFT_2 K_SHIFT_2 -> { \${1://cuerpo...} } # K_CTRL_ALT_2 snippet K_CTRL_ALT_2 K_CTRL_ALT_2 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_2 snippet K_CTRL_SHIFT_2 K_CTRL_SHIFT_2 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_2 snippet K_CTRL_ALT_SHIFT_2 K_CTRL_ALT_SHIFT_2 -> { \${1://cuerpo...} } # K_3 snippet K_3 K_3 -> { \${1://cuerpo...} } # K_CTRL_3 snippet K_CTRL_3 K_CTRL_3 -> { \${1://cuerpo...} } # K_ALT_3 snippet K_ALT_3 K_ALT_3 -> { \${1://cuerpo...} } # K_SHIFT_3 snippet K_SHIFT_3 K_SHIFT_3 -> { \${1://cuerpo...} } # K_CTRL_ALT_3 snippet K_CTRL_ALT_3 K_CTRL_ALT_3 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_3 snippet K_CTRL_SHIFT_3 K_CTRL_SHIFT_3 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_3 snippet K_CTRL_ALT_SHIFT_3 K_CTRL_ALT_SHIFT_3 -> { \${1://cuerpo...} } # K_4 snippet K_4 K_4 -> { \${1://cuerpo...} } # K_CTRL_4 snippet K_CTRL_4 K_CTRL_4 -> { \${1://cuerpo...} } # K_ALT_4 snippet K_ALT_4 K_ALT_4 -> { \${1://cuerpo...} } # K_SHIFT_4 snippet K_SHIFT_4 K_SHIFT_4 -> { \${1://cuerpo...} } # K_CTRL_ALT_4 snippet K_CTRL_ALT_4 K_CTRL_ALT_4 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_4 snippet K_CTRL_SHIFT_4 K_CTRL_SHIFT_4 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_4 snippet K_CTRL_ALT_SHIFT_4 K_CTRL_ALT_SHIFT_4 -> { \${1://cuerpo...} } # K_5 snippet K_5 K_5 -> { \${1://cuerpo...} } # K_CTRL_5 snippet K_CTRL_5 K_CTRL_5 -> { \${1://cuerpo...} } # K_ALT_5 snippet K_ALT_5 K_ALT_5 -> { \${1://cuerpo...} } # K_SHIFT_5 snippet K_SHIFT_5 K_SHIFT_5 -> { \${1://cuerpo...} } # K_CTRL_ALT_5 snippet K_CTRL_ALT_5 K_CTRL_ALT_5 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_5 snippet K_CTRL_SHIFT_5 K_CTRL_SHIFT_5 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_5 snippet K_CTRL_ALT_SHIFT_5 K_CTRL_ALT_SHIFT_5 -> { \${1://cuerpo...} } # K_6 snippet K_6 K_6 -> { \${1://cuerpo...} } # K_CTRL_6 snippet K_CTRL_6 K_CTRL_6 -> { \${1://cuerpo...} } # K_ALT_6 snippet K_ALT_6 K_ALT_6 -> { \${1://cuerpo...} } # K_SHIFT_6 snippet K_SHIFT_6 K_SHIFT_6 -> { \${1://cuerpo...} } # K_CTRL_ALT_6 snippet K_CTRL_ALT_6 K_CTRL_ALT_6 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_6 snippet K_CTRL_SHIFT_6 K_CTRL_SHIFT_6 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_6 snippet K_CTRL_ALT_SHIFT_6 K_CTRL_ALT_SHIFT_6 -> { \${1://cuerpo...} } # K_7 snippet K_7 K_7 -> { \${1://cuerpo...} } # K_CTRL_7 snippet K_CTRL_7 K_CTRL_7 -> { \${1://cuerpo...} } # K_ALT_7 snippet K_ALT_7 K_ALT_7 -> { \${1://cuerpo...} } # K_SHIFT_7 snippet K_SHIFT_7 K_SHIFT_7 -> { \${1://cuerpo...} } # K_CTRL_ALT_7 snippet K_CTRL_ALT_7 K_CTRL_ALT_7 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_7 snippet K_CTRL_SHIFT_7 K_CTRL_SHIFT_7 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_7 snippet K_CTRL_ALT_SHIFT_7 K_CTRL_ALT_SHIFT_7 -> { \${1://cuerpo...} } # K_8 snippet K_8 K_8 -> { \${1://cuerpo...} } # K_CTRL_8 snippet K_CTRL_8 K_CTRL_8 -> { \${1://cuerpo...} } # K_ALT_8 snippet K_ALT_8 K_ALT_8 -> { \${1://cuerpo...} } # K_SHIFT_8 snippet K_SHIFT_8 K_SHIFT_8 -> { \${1://cuerpo...} } # K_CTRL_ALT_8 snippet K_CTRL_ALT_8 K_CTRL_ALT_8 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_8 snippet K_CTRL_SHIFT_8 K_CTRL_SHIFT_8 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_8 snippet K_CTRL_ALT_SHIFT_8 K_CTRL_ALT_SHIFT_8 -> { \${1://cuerpo...} } # K_9 snippet K_9 K_9 -> { \${1://cuerpo...} } # K_CTRL_9 snippet K_CTRL_9 K_CTRL_9 -> { \${1://cuerpo...} } # K_ALT_9 snippet K_ALT_9 K_ALT_9 -> { \${1://cuerpo...} } # K_SHIFT_9 snippet K_SHIFT_9 K_SHIFT_9 -> { \${1://cuerpo...} } # K_CTRL_ALT_9 snippet K_CTRL_ALT_9 K_CTRL_ALT_9 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_9 snippet K_CTRL_SHIFT_9 K_CTRL_SHIFT_9 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_9 snippet K_CTRL_ALT_SHIFT_9 K_CTRL_ALT_SHIFT_9 -> { \${1://cuerpo...} } # K_F1 snippet K_F1 K_F1 -> { \${1://cuerpo...} } # K_CTRL_F1 snippet K_CTRL_F1 K_CTRL_F1 -> { \${1://cuerpo...} } # K_ALT_F1 snippet K_ALT_F1 K_ALT_F1 -> { \${1://cuerpo...} } # K_SHIFT_F1 snippet K_SHIFT_F1 K_SHIFT_F1 -> { \${1://cuerpo...} } # K_CTRL_ALT_F1 snippet K_CTRL_ALT_F1 K_CTRL_ALT_F1 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F1 snippet K_CTRL_SHIFT_F1 K_CTRL_SHIFT_F1 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F1 snippet K_CTRL_ALT_SHIFT_F1 K_CTRL_ALT_SHIFT_F1 -> { \${1://cuerpo...} } # K_F2 snippet K_F2 K_F2 -> { \${1://cuerpo...} } # K_CTRL_F2 snippet K_CTRL_F2 K_CTRL_F2 -> { \${1://cuerpo...} } # K_ALT_F2 snippet K_ALT_F2 K_ALT_F2 -> { \${1://cuerpo...} } # K_SHIFT_F2 snippet K_SHIFT_F2 K_SHIFT_F2 -> { \${1://cuerpo...} } # K_CTRL_ALT_F2 snippet K_CTRL_ALT_F2 K_CTRL_ALT_F2 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F2 snippet K_CTRL_SHIFT_F2 K_CTRL_SHIFT_F2 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F2 snippet K_CTRL_ALT_SHIFT_F2 K_CTRL_ALT_SHIFT_F2 -> { \${1://cuerpo...} } # K_F3 snippet K_F3 K_F3 -> { \${1://cuerpo...} } # K_CTRL_F3 snippet K_CTRL_F3 K_CTRL_F3 -> { \${1://cuerpo...} } # K_ALT_F3 snippet K_ALT_F3 K_ALT_F3 -> { \${1://cuerpo...} } # K_SHIFT_F3 snippet K_SHIFT_F3 K_SHIFT_F3 -> { \${1://cuerpo...} } # K_CTRL_ALT_F3 snippet K_CTRL_ALT_F3 K_CTRL_ALT_F3 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F3 snippet K_CTRL_SHIFT_F3 K_CTRL_SHIFT_F3 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F3 snippet K_CTRL_ALT_SHIFT_F3 K_CTRL_ALT_SHIFT_F3 -> { \${1://cuerpo...} } # K_A snippet K_A K_A -> { \${1://cuerpo...} } # K_CTRL_A snippet K_CTRL_A K_CTRL_A -> { \${1://cuerpo...} } # K_ALT_A snippet K_ALT_A K_ALT_A -> { \${1://cuerpo...} } # K_SHIFT_A snippet K_SHIFT_A K_SHIFT_A -> { \${1://cuerpo...} } # K_CTRL_ALT_A snippet K_CTRL_ALT_A K_CTRL_ALT_A -> { \${1://cuerpo...} } # K_CTRL_SHIFT_A snippet K_CTRL_SHIFT_A K_CTRL_SHIFT_A -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_A snippet K_CTRL_ALT_SHIFT_A K_CTRL_ALT_SHIFT_A -> { \${1://cuerpo...} } # K_F5 snippet K_F5 K_F5 -> { \${1://cuerpo...} } # K_CTRL_F5 snippet K_CTRL_F5 K_CTRL_F5 -> { \${1://cuerpo...} } # K_ALT_F5 snippet K_ALT_F5 K_ALT_F5 -> { \${1://cuerpo...} } # K_SHIFT_F5 snippet K_SHIFT_F5 K_SHIFT_F5 -> { \${1://cuerpo...} } # K_CTRL_ALT_F5 snippet K_CTRL_ALT_F5 K_CTRL_ALT_F5 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F5 snippet K_CTRL_SHIFT_F5 K_CTRL_SHIFT_F5 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F5 snippet K_CTRL_ALT_SHIFT_F5 K_CTRL_ALT_SHIFT_F5 -> { \${1://cuerpo...} } # K_F6 snippet K_F6 K_F6 -> { \${1://cuerpo...} } # K_CTRL_F6 snippet K_CTRL_F6 K_CTRL_F6 -> { \${1://cuerpo...} } # K_ALT_F6 snippet K_ALT_F6 K_ALT_F6 -> { \${1://cuerpo...} } # K_SHIFT_F6 snippet K_SHIFT_F6 K_SHIFT_F6 -> { \${1://cuerpo...} } # K_CTRL_ALT_F6 snippet K_CTRL_ALT_F6 K_CTRL_ALT_F6 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F6 snippet K_CTRL_SHIFT_F6 K_CTRL_SHIFT_F6 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F6 snippet K_CTRL_ALT_SHIFT_F6 K_CTRL_ALT_SHIFT_F6 -> { \${1://cuerpo...} } # K_F7 snippet K_F7 K_F7 -> { \${1://cuerpo...} } # K_CTRL_F7 snippet K_CTRL_F7 K_CTRL_F7 -> { \${1://cuerpo...} } # K_ALT_F7 snippet K_ALT_F7 K_ALT_F7 -> { \${1://cuerpo...} } # K_SHIFT_F7 snippet K_SHIFT_F7 K_SHIFT_F7 -> { \${1://cuerpo...} } # K_CTRL_ALT_F7 snippet K_CTRL_ALT_F7 K_CTRL_ALT_F7 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F7 snippet K_CTRL_SHIFT_F7 K_CTRL_SHIFT_F7 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F7 snippet K_CTRL_ALT_SHIFT_F7 K_CTRL_ALT_SHIFT_F7 -> { \${1://cuerpo...} } # K_F8 snippet K_F8 K_F8 -> { \${1://cuerpo...} } # K_CTRL_F8 snippet K_CTRL_F8 K_CTRL_F8 -> { \${1://cuerpo...} } # K_ALT_F8 snippet K_ALT_F8 K_ALT_F8 -> { \${1://cuerpo...} } # K_SHIFT_F8 snippet K_SHIFT_F8 K_SHIFT_F8 -> { \${1://cuerpo...} } # K_CTRL_ALT_F8 snippet K_CTRL_ALT_F8 K_CTRL_ALT_F8 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F8 snippet K_CTRL_SHIFT_F8 K_CTRL_SHIFT_F8 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F8 snippet K_CTRL_ALT_SHIFT_F8 K_CTRL_ALT_SHIFT_F8 -> { \${1://cuerpo...} } # K_F9 snippet K_F9 K_F9 -> { \${1://cuerpo...} } # K_CTRL_F9 snippet K_CTRL_F9 K_CTRL_F9 -> { \${1://cuerpo...} } # K_ALT_F9 snippet K_ALT_F9 K_ALT_F9 -> { \${1://cuerpo...} } # K_SHIFT_F9 snippet K_SHIFT_F9 K_SHIFT_F9 -> { \${1://cuerpo...} } # K_CTRL_ALT_F9 snippet K_CTRL_ALT_F9 K_CTRL_ALT_F9 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F9 snippet K_CTRL_SHIFT_F9 K_CTRL_SHIFT_F9 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F9 snippet K_CTRL_ALT_SHIFT_F9 K_CTRL_ALT_SHIFT_F9 -> { \${1://cuerpo...} } # K_F10 snippet K_F10 K_F10 -> { \${1://cuerpo...} } # K_CTRL_F10 snippet K_CTRL_F10 K_CTRL_F10 -> { \${1://cuerpo...} } # K_ALT_F10 snippet K_ALT_F10 K_ALT_F10 -> { \${1://cuerpo...} } # K_SHIFT_F10 snippet K_SHIFT_F10 K_SHIFT_F10 -> { \${1://cuerpo...} } # K_CTRL_ALT_F10 snippet K_CTRL_ALT_F10 K_CTRL_ALT_F10 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F10 snippet K_CTRL_SHIFT_F10 K_CTRL_SHIFT_F10 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F10 snippet K_CTRL_ALT_SHIFT_F10 K_CTRL_ALT_SHIFT_F10 -> { \${1://cuerpo...} } # K_F11 snippet K_F11 K_F11 -> { \${1://cuerpo...} } # K_CTRL_F11 snippet K_CTRL_F11 K_CTRL_F11 -> { \${1://cuerpo...} } # K_ALT_F11 snippet K_ALT_F11 K_ALT_F11 -> { \${1://cuerpo...} } # K_SHIFT_F11 snippet K_SHIFT_F11 K_SHIFT_F11 -> { \${1://cuerpo...} } # K_CTRL_ALT_F11 snippet K_CTRL_ALT_F11 K_CTRL_ALT_F11 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F11 snippet K_CTRL_SHIFT_F11 K_CTRL_SHIFT_F11 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F11 snippet K_CTRL_ALT_SHIFT_F11 K_CTRL_ALT_SHIFT_F11 -> { \${1://cuerpo...} } # K_F12 snippet K_F12 K_F12 -> { \${1://cuerpo...} } # K_CTRL_F12 snippet K_CTRL_F12 K_CTRL_F12 -> { \${1://cuerpo...} } # K_ALT_F12 snippet K_ALT_F12 K_ALT_F12 -> { \${1://cuerpo...} } # K_SHIFT_F12 snippet K_SHIFT_F12 K_SHIFT_F12 -> { \${1://cuerpo...} } # K_CTRL_ALT_F12 snippet K_CTRL_ALT_F12 K_CTRL_ALT_F12 -> { \${1://cuerpo...} } # K_CTRL_SHIFT_F12 snippet K_CTRL_SHIFT_F12 K_CTRL_SHIFT_F12 -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_F12 snippet K_CTRL_ALT_SHIFT_F12 K_CTRL_ALT_SHIFT_F12 -> { \${1://cuerpo...} } # K_RETURN snippet K_RETURN K_RETURN -> { \${1://cuerpo...} } # K_CTRL_RETURN snippet K_CTRL_RETURN K_CTRL_RETURN -> { \${1://cuerpo...} } # K_ALT_RETURN snippet K_ALT_RETURN K_ALT_RETURN -> { \${1://cuerpo...} } # K_SHIFT_RETURN snippet K_SHIFT_RETURN K_SHIFT_RETURN -> { \${1://cuerpo...} } # K_CTRL_ALT_RETURN snippet K_CTRL_ALT_RETURN K_CTRL_ALT_RETURN -> { \${1://cuerpo...} } # K_CTRL_SHIFT_RETURN snippet K_CTRL_SHIFT_RETURN K_CTRL_SHIFT_RETURN -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_RETURN snippet K_CTRL_ALT_SHIFT_RETURN K_CTRL_ALT_SHIFT_RETURN -> { \${1://cuerpo...} } # K_SPACE snippet K_SPACE K_SPACE -> { \${1://cuerpo...} } # K_CTRL_SPACE snippet K_CTRL_SPACE K_CTRL_SPACE -> { \${1://cuerpo...} } # K_ALT_SPACE snippet K_ALT_SPACE K_ALT_SPACE -> { \${1://cuerpo...} } # K_SHIFT_SPACE snippet K_SHIFT_SPACE K_SHIFT_SPACE -> { \${1://cuerpo...} } # K_CTRL_ALT_SPACE snippet K_CTRL_ALT_SPACE K_CTRL_ALT_SPACE -> { \${1://cuerpo...} } # K_CTRL_SHIFT_SPACE snippet K_CTRL_SHIFT_SPACE K_CTRL_SHIFT_SPACE -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_SPACE snippet K_CTRL_ALT_SHIFT_SPACE K_CTRL_ALT_SHIFT_SPACE -> { \${1://cuerpo...} } # K_ESCAPE snippet K_ESCAPE K_ESCAPE -> { \${1://cuerpo...} } # K_CTRL_ESCAPE snippet K_CTRL_ESCAPE K_CTRL_ESCAPE -> { \${1://cuerpo...} } # K_ALT_ESCAPE snippet K_ALT_ESCAPE K_ALT_ESCAPE -> { \${1://cuerpo...} } # K_SHIFT_ESCAPE snippet K_SHIFT_ESCAPE K_SHIFT_ESCAPE -> { \${1://cuerpo...} } # K_CTRL_ALT_ESCAPE snippet K_CTRL_ALT_ESCAPE K_CTRL_ALT_ESCAPE -> { \${1://cuerpo...} } # K_CTRL_SHIFT_ESCAPE snippet K_CTRL_SHIFT_ESCAPE K_CTRL_SHIFT_ESCAPE -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_ESCAPE snippet K_CTRL_ALT_SHIFT_ESCAPE K_CTRL_ALT_SHIFT_ESCAPE -> { \${1://cuerpo...} } # K_BACKSPACE snippet K_BACKSPACE K_BACKSPACE -> { \${1://cuerpo...} } # K_CTRL_BACKSPACE snippet K_CTRL_BACKSPACE K_CTRL_BACKSPACE -> { \${1://cuerpo...} } # K_ALT_BACKSPACE snippet K_ALT_BACKSPACE K_ALT_BACKSPACE -> { \${1://cuerpo...} } # K_SHIFT_BACKSPACE snippet K_SHIFT_BACKSPACE K_SHIFT_BACKSPACE -> { \${1://cuerpo...} } # K_CTRL_ALT_BACKSPACE snippet K_CTRL_ALT_BACKSPACE K_CTRL_ALT_BACKSPACE -> { \${1://cuerpo...} } # K_CTRL_SHIFT_BACKSPACE snippet K_CTRL_SHIFT_BACKSPACE K_CTRL_SHIFT_BACKSPACE -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_BACKSPACE snippet K_CTRL_ALT_SHIFT_BACKSPACE K_CTRL_ALT_SHIFT_BACKSPACE -> { \${1://cuerpo...} } # K_TAB snippet K_TAB K_TAB -> { \${1://cuerpo...} } # K_CTRL_TAB snippet K_CTRL_TAB K_CTRL_TAB -> { \${1://cuerpo...} } # K_ALT_TAB snippet K_ALT_TAB K_ALT_TAB -> { \${1://cuerpo...} } # K_SHIFT_TAB snippet K_SHIFT_TAB K_SHIFT_TAB -> { \${1://cuerpo...} } # K_CTRL_ALT_TAB snippet K_CTRL_ALT_TAB K_CTRL_ALT_TAB -> { \${1://cuerpo...} } # K_CTRL_SHIFT_TAB snippet K_CTRL_SHIFT_TAB K_CTRL_SHIFT_TAB -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_TAB snippet K_CTRL_ALT_SHIFT_TAB K_CTRL_ALT_SHIFT_TAB -> { \${1://cuerpo...} } # K_UP snippet K_UP K_UP -> { \${1://cuerpo...} } # K_CTRL_UP snippet K_CTRL_UP K_CTRL_UP -> { \${1://cuerpo...} } # K_ALT_UP snippet K_ALT_UP K_ALT_UP -> { \${1://cuerpo...} } # K_SHIFT_UP snippet K_SHIFT_UP K_SHIFT_UP -> { \${1://cuerpo...} } # K_CTRL_ALT_UP snippet K_CTRL_ALT_UP K_CTRL_ALT_UP -> { \${1://cuerpo...} } # K_CTRL_SHIFT_UP snippet K_CTRL_SHIFT_UP K_CTRL_SHIFT_UP -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_UP snippet K_CTRL_ALT_SHIFT_UP K_CTRL_ALT_SHIFT_UP -> { \${1://cuerpo...} } # K_DOWN snippet K_DOWN K_DOWN -> { \${1://cuerpo...} } # K_CTRL_DOWN snippet K_CTRL_DOWN K_CTRL_DOWN -> { \${1://cuerpo...} } # K_ALT_DOWN snippet K_ALT_DOWN K_ALT_DOWN -> { \${1://cuerpo...} } # K_SHIFT_DOWN snippet K_SHIFT_DOWN K_SHIFT_DOWN -> { \${1://cuerpo...} } # K_CTRL_ALT_DOWN snippet K_CTRL_ALT_DOWN K_CTRL_ALT_DOWN -> { \${1://cuerpo...} } # K_CTRL_SHIFT_DOWN snippet K_CTRL_SHIFT_DOWN K_CTRL_SHIFT_DOWN -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_DOWN snippet K_CTRL_ALT_SHIFT_DOWN K_CTRL_ALT_SHIFT_DOWN -> { \${1://cuerpo...} } # K_LEFT snippet K_LEFT K_LEFT -> { \${1://cuerpo...} } # K_CTRL_LEFT snippet K_CTRL_LEFT K_CTRL_LEFT -> { \${1://cuerpo...} } # K_ALT_LEFT snippet K_ALT_LEFT K_ALT_LEFT -> { \${1://cuerpo...} } # K_SHIFT_LEFT snippet K_SHIFT_LEFT K_SHIFT_LEFT -> { \${1://cuerpo...} } # K_CTRL_ALT_LEFT snippet K_CTRL_ALT_LEFT K_CTRL_ALT_LEFT -> { \${1://cuerpo...} } # K_CTRL_SHIFT_LEFT snippet K_CTRL_SHIFT_LEFT K_CTRL_SHIFT_LEFT -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_LEFT snippet K_CTRL_ALT_SHIFT_LEFT K_CTRL_ALT_SHIFT_LEFT -> { \${1://cuerpo...} } # K_RIGHT snippet K_RIGHT K_RIGHT -> { \${1://cuerpo...} } # K_CTRL_RIGHT snippet K_CTRL_RIGHT K_CTRL_RIGHT -> { \${1://cuerpo...} } # K_ALT_RIGHT snippet K_ALT_RIGHT K_ALT_RIGHT -> { \${1://cuerpo...} } # K_SHIFT_RIGHT snippet K_SHIFT_RIGHT K_SHIFT_RIGHT -> { \${1://cuerpo...} } # K_CTRL_ALT_RIGHT snippet K_CTRL_ALT_RIGHT K_CTRL_ALT_RIGHT -> { \${1://cuerpo...} } # K_CTRL_SHIFT_RIGHT snippet K_CTRL_SHIFT_RIGHT K_CTRL_SHIFT_RIGHT -> { \${1://cuerpo...} } # K_CTRL_ALT_SHIFT_RIGHT snippet K_CTRL_ALT_SHIFT_RIGHT K_CTRL_ALT_SHIFT_RIGHT -> { \${1://cuerpo...} } # recorrido (simple) snippet recorrido (simple) \${1:// Ir al inicio} while (not \${2:// es último elemento}) { \${3:// Procesar el elemento} \${4:// Ir al próximo elemento} } \${5:// Finalizar} # recorrido (de acumulación) snippet recorrido (de acumulación) \${1:// Ir al inicio} \${2:cantidadVistos} := \${3:// contar elementos en lugar actual} while (not \${4:// es último elemento}) { \${4:// Ir al próximo elemento} \${2:cantidadVistos} := \${2:cantidadVistos} + \${3:// contar elementos en lugar actual} } return (\${2:cantidadVistos}) # recorrido (de búsqueda) snippet recorrido (de búsqueda) \${1:// Ir al inicio} while (not \${2:// encontré lo que buscaba}) { \${3:// Ir al próximo elemento} } return (\${2:// encontré lo que buscaba }) # recorrido (de búsqueda con borde) snippet recorrido (de búsqueda con borde) \${1:// Ir al inicio} while (not \${2:// encontré lo que buscaba} && not \${3:// es último elemento}) { \${4:// Ir al próximo elemento} } return (\${2:// encontré lo que buscaba }) # recorrido (de tipos enumerativos) snippet recorrido (de tipos enumerativos) \${1:elementoActual} := \${2:minElemento()} while (\${1:elementoActual} /= \${3:maxElemento()}) { \${4:// Procesar con elemento actual} \${1:elementoActual} := siguiente(\${1:elementoActual}) } \${4:// Procesar con elemento actual} # recorrido (de búsqueda sobre lista) snippet recorrido (de búsqueda sobre lista) \${1:listaRecorrida} := \${2:lista} while (primero(\${1:listaRecorrida}) /= \${3://elemento buscado}) { \${1:elementoActual} := sinElPrimero(\${1:elementoActual}) } return (primero(\${1:listaRecorrida})) # recorrido (de búsqueda sobre lista con borde) snippet recorrido (de búsqueda sobre lista con borde) \${1:listaRecorrida} := \${2:lista} while (not esVacía(\${1:listaRecorrida}) && primero(\${1:listaRecorrida}) /= \${3://elemento buscado}) { \${1:elementoActual} := sinElPrimero(\${1:elementoActual}) } return (not esVacía(\${1:listaRecorrida})) # docs (procedimiento) snippet docs (procedimiento) /* @PROPÓSITO: \${1:...} @PRECONDICIÓN: \${2:...} */ # docs (procedimiento con parámetros) snippet docs (procedimiento con parámetros) /* @PROPÓSITO: \${1:...} @PRECONDICIÓN: \${2:...} @PARÁMETROS: * \${3:nombreDelParámetro} : \${4:Tipo} - \${5:descripción} */ # docs (función) snippet docs (función) /* @PROPÓSITO: \${1:...} @PRECONDICIÓN: \${2:...} @TIPO: \${3:...} */ # docs (función con parámetros) snippet docs (función con parámetros) /* @PROPÓSITO: \${1:...} @PRECONDICIÓN: \${2:...} @PARÁMETROS: * \${3:nombreDelParámetro} : \${4:Tipo} - \${5:descripción} @TIPO: \${6:...} */ `; ================================================ FILE: src/snippets/graphqlschema.js ================================================ "use strict"; exports.snippetText = require("./graphqlschema.snippets"); exports.scope = "graphqlschema"; ================================================ FILE: src/snippets/graphqlschema.snippets.js ================================================ module.exports = `# Type Snippet trigger type snippet type type \${1:type_name} { \${2:type_siblings} } # Input Snippet trigger input snippet input input \${1:input_name} { \${2:input_siblings} } # Interface Snippet trigger interface snippet interface interface \${1:interface_name} { \${2:interface_siblings} } # Interface Snippet trigger union snippet union union \${1:union_name} = \${2:type} | \${3: type} # Enum Snippet trigger enum snippet enum enum \${1:enum_name} { \${2:enum_siblings} } `; ================================================ FILE: src/snippets/haml.js ================================================ "use strict"; exports.snippetText = require("./haml.snippets"); exports.scope = "haml"; ================================================ FILE: src/snippets/haml.snippets.js ================================================ module.exports = `snippet t %table %tr %th \${1:headers} %tr %td \${2:headers} snippet ul %ul %li \${1:item} %li snippet =rp = render :partial => '\${1:partial}' snippet =rpl = render :partial => '\${1:partial}', :locals => {} snippet =rpc = render :partial => '\${1:partial}', :collection => @\$1 `; ================================================ FILE: src/snippets/haskell.js ================================================ "use strict"; exports.snippetText = require("./haskell.snippets"); exports.scope = "haskell"; ================================================ FILE: src/snippets/haskell.snippets.js ================================================ module.exports = `snippet lang {-# LANGUAGE \${1:OverloadedStrings} #-} snippet info -- | -- Module : \${1:Module.Namespace} -- Copyright : \${2:Author} \${3:2011-2012} -- License : \${4:BSD3} -- -- Maintainer : \${5:email@something.com} -- Stability : \${6:experimental} -- Portability : \${7:unknown} -- -- \${8:Description} -- snippet import import \${1:Data.Text} snippet import2 import \${1:Data.Text} (\${2:head}) snippet importq import qualified \${1:Data.Text} as \${2:T} snippet inst instance \${1:Monoid} \${2:Type} where \${3} snippet type type \${1:Type} = \${2:Type} snippet data data \${1:Type} = \${2:\$1} \${3:Int} snippet newtype newtype \${1:Type} = \${2:\$1} \${3:Int} snippet class class \${1:Class} a where \${2} snippet module module \`substitute(substitute(expand('%:r'), '[/\\\\]','.','g'),'^\\%(\\l*\\.\\)\\?','','')\` ( ) where \`expand('%') =~ 'Main' ? "\\n\\nmain = do\\n print \\"hello world\\"" : ""\` snippet const \${1:name} :: \${2:a} \$1 = \${3:undefined} snippet fn \${1:fn} :: \${2:a} -> \${3:a} \$1 \${4} = \${5:undefined} snippet fn2 \${1:fn} :: \${2:a} -> \${3:a} -> \${4:a} \$1 \${5} = \${6:undefined} snippet ap \${1:map} \${2:fn} \${3:list} snippet do do snippet λ \\\${1:x} -> \${2} snippet \\ \\\${1:x} -> \${2} snippet <- \${1:a} <- \${2:m a} snippet ← \${1:a} <- \${2:m a} snippet -> \${1:m a} -> \${2:a} snippet → \${1:m a} -> \${2:a} snippet tup (\${1:a}, \${2:b}) snippet tup2 (\${1:a}, \${2:b}, \${3:c}) snippet tup3 (\${1:a}, \${2:b}, \${3:c}, \${4:d}) snippet rec \${1:Record} { \${2:recFieldA} = \${3:undefined} , \${4:recFieldB} = \${5:undefined} } snippet case case \${1:something} of \${2} -> \${3} snippet let let \${1} = \${2} in \${3} snippet where where \${1:fn} = \${2:undefined} `; ================================================ FILE: src/snippets/html.js ================================================ "use strict"; exports.snippetText = require("./html.snippets"); exports.scope = "html"; ================================================ FILE: src/snippets/html.snippets.js ================================================ module.exports = `# Some useful Unicode entities # Non-Breaking Space snippet nbs   # ← snippet left ← # → snippet right → # ↑ snippet up ↑ # ↓ snippet down ↓ # ↩ snippet return ↩ # ⇤ snippet backtab ⇤ # ⇥ snippet tab ⇥ # ⇧ snippet shift ⇧ # ⌃ snippet ctrl ⌃ # ⌅ snippet enter ⌅ # ⌘ snippet cmd ⌘ # ⌥ snippet option ⌥ # ⌦ snippet delete ⌦ # ⌫ snippet backspace ⌫ # ⎋ snippet esc ⎋ # Generic Doctype snippet doctype HTML 4.01 Strict <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> snippet doctype HTML 4.01 Transitional <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> snippet doctype HTML 5 <!DOCTYPE HTML> snippet doctype XHTML 1.0 Frameset <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> snippet doctype XHTML 1.0 Strict <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> snippet doctype XHTML 1.0 Transitional <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> snippet doctype XHTML 1.1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> # HTML Doctype 4.01 Strict snippet docts <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> # HTML Doctype 4.01 Transitional snippet doct <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> # HTML Doctype 5 snippet doct5 <!DOCTYPE html> # XHTML Doctype 1.0 Frameset snippet docxf <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> # XHTML Doctype 1.0 Strict snippet docxs <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> # XHTML Doctype 1.0 Transitional snippet docxt <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> # XHTML Doctype 1.1 snippet docx <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> # html5shiv snippet html5shiv <!--[if lte IE 8]> <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script> <![endif]--> snippet html5printshiv <!--[if lte IE 8]> <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script> <![endif]--> # Attributes snippet attr \${1:attribute}="\${2:property}" snippet attr+ \${1:attribute}="\${2:property}" attr+\${3} snippet . class="\${1}"\${2} snippet # id="\${1}"\${2} snippet alt alt="\${1}"\${2} snippet charset charset="\${1:utf-8}"\${2} snippet data data-\${1}="\${2:\$1}"\${3} snippet for for="\${1}"\${2} snippet height height="\${1}"\${2} snippet href href="\${1:#}"\${2} snippet lang lang="\${1:en}"\${2} snippet media media="\${1}"\${2} snippet name name="\${1}"\${2} snippet rel rel="\${1}"\${2} snippet scope scope="\${1:row}"\${2} snippet src src="\${1}"\${2} snippet title= title="\${1}"\${2} snippet type type="\${1}"\${2} snippet value value="\${1}"\${2} snippet width width="\${1}"\${2} # Elements snippet a <a href="\${1:#}">\${2:\$1}</a> snippet a. <a class="\${1}" href="\${2:#}">\${3:\$1}</a> snippet a# <a id="\${1}" href="\${2:#}">\${3:\$1}</a> snippet a:ext <a href="http://\${1:example.com}">\${2:\$1}</a> snippet a:mail <a href="mailto:\${1:joe@example.com}?subject=\${2:feedback}">\${3:email me}</a> snippet abbr <abbr title="\${1}">\${2}</abbr> snippet address <address> \${1} </address> snippet area <area shape="\${1:rect}" coords="\${2}" href="\${3}" alt="\${4}" /> snippet area+ <area shape="\${1:rect}" coords="\${2}" href="\${3}" alt="\${4}" /> area+\${5} snippet area:c <area shape="circle" coords="\${1}" href="\${2}" alt="\${3}" /> snippet area:d <area shape="default" coords="\${1}" href="\${2}" alt="\${3}" /> snippet area:p <area shape="poly" coords="\${1}" href="\${2}" alt="\${3}" /> snippet area:r <area shape="rect" coords="\${1}" href="\${2}" alt="\${3}" /> snippet article <article> \${1} </article> snippet article. <article class="\${1}"> \${2} </article> snippet article# <article id="\${1}"> \${2} </article> snippet aside <aside> \${1} </aside> snippet aside. <aside class="\${1}"> \${2} </aside> snippet aside# <aside id="\${1}"> \${2} </aside> snippet audio <audio src="\${1}>\${2}</audio> snippet b <b>\${1}</b> snippet base <base href="\${1}" target="\${2}" /> snippet bdi <bdi>\${1}</bdo> snippet bdo <bdo dir="\${1}">\${2}</bdo> snippet bdo:l <bdo dir="ltr">\${1}</bdo> snippet bdo:r <bdo dir="rtl">\${1}</bdo> snippet blockquote <blockquote> \${1} </blockquote> snippet body <body> \${1} </body> snippet br <br />\${1} snippet button <button type="\${1:submit}">\${2}</button> snippet button. <button class="\${1:button}" type="\${2:submit}">\${3}</button> snippet button# <button id="\${1}" type="\${2:submit}">\${3}</button> snippet button:s <button type="submit">\${1}</button> snippet button:r <button type="reset">\${1}</button> snippet canvas <canvas id="\${1:canvas}"></canvas> snippet caption <caption>\${1}</caption> snippet cite <cite>\${1}</cite> snippet code <code>\${1}</code> snippet col <col />\${1} snippet col+ <col /> col+\${1} snippet colgroup <colgroup> \${1} </colgroup> snippet colgroup+ <colgroup> <col /> col+\${1} </colgroup> snippet command <command type="command" label="\${1}" icon="\${2}" /> snippet command:c <command type="checkbox" label="\${1}" icon="\${2}" /> snippet command:r <command type="radio" radiogroup="\${1}" label="\${2}" icon="\${3}" /> snippet datagrid <datagrid> \${1} </datagrid> snippet datalist <datalist> \${1} </datalist> snippet datatemplate <datatemplate> \${1} </datatemplate> snippet dd <dd>\${1}</dd> snippet dd. <dd class="\${1}">\${2}</dd> snippet dd# <dd id="\${1}">\${2}</dd> snippet del <del>\${1}</del> snippet details <details>\${1}</details> snippet dfn <dfn>\${1}</dfn> snippet dialog <dialog> \${1} </dialog> snippet div <div> \${1} </div> snippet div. <div class="\${1}"> \${2} </div> snippet div# <div id="\${1}"> \${2} </div> snippet dl <dl> \${1} </dl> snippet dl. <dl class="\${1}"> \${2} </dl> snippet dl# <dl id="\${1}"> \${2} </dl> snippet dl+ <dl> <dt>\${1}</dt> <dd>\${2}</dd> dt+\${3} </dl> snippet dt <dt>\${1}</dt> snippet dt. <dt class="\${1}">\${2}</dt> snippet dt# <dt id="\${1}">\${2}</dt> snippet dt+ <dt>\${1}</dt> <dd>\${2}</dd> dt+\${3} snippet em <em>\${1}</em> snippet embed <embed src=\${1} type="\${2} /> snippet fieldset <fieldset> \${1} </fieldset> snippet fieldset. <fieldset class="\${1}"> \${2} </fieldset> snippet fieldset# <fieldset id="\${1}"> \${2} </fieldset> snippet fieldset+ <fieldset> <legend><span>\${1}</span></legend> \${2} </fieldset> fieldset+\${3} snippet figcaption <figcaption>\${1}</figcaption> snippet figure <figure>\${1}</figure> snippet footer <footer> \${1} </footer> snippet footer. <footer class="\${1}"> \${2} </footer> snippet footer# <footer id="\${1}"> \${2} </footer> snippet form <form action="\${1}" method="\${2:get}" accept-charset="utf-8"> \${3} </form> snippet form. <form class="\${1}" action="\${2}" method="\${3:get}" accept-charset="utf-8"> \${4} </form> snippet form# <form id="\${1}" action="\${2}" method="\${3:get}" accept-charset="utf-8"> \${4} </form> snippet h1 <h1>\${1}</h1> snippet h1. <h1 class="\${1}">\${2}</h1> snippet h1# <h1 id="\${1}">\${2}</h1> snippet h2 <h2>\${1}</h2> snippet h2. <h2 class="\${1}">\${2}</h2> snippet h2# <h2 id="\${1}">\${2}</h2> snippet h3 <h3>\${1}</h3> snippet h3. <h3 class="\${1}">\${2}</h3> snippet h3# <h3 id="\${1}">\${2}</h3> snippet h4 <h4>\${1}</h4> snippet h4. <h4 class="\${1}">\${2}</h4> snippet h4# <h4 id="\${1}">\${2}</h4> snippet h5 <h5>\${1}</h5> snippet h5. <h5 class="\${1}">\${2}</h5> snippet h5# <h5 id="\${1}">\${2}</h5> snippet h6 <h6>\${1}</h6> snippet h6. <h6 class="\${1}">\${2}</h6> snippet h6# <h6 id="\${1}">\${2}</h6> snippet head <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>\${1:\`substitute(Filename('', 'Page Title'), '^.', '\\u&', '')\`} \${2} snippet header
    \${1}
    snippet header.
    \${2}
    snippet header#
    \${2}
    snippet hgroup
    \${1}
    snippet hgroup.
    \${1} snippet html5 \${1:\`substitute(Filename('', 'Page Title'), '^.', '\\u&', '')\`} \${2:meta} \${3:body} snippet xhtml5 \${1:\`substitute(Filename('', 'Page Title'), '^.', '\\u&', '')\`} \${2:meta} \${3:body} snippet i \${1} snippet iframe \${2} snippet iframe. \${3} snippet iframe# \${3} snippet img \${2}\${3} snippet img. \${3}\${4} snippet img# \${3}\${4} snippet input \${5} snippet input. \${6} snippet input:text \${4} snippet input:submit \${4} snippet input:hidden \${4} snippet input:button \${4} snippet input:image \${5} snippet input:checkbox \${3} snippet input:radio \${3} snippet input:color \${4} snippet input:date \${4} snippet input:datetime \${4} snippet input:datetime-local \${4} snippet input:email \${4} snippet input:file \${4} snippet input:month \${4} snippet input:number \${4} snippet input:password \${4} snippet input:range \${4} snippet input:reset \${4} snippet input:search \${4} snippet input:time \${4} snippet input:url \${4} snippet input:week \${4} snippet ins \${1} snippet kbd \${1} snippet keygen \${1} snippet label snippet label:i \${7} snippet label:s snippet legend \${1} snippet legend+ \${1} snippet li
  • \${1}
  • snippet li.
  • \${2}
  • snippet li+
  • \${1}
  • li+\${2} snippet lia
  • \${1}
  • snippet lia+
  • \${1}
  • lia+\${3} snippet link \${5} snippet link:atom \${2} snippet link:css \${4} snippet link:favicon \${2} snippet link:rss \${2} snippet link:touch \${2} snippet map \${2} snippet map. \${3} snippet map# \${5}\${6} \${7} snippet mark \${1} snippet menu \${1} snippet menu:c \${1} snippet menu:t \${1} snippet meta \${3} snippet meta:compat \${3} snippet meta:refresh \${3} snippet meta:utf \${3} snippet meter \${1} snippet nav snippet nav. snippet nav# snippet noscript snippet object \${3} \${4} # Embed QT Movie snippet movie \${6} snippet ol
      \${1}
    snippet ol.
      \${2}
    snippet ol+
    1. \${1}
    2. li+\${2}
    snippet opt snippet opt+ opt+\${3} snippet optt snippet optgroup opt+\${3} snippet output \${1} snippet p

    \${1}

    snippet param \${3} snippet pre
    		\${1}
    	
    snippet progress \${1} snippet q \${1} snippet rp \${1} snippet rt \${1} snippet ruby \${1} snippet s \${1} snippet samp \${1} snippet script snippet scriptsrc snippet newscript snippet newscriptsrc snippet section
    \${1}
    snippet section.
    \${2}
    snippet section#
    \${2}
    snippet select snippet select. snippet small \${1} snippet source snippet span \${1} snippet strong \${1} snippet style snippet sub \${1} snippet summary \${1} snippet sup \${1} snippet table \${2}
    snippet table. \${3}
    snippet table# \${3}
    snippet tbody \${1} snippet td \${1} snippet td. \${2} snippet td# \${2} snippet td+ \${1} td+\${2} snippet textarea \${6} snippet tfoot \${1} snippet th \${1} snippet th. \${2} snippet th# \${2} snippet th+ \${1} th+\${2} snippet thead \${1} snippet time