Compare commits

..

314 Commits

Author SHA1 Message Date
Dawa Ometto 804d21e31d Release 3.1.3 2015-04-04 11:45:17 +02:00
Dawa Ometto 6d33687866 Merge pull request #990 from repotag/issue940
Block on no-edit without using middleware
2015-04-03 17:32:20 +02:00
Dawa Ometto 21bb1efb46 Block on no-edit without using middleware 2015-04-03 17:22:51 +02:00
Dawa Ometto 9d0986f1ca Merge pull request #964 from simonzack/mathjax_livepreview
Enable mathjax in live preview
2015-04-02 13:13:25 +02:00
Bart Kamphorst fd483f397f Merge pull request #988 from andrewarrow/fix_template_dir
adding template dir logic to app.rb vs. just the bin
2015-03-30 13:27:54 +02:00
Andrew Arrow 09364850ee adding template dir logic to app.rb vs. just the bin 2015-03-27 15:13:55 -07:00
Dawa Ometto 4d3a8bad4c Merge pull request #985 from uraimo/patch-1
Fixed two broken links in README.md
2015-03-13 14:40:19 +01:00
Umberto Raimondi cc39b0aa41 Fixed two broken links in README.md
The textile site was shut down a few years ago, better refer to wiki for format details.
2015-03-13 14:28:04 +01:00
Dawa Ometto 6fc3b4be75 Merge pull request #970 from repotag/issue969
Add root slash to drag-and-drop upload path. Resolves #969.
2015-01-30 22:13:01 +01:00
Dawa Ometto af6d690fc8 Add root slash to drag-and-drop upload path. Resolves #969. 2015-01-30 22:06:31 +01:00
Dawa Ometto eea5152444 Update README.md 2015-01-30 18:34:18 +01:00
Dawa Ometto 1ca38b625b Update README.md 2015-01-30 18:33:52 +01:00
Sunny Ripert f964407c47 Merge pull request #965 from simonzack/ace_hook
added an initAce hook to allow configuration of the live editor
2015-01-28 17:00:43 +01:00
simonzack 3be2e76ec0 enable $ inline expressions so the example markdown doc works, $ can be escaped using \$ so shouldn't be much of an issue 2015-01-28 19:06:24 +11:00
simonzack f9a9b90ed7 enable mathjax in live preview 2015-01-28 18:00:35 +11:00
Dawa Ometto 1f2917ac22 Merge pull request #959 from simonzack/ace_update
Updated ace so markdown highlights better.
2015-01-27 17:51:47 +01:00
simonzack fe1a8569f6 updated ace 2015-01-27 22:46:30 +11:00
simonzack 33e8d4f328 added an initAce hook to allow configuration of the live editor 2015-01-27 21:16:05 +11:00
Dawa Ometto e183260d0a Merge pull request #956 from repotag/issue_955
Resolves #955.
2015-01-26 23:16:50 +01:00
Dawa Ometto b4023942b4 Remove page file dir from upload path 2015-01-26 23:10:28 +01:00
Dawa Ometto c10c24d90d Merge pull request #953 from simonzack/master
Resolves #952.
2015-01-25 18:45:17 +01:00
simonzack 915f63cac4 pixel tweaks so the left scrollbar is selectable and the viewport takes the whole page 2015-01-26 04:15:14 +11:00
Dawa Ometto 5c30ff4d3e Release 3.1.2 2015-01-23 00:27:04 +01:00
Dawa Ometto 3269f02ba7 Merge pull request #950 from repotag/fix_allow_editing
Set the allow_editing wiki option to true by default.
2015-01-23 00:26:22 +01:00
Dawa Ometto e5c2e3b3eb Set the allow_editing wiki option to true by default. 2015-01-23 00:14:13 +01:00
Dawa Ometto 77f4aee0af Fix test related to gollum-lib TOC update 2015-01-23 00:00:01 +01:00
Dawa Ometto 868cbdfc7b Merge pull request #936 from techwiz24/iss922-sort-pages
Sort `/pages` alphabetically. Resolves #922.
2015-01-13 10:18:51 +01:00
Nathan Lowe a650c0eab8 Sort /pages alphabetically
Previously, the 'All Pages' view was not sorted alphabetically. We need
to sort on the lowercase version of the page names so that lowercase
names do not end up at the bottom of the list and are instead mixed in
alphabetically, as they should be.

Patches test/test_latest_changes_view.rb to include changes needed to
test alphabetical sorting.
2015-01-12 19:04:07 -05:00
Dawa Ometto a7dc8d8c6f Merge pull request #929 from repotag/830_pagename_encodings
Allow utf-8 page names when not using grit. Resolves #830 (when using rugged adapter).
2015-01-04 13:07:27 +01:00
Dawa Ometto 355db16d2c Allow utf-8 page names when not using grit. 2015-01-04 12:20:25 +01:00
Dawa Ometto c54ce41eb7 Merge pull request #928 from LEW21/compare-escape-redirect
Encode the page title in the URL of a diff page
2015-01-03 19:58:56 +01:00
Janusz Lewandowski afb7d4c9d1 Encode the page title in the URL of a diff page. 2015-01-03 17:56:51 +01:00
Dawa Ometto b55cdde9da Merge pull request #924 from rtrvrtg/patch-1
Fix wiki_options errors for hosted Gollum instances.
2014-12-29 12:31:39 +01:00
Geoffrey Roberts 93cbc6c770 Fix intermittent wiki_options errors
Changed to resolve intermittent errors where I'd see the following in my logs:

```text
ERROR -- : app error: undefined method `wiki_options' for Precious::App:Class (NoMethodError)
ERROR -- : /home/gollum/production/releases/20141229-172128/vendor/bundle/ruby/2.0.0/gems/gollum-3.1.1.1anchor4/lib/gollum/editing_auth.rb:10:in `call'
ERROR -- : /home/gollum/production/releases/20141229-172128/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
...
```

I suspect this is the case for Sinatra applications that host instances of Gollum using its `map` feature, as this reflects the production setup we're using it in. Calling @app.settings.wiki_options uses the app instance that gets passed into Precious::EditingAuth, thereby ensuring that we're getting a Gollum instance all the time.
2014-12-29 17:28:47 +11:00
Dawa Ometto 3b1b4a0a96 Update README.md 2014-12-22 20:28:50 +01:00
Dawa Ometto 10b45cb54d Add --bare command line option (see #811). 2014-12-22 20:20:57 +01:00
Dawa Ometto 9d289e571b Describe important security update. 2014-12-18 16:44:23 +01:00
Dawa Ometto cce871c30e Allow running tests with alternative adapter 2014-12-08 01:44:01 +01:00
Dawa Ometto c2b605a90f Release 3.1.1 2014-12-04 14:06:57 +01:00
Dawa Ometto 09149592b5 Set allow_editing in Precious::App to true by default. Closes #911 2014-12-04 13:53:58 +01:00
Dawa Ometto e7410e551b Bring rake dependency up to date. 2014-11-28 14:13:40 +01:00
Dawa Ometto 9d77bc4192 Release 3.1.0 2014-11-28 14:06:36 +01:00
Dawa Ometto 537fa0c423 Merge branch 'rc' 2014-11-28 13:38:33 +01:00
Dawa Ometto c78dbc8bc1 Merge branch 'master' into rc
Conflicts:
	README.md
	lib/gollum/app.rb
2014-11-28 13:36:21 +01:00
Dawa Ometto 249eed5c2c Update HISTORY.md 2014-11-28 13:26:47 +01:00
Dawa Ometto 55eb3b24f7 Merge pull request #904 from ut7/latest_changes_test_fix_dependency
Update test to avoide being dependent on git configuration
2014-11-28 12:39:12 +01:00
Étienne Charignon 508c255d0f Update test to avoide being dependent on git configuration
The previous test implementation was dependent on the git configuration:
	renames = copies

It could then pass on a computer with that config but not passe on
a different developpeur computer who could have a different git configuration.

That new implementation is testing the same behaviour but at a lower
level and is not dependent on the git configuration anymore.
2014-11-28 12:12:23 +01:00
Dawa Ometto 9f8a90c0ac Merge pull request #875 from ut7/latest-changes
Add a "latest changes" button and page
2014-11-27 19:22:42 +01:00
Dawa Ometto 861dc935cb Configure git on Travis 2014-11-27 19:12:54 +01:00
Dawa Ometto 96ef8cacea Merge pull request #899 from repotag/gollum-lib-112
Fix tests, see https://github.com/gollum/gollum-lib/issues/112
2014-11-27 14:11:01 +01:00
Dawa Ometto 5f3ecc8713 Merge pull request #901 from repotag/prepare-release
Prepare new release.
2014-11-27 13:58:24 +01:00
Dawa Ometto 8b8ef0eb46 Prepare new release. 2014-11-27 13:51:02 +01:00
Dawa Ometto 2dbea54c84 Merge pull request #900 from repotag/adapter-flag
Implement git adapter CLI flag.
2014-11-26 00:47:39 +01:00
Dawa Ometto a776d9fb6f Implement git adapter CLI flag. 2014-11-26 00:33:03 +01:00
Dawa Ometto 57b7bbff5a Update README.md
Updated command line options.
2014-11-25 23:43:42 +01:00
Dawa Ometto a832b0ed54 Fix tests, see https://github.com/gollum/gollum-lib/issues/112 2014-11-25 19:54:31 +01:00
Dawa Ometto 3ec75b84ae Merge pull request #898 from bambycha/editable
Disable editing from UI
2014-11-22 12:15:24 +01:00
Roman Bambycha b932763080 add function to disable editing, resolves #879 2014-11-17 19:46:46 +02:00
Étienne Charignon 374f8f2f69 First attempt at a global latest changes overview.
- uses a wiki_options entry named :latest_changes_count instead of a
  constant
- lists modified pages with links
2014-11-11 22:43:34 +01:00
Dawa Ometto 226c253d5a Merge pull request #895 from repotag/rc_fix_sidebar
Fix sidebar, header, and footer, and add regression test.
2014-11-10 22:54:05 +01:00
Dawa Ometto c78a9f7950 Fix sidebar, header, and footer, and add regression test. 2014-11-10 22:39:42 +01:00
Bart Kamphorst 7264510ab2 Merge pull request #893 from tuftedocelot/add-systemd
Add systemd service file to contrib and move openrc files to contrib directory as well.
2014-11-06 22:03:18 +01:00
Dawa Ometto 3458ec6511 Merge pull request #894 from repotag/892-view-file-revisions
Route /filename/[commit-sha] will display specific revision of a file. Resolves #892.
2014-11-06 21:57:25 +01:00
Dawa Ometto 2c80db6678 Route /filename/[commit-sha] will display specific revision of a file. Resolves #892. 2014-11-06 21:31:23 +01:00
tuftedocelot 439aa6e4f5 Prepare contrib directory
Move openrc files to contrib/ in conjunction with systemd service.
Update gemspec to bundle contrib/ into the gem.
2014-11-06 14:20:33 -06:00
tuftedocelot adf544dca9 Add systemd service file to contrib
Supersedes #887 to add a systemd unit file which will run as a user and
whose gollum path and options can be changed as needed.
2014-11-06 10:33:18 -06:00
Bart Kamphorst 0965269ee9 Merge pull request #890 from repotag/ignore_footer_header_sidebar_if_empty
Do not render footers, headers and sidebars if (after formatting) they are empty. Resolves #398 .
2014-11-05 09:10:28 +01:00
Dawa Ometto 19d370c4e9 Merge pull request #891 from repotag/704-showall-files
Resolves #704. Implements the fix proposed by @bdillahu in https://github.com/gollum/gollum/pull/767 and modifies tests accordingly.
2014-11-05 02:48:03 +01:00
Dawa Ometto cee0f8b652 Change pages display to handle non-wiki file types with --show_all enabled 2014-11-05 02:30:07 +01:00
Bart Kamphorst 37664d3487 Do not render footers, headers and sidebars if (after formatting) they are empty. Resolves #398 . 2014-11-05 02:15:35 +01:00
Dawa Ometto 5a78015d81 Merge pull request #889 from repotag/888-h1-logic
Page header now uses h1-title logic. Resolves #888.
2014-11-04 23:34:42 +01:00
Dawa Ometto 7250962ba3 Page header now uses h1-title logic. 2014-11-04 23:23:46 +01:00
Bart Kamphorst 442120bfdb Merge pull request #884 from tuftedocelot/issue600-docs
add detail to inline help
2014-10-28 20:25:52 +01:00
tuftedocelot de624d1e54 add detail to inline help 2014-10-27 07:12:43 -05:00
Dawa Ometto 523029cc45 Merge pull request #876 from LEW21/delete-commit-rc
Fix the commit information for page deletion. Solves #807.
2014-10-11 14:21:50 +02:00
Janusz Lewandowski 934affe419 Fix the commit information for page deletion.
Now they will be authored by the gollum.author.
2014-10-11 13:15:23 +02:00
Bart Kamphorst 55b9af1589 Merge pull request #869 from lucas-clemente/rc
allow uploading files by drag and drop (if uploading files is enabled).
2014-10-05 08:22:40 -04:00
Lucas Clemente 16dd7e46ef allow uploading files by drag and drop 2014-10-05 14:15:48 +02:00
Dawa Ometto 851c77d8f2 Merge pull request #847 from hardywu/master
add --mathjax-config to inject root-repo/mathjax.config.js. Closes #842.
2014-10-05 12:41:03 +02:00
Hardy ee55b74898 add --mathjax [CONFIG] to inject root-repo/[CONFIG] file,
which is similar to the behavior of --css and --js.
CONFIG is "mathjax.config.js" by default.
2014-10-04 23:09:10 -04:00
Dawa Ometto 13fc1e5c66 Merge pull request #872 from Mogztter/issue-870
Resolves #870.
2014-10-04 13:53:03 +02:00
Dawa Ometto 87112c2942 Merge pull request #873 from Mogztter/issue-871
Fix css selector for Asciidoctor h1 html ouptput
2014-10-04 13:47:26 +02:00
Guillaume Grossetie 2664fdca30 Fix css selector for Asciidoctor h1 html ouptput 2014-10-04 12:45:35 +02:00
Guillaume Grossetie e05f523145 Horizontal scroll when table is too wide 2014-10-04 12:37:21 +02:00
Geoffrey Roberts 1148d29439 Made the Gollum theme responsive.
Not a particularly comprehensive change in style, just one that removes all the fixed sizing for browsers below 940px in width.

Closes #831.
2014-10-02 00:50:29 +02:00
Sunny Ripert 7ba52978d1 Merge pull request #864 from Mogztter/asciidoc-headers
Adds headers to the AsciiDoc editor
2014-09-26 15:48:47 +02:00
Sunny Ripert 138a9fee43 Merge branch 'master' into rc 2014-09-24 10:58:10 +02:00
Sunny Ripert 1d522eaf0d Merge pull request #862 from Mogztter/asciidoctor-1.5.0-syntax
Use Asciidoctor 1.5.0 new syntax backtick
2014-09-22 13:51:40 +02:00
Sunny Ripert b5c5da64c9 Merge pull request #859 from Mogztter/patch-1
Update installation procedure for AsciiDoc
2014-09-22 13:49:05 +02:00
Guillaume Grossetie 8466425836 Adds headers to the AsciiDoc editor 2014-09-18 20:03:35 +02:00
Guillaume Grossetie b774ee5cd0 Use Asciidoctor 1.5.0 new syntax backtick
Asciidoctor 1.5.0 is now using backtick for inline code.
Replaces ASCIIDoc by AsciiDoc to respect the case.
2014-09-18 19:50:54 +02:00
Guillaume Grossetie 7e2e0e926b Update README.md
GitHub Markup is now using asciidoctor
2014-09-17 19:09:28 +02:00
Dawa Ometto 30f673c63c Update README.md with installation instructions 2014-09-13 12:29:39 +02:00
Bart Kamphorst bb5be728e3 Merge pull request #853 from joscarsson/patch-1
Update --allow-uploads help text in README
2014-09-09 17:19:12 +02:00
Jonas Oscarsson 0be5d1c657 Update --allow-uploads help text in README 2014-09-09 16:57:33 +02:00
Sunny Ripert d143e6be06 Merge pull request #841 from marcusps/mathjax-cdn-fix
Fix MathJax CDN URL
2014-07-24 13:52:33 +02:00
Marcus P S e65a78a5f5 Fix MathJax CDN URL
According to the [MathJax Blog](http://www.mathjax.org/changes-to-the-mathjax-cdn/), MathJax will retire the `rackcdn` CDN address at the end of this month. Updated the script to used the new CDN URL, and also made it so that the URL is HTTP/HTTPS agnostic, following the [MathJax docs](http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn).
2014-07-23 11:46:22 -04:00
Dawa Ometto 4f443a3c62 Merge pull request #805 from MrJaeger/respect-dollar-signs
Allow for $ characters on front-end editor
2014-06-01 17:54:52 +02:00
bootstraponline ff82ddea97 Add font awesome link 2014-04-05 14:38:34 -04:00
bootstraponline 2e2d3f5e87 Release 3.0.0 2014-04-05 14:25:55 -04:00
bootstraponline 491b1041f8 Add publish alias. Fix rake release 2014-04-05 14:25:39 -04:00
bootstraponline ce192d33f7 Add mocha development dependency 2014-04-05 14:12:55 -04:00
bootstraponline ca1cb64026 Use SVG badges 2014-04-05 13:55:52 -04:00
bootstraponline 71b5f5e469 Update gemspec dependencies 2014-04-05 13:35:11 -04:00
bootstraponline 946567f903 Merge pull request #817 from bootstraponline/test_fixes
Use FontAwesome for anchor links. Fix tests
2014-04-05 13:30:58 -04:00
bootstraponline 036e739511 Fix CSS to match github 2014-04-05 13:30:23 -04:00
bootstraponline 87a95b85c5 Use FontAwesome 4.0.3 for anchor links 2014-04-05 13:30:03 -04:00
bootstraponline 4f49859bf7 Format css 2014-04-05 13:30:03 -04:00
bootstraponline 2c53e55533 Update css 2014-04-05 13:30:03 -04:00
bootstraponline 2ae75978dd Format code 2014-04-05 13:30:02 -04:00
bootstraponline 452d825e66 Clean up tests. Remove templates 2014-04-05 13:30:02 -04:00
bootstraponline a7a1c4f81e Fix utf8 test 2014-04-05 13:30:02 -04:00
bootstraponline 00740eb9e8 Fix locale warning 2014-04-05 13:30:02 -04:00
bootstraponline d76264c255 Update version to 3.0.0 2014-04-05 13:28:04 -04:00
bootstraponline 2297ce418d Test on Ruby 2.1.1
The current stable version of Ruby is 2.1.1 so gollum should be tested there.
2014-04-02 23:30:20 -04:00
Sunny Ripert fec85e6c59 Merge pull request #815 from nyjt/patch-1
Travis-CI SVG badge [ci skip]
2014-03-28 14:49:01 +01:00
Jozsef Nyitrai 54efa35fb3 Fix broken travis-ci badge 2014-03-28 14:08:21 +01:00
bootstraponline 988aebf630 Merge pull request #813 from bootstraponline/update_template_css
Update template.css to match github
2014-03-14 22:20:08 -04:00
bootstraponline d2f7766aea Update template.css to match github 2014-03-14 22:19:33 -04:00
Daniel Kimsey 25d30aee64 Release 2.7.0 2014-02-20 11:10:00 -05:00
Daniel Kimsey 8af92da23c Update version of gollum-lib to 2.0.0 2014-02-20 11:07:59 -05:00
Andrew Jaeger 08dd36e1b0 In the javascript editor, '$' characters were getting stomped on when
trying to remove backreferences after doing transformations on text
(Bolding, Italicizing, etc.).  This can be fixed by first escaping the
string to be transformed and then unescaping it afterwards.
2014-02-08 14:18:36 -08:00
Sunny Ripert 324ff0a17c Merge pull request #802 from ExocTBlid/master
Printing CSS
2014-02-04 14:05:15 -08:00
Blomquist, Ethan cfb372e5e2 Another minor update... 2014-02-03 10:53:37 -07:00
Blomquist, Ethan 6513c732ba Minor update to the delete link for printing. 2014-02-03 10:50:13 -07:00
Blomquist, Ethan c4ea869223 Added print.css to remove action buttons and delete link for better print format. 2014-02-03 10:45:06 -07:00
Dawa Ometto 5387267675 Merge pull request #800 from budziq/delete_crash
Fixes crash if "delete page" was selected in preview of page that being created
2014-02-01 10:01:57 -08:00
Dawa Ometto 8e4c3cc562 Merge pull request #801 from budziq/history_crash_clean
fixes crash when selected "history" in preview of page being created
2014-02-01 09:58:42 -08:00
Michał Budzyński 8b6b0699e5 fixes crash when selected "history" in preview of page being created
- history button is hidden in newly created page preview as it makes no sense
- redirect to '/' if page does not exist yet
2014-01-31 02:43:03 +01:00
Michał Budzyński 229bff1658 Fixes crash if "delete page" was selected in preview of page that being created 2014-01-31 02:10:15 +01:00
Jamie Oliver 7a59d37350 Merge pull request #794 from github/ungithub-upstream
Status of GitHub Wikis
2014-01-28 11:12:20 -08:00
Dawa Ometto d06b1e7883 Merge pull request #787 from akretion/fix-upload-path
fixes bug #786 per_page_uploads: incorrect file path if page is inside some directory
2014-01-25 02:12:55 -08:00
Akretion BOT c8a284db9d fixes bug #786 per_page_uploads: incorrect file path if page is inside some directory 2014-01-25 04:53:19 +01:00
Dawa Ometto c7d6aceff4 Update sanitization.md 2014-01-23 19:33:25 +01:00
Dawa Ometto 7ea45d5e89 Update sanitization.md
Document customization of sanitation settings; see https://github.com/gollum/gollum/issues/759
2014-01-23 19:29:20 +01:00
Brandon Keepers 48c4aafb15 Remove reference to GitHub in readme
:(
2014-01-21 09:40:41 -08:00
Bart Kamphorst ff302ed842 Fixes alignment of tables (issue #700).
Fixes https://github.com/gollum/gollum/issues/700 .
2014-01-21 16:55:05 +01:00
Dawa Ometto 20a2424b83 Merge pull request #793 from repotag/flag_for_per_page_uploads
Add optional 'mode' argument to --allow-uploads flag, allowing user to toggle per_page_uploads.
2014-01-21 03:34:43 -08:00
Dawa Ometto de0f34a27a Add optional 'mode' argument to --allow-uploads flag, allowing user to toggle per_page_uploads. 2014-01-21 12:14:47 +01:00
Sunny Ripert d0992cce3f Merge pull request #790 from akretion/better-redirect-after-upload
fixes #788 better redirect after file upload
2014-01-20 03:13:13 -08:00
Akretion BOT 15feeb3614 fixes #788 better redirect after file upload 2014-01-19 23:24:01 +01:00
Jamie Oliver fc0a879e52 Support Ruby 2.1.0. Closes #784 2014-01-11 14:42:35 +00:00
Daniel Kimsey 9b675146a2 Merge pull request #782 from Joe8Bit/master
Update README.md to show options
2014-01-10 07:26:25 -08:00
Joe Pettersson 4d0bdcc8c0 Update README.md to show options 2014-01-10 13:47:15 +00:00
bootstraponline 0abdb67687 Merge pull request #781 from anchor/per-page-uploads
Implement the ability to store uploads on a per-page basis
2014-01-04 19:11:07 -08:00
Matt Palmer d1fb98cf1b Merge remote-tracking branch 'upstream/master' into per-page-uploads
Conflicts:
	lib/gollum/public/gollum/javascript/gollum.js
2014-01-03 17:49:53 +11:00
Matt Palmer 5eac24eacb Implement the ability to store uploads on a per-page basis
Storing all uploaded files in a single directory kinda sucks when you've got
a largish wiki, or the possibility of filename collisions.  With this patch,
though, you can set `:per_page_uploads => true` in your wiki settings and
have the file uploaded to a directory named for the page you were on when
you clicked 'Upload'.
2014-01-03 15:34:24 +11:00
bootstraponline 3fd16daeca Release 2.6.0 2014-01-02 23:32:41 -05:00
bootstraponline d9b38c3b73 Use baseUrl for /uploadFile
Thanks @mpalmer
https://github.com/gollum/gollum/pull/780
2014-01-02 23:03:33 -05:00
bootstraponline 0a5176c1ee Merge pull request #780 from peterkeen/upload-base-path
Base upload button action on home page url
2014-01-02 19:50:35 -08:00
Pete Keen b836b0e273 Base upload button action on home page url 2014-01-01 17:05:32 -05:00
bootstraponline 9a41e2a65d Merge pull request #772 from zorun/master
Prevent indexing of old versions of a page (fixes #768)
2014-01-01 09:05:07 -08:00
bootstraponline cb1b74ed7b Merge pull request #776 from eucher/first_slash_in_create
First slash in create
2014-01-01 09:02:58 -08:00
bootstraponline e25e5d9768 Merge pull request #779 from anchor/semantic-versioning
Fix version specifiers
2014-01-01 09:02:14 -08:00
Matt Palmer 9f3766952f Fix version specifiers
Adjusted the version specs on the two gems that explicitly state they are
SemVer compliant, and fixed up the one dependency that correctly *could* have
used ~> but didn't.
2013-12-31 15:18:15 +11:00
bootstraponline cb4471b07f Merge pull request #778 from jhogendorn/baddialog
Fixes dialog hiding so it doesnt block the UI
2013-12-08 08:55:28 -08:00
Joshua Hogendorn 9fa7eac41f Fixes dialog hiding so it doesnt block the UI 2013-12-08 20:15:59 +10:00
zorun 94fa985550 Add a test for issue #772 2013-12-06 02:46:15 +01:00
Evgeni Cherdancev 1c498ead35 gsub before begin 2013-11-28 12:32:08 +07:00
Evgeni Cherdancev 5abc983172 write_page first slash fix 2013-11-28 12:26:06 +07:00
zorun 7a0d4919b0 Prevent indexing of old versions of a page (fixes #768) 2013-11-22 12:49:42 +01:00
bootstraponline d5e9183877 Merge pull request #762 from pdenes/add_template_dir_option
add option to specify custom template directory
2013-11-11 14:25:27 -08:00
bootstraponline 9b39a51e9f Merge pull request #758 from samer/master
Fix revert for pages in directories
2013-11-11 14:25:10 -08:00
pdenes bec7eabd1c add option to specify custom template directory 2013-11-06 21:46:54 +00:00
Samer N cd3791087f Fix revert for pages in directories, as seen in issue #736 2013-11-04 13:03:31 +02:00
Jamie Oliver 714985e377 Release 2.5.2 2013-11-02 11:31:21 +00:00
Jamie Oliver 76c37dce96 Upgrade gollum-lib 2013-11-02 11:21:39 +00:00
bootstraponline 5a9af40058 Release 2.5.1 2013-10-15 07:20:13 -04:00
bootstraponline e871ff35b7 Merge pull request #753 from bootstraponline/master
Update gemspec
2013-10-15 04:19:41 -07:00
bootstraponline ecc6c32933 Update gemspec 2013-10-15 07:11:36 -04:00
bootstraponline 831cf61a08 Merge pull request #747 from invenia/master
Created OpenRC init script.
2013-10-12 12:18:22 -07:00
Curtis Vogt cc1231dece Added MIT license to init script header. 2013-09-30 13:52:34 +00:00
bootstraponline bb3d1a165b Merge pull request #751 from 1gor/patch-1
Added dependency 'github-markdown'
2013-09-29 09:29:23 -07:00
1gor 3da0426c54 Added dependency 'github-markdown' 2013-09-29 10:49:11 +06:00
Curtis Vogt e01aa25be3 Added basic logging to OpenRC script. 2013-09-27 17:02:16 +00:00
Abhijit Menon-Sen ee2f9d8dcb Merge pull request #748 from singlebrook/upload_instructions
Add some instructions to upload dialog
2013-09-27 07:30:40 -07:00
Leon Miller-Out 4d8677965c Add instructions for how to access file post-upload 2013-09-27 10:16:35 -04:00
Leon Miller-Out 72729d5510 Whitespace 2013-09-27 10:16:35 -04:00
Curtis Vogt 0b57e70c87 Removed explictly set license in OpenRC init script. 2013-09-27 14:09:00 +00:00
Curtis Vogt 033d6489f8 Created OpenRC init script. 2013-09-26 16:28:19 +00:00
Abhijit Menon-Sen 8608007337 Merge pull request #743 from singlebrook/upload_action_path
Use correct path for uploadFile action even when current page is in a folder.
2013-09-17 21:32:33 -07:00
Leon Miller-Out 665e493570 Use correct path for uploadFile action even when looking at a page in a folder 2013-09-17 12:36:53 -04:00
bootstraponline eb1e2f60f3 Fix #740 2013-09-12 08:49:27 -04:00
bootstraponline dc637f0a9b Merge pull request #734 from repotag/no_grit
No grit
2013-08-11 08:07:33 -07:00
Dawa Ometto f81634728d Replaced grit calls to new calls in gollum-lib 1.06 (set_git_timeout and set_git_max_filsize). Removed grit dependency from tests, using cp of empty.git instead. Replaced Grit exceptions with equivalents in the Gollum module. 2013-08-11 13:19:43 +02:00
bootstraponline 440cd5ebc0 Merge pull request #735 from ngyuki/fix-edit-for-multibyte
Fix `Encoding::CompatibilityError` of edit view.
2013-08-10 11:27:14 -07:00
Jamie Oliver 1cd7d0f205 Use display path in rename dialog. Fixes #703 2013-08-10 11:41:15 +01:00
ngyuki a69d62911c Fix editing of the sidebar with multi-byte characters. 2013-08-09 14:45:19 +09:00
ngyuki 395e9bd006 Add test for editing the sidebar, including multi-byte characters. 2013-08-09 14:41:52 +09:00
Jamie Oliver 90e20810d5 Do not force downcase on URLs. Fixes #621 2013-08-04 18:27:32 +01:00
bootstraponline 9c714e7687 Release 2.5.0 2013-07-21 07:22:46 -04:00
bootstraponline 6c3523d61c Merge pull request #725 from amenonsen/upload
Add a file Upload button
2013-07-21 04:19:58 -07:00
Abhijit Menon-Sen 183840b793 Add file upload functionality
Adds an :allow_uploads wiki option, an --allow-uploads flag to
bin/gollum, an "Upload" button with a file upload dialog, and a
handler to commit uploaded files into the repository.

:allow_uploads defaults to false, to prevent unauthenticated users
from uploading arbitrary files into the repository (albeit only in
the uploads directory).

This code is based on the patch from @l3iggs at
https://github.com/gollum/gollum/issues/694, but the handling on the
backend is completely rewritten to use the Committer infrastructure.
2013-07-21 16:28:15 +05:30
bootstraponline 4e2856aa64 Update gollum-lib to 1.0.4 2013-07-20 19:24:26 -04:00
Abhijit Menon-Sen 4627a39165 Merge pull request #727 from amenonsen/no-live-preview
Disable live preview by default, because it's broken (closes #718)
2013-07-18 05:39:48 -07:00
bootstraponline c87cbe83d2 Fix #709
Require Ruby >= 1.9
2013-07-18 08:17:17 -04:00
bootstraponline f05282badf Drop 1.8.7 support on Travis (It's broken)
Don't email me on fail
2013-07-18 08:16:01 -04:00
Abhijit Menon-Sen 957879346e Merge pull request #726 from amenonsen/fixes
Trivial fix: set label.for to the input's id
2013-07-17 18:53:37 -07:00
Abhijit Menon-Sen 87e64f67f3 A tiny patch to disable live preview (#718) 2013-07-17 14:24:36 +05:30
Abhijit Menon-Sen 43840d246d Trivial fix: set label.for to the input's id 2013-07-17 13:31:46 +05:30
bootstraponline 4aeb9af8a7 Release 2.4.15 2013-06-18 22:19:34 -04:00
dekimsey b37acb8bc6 Merge pull request #711 from cpence/master
Add support for file streaming
2013-06-18 19:15:57 -07:00
Charles Pence 433865e927 Require newer gollum-lib. 2013-06-18 22:10:02 -04:00
Charles Pence 5428161e0f Add support for on-disk file streaming. 2013-06-18 21:49:38 -04:00
Jamie Oliver db0b536b5b Release 2.4.14 2013-06-15 17:20:48 +01:00
Jamie Oliver a4e50908fb Upgrade gollum-lib 2013-06-15 17:12:46 +01:00
bootstraponline 96b89fe83d Add version badge 2013-05-31 22:05:23 -03:00
Jamie Oliver adb131f131 Upgrade gollum-lib 2013-05-31 10:04:01 +01:00
bootstraponline 757ab87e8a Fix shoulda version
Gem::InstallError: shoulda-matchers requires Ruby version >= 1.9.2

Gollum is stuck on 1.8 so use the old version of shoulda.
2013-05-27 16:16:17 -03:00
bootstraponline f1d1db1159 Update useragent and shoulda 2013-05-27 16:07:24 -03:00
bootstraponline 3942bf60a6 Merge pull request #698 from ddeyoung/improve-page-create
Leaving off the leading slash in a page name with a subdirectory will corrupt the repository
2013-05-27 10:47:31 -07:00
Dustin DeYoung e2c0dcc0da Ruby 1.8.7 compatible double slash gsub 2013-05-26 16:14:56 -04:00
Dustin DeYoung f63180d8d8 Correct 1.8.7 negative match assertion. 2013-05-26 11:16:43 -04:00
Dustin DeYoung 999bbf3d50 Regex is 1.8.7 compatible for subpage create tests 2013-05-26 11:10:50 -04:00
Dustin DeYoung eab612bdd0 Remove temporary change in app test. 2013-05-26 11:03:40 -04:00
Dustin DeYoung 1147186b4c Page create with a relative path forces an absolute path. 2013-05-26 10:03:23 -04:00
Sunny Ripert a88314e061 Merge pull request #697 from bitmorse/master
Typo in page.mustache
2013-05-17 10:48:56 -07:00
Sam Sulaimanov 9221f5528d Fix form tag typo in page template. 2013-05-17 18:23:50 +02:00
bootstraponline 520f60cd65 Merge pull request #693 from alecperkins/patch-1
Add bottom margin to hr elements
2013-05-08 15:00:55 -07:00
Alec Perkins 84c85774e8 Add bottom margin to hr elements
This gives some more consistent spacing.
2013-05-08 18:09:39 -03:00
bootstraponline 1f118deed9 Merge pull request #687 from DirtYiCE/gravatar-fix
Fix gravatar url generation
2013-04-13 14:04:20 -07:00
Kővágó, Zoltán 55ce07ae73 Fix gravatar url generation 2013-04-13 22:18:04 +02:00
Sunny Ripert 85677d5e91 README trimming to point to the wiki
-> gollum/gollum#1
2013-04-08 20:32:11 +03:00
Jamie Oliver 04f9be15b8 Upgrade minitest-reporters. Fixes #684 2013-04-08 07:24:05 +01:00
Jamie Oliver 09cd72a829 Add license to gemspec. Fixes #681 2013-04-05 17:57:17 +01:00
Jamie Oliver f5f5ad70e3 Downgrade minitest-reporters. Temporary fix for #684 2013-04-05 16:03:20 +01:00
Jamie Oliver a0774b320a Update useragent 2013-04-05 15:00:41 +01:00
bootstraponline 4feea6051a Release 2.4.13 2013-04-03 19:28:29 -04:00
dekimsey f548ea757b Merge pull request #682 from dekimsey/missing-buttons
Fix missing new/rename buttons
2013-04-03 08:21:12 -07:00
Daniel Kimsey abc8ea5280 Fix missing new/rename buttons 2013-04-03 10:41:36 -04:00
bootstraponline bacd2313fb Release 2.4.12 2013-04-02 19:56:01 -04:00
bootstraponline 63295d3f9b Update gollum lib 2013-04-02 20:55:12 -03:00
Daniel Kimsey 9c25eb20cf Add a title attr to show full date on history log 2013-04-01 15:53:08 -04:00
bootstraponline 7f533f33ae Merge pull request #677 from uk-ar/fix-dependancy
Fix library dependancy issue when running with config.ru
2013-03-29 15:39:35 -07:00
uk-ar 352b4e1ed8 Fix NoMethodError when running with sample config.ru 2013-03-30 05:59:36 +09:00
Sunny Ripert 9a4252b579 Merge pull request #676 from crisman/master
Class duplication issues in frontend
2013-03-28 01:37:10 -07:00
Daniel Crisman ed7011c229 Deduplicate button action-* class names 2013-03-27 14:23:28 -04:00
Daniel Crisman 4ddd6a5207 Merge duplicate class attributes (class="jaws") 2013-03-26 13:47:21 -04:00
bootstraponline 0a74c7cfd2 Merge pull request #675 from uk-ar/fix-error-in-irb
Fix error when running with --irb option
2013-03-25 18:18:21 -07:00
uk-ar d84fdc7599 Fix error when running with --irb option
uninitialized constant Gollum::Wiki (NameError)
2013-03-26 04:49:29 +09:00
uk-ar dac1268266 Update the example of config.ru in the README 2013-03-26 04:25:53 +09:00
bootstraponline b42db1c7c1 Fix #668 2013-03-22 22:07:57 -03:00
bootstraponline 7a7a27c5c7 Merge pull request #672 from bootstraponline/master
Try removing dependencies
2013-03-22 18:06:25 -07:00
bootstraponline af83186b10 Try removing deps 2013-03-22 21:03:05 -04:00
bootstraponline a8646f8fe7 Update shoulda 2013-03-22 20:59:40 -03:00
bootstraponline 01c1e30284 Use latest sinatra 2013-03-22 20:49:40 -03:00
bootstraponline b3980f9e39 Merge pull request #669 from gollum/sinatra1.4
Upgrade to sinatra 1.4
2013-03-22 15:26:27 -07:00
Sunny Ripert c9fd50d23e Upgrade to sinatra 1.4 2013-03-22 13:45:08 +01:00
Sunny Ripert ea3544f46d Syntax highlighting in README 2013-03-22 13:18:30 +01:00
Sunny Ripert 4e04f5f540 README mention of gollum-lib and whitespace fixes 2013-03-22 12:27:20 +01:00
bootstraponline b1021cf233 Update MathJax docs 2013-03-21 23:23:42 -03:00
bootstraponline 8fa3529123 Merge pull request #667 from cpence/master
Tweak TeX math delimiters
2013-03-21 19:13:34 -07:00
Charles Pence 3b494c235a Tweak TeX math delimiters. 2013-03-21 22:09:01 -04:00
bootstraponline 1641c3e3e8 Update gemspec 2013-03-21 21:53:48 -04:00
bootstraponline ccd5d850ac Merge pull request #664 from jamieoliver/feature/gollum-lib
Move gollum back end to gollum-lib #647
2013-03-20 16:54:57 -07:00
Jamie Oliver b989f160cf Merge branch 'master' into feature/gollum-lib
Conflicts:
	lib/gollum/markup.rb
	test/test_gitcode.rb
2013-03-20 07:46:11 +00:00
bootstraponline 54e144564c Merge pull request #660 from simonista/fix-github-links
Fix for embedding code from github
2013-03-19 17:25:36 -07:00
bootstraponline ab8599da6d Update README.md 2013-03-19 21:11:41 -03:00
bootstraponline 0885702873 Update README.md 2013-03-19 21:10:22 -03:00
bootstraponline 0083bc9302 Merge pull request #661 from simonista/custom-js
Add option for custom js (like custom css)
2013-03-19 17:06:38 -07:00
Jamie Oliver cbc0821928 Merge branch 'master' into feature/gollum-lib
Conflicts:
	lib/gollum/markup.rb
2013-03-19 23:54:27 +00:00
bootstraponline 7a70169d06 Fix style 2013-03-19 19:35:54 -03:00
bootstraponline bf2377ac11 Merge pull request #662 from lemonsqueeze/clearfloats
[[_]] float clearing tag experiment
2013-03-19 15:35:18 -07:00
Jamie Oliver 1f79126b27 Move gollum back end to gollum-lib #647 2013-03-19 22:11:09 +00:00
lemonsqueeze 624e324383 [[_]] float clearing tag experiment 2013-03-19 18:15:01 +01:00
Simon Williams 846ebb285e Add option for custom js (like custom css)
* Add a new 'js' flag to indicate you want to embed a file named 'custom.js'
  which should exist at the root of the wiki
2013-03-17 18:42:01 -06:00
Simon Williams e567759935 Fix for embedding code from github 2013-03-17 18:27:40 -06:00
bootstraponline fe706c184e Merge pull request #659 from cpence/master
Fix symlink base path, don't allow in bare repos
2013-03-16 20:39:00 -07:00
Charles Pence 90bbb8e348 Fix symlink base path, don't allow symlinks in bare repos. 2013-03-16 22:00:19 -04:00
bootstraponline e21ec540c2 Merge pull request #658 from cpence/master
Basic support for symbolic links
2013-03-16 18:08:40 -07:00
Charles Pence 2a4517ced4 Add basic support for symbolic links. 2013-03-16 21:07:05 -04:00
bootstraponline 8c8d151b3e Update README.md 2013-03-16 20:39:31 -03:00
bootstraponline 44a3cf1934 Merge pull request #652 from simonista/update-references
Update references to new project location
2013-03-15 15:04:33 -07:00
Jamie Oliver 5dcd3c8c8f Merge pull request #651 from simonista/fix-specs
Fix tests that depended on old github location
2013-03-15 01:52:46 -07:00
Simon Williams 251bd7cd3d Update references to new project location
* Change 'github/gollum' references to 'gollum/gollum'
2013-03-14 23:22:51 -06:00
Simon Williams 02dfb0a8c1 Fix tests that depended on old github location
* Two tests depended on the following file existing:
  github/gollum/master/test/file_view/1_file.txt
2013-03-14 23:14:39 -06:00
bootstraponline 544d499ab1 Merge pull request #646 from bootstraponline/master
Fix #645
2013-03-04 19:39:07 -08:00
bootstraponline 8ebc2f7079 Fix #645 2013-03-04 19:32:55 -05:00
bootstraponline a31ba16070 Merge pull request #644 from dekimsey/empty-commit-612
Fix empty commits and non-descript revert messages (For #612)
2013-03-04 15:31:46 -08:00
Daniel Kimsey 60e3baad8a Fix empty commits and non-descript revert messages
* Empty commits via editor now have the message: "[no message]"
  * Reverts now have the slightly more useful message: "Revert commit #1234567"
2013-03-04 12:37:16 -05:00
bootstraponline f720a84831 Merge pull request #643 from mattr-/master
Update the GFM link in the README
2013-02-28 05:05:33 -08:00
Matt Rogers b74b2c4399 Update the GFM link in the README
github.github.com/github-flavored-markdown shows a different version of
the page for a split second, and then redirects to
https://help.github.com/articles/github-flavored-markdown so let's just
point there directly.
2013-02-27 22:39:06 -06:00
bootstraponline 252aa10d75 Update gemspec 2013-02-26 19:25:58 -05:00
bootstraponline 6f3d362920 Update Gemfile 2013-02-26 19:25:11 -05:00
bootstraponline 9b54e4c79f Update gollum.gemspec 2013-02-26 19:24:43 -05:00
bootstraponline f908d0d170 Document how to run the tests 2013-02-26 19:22:44 -05:00
bootstraponline 852ecdd1a9 Update pygments.rb. Fixes #639 2013-02-26 18:57:34 -05:00
bootstraponline 78f5df5e56 Update org-ruby. Fixes #640 2013-02-26 18:25:00 -05:00
bootstraponline 580a61a515 Merge pull request #641 from jamieoliver/bug/new-page-subdirectory
Update working directory when creating new page in subdirectory
2013-02-26 15:16:47 -08:00
Jamie Oliver 4faf5a0150 Update working directory when creating new page in subdirectory 2013-02-26 22:43:27 +00:00
bootstraponline 1201d2434a Merge pull request #637 from jamesdabbs/custom-markup
Allow registering custom markup engines
2013-02-25 19:59:18 -08:00
bootstraponline e1ca392da6 Fix tests
0.4.1 and 0.4.2 break gollum's tests
2013-02-25 22:54:32 -05:00
bootstraponline 3ee6d22727 Fix tests
org-ruby 0.8.0+ break the tests
2013-02-25 22:48:46 -05:00
bootstraponline 28a0329f65 Notify me on build failure 2013-02-25 21:50:49 -05:00
bootstraponline 2dc696c940 Update pygments 2013-02-25 21:47:32 -05:00
James Dabbs e3acef0e91 Add test for custom markup engine
This required adding a file to the example repo, so some of the tests'
expected hash values changed accordingly.
2013-02-25 21:06:00 -05:00
James Dabbs 62601f1adc Add system for registering new page extensions / markup formats 2013-02-25 21:05:35 -05:00
bootstraponline 982915a22f Fix #636
https://github.com/github/gollum/issues/636
2013-02-23 15:04:29 -05:00
bootstraponline 9f1bbd097f Merge pull request #634 from jamieoliver/bug/new-rename-dialogs-redirect
Fix Create New Page and Rename Page dialogs redirect behaviour
2013-02-19 16:03:59 -08:00
bootstraponline 694bd6e74a Update gollum.gemspec 2013-02-19 17:43:56 -05:00
Jamie Oliver 394cf0bc8e Fix Create New Page and Rename Page dialogs redirect behaviour 2013-02-19 21:29:21 +00:00
bootstraponline 09257deaae Merge pull request #632 from arr2036/master
Specify the sidebar side
2013-02-11 15:19:04 -08:00
Arran Cudbard-Bell 21c4b0dd95 Allow the sidebar side to be specified 2013-02-11 17:57:45 -05:00
bootstraponline 3b4662b583 Merge pull request #631 from arr2036/master
Fix redirects to index_pages for subdirs
2013-02-06 22:11:11 -08:00
Arran Cudbard-Bell 2e2e6457c7 Add option to specify index_page
Fix redirect to index_page creation for subdirs

Redirect attempts to access directories to index_page

Add tests
2013-02-06 22:05:36 -05:00
bootstraponline 631a7cccd6 Merge pull request #628 from arr2036/fix_titles
Fix page titles for non markdown formats
2013-02-04 15:47:17 -08:00
Arran Cudbard-Bell 2a3d51c7dc Fix page titles for non markdown formats 2013-02-04 16:12:41 -05:00
bootstraponline e7e8a17b61 Merge pull request #598 from dekimsey/new-page-in-current-directory
New page button now respects current directory
2013-01-30 14:57:07 -08:00
Daniel Kimsey 8fd8a56893 New and Rename buttons now support directories
* Also fixes renaming a file from a subdirectory moves it to the root.
  * Add context info option to dialog, used in the new dialog
  * Added CSS to support new context option for dialogs
  * Fix /pages view messing up directory creation in new
  * Removed the Edit and Rename buttons from historic view
2013-01-30 11:03:00 -05:00
bootstraponline 443c453507 Apply font from #624
https://github.com/github/gollum/pull/624
2013-01-20 12:44:53 -05:00
bootstraponline 0495c89ba1 Update HISTORY.md 2013-01-10 18:46:24 -05:00
bootstraponline 78e4dfbece Fix metadata tests 2013-01-08 17:09:21 -05:00
bootstraponline 1c7a481ed9 Release 2.4.11 2013-01-08 16:59:47 -05:00
bootstraponline c3dedcbba5 Disable metadata 2013-01-08 16:58:21 -05:00
1201 changed files with 222942 additions and 79449 deletions
+1
View File
@@ -5,3 +5,4 @@ pkg
Gemfile.lock
*.gem
*.swp
.*
+4 -3
View File
@@ -1,7 +1,8 @@
rvm:
- 1.8.7
- 1.9.3
notifications:
disabled: true
- 2.0.0
- 2.1.0
- 2.1.1
before_install:
- sudo apt-get update
- sudo apt-get install libicu-dev
+1 -1
View File
@@ -1,4 +1,4 @@
source 'https://rubygems.org'
gemspec
gem 'rake', '~> 10.0.2'
gem 'rake', '~> 10.4'
+22
View File
@@ -1,3 +1,25 @@
# 3.1.1 /2014-12-04
* Security fix for [remote code execution issue](https://github.com/gollum/gollum/issues/913). Please update!
# 3.1 / 2014-11-28
* New features
* Drag-and-drop uploading in the editor [@lucas-clemente](https://github.com/lucas-clemente)
* Latest changes view [@etienneCharignon](https://github.com/etienneCharignon) (#707)
* Option `--no-edit` to disable editing from the web interface [@bambycha](https://github.com/bambycha) (#879)
* Option `--mathjax-config` to specify custom mathjax configuration [@hardywu](https://github.com/hardywu) (#842)
* Major enhancements
* Made the Gollum theme responsive [@rtrvrtg](https://github.com/rtrvrtg) (#831)
* Depends on new [gollum-lib](https://github.com/gollum/gollum-lib) `4.0.0`
* Allows specifiying [git adapter](https://github.com/gollum/gollum/wiki/Git-adapters) with `--adapter` [@bartkamphorst](https://github.com/bartkamphorst), [@dometto](https://github.com/dometto)
* Numerous bugfixes
* **NB**: please pass `--h1-title` if you do not want page titles to default to the page's filepath. See [here](https://github.com/gollum/gollum/wiki/Page-titles).
# 2.4.11 / 2013-01-08
* Numerous security issues have been fixed. Please update to `2.4.11`
# 1.4.0 / 2012-04-10
* Minor
+140 -495
View File
@@ -1,12 +1,13 @@
gollum -- A wiki built on top of Git
====================================
[![Build Status](https://secure.travis-ci.org/github/gollum.png?branch=master)](http://travis-ci.org/github/gollum)
[![Dependency Status](https://gemnasium.com/github/gollum.png)](https://gemnasium.com/github/gollum)
[![Gem Version](https://badge.fury.io/rb/gollum.svg)](http://badge.fury.io/rb/gollum)
[![Build Status](https://travis-ci.org/gollum/gollum.svg?branch=master)](https://travis-ci.org/gollum/gollum)
[![Dependency Status](https://gemnasium.com/gollum/gollum.svg)](https://gemnasium.com/gollum/gollum)
## DESCRIPTION
Gollum is a simple wiki system built on top of Git that powers GitHub Wikis.
Gollum is a simple wiki system built on top of Git.
Gollum wikis are simply Git repositories that adhere to a specific format.
Gollum pages may be written in a variety of formats and can be edited in a
@@ -20,541 +21,151 @@ Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
[TomDoc](http://tomdoc.org/) for inline documentation.
## SYSTEM REQUIREMENTS
- Python 2.5+ (2.7.3 recommended)
- Ruby 1.8.7+ (1.9.3 recommended)
- Ruby 1.9.3+ (1.9.3 recommended)
- Unix like operating system (OS X, Ubuntu, Debian, and more)
- Will not work on Windows (because of [grit](https://github.com/github/grit))
## SECURITY
Don't enable `--custom-css`, `--custom-js` or `--mathjax-config` unless you trust every user who has the ability to edit the wiki.
A better solution with more security is being tracked in [#665](https://github.com/gollum/gollum/issues/665).
## INSTALLATION
The best way to install Gollum is with RubyGems:
$ [sudo] gem install gollum
```bash
$ [sudo] gem install gollum
```
You may first need to install some additional [development packages](https://github.com/gollum/gollum/wiki/Installation) for your OS.
If you're installing from source, you can use [Bundler][bundler] to pick up all the
gems:
$ bundle install
```bash
$ bundle install
```
In order to use the various formats that Gollum supports, you will need to
separately install the necessary dependencies for each format. You only need
to install the dependencies for the formats that you plan to use.
* [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc` on mac or `apt-get install -y asciidoc` on Ubuntu
* [Creole](http://wikicreole.org/) -- `gem install creole`
* [AsciiDoc](http://asciidoctor.org) -- `gem install asciidoctor`
* [Creole](http://www.wikicreole.org/) -- `gem install creole`
* [Markdown](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet`
* [GitHub Flavored Markdown](http://github.github.com/github-flavored-markdown/) -- `gem install github-markdown`
* [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown) -- `gem install github-markdown`
* [Org](http://orgmode.org/) -- `gem install org-ruby`
* [Pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
* [RDoc](http://rdoc.sourceforge.net/)
* [ReStructuredText](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
* [Textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth`
* [Textile](http://en.wikipedia.org/wiki/Textile_(markup_language)) -- `gem install RedCloth`
* [MediaWiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
[bundler]: http://gembundler.com/
## SYNTAX
Gollum supports a variety of formats and extensions (Markdown, MediaWiki, Textile, …).
On top of these formats Gollum lets you insert headers, footers, links, image, math and more.
Check out the [Gollum Wiki](https://github.com/gollum/gollum/wiki) for all of Gollum's formats and syntactic options.
## RUNNING
To view and edit your Gollum repository locally via the built in web
interface, simply install the Gollum gem, navigate to your repository via the
command line, and run the executable:
$ gollum
```bash
$ gollum
```
This will start up a web server running the Gollum frontend and you can view
and edit your wiki at http://localhost:4567. To get help on the command line
utility, you can run it like so:
$ gollum --help
```bash
$ gollum --help
```
This will show you the options you can pass as arguments to the `gollum` command:
```bash
Options:
--port [PORT] Bind port (default 4567).
--host [HOST] Hostname or IP address to listen on (default 0.0.0.0).
--version Display current version.
--config [CONFIG] Path to additional configuration file.
--adapter [ADAPTER] Git adapter to use in the backend. Defaults to grit.
--irb Start an irb process with gollum loaded for the current wiki.
--css Inject custom css. Uses custom.css from root repository.
--js Inject custom js. Uses custom.js from root repository.
--template-dir [PATH] Specify custom template directory.
--page-file-dir [PATH] Specify the sub directory for all page files (default: repository root).
--base-path [PATH] Specify the base path for the served pages (default: /) Example: --base-path wiki yields the home page accessible at http://localhost:4567/wiki/.
--gollum-path [PATH] Specify the path to the git repository to be served.
--ref [REF] Specify the repository ref to use (default: master).
--bare Specify that the repository is bare (only necessary when using the grit adapter).
--no-edit Restricts editing capability through frontend.
--no-live-preview Disables livepreview.
--live-preview Enables livepreview.
--allow-uploads [MODE] Allows file uploads. Modes: dir (default, store all uploads in the same directory), page (store each upload at the same location as the page).
--mathjax Enables mathjax for rendering mathematical equations. Uses the TeX-AMS-MML_HTMLorMML config with the autoload-all extension by default.
--mathjax-config [SOURCE] Inject custom mathjax config file. Uses mathjax.config.js from root repository by default.
--user-icons [SOURCE] Set the history user icons. Valid values: gravatar, identicon, none. Default: none.
--show-all Shows all files in file view. By default only valid pages are shown.
--collapse-tree Collapse file view tree. By default, expanded tree is shown.
--h1-title Sets page title to value of first h1.
```
Note that the gollum server will not run on Windows because of [an issue](https://github.com/rtomayko/posix-spawn/issues/9) with posix-spawn (which is used by Grit).
## REPO STRUCTURE
A Gollum repository's contents are designed to be human editable. Page content
is written in `page files` and may be organized into directories any way you
choose. Special footers can be created in `footer files`. Other content
(images, PDFs, etc) may also be present and organized in the same way.
## PAGE FILES
Page files may be written in any format supported by
[GitHub-Markup](http://github.com/github/markup) (except roff). The
current list of formats and allowed extensions is:
* ASCIIDoc: .asciidoc
* Creole: .creole
* Markdown: .markdown, .mdown, .mkdn, .mkd, .md
* Org Mode: .org
* Pod: .pod
* RDoc: .rdoc
* ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
* Textile: .textile
* MediaWiki: .mediawiki, .wiki
Gollum detects the page file format via the extension, so files must have one
of the supported extensions in order to be converted.
Page file names may contain any printable UTF-8 character except space
(U+0020) and forward slash (U+002F). If you commit a page file with any of
these characters in the name it will not be accessible via the web interface.
Even though page files may be placed in any directory, there is still only a
single namespace for page names, so all page files should have globally unique
names regardless of where they are located in the repository.
The special page file `Home.ext` (where the extension is one of the supported
formats) will be used as the entrance page to your wiki. If it is missing, an
automatically generated table of contents will be shown instead.
## SIDEBAR FILES
Sidebar files allow you to add a simple sidebar to your wiki. Sidebar files
are named `_Sidebar.ext` where the extension is one of the supported formats.
Sidebars affect all pages in their directory and any subdirectories that do not
have a sidebar file of their own.
## HEADER FILES
Header files allow you to add a simple header to your wiki. Header files must
be named `_Header.ext` where the extension is one of the supported formats.
Like sidebars, headers affect all pages in their directory and any
subdirectories that do not have a header file of their own.
## FOOTER FILES
Footer files allow you to add a simple footer to your wiki. Footer files must
be named `_Footer.ext` where the extension is one of the supported formats.
Like sidebars, footers affect all pages in their directory and any
subdirectories that do not have a footer file of their own.
## HTML SANITIZATION
For security and compatibility reasons Gollum wikis may not contain custom CSS
or JavaScript. These tags will be stripped from the converted HTML. See
`docs/sanitization.md` for more details on what tags and attributes are
allowed.
## TITLES
The first defined `h1` will override the default header on a page. There are two ways to set a page title. The metadata syntax:
`<!-- --- title: New Title -->`
The first `h1` tag can be set to always override the page title, without needing to use the metadata syntax. Start gollum with the `--h1-title` flag.
## BRACKET TAGS
A variety of Gollum tags use a double bracket syntax. For example:
[[Link]]
Some tags will accept attributes which are separated by pipe symbols. For
example:
[[Link|Page Title]]
In all cases, the first thing in the link is what is displayed on the page.
So, if the tag is an internal wiki link, the first thing in the tag will be
the link text displayed on the page. If the tag is an embedded image, the
first thing in the tag will be a path to an image file. Use this trick to
easily remember which order things should appear in tags.
Some formats, such as MediaWiki, support the opposite syntax:
[[Page Title|Link]]
## PAGE LINKS
To link to another Gollum wiki page, use the Gollum Page Link Tag.
[[Frodo Baggins]]
The above tag will create a link to the corresponding page file named
`Frodo-Baggins.ext` where `ext` may be any of the allowed extension types. The
conversion is as follows:
1. Replace any spaces (U+0020) with dashes (U+002D)
2. Replace any slashes (U+002F) with dashes (U+002D)
If you'd like the link text to be something that doesn't map directly to the
page name, you can specify the actual page name after a pipe:
[[Frodo|Frodo Baggins]]
The above tag will link to `Frodo-Baggins.ext` using "Frodo" as the link text.
The page file may exist anywhere in the directory structure of the repository.
Gollum does a breadth first search and uses the first match that it finds.
Here are a few more examples:
[[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
[[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
[[モルドール]] -> モルドール.ext
## EXTERNAL LINKS
As a convenience, simple external links can be placed within brackets and they
will be linked to the given URL with the URL as the link text. For example:
[[http://example.com]]
External links must begin with either "http://" or "https://". If you need
something more flexible, you can resort to the link syntax in the page's
underlying markup format.
## ABSOLUTE VS. RELATIVE VS. EXTERNAL PATH
For Gollum tags that operate on static files (images, PDFs, etc), the paths
may be referenced as either relative, absolute, or external. Relative paths
point to a static file relative to the page file within the directory
structure of the Gollum repo (even though after conversion, all page files
appear to be top level). These paths are NOT prefixed with a slash. For
example:
gollum.pdf
docs/diagram.png
Absolute paths point to a static file relative to the Gollum repo's
root, regardless of where the page file is stored within the directory
structure. These paths ARE prefixed with a slash. For example:
/pdfs/gollum.pdf
/docs/diagram.png
External paths are full URLs. An external path must begin with either
"http://" or "https://". For example:
http://example.com/pdfs/gollum.pdf
http://example.com/images/diagram.png
All of the examples in this README use relative paths, but you may use
whatever works best in your situation.
## FILE LINKS
To link to static files that are contained in the Gollum repository you should
use the Gollum File Link Tag.
[[Gollum|gollum.pdf]]
The first part of the tag is the link text. The path to the file appears after
the pipe.
## IMAGES
To display images that are contained in the Gollum repository you should use
the Gollum Image Tag. This will display the actual image on the page.
[[gollum.png]]
In addition to the simple format, there are a variety of options that you
can specify between pipe delimiters.
To specify alt text, use the `alt=` option. Default is no alt text.
[[gollum.png|alt=Gollum and his precious wiki]]
To place the image in a frame, use the `frame` option. When combined with the
`alt=` option, the alt text will be used as a caption as well. Default is no
frame.
[[gollum.png|frame|alt=Gollum and his precious wiki]]
To specify the alignment of the image on the page, use the `align=` option.
Possible values are `left`, `center`, and `right`. Default is `left`.
[[gollum.png|align=center]]
To float an image so that text flows around it, use the `float` option. When
`float` is specified, only `left` and `right` are valid `align` options.
Default is not floating. When floating is activated but no alignment is
specified, default alignment is `left`.
[[gollum.png|float]]
To specify a max-width, use the `width=` option. Units must be specified in
either `px` or `em`.
[[gollum.png|width=400px]]
To specify a max-height, use the `height=` option. Units must be specified in
either `px` or `em`.
[[gollum.png|height=300px]]
Any of these options may be composed together by simply separating them with
pipes.
## ESCAPING GOLLUM TAGS
If you need the literal text of a wiki or static link to show up in your final
wiki page, simply preface the link with a single quote (like in LISP):
'[[Page Link]]
'[[File Link|file.pdf]]
'[[image.jpg]]
This is useful for writing about the link syntax in your wiki pages.
## TABLE OF CONTENTS
Gollum has a special tag to insert a table of contents (new in v2.1)
[[_TOC_]]
This tag is case sensitive, use all upper case. The TOC tag can be inserted
into the `_Header`, `_Footer` or `_Sidebar` files too.
There is also a wiki option `:universal_toc` which will display a
table of contents at the top of all your wiki pages if it is enabled.
The `:universal_toc` is not enabled by default. To set the option,
add the option to the `:wiki_options` hash before starting the
frontend app:
Precious::App.set(:wiki_options, {:universal_toc => true})
## SYNTAX HIGHLIGHTING
In page files you can get automatic syntax highlighting for a wide range of
languages (courtesy of [Pygments](http://pygments.org/) - must install
separately) by using the following syntax:
```ruby
def foo
puts 'bar'
end
```
The block must start with three backticks, at the beginning of a line or
indented with any number of spaces or tabs.
After that comes the name of the language that is contained by the
block. The language must be one of the `short name` lexer strings supported by
Pygments. See the [list of lexers](http://pygments.org/docs/lexers/) for valid
options.
The block contents should be indented at the same level than the opening backticks.
If the block contents are indented with an additional two spaces or one tab,
then that whitespace will be ignored (this makes the blocks easier to read in plaintext).
The block must end with three backticks indented at the same level than the opening
backticks.
### GITHUB SYNTAX HIGHLIGHTING
As an extra feature, you can syntax highlight a file from your repository, allowing
you keep some of your sample code in the main repository. The code-snippet is
updated when the wiki is rebuilt. You include github code like this:
```html:github/gollum/master/test/file_view/1_file.txt```
This will make the builder look at the **github user**, in the **gollum project**,
in the **master branch**, at path **test/file_view/1_file.txt**. It will be
rewritten to:
```html
<ol class="tree">
<li class="file"><a href="0">0</a></li>
</ol>
```
Which will be parsed as HTML code during the Pygments run, and thereby coloured
appropriately.
## MATHEMATICAL EQUATIONS
Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the `autoload-all` extension.
Inline math:
- $2^2$
- `\\(2^2\\)`
Display math:
- $$2^2$$
- [2^2]
## SEQUENCE DIAGRAMS
You may imbed sequence diagrams into your wiki page (rendered by
[WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
following syntax:
{{{{{{ blue-modern
alice->bob: Test
bob->alice: Test response
}}}}}}
You can replace the string "blue-modern" with any supported style.
## API DOCUMENTATION
The Gollum API allows you to retrieve raw or formatted wiki content from a Git
repository, write new content to the repository, and collect various meta data
about the wiki as a whole.
Initialize the Gollum::Repo object:
# Require rubygems if necessary
require 'rubygems'
# Require the Gollum library
require 'gollum'
# Create a new Gollum::Wiki object by initializing it with the path to the
# Git repository.
wiki = Gollum::Wiki.new("my-gollum-repo.git")
# => <Gollum::Wiki>
By default, internal wiki links are all absolute from the root. To specify a different base path, you can specify the `:base_path` option:
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
Note that base_path just modifies the links. To map gollum to a non-root location:
- Use the gollum binary: `gollum path/to/wiki --base-path mywiki`
- Define config.ru with `map`. See [#532](https://github.com/github/gollum/issues/532) for an example.
> :base_path - String base path for all Wiki links.
>
> The String base path to prefix to internal links. For example, when set
> to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
> to "/".
Get the latest version of the given human or canonical page name:
page = wiki.page('page-name')
# => <Gollum::Page>
page.raw_data
# => "# My wiki page"
page.formatted_data
# => "<h1>My wiki page</h1>"
page.format
# => :markdown
vsn = page.version
# => <Grit::Commit>
vsn.id
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
Get the footer (if any) for a given page:
page.footer
# => <Gollum::Page>
Get the header (if any) for a given page:
page.header
# => <Gollum::Page>
Get a list of versions for a given page:
vsns = wiki.page('page-name').versions
# => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
vsns.first.id
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
vsns.first.authored_date
# => Sun Mar 28 19:11:21 -0700 2010
Get a specific version of a given canonical page file:
wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
Get the latest version of a given static file:
file = wiki.file('asset.js')
# => <Gollum::File>
file.raw_data
# => "alert('hello');"
file.version
# => <Grit::Commit>
Get a specific version of a given static file:
wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
Get an in-memory Page preview (useful for generating previews for web
interfaces):
preview = wiki.preview_page("My Page", "# Contents", :markdown)
preview.formatted_data
# => "<h1>Contents</h1>"
Methods that write to the repository require a Hash of commit data that takes
the following form:
commit = { :message => 'commit message',
:name => 'Tom Preston-Werner',
:email => 'tom@github.com' }
Write a new version of a page (the file will be created if it does not already
exist) and commit the change. The file will be written at the repo root.
wiki.write_page('Page Name', :markdown, 'Page contents', commit)
Update an existing page. If the format is different than the page's current
format, the file name will be changed to reflect the new format.
page = wiki.page('Page Name')
wiki.update_page(page, page.name, page.format, 'Page contents', commit)
To delete a page and commit the change:
wiki.delete_page(page, commit)
### RACK
You can also run gollum with any rack-compatible server by placing this config.ru
file inside your wiki repository. This allows you to utilize any Rack middleware
like Rack::Auth, OmniAuth, etc.
You can also run gollum with any rack-compatible server by placing configuring a config.ru
file. This allows you to utilize any Rack middleware like Rack::Auth, OmniAuth, etc. See below for an example of a `config.ru`. You can define all the [options available on the command line](#running) by configuring the app's `:wiki_options` hash. See [here](https://github.com/gollum/gollum/wiki/Using-Gollum-with-Rack) for the names of the options corresponding to the command line switches.
#!/usr/bin/env ruby
require 'rubygems'
require 'gollum/frontend/app'
```ruby
#!/usr/bin/env ruby
require 'rubygems'
require 'gollum/app'
gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
Precious::App.set(:wiki_options, {:universal_toc => false})
run Precious::App
gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
Precious::App.set(:wiki_options, {:universal_toc => false})
run Precious::App
```
Your Rack middleware can pass author details to Gollum in a Hash in the session under the 'gollum.author' key.
## WINDOWS FILENAME VALIDATION
Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
## CONFIG FILE
Gollum optionally takes a `--config file`. See [config.rb](https://github.com/github/gollum/blob/master/config.rb) for an example.
Gollum optionally takes a `--config file`. See [config.rb](https://github.com/gollum/gollum/blob/master/config.rb) for an example.
## CUSTOM CSS
## CUSTOM CSS/JS
The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page. Here's an example of floating the sidebar to the left.
The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page.
The `--js` flag will inject `custom.js` from the root of your git repository into each page. `custom.js` must be commited to git or you will get a 302 redirect to the create page.
## API DOCUMENTATION
The [Gollum API](https://github.com/gollum/gollum-lib/) allows you to retrieve
raw or formatted wiki content from a Git repository, write new content to the
repository, and collect various meta data about the wiki as a whole.
```css
#wiki-rightbar { float: left !important; }
```
## CONTRIBUTE
If you'd like to hack on Gollum, start by forking my repo on GitHub:
If you'd like to hack on Gollum, start by forking the repo on GitHub:
http://github.com/github/gollum
http://github.com/gollum/gollum
To get all of the dependencies, install the gem first. The best way to get
your changes merged back into core is as follows:
@@ -567,23 +178,57 @@ your changes merged back into core is as follows:
1. Do not change the version number, I will do that on my end
1. If necessary, rebase your commits into logical chunks, without errors
1. Push the branch up to GitHub
1. Send a pull request to the github/gollum project.
1. Send a pull request to the gollum/gollum project.
## RELEASING
Gollum uses [Semantic Versioning](http://semver.org/).
x.y.z
For z releases:
$ rake bump
$ rake release
For z releases:
For x.y releases:
Update VERSION in lib/gollum.rb
$ rake gemspec
$ rake release
```bash
$ rake bump
$ rake release
```
For x.y releases:
```bash
Update VERSION in lib/gollum.rb
$ rake gemspec
$ rake release
```
## BUILDING THE GEM FROM MASTER
$ gem uninstall -aIx gollum
$ git clone https://github.com/github/gollum.git
$ cd gollum
gollum$ rake build
gollum$ gem install --no-ri --no-rdoc pkg/gollum*.gem
```bash
$ gem uninstall -aIx gollum
$ git clone https://github.com/gollum/gollum.git
$ cd gollum
gollum$ rake build
gollum$ gem install --no-ri --no-rdoc pkg/gollum*.gem
```
## RUN THE TESTS
```bash
$ bundle install
$ bundle exec rake test
```
## WORK WITH TEST REPOS
An example of how to add a test file to the bare repository lotr.git.
```bash
$ mkdir tmp; cd tmp
$ git clone ../lotr.git/ .
Cloning into '.'...
done.
$ git log
$ echo "test" > test.md
$ git add . ; git commit -am "Add test"
$ git push ../lotr.git/ master
```
+10 -2
View File
@@ -107,20 +107,23 @@ end
#
#############################################################################
desc 'Create a release build'
desc 'Create a release build and push to rubygems'
task :release => :build do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
exit!
end
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git pull"
sh "git pull --rebase origin master"
sh "git tag v#{version}"
sh "git push origin master"
sh "git push origin v#{version}"
sh "gem push pkg/#{name}-#{version}.gem"
end
desc 'Publish to rubygems. Same as release'
task :publish => :release
desc 'Build gem'
task :build => :gemspec do
sh "mkdir -p pkg"
@@ -128,6 +131,11 @@ task :build => :gemspec do
sh "mv #{gem_file} pkg"
end
desc "Build and install"
task :install => :build do
sh "gem install --local --no-ri --no-rdoc pkg/#{name}-#{version}.gem"
end
desc 'Update gemspec'
task :gemspec => :validate do
# read spec file and split out manifest section
+49 -8
View File
@@ -19,7 +19,11 @@ require 'gollum'
exec = {}
options = { 'port' => 4567, 'bind' => '0.0.0.0' }
wiki_options = {}
wiki_options = {
:live_preview => false,
:allow_uploads => false,
:allow_editing => true,
}
opts = OptionParser.new do |opts|
opts.banner = help
@@ -41,6 +45,10 @@ opts = OptionParser.new do |opts|
options['config'] = config
end
opts.on("--adapter [ADAPTER]", "Git adapter to use in the backend. Defaults to grit.") do |adapter|
Gollum::GIT_ADAPTER = adapter
end
opts.on("--irb", "Start an irb process with gollum loaded for the current wiki.") do
options['irb'] = true
end
@@ -49,15 +57,23 @@ opts = OptionParser.new do |opts|
wiki_options[:css] = true
end
opts.on("--js", "Inject custom js. Uses custom.js from root repository") do
wiki_options[:js] = true
end
opts.on("--template-dir [PATH]", "Specify custom template directory") do |path|
wiki_options[:template_dir] = path
end
opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path|
wiki_options[:page_file_dir] = path
end
opts.on("--base-path [PATH]", "Specify the base path.") do |path|
opts.on("--base-path [PATH]", "Specify the base path for the served pages (default: /) Example: --base-path wiki yields the home page accessible at http://localhost:4567/wiki/.") do |path|
wiki_options[:base_path] = path
end
opts.on("--gollum-path [PATH]", "Specify the gollum path.") do |path|
opts.on("--gollum-path [PATH]", "Specify the path to the git repository to be served.") do |path|
wiki_options[:gollum_path] = path
end
@@ -65,14 +81,35 @@ opts = OptionParser.new do |opts|
wiki_options[:ref] = ref
end
opts.on("--bare", "Specify that the repository is bare (only necessary when using the grit adapter).") do
wiki_options[:repo_is_bare] = true
end
opts.on("--no-edit", "Restricts editing capability through frontend.") do
wiki_options[:allow_editing] = false
end
opts.on("--no-live-preview", "Disables livepreview.") do
wiki_options[:live_preview] = false
end
opts.on("--mathjax", "Enables mathjax.") do
opts.on("--live-preview", "Enables livepreview.") do
wiki_options[:live_preview] = true
end
opts.on("--allow-uploads [MODE]", [:dir, :page], "Allows file uploads. Modes: dir (default, store all uploads in the same directory), page (store each upload at the same location as the page).") do |mode|
wiki_options[:allow_uploads] = true
wiki_options[:per_page_uploads] = true if mode == :page
end
opts.on("--mathjax", "Enables mathjax for rendering mathematical equations. Uses the TeX-AMS-MML_HTMLorMML config with the autoload-all extension by default.") do
wiki_options[:mathjax] = true
end
opts.on("--mathjax-config [SOURCE]", "Inject custom mathjax config file. Uses mathjax.config.js from root repository by default") do |source|
wiki_options[:mathjax_config] = source || 'mathjax.config.js'
end
opts.on("--user-icons [SOURCE]", "Set the history user icons. Valid values: gravatar, identicon, none. Default: none.") do |source|
wiki_options[:user_icons] = source
end
@@ -129,8 +166,11 @@ if options['irb']
end
begin
require 'gollum-lib'
wiki = Gollum::Wiki.new(gollum_path, wiki_options)
if !wiki.exist? then raise Grit::InvalidGitRepositoryError end
if !wiki.exist? then
raise Gollum::InvalidGitRepositoryError
end
puts "Loaded Gollum wiki at #{File.expand_path(gollum_path).inspect}."
puts
puts %( page = wiki.page('page-name'))
@@ -144,14 +184,15 @@ if options['irb']
puts
puts "Check out the Gollum README for more."
IRB.start_session(binding)
rescue Grit::InvalidGitRepositoryError, Grit::NoSuchPathError
rescue Gollum::InvalidGitRepositoryError, Gollum::NoSuchPathError
puts "Invalid Gollum wiki at #{File.expand_path(gollum_path).inspect}"
exit 0
end
else
require 'gollum/frontend/app'
require 'gollum/app'
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:wiki_options, wiki_options)
Precious::App.settings.mustache[:templates] = wiki_options[:template_dir] if wiki_options[:template_dir]
if cfg = options['config']
# If the path begins with a '/' it will be considered an absolute path,
@@ -171,7 +212,7 @@ else
def initialize base_path
@mg = Rack::Builder.new do
map '/' do
run Proc.new { [ 302, {'Location'=> "/#{base_path}" }, [] ] }
run Proc.new { [302, { 'Location' => "/#{base_path}" }, []] }
end
map "/#{base_path}" do
+3
View File
@@ -0,0 +1,3 @@
GOLLUM_USER=gollum
GOLLUM_BASE=/home/gollum/wiki
GOLLUM_OPTS="--config /home/gollum/config.rb"
+36
View File
@@ -0,0 +1,36 @@
#!/sbin/runscript
# Distributed under the terms of the MIT License
NAME=gollum
PID=/var/run/${NAME}.pid
EXEC=/usr/local/bin/gollum
LOG=/var/log/gollum.log
depend() {
need net
}
start() {
# Change log file to be owned by GOLLUM_USER
touch "${LOG}"
chown "${GOLLUM_USER}" "${LOG}"
ebegin "Starting Gollum"
start-stop-daemon --start \
--name "${NAME}" \
--user "${GOLLUM_USER}" \
--pidfile "${PID}" \
--make-pidfile --background \
--stderr "${LOG}" \
--exec "${EXEC}" -- $GOLLUM_OPTS "$GOLLUM_BASE"
eend $?
}
stop() {
ebegin "Stopping Gollum"
start-stop-daemon --stop \
--name "${NAME}" \
--user "${GOLLUM_USER}" \
--pidfile "${PID}"
eend $?
}
+12
View File
@@ -0,0 +1,12 @@
[Unit]
Description=Gollum wiki server
After=network.target
[Service]
Type=simple
User=%i
ExecStart=/usr/bin/gollum
Restart=on-abort
[Install]
WantedBy=multi-user.target
+19 -18
View File
@@ -2,31 +2,32 @@ Sanitization Rules
==================
Gollum uses the [Sanitize](http://wonko.com/post/sanitize) gem for HTML
sanitization.
sanitization. Below you find the default allowed tags, attributes, and protocols, as well as directions to customize these settings.
See `lib/gollum.rb` for actual settings.
# Default Settings
## ALLOWED TAGS
a, abbr, acronym, address, area, b, big, blockquote, br, button, caption,
center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em,
fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, img, input, ins, kbd,
label, legend, li, map, menu, ol, optgroup, option, p, pre, q, s, samp,
select, small, span, strike, strong, sub, sup, table, tbody, td, textarea,
tfoot, th, thead, tr, tt, u, ul, var
a, abbr, acronym, address, area, b, big, blockquote, br, button, caption, center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, img, input, ins, kbd, label, legend, li, map, menu, ol, optgroup, option, p, pre, q, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var
## ALLOWED ATTRIBUTES
abbr, accept, accept-charset, accesskey, action, align, alt, axis, border,
cellpadding, cellspacing, char, charoff, charset, checked, cite, class, clear,
cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, for,
frame, headers, height, href, hreflang, hspace, id, ismap, label, lang,
longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap,
prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape,
size, span, src, start, summary, tabindex, target, title, type, usemap,
valign, value, vspace, width
a href, abbr, accept, accept-charset, accesskey, action, align, alt, axis, border, cellpadding, cellspacing, char, charoff, class, charset, checked, cite, clear, cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, for, frame, headers, height, hreflang, hspace, id, img src, ismap, label, lang, longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap, prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape, size, span, start, summary, tabindex, target, title, type, usemap, valign, value, vspace, width
## ALLOWED PROTOCOLS
a href: http, https, mailto
img src: http, https
* a href: http, https, mailto, ftp, irc, apt, :relative
* img src: http, https, :relative
* form action: http, https, :relative
# Customizing
To customize these settings, edit your `config.rb` file along the following lines (be sure to run gollum with the `--config` option):
```ruby
sanitizer = Gollum::Sanitization.new
sanitizer.protocols['a']['href'].concat ['ssh', 'vnc'] # Protocols
sanitizer.elements.concat ['customtag1', 'customtag2'] # Tags
sanitizer.attributes['a'].push 'target' # Attributes
Precious::App.set(:wiki_options, {:sanitization => sanitizer})
```
+1046 -525
View File
File diff suppressed because it is too large Load Diff
+6 -17
View File
@@ -5,36 +5,25 @@ require 'digest/sha1'
require 'ostruct'
# external
require 'grit'
require 'github/markup'
require 'sanitize'
# internal
require File.expand_path('../gollum/git_access', __FILE__)
require File.expand_path('../gollum/committer', __FILE__)
require File.expand_path('../gollum/pagination', __FILE__)
require File.expand_path('../gollum/blob_entry', __FILE__)
require File.expand_path('../gollum/wiki', __FILE__)
require File.expand_path('../gollum/page', __FILE__)
require File.expand_path('../gollum/file', __FILE__)
require File.expand_path('../gollum/file_view', __FILE__)
require File.expand_path('../gollum/markup', __FILE__)
require File.expand_path('../gollum/sanitization', __FILE__)
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
require File.expand_path('../gollum/uri_encode_component', __FILE__)
# Set ruby to UTF-8 mode
# This is required for Ruby 1.8.7 which gollum still supports.
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
$KCODE = 'U' if RUBY_VERSION[0, 3] == '1.8'
module Gollum
VERSION = '2.4.10'
VERSION = '3.1.3'
def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
end
class Error < StandardError; end
class Error < StandardError;
end
class DuplicatePageError < Error
attr_accessor :dir
+556
View File
@@ -0,0 +1,556 @@
# ~*~ encoding: utf-8 ~*~
require 'cgi'
require 'sinatra'
require 'gollum-lib'
require 'mustache/sinatra'
require 'useragent'
require 'stringex'
require 'gollum'
require 'gollum/views/layout'
require 'gollum/views/editable'
require 'gollum/views/has_page'
require File.expand_path '../helpers', __FILE__
#required to upload bigger binary files
Gollum::set_git_timeout(120)
Gollum::set_git_max_filesize(190 * 10**6)
# Fix to_url
class String
alias :upstream_to_url :to_url
if defined?(Gollum::GIT_ADAPTER) && Gollum::GIT_ADAPTER != 'grit'
def to_ascii
self # Do not transliterate utf-8 url's unless using Grit
end
end
# _Header => header which causes errors
def to_url
return nil if self.nil?
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar'], :force_downcase => false
end
end
# Run the frontend, based on Sinatra
#
# There are a number of wiki options that can be set for the frontend
#
# Example
# require 'gollum/app'
# Precious::App.set(:wiki_options, {
# :universal_toc => false,
# }
#
# See the wiki.rb file for more details on wiki options
module Precious
class App < Sinatra::Base
register Mustache::Sinatra
include Precious::Helpers
dir = File.dirname(File.expand_path(__FILE__))
# Detect unsupported browsers.
Browser = Struct.new(:browser, :version)
@@min_ua = [
Browser.new('Internet Explorer', '10.0'),
Browser.new('Chrome', '7.0'),
Browser.new('Firefox', '4.0'),
]
def supported_useragent?(user_agent)
ua = UserAgent.parse(user_agent)
@@min_ua.detect { |min| ua >= min }
end
# We want to serve public assets for now
set :public_folder, "#{dir}/public/gollum"
set :static, true
set :default_markup, :markdown
set :mustache, {
# Tell mustache where the Views constant lives
:namespace => Precious,
# Mustache templates live here
:templates => "#{dir}/templates",
# Tell mustache where the views are
:views => "#{dir}/views"
}
# Sinatra error handling
configure :development, :staging do
enable :show_exceptions, :dump_errors
disable :raise_errors, :clean_trace
end
configure :test do
enable :logging, :raise_errors, :dump_errors
end
before do
settings.wiki_options[:allow_editing] = settings.wiki_options.fetch(:allow_editing, true)
@allow_editing = settings.wiki_options[:allow_editing]
forbid unless @allow_editing || request.request_method == "GET"
Precious::App.set(:mustache, {:templates => settings.wiki_options[:template_dir]}) if settings.wiki_options[:template_dir]
@base_url = url('/', false).chomp('/')
# above will detect base_path when it's used with map in a config.ru
settings.wiki_options.merge!({ :base_path => @base_url })
@css = settings.wiki_options[:css]
@js = settings.wiki_options[:js]
@mathjax_config = settings.wiki_options[:mathjax_config]
end
get '/' do
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect clean_url(::File.join(@base_url, page_dir, wiki_new.index_page))
end
# path is set to name if path is nil.
# if path is 'a/b' and a and b are dirs, then
# path must have a trailing slash 'a/b/' or
# extract_path will trim path to 'a'
# name, path, version
def wiki_page(name, path = nil, version = nil, exact = true)
wiki = wiki_new
path = name if path.nil?
name = extract_name(name) || wiki.index_page
path = extract_path(path)
path = '/' if exact && path.nil?
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
:name => name, :path => path)
end
def wiki_new
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
end
get '/data/*' do
if page = wiki_page(params[:splat].first).page
page.raw_data
end
end
get '/edit/*' do
forbid unless @allow_editing
wikip = wiki_page(params[:splat].first)
@name = wikip.name
@path = wikip.path
@upload_dest = find_upload_dest(@path)
wiki = wikip.wiki
@allow_uploads = wiki.allow_uploads
if page = wikip.page
if wiki.live_preview && page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent)
live_preview_url = '/livepreview/?page=' + encodeURIComponent(@name)
if @path
live_preview_url << '&path=' + encodeURIComponent(@path)
end
redirect to(live_preview_url)
else
@page = page
@page.version = wiki.repo.log(wiki.ref, @page.path).first
@content = page.text_data
mustache :edit
end
else
redirect to("/create/#{encodeURIComponent(@name)}")
end
end
post '/uploadFile' do
wiki = wiki_new
unless wiki.allow_uploads
@message = "File uploads are disabled"
mustache :error
return
end
if params[:file]
fullname = params[:file][:filename]
tempfile = params[:file][:tempfile]
end
# Remove page file dir prefix from upload path if necessary -- committer handles this itself
dir = wiki.per_page_uploads ? params[:upload_dest].match(/^(#{wiki.page_file_dir}\/+)?(.*)/)[2] : 'uploads'
ext = ::File.extname(fullname)
format = ext.split('.').last || 'txt'
filename = ::File.basename(fullname, ext)
contents = ::File.read(tempfile)
reponame = filename + '.' + format
head = wiki.repo.head
options = {
:message => "Uploaded file to #{dir}/#{reponame}",
:parent => wiki.repo.head.commit,
}
author = session['gollum.author']
unless author.nil?
options.merge! author
end
begin
committer = Gollum::Committer.new(wiki, options)
committer.add_to_index(dir, filename, format, contents)
committer.after_commit do |committer, sha|
wiki.clear_cache
committer.update_working_dir(dir, filename, format)
end
committer.commit
redirect to(request.referer)
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
end
end
post '/rename/*' do
wikip = wiki_page(params[:splat].first)
halt 500 if wikip.nil?
wiki = wikip.wiki
page = wiki.paged(wikip.name, wikip.path, exact = true)
rename = params[:rename]
halt 500 if page.nil?
halt 500 if rename.nil? or rename.empty?
# Fixup the rename if it is a relative path
# In 1.8.7 rename[0] != rename[0..0]
if rename[0..0] != '/'
source_dir = ::File.dirname(page.path)
source_dir = '' if source_dir == '.'
(target_dir, target_name) = ::File.split(rename)
target_dir = target_dir == '' ? source_dir : "#{source_dir}/#{target_dir}"
rename = "#{target_dir}/#{target_name}"
end
committer = Gollum::Committer.new(wiki, commit_message)
commit = { :committer => committer }
success = wiki.rename_page(page, rename, commit)
if !success
# This occurs on NOOPs, for example renaming A => A
redirect to("/#{page.escaped_url_path}")
return
end
committer.commit
wikip = wiki_page(rename)
page = wiki.paged(wikip.name, wikip.path, exact = true)
return if page.nil?
redirect to("/#{page.escaped_url_path}")
end
post '/edit/*' do
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
page_name = CGI.unescape(params[:page])
wiki = wiki_new
page = wiki.paged(page_name, path, exact = true)
return if page.nil?
committer = Gollum::Committer.new(wiki, commit_message)
commit = { :committer => committer }
update_wiki_page(wiki, page, params[:content], commit, page.name, params[:format])
update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
committer.commit
redirect to("/#{page.escaped_url_path}") unless page.nil?
end
get '/delete/*' do
forbid unless @allow_editing
wikip = wiki_page(params[:splat].first)
name = wikip.name
wiki = wikip.wiki
page = wikip.page
unless page.nil?
commit = commit_message
commit[:message] = "Destroyed #{name} (#{page.format})"
wiki.delete_page(page, commit)
end
redirect to('/')
end
get '/create/*' do
forbid unless @allow_editing
wikip = wiki_page(params[:splat].first.gsub('+', '-'))
@name = wikip.name.to_url
@path = wikip.path
@allow_uploads = wikip.wiki.allow_uploads
@upload_dest = find_upload_dest(@path)
page_dir = settings.wiki_options[:page_file_dir].to_s
unless page_dir.empty?
# --page-file-dir docs
# /docs/Home should be created in /Home
# not /docs/Home because write_page will append /docs
@path = @path.sub(page_dir, '/') if @path.start_with? page_dir
end
@path = clean_path(@path)
page = wikip.page
if page
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect to("/#{clean_url(::File.join(page_dir, page.escaped_url_path))}")
else
mustache :create
end
end
post '/create' do
name = params[:page].to_url
path = sanitize_empty_params(params[:path]) || ''
format = params[:format].intern
wiki = wiki_new
path.gsub!(/^\//, '')
begin
wiki.write_page(name, format, params[:content], commit_message, path)
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect to("/#{clean_url(::File.join(page_dir, path, encodeURIComponent(name)))}")
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
end
end
post '/revert/*/:sha1/:sha2' do
wikip = wiki_page(params[:splat].first)
@path = wikip.path
@name = wikip.name
wiki = wikip.wiki
@page = wiki.paged(@name, @path)
sha1 = params[:sha1]
sha2 = params[:sha2]
commit = commit_message
commit[:message] = "Revert commit #{sha1.chars.take(7).join}"
if wiki.revert_page(@page, sha1, sha2, commit)
redirect to("/#{@page.escaped_url_path}")
else
sha2, sha1 = sha1, "#{sha1}^" if !sha2
@versions = [sha1, sha2]
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
@message = "The patch does not apply."
mustache :compare
end
end
post '/preview' do
wiki = wiki_new
@name = params[:page] || "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format])
@content = @page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@h1_title = wiki.h1_title
@editable = false
@allow_uploads = wiki.allow_uploads
mustache :page
end
get '/livepreview/' do
wiki = wiki_new
@mathjax = wiki.mathjax
mustache :livepreview, { :layout => false }
end
get '/history/*' do
@page = wiki_page(params[:splat].first).page
@page_num = [params[:page].to_i, 1].max
unless @page.nil?
@versions = @page.versions :page => @page_num
mustache :history
else
redirect to("/")
end
end
get '/latest_changes' do
@wiki = wiki_new
max_count = settings.wiki_options.fetch(:latest_changes_count, 10)
@versions = @wiki.latest_changes({:max_count => max_count})
mustache :latest_changes
end
post '/compare/*' do
@file = encodeURIComponent(params[:splat].first)
@versions = params[:versions] || []
if @versions.size < 2
redirect to("/history/#{@file}")
else
redirect to("/compare/%s/%s...%s" % [
@file,
@versions.last,
@versions.first]
)
end
end
get %r{
/compare/ # match any URL beginning with /compare/
(.+) # extract the full path (including any directories)
/ # match the final slash
([^.]+) # match the first SHA1
\.{2,3} # match .. or ...
(.+) # match the second SHA1
}x do |path, start_version, end_version|
wikip = wiki_page(path)
@path = wikip.path
@name = wikip.name
@versions = [start_version, end_version]
wiki = wikip.wiki
@page = wikip.page
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
mustache :compare
end
get %r{/(.+?)/([0-9a-f]{40})} do
file_path = params[:captures][0]
version = params[:captures][1]
wikip = wiki_page(file_path, file_path, version)
name = wikip.name
path = wikip.path
if page = wikip.page
@page = page
@name = name
@content = page.formatted_data
@version = version
mustache :page
elsif file = wikip.wiki.file("#{file_path}", version, true)
show_file(file)
else
halt 404
end
end
get '/search' do
@query = params[:q]
wiki = wiki_new
# Sort wiki search results by count (desc) and then by name (asc)
@results = wiki.search(@query).sort { |a, b| (a[:count] <=> b[:count]).nonzero? || b[:name] <=> a[:name] }.reverse
@name = @query
mustache :search
end
get %r{
/pages # match any URL beginning with /pages
(?: # begin an optional non-capturing group
/(.+) # capture any path after the "/pages" excluding the leading slash
)? # end the optional non-capturing group
}x do |path|
@path = extract_path(path) if path
wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
@results = wiki.pages
@results += wiki.files if settings.wiki_options[:show_all]
@results = @results.sort_by { |p| p.name.downcase } # Sort Results alphabetically, fixes 922
@ref = wiki.ref
mustache :pages
end
get '/fileview' do
wiki = wiki_new
options = settings.wiki_options
content = wiki.pages
# if showing all files include wiki.files
content += wiki.files if options[:show_all]
# must pass wiki_options to FileView
# --show-all and --collapse-tree can be set.
@results = Gollum::FileView.new(content, options).render_files
@ref = wiki.ref
mustache :file_view, { :layout => false }
end
get '/*' do
show_page_or_file(params[:splat].first)
end
def show_page_or_file(fullpath)
wiki = wiki_new
name = extract_name(fullpath) || wiki.index_page
path = extract_path(fullpath) || '/'
if page = wiki.paged(name, path, exact = true)
@page = page
@name = name
@content = page.formatted_data
@upload_dest = find_upload_dest(path)
# Extensions and layout data
@editable = true
@page_exists = !page.versions.empty?
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@h1_title = wiki.h1_title
@bar_side = wiki.bar_side
@allow_uploads = wiki.allow_uploads
mustache :page
elsif file = wiki.file(fullpath, wiki.ref, true)
show_file(file)
else
not_found unless @allow_editing
page_path = [path, name].compact.join('/')
redirect to("/create/#{clean_url(encodeURIComponent(page_path))}")
end
end
def show_file(file)
return unless file
if file.on_disk?
send_file file.on_disk_path, :disposition => 'inline'
else
content_type file.mime_type
file.raw_data
end
end
def update_wiki_page(wiki, page, content, commit, name = nil, format = nil)
return if !page ||
((!content || page.raw_data == content) && page.format == format)
name ||= page.name
format = (format || page.format).to_sym
content ||= page.raw_data
wiki.update_page(page, name, format, content.to_s, commit)
end
private
# Options parameter to Gollum::Committer#initialize
# :message - The String commit message.
# :name - The String author full name.
# :email - The String email address.
# message is sourced from the incoming request parameters
# author details are sourced from the session, to be populated by rack middleware ahead of us
def commit_message
msg = (params[:message].nil? or params[:message].empty?) ? "[no message]" : params[:message]
commit_message = { :message => msg }
author_parameters = session['gollum.author']
commit_message.merge! author_parameters unless author_parameters.nil?
commit_message
end
def find_upload_dest(path)
settings.wiki_options[:allow_uploads] ?
(settings.wiki_options[:per_page_uploads] ?
"#{path}/#{@name}".sub(/^\/\//, '') : 'uploads'
) : ''
end
end
end
-91
View File
@@ -1,91 +0,0 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
class BlobEntry
# Gets the String SHA for this blob.
attr_reader :sha
# Gets the full path String for this blob.
attr_reader :path
# Gets the Fixnum size of this blob.
attr_reader :size
def initialize(sha, path, size = nil)
@sha = sha
@path = path
@size = size
@dir = @name = @blob = nil
end
# Gets the normalized directory path String for this blob.
def dir
@dir ||= self.class.normalize_dir(::File.dirname(@path))
end
# Gets the file base name String for this blob.
def name
@name ||= ::File.basename(@path)
end
# Gets a Grit::Blob instance for this blob.
#
# repo - Grit::Repo instance for the Grit::Blob.
#
# Returns an unbaked Grit::Blob instance.
def blob(repo)
@blob ||= Grit::Blob.create(repo,
:id => @sha, :name => name, :size => @size)
end
# Gets a Page instance for this blob.
#
# wiki - Gollum::Wiki instance for the Gollum::Page
#
# Returns a Gollum::Page instance.
def page(wiki, commit)
blob = self.blob(wiki.repo)
page = wiki.page_class.new(wiki).populate(blob, self.dir)
page.version = commit
page
end
# Gets a File instance for this blob.
#
# wiki - Gollum::Wiki instance for the Gollum::File
#
# Returns a Gollum::File instance.
def file(wiki, commit)
blob = self.blob(wiki.repo)
file = wiki.file_class.new(wiki).populate(blob, self.dir)
file.version = commit
file
end
def inspect
%(#<Gollum::BlobEntry #{@sha} #{@path}>)
end
# Normalizes a given directory name for searching through tree paths.
# Ensures that a directory begins with a slash, or
#
# normalize_dir("") # => ""
# normalize_dir(".") # => ""
# normalize_dir("foo") # => "/foo"
# normalize_dir("/foo/") # => "/foo"
# normalize_dir("/") # => ""
# normalize_dir("c:/") # => ""
#
# dir - String directory name.
#
# Returns a normalized String directory name, or nil if no directory
# is given.
def self.normalize_dir(dir)
return '' if dir =~ /^.:\/$/
if dir
dir = ::File.expand_path(dir, '/')
dir = '' if dir == '/'
end
dir
end
end
end
-236
View File
@@ -1,236 +0,0 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
# Responsible for handling the commit process for a Wiki. It sets up the
# Git index, provides methods for modifying the tree, and stores callbacks
# to be fired after the commit has been made. This is specifically
# designed to handle multiple updated pages in a single commit.
class Committer
# Gets the instance of the Gollum::Wiki that is being updated.
attr_reader :wiki
# Gets a Hash of commit options.
attr_reader :options
# Initializes the Committer.
#
# wiki - The Gollum::Wiki instance that is being updated.
# options - The commit Hash details:
# :message - The String commit message.
# :name - The String author full name.
# :email - The String email address.
# :parent - Optional Grit::Commit parent to this update.
# :tree - Optional String SHA of the tree to create the
# index from.
# :committer - Optional Gollum::Committer instance. If provided,
# assume that this operation is part of batch of
# updates and the commit happens later.
#
# Returns the Committer instance.
def initialize(wiki, options = {})
@wiki = wiki
@options = options
@callbacks = []
end
# Public: References the Git index for this commit.
#
# Returns a Grit::Index.
def index
@index ||= begin
idx = @wiki.repo.index
if tree = options[:tree]
idx.read_tree(tree)
elsif parent = parents.first
idx.read_tree(parent.tree.id)
end
idx
end
end
# Public: The committer for this commit.
#
# Returns a Grit::Actor.
def actor
@actor ||= begin
@options[:name] = @wiki.default_committer_name if @options[:name].to_s.empty?
@options[:email] = @wiki.default_committer_email if @options[:email].to_s.empty?
Grit::Actor.new(@options[:name], @options[:email])
end
end
# Public: The parent commits to this pending commit.
#
# Returns an array of Grit::Commit instances.
def parents
@parents ||= begin
arr = [@options[:parent] || @wiki.repo.commit(@wiki.ref)]
arr.flatten!
arr.compact!
arr
end
end
# Adds a page to the given Index.
#
# dir - The String subdirectory of the Gollum::Page without any
# prefix or suffix slashes (e.g. "foo/bar").
# name - The String Gollum::Page filename_stripped.
# format - The Symbol Gollum::Page format.
# data - The String wiki data to store in the tree map.
# allow_same_ext - A Boolean determining if the tree map allows the same
# filename with the same extension.
#
# Raises Gollum::DuplicatePageError if a matching filename already exists.
# This way, pages are not inadvertently overwritten.
#
# Returns nothing (modifies the Index in place).
def add_to_index(dir, name, format, data, allow_same_ext = false)
# spaces must be dashes
dir.gsub!(' ', '-')
name.gsub!(' ', '-')
path = @wiki.page_file_name(name, format)
dir = '/' if dir.strip.empty?
fullpath = ::File.join(*[@wiki.page_file_dir, dir, path].compact)
fullpath = fullpath[1..-1] if fullpath =~ /^\//
if index.current_tree && tree = index.current_tree / (@wiki.page_file_dir || '/')
tree = tree / dir unless tree.nil?
end
if tree
downpath = path.downcase.sub(/\.\w+$/, '')
tree.blobs.each do |blob|
next if page_path_scheduled_for_deletion?(index.tree, fullpath)
existing_file = blob.name.downcase.sub(/\.\w+$/, '')
existing_file_ext = ::File.extname(blob.name).sub(/^\./, '')
new_file_ext = ::File.extname(path).sub(/^\./, '')
if downpath == existing_file && !(allow_same_ext && new_file_ext == existing_file_ext)
raise DuplicatePageError.new(dir, blob.name, path)
end
end
end
fullpath = fullpath.force_encoding('ascii-8bit') if fullpath.respond_to?(:force_encoding)
index.add(fullpath, @wiki.normalize(data))
end
# Update the given file in the repository's working directory if there
# is a working directory present.
#
# dir - The String directory in which the file lives.
# name - The String name of the page or the stripped filename
# (should be pre-canonicalized if required).
# format - The Symbol format of the page.
#
# Returns nothing.
def update_working_dir(dir, name, format)
unless @wiki.repo.bare
if @wiki.page_file_dir
dir = dir.size.zero? ? @wiki.page_file_dir : ::File.join(dir, @wiki.page_file_dir)
end
path =
if dir == ''
@wiki.page_file_name(name, format)
else
::File.join(dir, @wiki.page_file_name(name, format))
end
path = path.force_encoding('ascii-8bit') if path.respond_to?(:force_encoding)
Dir.chdir(::File.join(@wiki.repo.path, '..')) do
if file_path_scheduled_for_deletion?(index.tree, path)
@wiki.repo.git.rm({'f' => true}, '--', path)
else
@wiki.repo.git.checkout({}, 'HEAD', '--', path)
end
end
end
end
# Writes the commit to Git and runs the after_commit callbacks.
#
# Returns the String SHA1 of the new commit.
def commit
sha1 = index.commit(@options[:message], parents, actor, nil, @wiki.ref)
@callbacks.each do |cb|
cb.call(self, sha1)
end
sha1
end
# Adds a callback to be fired after a commit.
#
# block - A block that expects this Committer instance and the created
# commit's SHA1 as the arguments.
#
# Returns nothing.
def after_commit(&block)
@callbacks << block
end
# Determine if a given page (regardless of format) is scheduled to be
# deleted in the next commit for the given Index.
#
# map - The Hash map:
# key - The String directory or filename.
# val - The Hash submap or the String contents of the file.
# path - The String path of the page file. This may include the format
# extension in which case it will be ignored.
#
# Returns the Boolean response.
def page_path_scheduled_for_deletion?(map, path)
parts = path.split('/')
if parts.size == 1
deletions = map.keys.select { |k| !map[k] }
downfile = parts.first.downcase.sub(/\.\w+$/, '')
deletions.any? { |d| d.downcase.sub(/\.\w+$/, '') == downfile }
else
part = parts.shift
if rest = map[part]
page_path_scheduled_for_deletion?(rest, parts.join('/'))
else
false
end
end
end
# Determine if a given file is scheduled to be deleted in the next commit
# for the given Index.
#
# map - The Hash map:
# key - The String directory or filename.
# val - The Hash submap or the String contents of the file.
# path - The String path of the file including extension.
#
# Returns the Boolean response.
def file_path_scheduled_for_deletion?(map, path)
parts = path.split('/')
if parts.size == 1
deletions = map.keys.select { |k| !map[k] }
deletions.any? { |d| d == parts.first }
else
part = parts.shift
if rest = map[part]
file_path_scheduled_for_deletion?(rest, parts.join('/'))
else
false
end
end
end
# Proxies methods t
def method_missing(name, *args)
args.map! { |item| item.respond_to?(:force_encoding) ? item.force_encoding('ascii-8bit') : item }
index.send(name, *args)
end
end
end
-94
View File
@@ -1,94 +0,0 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
class File
Wiki.file_class = self
# Public: Initialize a file.
#
# wiki - The Gollum::Wiki in question.
#
# Returns a newly initialized Gollum::File.
def initialize(wiki)
@wiki = wiki
@blob = nil
@path = nil
end
# Public: The url path required to reach this page within the repo.
#
# Returns the String url_path
def url_path
path = self.path
path = path.sub(/\/[^\/]+$/, '/') if path.include?('/')
path
end
# Public: The url_path, but CGI escaped.
#
# Returns the String url_path
def escaped_url_path
CGI.escape(self.url_path).gsub('%2F','/')
end
# Public: The on-disk filename of the file.
#
# Returns the String name.
def name
@blob && @blob.name
end
alias filename name
# Public: The raw contents of the page.
#
# Returns the String data.
def raw_data
@blob && @blob.data
end
# Public: The Grit::Commit version of the file.
attr_accessor :version
# Public: The String path of the file.
attr_reader :path
# Public: The String mime type of the file.
def mime_type
@blob.mime_type
end
# Populate the File with information from the Blob.
#
# blob - The Grit::Blob that contains the info.
# path - The String directory path of the file.
#
# Returns the populated Gollum::File.
def populate(blob, path=nil)
@blob = blob
@path = "#{path}/#{blob.name}"[1..-1]
self
end
#########################################################################
#
# Internal Methods
#
#########################################################################
# Find a file in the given Gollum repo.
#
# name - The full String path.
# version - The String version ID to find.
#
# Returns a Gollum::File or nil if the file could not be found.
def find(name, version)
checked = name.downcase
map = @wiki.tree_map_for(version)
if entry = map.detect { |entry| entry.path.downcase == checked }
@path = name
@blob = entry.blob(@wiki.repo)
@version = version.is_a?(Grit::Commit) ? version : @wiki.commit_for(version)
self
end
end
end
end
-155
View File
@@ -1,155 +0,0 @@
# ~*~ encoding: utf-8 ~*~
module Gollum
=begin
FileView requires that:
- All files in root dir are processed first
- Then all the folders are sorted and processed
=end
class FileView
# common use cases:
# set pages to wiki.pages and show_all to false
# set pages to wiki.pages + wiki.files and show_all to true
def initialize pages, options = {}
@pages = pages
@show_all = options[:show_all] || false
@checked = options[:collapse_tree] ? '' : "checked"
end
def enclose_tree string
%Q(<ol class="tree">\n) + string + %Q(</ol>)
end
def new_page page
name = page.name
url = url_for_page page
%Q( <li class="file"><a href="#{url}"><span class="icon"></span>#{name}</a></li>)
end
def new_folder folder_path
new_sub_folder folder_path
end
def new_sub_folder path
<<-HTML
<li>
<label>#{path}</label> <input type="checkbox" #{@checked} />
<ol>
HTML
end
def end_folder
"</ol></li>\n"
end
def url_for_page page
url = ''
if @show_all
# Remove ext for valid pages.
filename = page.filename
filename = Page::valid_page_name?(filename) ? filename.chomp(::File.extname(filename)) : filename
url = ::File.join(::File.dirname(page.path), filename)
else
url = ::File.join(::File.dirname(page.path), page.filename_stripped)
end
url = url[2..-1] if url[0,2] == './'
url
end
def render_files
html = ''
count = @pages.size
folder_start = -1
# Process all pages until folders start
count.times do | index |
page = @pages[ index ]
path = page.path
unless path.include? '/'
# Page processed (not contained in a folder)
html += new_page page
else
# Folders start at the next index
folder_start = index
break # Pages finished, move on to folders
end
end
# If there are no folders, then we're done.
return enclose_tree(html) if folder_start <= -1
# Handle special case of only one folder.
if (count - folder_start == 1)
page = @pages[ folder_start ]
html += <<-HTML
<li>
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
<ol>
#{new_page page}
</ol>
</li>
HTML
return enclose_tree html
end
sorted_folders = []
(folder_start).upto count - 1 do | index |
sorted_folders += [[ @pages[ index ].path, index ]]
end
# http://stackoverflow.com/questions/3482814/sorting-list-of-string-paths-in-vb-net
sorted_folders.sort! do |first,second|
a = first[0]
b = second[0]
# use :: operator because gollum defines its own conflicting File class
dir_compare = ::File.dirname(a) <=> ::File.dirname(b)
# Sort based on directory name unless they're equal (0) in
# which case sort based on file name.
if dir_compare == 0
::File.basename(a) <=> ::File.basename(b)
else
dir_compare
end
end
# keep track of folder depth, 0 = at root.
cwd_array = []
changed = false
# process rest of folders
(0...sorted_folders.size).each do | index |
page = @pages[ sorted_folders[ index ][ 1 ] ]
path = page.path
folder = ::File.dirname path
tmp_array = folder.split '/'
(0...tmp_array.size).each do | index |
if cwd_array[ index ].nil? || changed
html += new_sub_folder tmp_array[ index ]
next
end
if cwd_array[ index ] != tmp_array[ index ]
changed = true
(cwd_array.size - index).times do
html += end_folder
end
html += new_sub_folder tmp_array[ index ]
end
end
html += new_page page
cwd_array = tmp_array
changed = false
end
# return the completed html
enclose_tree html
end # end render_files
end # end FileView class
end # end Gollum module
-397
View File
@@ -1,397 +0,0 @@
# ~*~ encoding: utf-8 ~*~
require 'cgi'
require 'sinatra'
require 'gollum'
require 'mustache/sinatra'
require 'useragent'
require 'stringex'
require 'gollum/frontend/views/layout'
require 'gollum/frontend/views/editable'
require 'gollum/frontend/views/has_page'
require File.expand_path '../helpers', __FILE__
# Fix to_url
class String
alias :upstream_to_url :to_url
# _Header => header which causes errors
def to_url
return nil if self.nil?
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar']
end
end
# Run the frontend, based on Sinatra
#
# There are a number of wiki options that can be set for the frontend
#
# Example
# require 'gollum/frontend/app'
# Precious::App.set(:wiki_options, {
# :universal_toc => false,
# }
#
# See the wiki.rb file for more details on wiki options
module Precious
class App < Sinatra::Base
register Mustache::Sinatra
include Precious::Helpers
dir = File.dirname(File.expand_path(__FILE__))
# Detect unsupported browsers.
Browser = Struct.new(:browser, :version)
@@min_ua = [
Browser.new('Internet Explorer', '10.0'),
Browser.new('Chrome', '7.0'),
Browser.new('Firefox', '4.0'),
]
def supported_useragent?(user_agent)
ua = UserAgent.parse(user_agent)
@@min_ua.detect {|min| ua >= min }
end
# We want to serve public assets for now
set :public_folder, "#{dir}/public/gollum"
set :static, true
set :default_markup, :markdown
set :mustache, {
# Tell mustache where the Views constant lives
:namespace => Precious,
# Mustache templates live here
:templates => "#{dir}/templates",
# Tell mustache where the views are
:views => "#{dir}/views"
}
# Sinatra error handling
configure :development, :staging do
enable :show_exceptions, :dump_errors
disable :raise_errors, :clean_trace
end
configure :test do
enable :logging, :raise_errors, :dump_errors
end
before do
@base_url = url('/', false).chomp('/')
# above will detect base_path when it's used with map in a config.ru
settings.wiki_options.merge!({ :base_path => @base_url })
@css = settings.wiki_options[:css]
end
get '/' do
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect clean_url(::File.join(@base_url, page_dir, 'Home'))
end
# path is set to name if path is nil.
# if path is 'a/b' and a and b are dirs, then
# path must have a trailing slash 'a/b/' or
# extract_path will trim path to 'a'
# name, path, version
def wiki_page(name, path = nil, version = nil, exact = true)
path = name if path.nil?
name = extract_name(name)
path = extract_path(path)
path = '/' if exact && path.nil?
wiki = wiki_new
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
:name => name, :path => path)
end
def wiki_new
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
end
get '/data/*' do
if page = wiki_page(params[:splat].first).page
page.raw_data
end
end
get '/edit/*' do
wikip = wiki_page(params[:splat].first)
@name = wikip.name
@path = wikip.path
wiki = wikip.wiki
if page = wikip.page
if wiki.live_preview && page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent)
live_preview_url = '/livepreview/index.html?page=' + encodeURIComponent(@name)
if @path
live_preview_url << '&path=' + encodeURIComponent(@path)
end
redirect to(live_preview_url)
else
@page = page
@page.version = wiki.repo.log(wiki.ref, @page.path).first
raw_data = page.raw_data
@content = raw_data.respond_to?(:force_encoding) ? raw_data.force_encoding('UTF-8') : raw_data
mustache :edit
end
else
redirect to("/create/#{encodeURIComponent(@name)}")
end
end
post '/edit/*' do
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
page_name = CGI.unescape(params[:page])
wiki = wiki_new
page = wiki.paged(page_name, path, exact = true)
return if page.nil?
rename = params[:rename].to_url if params[:rename]
name = rename || page.name
committer = Gollum::Committer.new(wiki, commit_message)
commit = {:committer => committer}
update_wiki_page(wiki, page, params[:content], commit, name, params[:format])
update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
committer.commit
page = wiki.page(rename) if rename
redirect to("/#{page.escaped_url_path}") unless page.nil?
end
get '/delete/*' do
wikip = wiki_page(params[:splat].first)
name = wikip.name
wiki = wikip.wiki
page = wikip.page
wiki.delete_page(page, { :message => "Destroyed #{name} (#{page.format})" })
redirect to('/')
end
get '/create/*' do
wikip = wiki_page(params[:splat].first.gsub('+', '-'))
@name = wikip.name.to_url
@path = wikip.path
page_dir = settings.wiki_options[:page_file_dir].to_s
unless page_dir.empty?
# --page-file-dir docs
# /docs/Home should be created in /Home
# not /docs/Home because write_page will append /docs
@path = @path.sub(page_dir, '/') if @path.start_with? page_dir
end
page = wikip.page
if page
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect to("/#{clean_url(::File.join(page_dir, page.escaped_url_path))}")
else
mustache :create
end
end
post '/create' do
name = params[:page].to_url
path = sanitize_empty_params(params[:path]) || ''
format = params[:format].intern
wiki = wiki_new
begin
wiki.write_page(name, format, params[:content], commit_message, path)
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect to("/#{clean_url(::File.join(page_dir, path, name))}")
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
end
end
post '/revert/:page/*' do
wikip = wiki_page(params[:page])
@path = wikip.path
@name = wikip.name
wiki = wikip.wiki
@page = wiki.paged(@name,@path)
shas = params[:splat].first.split("/")
sha1 = shas.shift
sha2 = shas.shift
if wiki.revert_page(@page, sha1, sha2, commit_message)
redirect to("/#{@page.escaped_url_path}")
else
sha2, sha1 = sha1, "#{sha1}^" if !sha2
@versions = [sha1, sha2]
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
@message = "The patch does not apply."
mustache :compare
end
end
post '/preview' do
wiki = wiki_new
@name = params[:page] || "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format])
@content = @page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@h1_title = wiki.h1_title
@editable = false
mustache :page
end
get '/history/*' do
@page = wiki_page(params[:splat].first).page
@page_num = [params[:page].to_i, 1].max
@versions = @page.versions :page => @page_num
mustache :history
end
post '/compare/*' do
@file = params[:splat].first
@versions = params[:versions] || []
if @versions.size < 2
redirect to("/history/#{@file}")
else
redirect to("/compare/%s/%s...%s" % [
@file,
@versions.last,
@versions.first]
)
end
end
get %r{
/compare/ # match any URL beginning with /compare/
(.+) # extract the full path (including any directories)
/ # match the final slash
([^.]+) # match the first SHA1
\.{2,3} # match .. or ...
(.+) # match the second SHA1
}x do |path, start_version, end_version|
wikip = wiki_page(path)
@path = wikip.path
@name = wikip.name
@versions = [start_version, end_version]
wiki = wikip.wiki
@page = wikip.page
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
mustache :compare
end
get %r{/(.+?)/([0-9a-f]{40})} do
file_path = params[:captures][0]
version = params[:captures][1]
wikip = wiki_page(file_path, file_path, version)
name = wikip.name
path = wikip.path
if page = wikip.page
@page = page
@name = name
@content = page.formatted_data
@editable = true
mustache :page
else
halt 404
end
end
get '/search' do
@query = params[:q]
wiki = wiki_new
# Sort wiki search results by count (desc) and then by name (asc)
@results = wiki.search(@query).sort{ |a, b| (a[:count] <=> b[:count]).nonzero? || b[:name] <=> a[:name] }.reverse
@name = @query
mustache :search
end
get %r{
/pages # match any URL beginning with /pages
(?: # begin an optional non-capturing group
/(.+) # capture any path after the "/pages" excluding the leading slash
)? # end the optional non-capturing group
}x do |path|
@path = extract_path(path) if path
wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
@results = wiki.pages
@results += wiki.files if settings.wiki_options[:show_all]
@ref = wiki.ref
mustache :pages
end
get '/fileview' do
wiki = wiki_new
options = settings.wiki_options
content = wiki.pages
# if showing all files include wiki.files
content += wiki.files if options[:show_all]
# must pass wiki_options to FileView
# --show-all and --collapse-tree can be set.
@results = Gollum::FileView.new(content, options).render_files
@ref = wiki.ref
mustache :file_view, { :layout => false }
end
get '/*' do
show_page_or_file(params[:splat].first)
end
def show_page_or_file(fullpath)
name = extract_name(fullpath)
path = extract_path(fullpath) || '/'
wiki = wiki_new
if page = wiki.paged(name, path, exact = true)
@page = page
@name = name
@editable = true
@content = page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@h1_title = wiki.h1_title
mustache :page
elsif file = wiki.file(fullpath)
content_type file.mime_type
file.raw_data
else
page_path = [path, name].compact.join('/')
redirect to("/create/#{clean_url(encodeURIComponent(page_path))}")
end
end
def update_wiki_page(wiki, page, content, commit, name = nil, format = nil)
return if !page ||
((!content || page.raw_data == content) && page.format == format)
name ||= page.name
format = (format || page.format).to_sym
content ||= page.raw_data
wiki.update_page(page, name, format, content.to_s, commit)
end
private
# Options parameter to Gollum::Committer#initialize
# :message - The String commit message.
# :name - The String author full name.
# :email - The String email address.
# message is sourced from the incoming request parameters
# author details are sourced from the session, to be populated by rack middleware ahead of us
def commit_message
commit_message = { :message => params[:message] }
author_parameters = session['gollum.author']
commit_message.merge! author_parameters unless author_parameters.nil?
commit_message
end
end
end
-36
View File
@@ -1,36 +0,0 @@
# ~*~ encoding: utf-8 ~*~
module Precious
module Helpers
# Extract the path string that Gollum::Wiki expects
def extract_path(file_path)
return nil if file_path.nil?
last_slash = file_path.rindex("/")
if last_slash
file_path[0, last_slash]
end
end
# Extract the 'page' name from the file_path
def extract_name(file_path)
::File.basename(file_path)
end
def sanitize_empty_params(param)
[nil,''].include?(param) ? nil : CGI.unescape(param)
end
# Remove all slashes from the start of string.
# Remove all double slashes
def clean_url url
return url if url.nil?
url.gsub('%2F','/').gsub(/^\/+/,'').gsub('//','/')
end
def trim_leading_slash url
return url if url.nil?
url.gsub!('%2F','/')
return '/' + url.gsub(/^\/+/,'') if url[0,1] == '/'
url
end
end
end
@@ -1,368 +0,0 @@
.ace_editor {
position: absolute;
overflow: hidden;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
font-size: 12px;
}
.ace_scroller {
position: absolute;
overflow: hidden;
}
.ace_content {
position: absolute;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: text;
}
.ace_gutter {
position: absolute;
overflow : hidden;
height: 100%;
width: auto;
cursor: default;
z-index: 4;
}
.ace_gutter-active-line {
position: absolute;
left: 0;
right: 0;
}
.ace_scroller.ace_scroll-left {
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
}
.ace_gutter-cell {
padding-left: 19px;
padding-right: 6px;
background-repeat: no-repeat;
}
.ace_gutter-cell.ace_error {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTQ4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTU4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBMjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBMzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkgXxbAAAAJbSURBVHjapFNNaBNBFH4zs5vdZLP5sQmNpT82QY209heh1ioWisaDRcSKF0WKJ0GQnrzrxasHsR6EnlrwD0TagxJabaVEpFYxLWlLSS822tr87m66ccfd2GKyVhA6MMybgfe97/vmPUQphd0sZjto9XIn9OOsvlu2nkqRzVU+6vvlzPf8W6bk8dxQ0NPbxAALgCgg2JkaQuhzQau/El0zbmUA7U0Es8v2CiYmKQJHGO1QICCLoqilMhkmurDAyapKgqItezi/USRdJqEYY4D5jCy03ht2yMkkvL91jTTX10qzyyu2hruPRN7jgbH+EOsXcMLgYiThEgAMhABW85oqy1DXdRIdvP1AHJ2acQXvDIrVHcdQNrEKNYSVMSZGMjEzIIAwDXIo+6G/FxcGnzkC3T2oMhLjre49sBB+RRcHLqdafK6sYdE/GGBwU1VpFNj0aN8pJbe+BkZyevUrvLl6Xmm0W9IuTc0DxrDNAJd5oEvI/KRsNC3bQyNjPO9yQ1YHcfj2QvfQc/5TUhJTBc2iM0U7AWDQtc1nJHvD/cfO2s7jaGkiTEfa/Ep8coLu7zmNmh8+dc5lZDuUeFAGUNA/OY6JVaypQ0vjr7XYjUvJM37vt+j1vuTK5DgVfVUoTjVe+y3/LxMxY2GgU+CSLy4cpfsYorRXuXIOi0Vt40h67uZFTdIo6nLaZcwUJWAzwNS0tBnqqKzQDnjdG/iPyZxo46HaKUpbvYkj8qYRTZsBhge+JHhZyh0x9b95JqjVJkT084kZIPwu/mPWqPgfQ5jXh2+92Ay7HedfAgwA6KDWafb4w3cAAAAASUVORK5CYII=");
background-repeat: no-repeat;
background-position: 2px center;
}
.ace_gutter-cell.ace_warning {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==");
background-position: 2px center;
}
.ace_gutter-cell.ace_info {
background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7");
background-position: 2px center;
}
.ace_dark .ace_gutter-cell.ace_info {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=");
}
.ace_scrollbar {
position: absolute;
overflow-x: hidden;
overflow-y: scroll;
right: 0;
}
.ace_scrollbar-inner {
position: absolute;
width: 1px;
left: 0;
}
.ace_print-margin {
position: absolute;
height: 100%;
}
.ace_text-input {
position: absolute;
z-index: 0;
width: 0.5em;
height: 1em;
opacity: 0;
background: transparent;
-moz-appearance: none;
appearance: none;
border: none;
resize: none;
outline: none;
overflow: hidden;
}
.ace_text-input.ace_composition {
background: #fff;
color: #000;
z-index: 1000;
opacity: 1;
border: solid lightgray 1px;
margin: -1px
}
.ace_layer {
z-index: 1;
position: absolute;
overflow: hidden;
white-space: nowrap;
height: 100%;
width: 100%;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
/* setting pointer-events: auto; on node under the mouse, which changes
during scroll, will break mouse wheel scrolling in Safari */
pointer-events: none;
}
.ace_gutter-layer {
position: relative;
width: auto;
text-align: right;
pointer-events: auto;
}
.ace_text-layer {
color: black;
font: inherit !important;
}
.ace_cjk {
display: inline-block;
text-align: center;
}
.ace_cursor-layer {
z-index: 4;
}
.ace_cursor {
z-index: 4;
position: absolute;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.ace_hidden-cursors .ace_cursor {
opacity: 0.2;
}
.ace_smooth-blinking .ace_cursor {
-moz-transition: opacity 0.18s;
-webkit-transition: opacity 0.18s;
-o-transition: opacity 0.18s;
-ms-transition: opacity 0.18s;
transition: opacity 0.18s;
}
.ace_cursor[style*="opacity: 0"]{
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
}
.ace_editor.ace_multiselect .ace_cursor {
border-left-width: 1px;
}
.ace_line {
white-space: nowrap;
}
.ace_marker-layer .ace_step {
position: absolute;
z-index: 3;
}
.ace_marker-layer .ace_selection {
position: absolute;
z-index: 5;
}
.ace_marker-layer .ace_bracket {
position: absolute;
z-index: 6;
}
.ace_marker-layer .ace_active-line {
position: absolute;
z-index: 2;
}
.ace_marker-layer .ace_selected-word {
position: absolute;
z-index: 4;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.ace_line .ace_fold {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
display: inline-block;
height: 11px;
margin-top: -2px;
vertical-align: middle;
background-image:
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat, repeat-x;
background-position: center center, top left;
color: transparent;
border: 1px solid black;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
cursor: pointer;
pointer-events: auto;
}
.ace_dark .ace_fold {
}
.ace_fold:hover{
background-image:
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat, repeat-x;
background-position: center center, top left;
}
.ace_editor.ace_dragging .ace_content {
cursor: move;
}
.ace_gutter-tooltip {
background-color: #FFFFD5;
border: 1px solid gray;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
color: black;
display: inline-block;
padding: 4px;
position: absolute;
z-index: 300;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: default;
white-space: pre-line;
word-wrap: break-word;
}
.ace_folding-enabled > .ace_gutter-cell {
padding-right: 13px;
}
.ace_fold-widget {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0 -12px 0 1px;
display: inline-block;
width: 11px;
vertical-align: top;
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat;
background-position: center;
border-radius: 3px;
border: 1px solid transparent;
}
.ace_fold-widget.ace_end {
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82");
}
.ace_fold-widget.ace_closed {
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82");
}
.ace_fold-widget:hover {
border: 1px solid rgba(0, 0, 0, 0.3);
background-color: rgba(255, 255, 255, 0.2);
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
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);
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
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 {
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
}
.ace_fold-widget.ace_invalid {
background-color: #FFB4B4;
border-color: #DE5555;
}
.ace_fade-fold-widgets .ace_fold-widget {
-moz-transition: opacity 0.4s ease 0.05s;
-webkit-transition: opacity 0.4s ease 0.05s;
-o-transition: opacity 0.4s ease 0.05s;
-ms-transition: opacity 0.4s ease 0.05s;
transition: opacity 0.4s ease 0.05s;
opacity: 0;
}
.ace_fade-fold-widgets:hover .ace_fold-widget {
-moz-transition: opacity 0.05s ease 0.05s;
-webkit-transition: opacity 0.05s ease 0.05s;
-o-transition: opacity 0.05s ease 0.05s;
-ms-transition: opacity 0.05s ease 0.05s;
transition: opacity 0.05s ease 0.05s;
opacity:1;
}
.ace_underline {
text-decoration: underline;
}
.ace_bold {
font-weight: bold;
}
.ace_nobold .ace_bold {
font-weight: normal;
}
.ace_italic {
font-style: italic;
}
@@ -1,22 +0,0 @@
.ace_editor {
font-family: 'Monaco', 'Menlo', 'Droid Sans Mono', 'Courier New', monospace;
font-size: 12px;
}
.ace_editor .ace_gutter {
width: 25px !important;
display: block;
float: left;
text-align: right;
padding: 0 3px 0 0;
margin-right: 3px;
}
.ace_line { clear: both; }
*.ace_gutter-cell {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
user-select: none;
}
@@ -1,88 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var EditSession = require("../edit_session").EditSession;
var TextLayer = require("../layer/text").Text;
var baseStyles = require("../requirejs/text!./static.css");
/* Transforms a given input code snippet into HTML using the given mode
*
* @param {string} input Code snippet
* @param {mode} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode')
* @param {string} r Code snippet
* @returns {object} An object containing: html, css
*/
exports.render = function(input, mode, theme, lineStart, disableGutter) {
lineStart = parseInt(lineStart || 1, 10);
var session = new EditSession("");
session.setMode(mode);
session.setUseWorker(false);
var textLayer = new TextLayer(document.createElement("div"));
textLayer.setSession(session);
textLayer.config = {
characterWidth: 10,
lineHeight: 20
};
session.setValue(input);
var stringBuilder = [];
var length = session.getLength();
for(var ix = 0; ix < length; ix++) {
stringBuilder.push("<div class='ace_line'>");
if (!disableGutter)
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
textLayer.$renderLine(stringBuilder, ix, true, false);
stringBuilder.push("</div>");
}
// let's prepare the whole html
var html = "<div class=':cssClass'>\
<div class='ace_editor ace_scroller ace_text-layer'>\
:code\
</div>\
</div>".replace(/:cssClass/, theme.cssClass).replace(/:code/, stringBuilder.join(""));
textLayer.destroy();
return {
css: baseStyles + theme.cssText,
html: html
};
};
});
@@ -1,76 +0,0 @@
if (typeof process !== "undefined") {
require("amd-loader");
require("../test/mockdom");
}
define(function(require, exports, module) {
"use strict";
var assert = require("assert");
var highlighter = require("./static_highlight");
var JavaScriptMode = require("../mode/javascript").Mode;
// Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite
module.exports = {
timeout: 10000,
"test simple snippet": function(next) {
var theme = require("../theme/tomorrow");
var snippet = "\
/** this is a function\n\
*\n\
*/\n\
function hello (a, b, c) {\n\
console.log(a * b + c + 'sup?');\n\
}";
var mode = new JavaScriptMode();
var result = highlighter.render(snippet, mode, theme);
assert.equal(result.html, "<div class='ace-tomorrow'> <div class='ace_editor ace_scroller ace_text-layer'> <div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>1</span><span class='ace_comment ace_doc'>/**&#160;this&#160;is&#160;a&#160;function</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>2</span><span class='ace_comment ace_doc'>*</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>3</span><span class='ace_comment ace_doc'>*/</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>4</span><span class='ace_storage ace_type'>function</span>&#160;<span class='ace_entity ace_name ace_function'>hello</span>&#160;<span class='ace_paren ace_lparen'>(</span><span class='ace_variable ace_parameter'>a</span><span class='ace_punctuation ace_operator'>,&#160;</span><span class='ace_variable ace_parameter'>b</span><span class='ace_punctuation ace_operator'>,&#160;</span><span class='ace_variable ace_parameter'>c</span><span class='ace_paren ace_rparen'>)</span>&#160;<span class='ace_paren ace_lparen'>{</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>5</span>&#160;&#160;&#160;&#160;<span class='ace_storage ace_type'>console</span><span class='ace_punctuation ace_operator'>.</span><span class='ace_support ace_function ace_firebug'>log</span><span class='ace_paren ace_lparen'>(</span><span class='ace_identifier'>a</span>&#160;<span class='ace_keyword ace_operator'>*</span>&#160;<span class='ace_identifier'>b</span>&#160;<span class='ace_keyword ace_operator'>+</span>&#160;<span class='ace_identifier'>c</span>&#160;<span class='ace_keyword ace_operator'>+</span>&#160;<span class='ace_string'>'sup?'</span><span class='ace_paren ace_rparen'>)</span><span class='ace_punctuation ace_operator'>;</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>6</span><span class='ace_paren ace_rparen'>}</span></div> </div> </div>");
assert.ok(!!result.css);
next();
},
"test css from theme is used": function(next) {
var theme = require("../theme/tomorrow");
var snippet = "\
/** this is a function\n\
*\n\
*/\n\
function hello (a, b, c) {\n\
console.log(a * b + c + 'sup?');\n\
}";
var mode = new JavaScriptMode();
var isError = false, result;
result = highlighter.render(snippet, mode, theme);
assert.ok(result.css.indexOf(theme.cssText) !== -1);
next();
},
"test theme classname should be in output html": function (next) {
var theme = require("../theme/tomorrow");
var snippet = "\
/** this is a function\n\
*\n\
*/\n\
function hello (a, b, c) {\n\
console.log(a * b + c + 'sup?');\n\
}";
var mode = new JavaScriptMode();
var isError = false, result;
result = highlighter.render(snippet, mode, theme);
assert.equal(!!result.html.match(/<div class='ace-tomorrow'>/), true);
next();
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}
@@ -1,375 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var dom = require("../lib/dom");
var screenToTextBlockCoordinates = function(pageX, pageY) {
var canvasPos = this.scroller.getBoundingClientRect();
var col = Math.floor(
(pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) / this.characterWidth
);
var row = Math.floor(
(pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) / this.lineHeight
);
return this.session.screenToDocumentPosition(row, col);
};
var HashHandler = require("./hash_handler").HashHandler;
exports.handler = new HashHandler();
var initialized = false;
exports.handler.attach = function(editor) {
if (!initialized) {
initialized = true;
dom.importCssString('\
.emacs-mode .ace_cursor{\
border: 2px rgba(50,250,50,0.8) solid!important;\
-moz-box-sizing: border-box!important;\
-webkit-box-sizing: border-box!important;\
box-sizing: border-box!important;\
background-color: rgba(0,250,0,0.9);\
opacity: 0.5;\
}\
.emacs-mode .ace_cursor.ace_hidden{\
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'
);
}
editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
editor.setStyle("emacs-mode");
};
exports.handler.detach = function(editor) {
delete editor.renderer.screenToTextCoordinates;
editor.unsetStyle("emacs-mode");
};
var keys = require("../lib/keys").KEY_MODS;
var eMods = {
C: "ctrl", S: "shift", M: "alt"
};
["S-C-M", "S-C", "S-M", "C-M", "S", "C", "M"].forEach(function(c) {
var hashId = 0;
c.split("-").forEach(function(c){
hashId = hashId | keys[eMods[c]];
});
eMods[hashId] = c.toLowerCase() + "-";
});
exports.handler.bindKey = function(key, command) {
if (!key)
return;
var ckb = this.commmandKeyBinding;
key.split("|").forEach(function(keyPart) {
keyPart = keyPart.toLowerCase();
ckb[keyPart] = command;
keyPart = keyPart.split(" ")[0];
if (!ckb[keyPart])
ckb[keyPart] = "null";
}, this);
};
exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
if (hashId == -1) {
if (data.count) {
var str = Array(data.count + 1).join(key);
data.count = null;
return {command: "insertstring", args: str};
}
}
if (key == "\x00")
return;
var modifier = eMods[hashId];
if (modifier == "c-" || data.universalArgument) {
var count = parseInt(key[key.length - 1]);
if (count) {
data.count = count;
return {command: "null"};
}
}
data.universalArgument = false;
if (modifier)
key = modifier + key;
if (data.keyChain)
key = data.keyChain += " " + key;
var command = this.commmandKeyBinding[key];
data.keyChain = command == "null" ? key : "";
if (!command)
return;
if (command == "null")
return {command: "null"};
if (command == "universalArgument") {
data.universalArgument = true;
return {command: "null"};
}
if (typeof command != "string") {
var args = command.args;
command = command.command;
}
if (typeof command == "string") {
command = this.commands[command] || data.editor.commands.commands[command];
}
if (!command.readonly && !command.isYank)
data.lastCommand = null;
if (data.count) {
var count = data.count;
data.count = 0;
return {
args: args,
command: {
exec: function(editor, args) {
for (var i = 0; i < count; i++)
command.exec(editor, args);
}
}
};
}
return {command: command, args: args};
};
exports.emacsKeys = {
// movement
"Up|C-p" : "golineup",
"Down|C-n" : "golinedown",
"Left|C-b" : "gotoleft",
"Right|C-f" : "gotoright",
"C-Left|M-b" : "gotowordleft",
"C-Right|M-f" : "gotowordright",
"Home|C-a" : "gotolinestart",
"End|C-e" : "gotolineend",
"C-Home|S-M-,": "gotostart",
"C-End|S-M-." : "gotoend",
// 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": "gotopagedown",
"C-Up": "gotopageup",
"PageDown|C-v": "gotopagedown",
"PageUp|M-v": "gotopageup",
"S-C-Down": "selectpagedown",
"S-C-Up": "selectpageup",
"C-s": "findnext",
"C-r": "findprevious",
"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": "killRegion",
"M-w": "killRingSave",
"C-Space": "setMark",
"C-x C-x": "exchangePointAndMark",
"C-t": "transposeletters",
"M-u": "touppercase",
"M-l": "tolowercase",
"M-/": "autocomplete",
"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"
// todo
// "M-x" "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: function() {
},
exchangePointAndMark: {
exec: function(editor) {
var range = editor.selection.getRange();
editor.selection.setSelectionRange(range, !editor.selection.isBackwards());
},
readonly: 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.selection.selectLine();
var range = editor.getSelectionRange();
var text = editor.session.getTextRange(range);
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.onPaste(exports.killRing.rotate());
editor.keyBinding.$data.lastCommand = "yank";
},
killRegion: function(editor) {
exports.killRing.add(editor.getCopyText());
editor.commands.byName.cut.exec(editor);
},
killRingSave: function(editor) {
exports.killRing.add(editor.getCopyText());
}
});
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();
},
get: function() {
return this.$data[this.$data.length - 1] || "";
},
pop: function() {
if (this.$data.length > 1)
this.$data.pop();
return this.get();
},
rotate: function() {
this.$data.unshift(this.$data.pop());
return this.get();
}
};
});
@@ -1,380 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var event = require("../lib/event");
var useragent = require("../lib/useragent");
var dom = require("../lib/dom");
var TextInput = function(parentNode, host) {
var text = dom.createElement("textarea");
text.className = "ace_text-input";
/*/ debug
text.style.opacity = 1
text.style.background = "rgba(0, 250, 0, 0.3)"
text.style.outline = "rgba(0, 250, 0, 0.8) solid 1px"
text.style.outlineOffset = "3px"
/**/
if (useragent.isTouchPad)
text.setAttribute("x-palm-disable-auto-cap", true);
text.wrap = "off";
text.spellcheck = false;
text.style.top = "-2em";
parentNode.insertBefore(text, parentNode.firstChild);
var PLACEHOLDER = useragent.isIE || useragent.isOpera ? "\x01\x01" : "\x00\x00";
resetValue();
if (isFocused())
host.onFocus();
// Somehow fixes problem with firing onpropertychange on first typed char
if (useragent.isOldIE) {
resetSelection();
resetValue();
setTimeout(resetSelection);
}
var cut = false
var copied = false;
var pasted = false;
var inCompostion = false;
var resetTimeout = null;
var tempStyle = '';
function resetValue() {
text.value = PLACEHOLDER;
//http://code.google.com/p/chromium/issues/detail?id=76516
if (useragent.isWebKit && !resetTimeout)
resetTimeout = setTimeout(function(){
text.value = PLACEHOLDER;
resetSelection();
resetTimeout = null;
});
};
function resetSelection(isEmpty) {
var selectionStart = isEmpty ? 2 : 1;
var selectionEnd = 2;
// on firefox this throws if textarea is hidden
try {
if (text.setSelectionRange) {
text.setSelectionRange(selectionStart, selectionEnd);
}
// IE8 does not support setSelectionRange
else if (text.createTextRange) {
var range = text.createTextRange();
range.collapse(true);
range.moveEnd('character', selectionEnd);
range.moveStart('character', selectionStart);
range.select();
}
} catch(e){}
};
var onSelect = function(e) {
if (cut) {
cut = false;
return;
}
if (copied) {
copied = false;
return;
}
if (text.selectionStart === 0 && text.selectionEnd === text.value.length) {
host.selectAll();
resetSelection();
}
};
var onInput = function(e) {
if (inCompostion)
return;
if (pasted) {
var data = text.value;
resetValue();
if (data)
host.onPaste(data);
pasted = false;
return;
}
var data = text.value;
if (data.substring(0, 2) == PLACEHOLDER)
data = data.substr(2);
else
data = data.substr(1);
resetValue();
if (data) {
// can happen if undo in textarea isn't stopped
if (data[data.length - 1] == PLACEHOLDER[0])
data = data.slice(0, -1);
if (data)
host.onTextInput(data);
} else
host.onDelete();
};
var onCompositionStart = function(e) {
inCompostion = true;
host.onCompositionStart();
setTimeout(onCompositionUpdate, 0);
};
var onCompositionUpdate = function() {
if (!inCompostion) return;
host.onCompositionUpdate(text.value);
};
var onCompositionEnd = function(e) {
inCompostion = false;
host.onCompositionEnd();
};
var onCut = function(e) {
var data = host.getCopyText();
if (!data) {
event.preventDefault(e);
return;
}
var clipboardData = e.clipboardData || window.clipboardData;
if (clipboardData) {
// Safari 5 has clipboardData object, but does not handle setData()
var supported = clipboardData.setData("Text", data);
if (supported) {
host.onCut();
event.preventDefault(e);
}
}
if (!supported) {
cut = true;
text.value = data;
text.select();
setTimeout(function(){
cut = false;
resetValue();
resetSelection();
host.onCut();
});
}
};
var onCopy = function(e) {
var data = host.getCopyText();
if (!data) {
event.preventDefault(e);
return;
}
var clipboardData = e.clipboardData || window.clipboardData;
if (clipboardData) {
// Safari 5 has clipboardData object, but does not handle setData()
var supported = clipboardData.setData("Text", data);
if (supported) {
host.onCopy();
event.preventDefault(e);
}
}
if (!supported) {
copied = true;
text.value = data;
text.select();
setTimeout(function(){
copied = false;
resetValue();
resetSelection();
host.onCopy();
});
}
};
var onPaste = function(e) {
var clipboardData = e.clipboardData || window.clipboardData;
if (clipboardData) {
var data = clipboardData.getData("Text");
if (data)
host.onPaste(data);
event.preventDefault(e);
}
else {
text.value = "";
pasted = true;
}
};
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
event.addListener(text, "select", onSelect);
event.addListener(text, "input", onInput);
event.addListener(text, "cut", onCut);
event.addListener(text, "copy", onCopy);
event.addListener(text, "paste", onPaste);
// Opera has no clipboard events
if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){
event.addListener(parentNode, "keydown", function(e) {
if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
return;
switch (e.keyCode) {
case 67:
onCopy(e);
break;
case 86:
onPaste(e);
break;
case 88:
onCut(e);
break;
}
});
}
if (useragent.isOldIE) {
event.addListener(text, "propertychange", function(e){
if (text.value != "" && text.value != PLACEHOLDER)
onInput(e);
});
var keytable = { 13:1, 27:1 };
event.addListener(text, "keyup", function (e) {
if (inCompostion && (!text.value || keytable[e.keyCode]))
setTimeout(onCompositionEnd, 0);
if ((text.value.charCodeAt(0)|0) < 129) {
return;
}
inCompostion ? onCompositionUpdate() : onCompositionStart();
});
}
event.addListener(text, "compositionstart", onCompositionStart);
if (useragent.isGecko) {
event.addListener(text, "text", onCompositionUpdate);
}
if (useragent.isWebKit) {
event.addListener(text, "keyup", onCompositionUpdate);
}
event.addListener(text, "compositionend", onCompositionEnd);
event.addListener(text, "blur", function() {
host.onBlur();
});
event.addListener(text, "focus", function() {
host.onFocus();
resetSelection();
});
this.focus = function() {
text.focus();
};
this.blur = function() {
text.blur();
};
function isFocused() {
return document.activeElement === text;
}
this.isFocused = isFocused;
this.getElement = function() {
return text;
};
this.onContextMenu = function(e) {
if (!tempStyle)
tempStyle = text.style.cssText;
text.style.cssText =
"position:fixed; z-index:100000;" +
(useragent.isIE ? "background:rgba(0, 0, 0, 0.03); opacity:0.1;" : "") + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
"left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;";
resetSelection(host.selection.isEmpty());
if (e.type != "mousedown")
return;
if (host.renderer.$keepTextAreaAtCursor)
host.renderer.$keepTextAreaAtCursor = null;
// on windows context menu is opened after mouseup
if (useragent.isWin)
event.capture(host.container, function(e) {
text.style.left = e.clientX - 2 + "px";
text.style.top = e.clientY - 2 + "px";
}, onContextMenuClose);
};
function onContextMenuClose() {
setTimeout(function () {
if (tempStyle) {
text.style.cssText = tempStyle;
tempStyle = '';
}
if (host.renderer.$keepTextAreaAtCursor == null) {
host.renderer.$keepTextAreaAtCursor = true;
host.renderer.$moveTextAreaToCursor();
}
}, 0);
};
this.onContextMenuClose = onContextMenuClose;
// firefox fires contextmenu event after opening it
if (!useragent.isGecko)
event.addListener(text, "contextmenu", function(e) {
host.textInput.onContextMenu(e);
onContextMenuClose();
});
};
exports.TextInput = TextInput;
});
@@ -1,149 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var cmds = require("./vim/commands");
var coreCommands = cmds.coreCommands;
var util = require("./vim/maps/util");
var useragent = require("../lib/useragent");
var startCommands = {
"i": {
command: coreCommands.start
},
"I": {
command: coreCommands.startBeginning
},
"a": {
command: coreCommands.append
},
"A": {
command: coreCommands.appendEnd
},
"ctrl-f": {
command: "gotopagedown"
},
"ctrl-b": {
command: "gotopageup"
}
};
exports.handler = {
// workaround for j not repeating with `defaults write -g ApplePressAndHoldEnabled -bool true`
handleMacRepeat: function(data, hashId, key) {
if (hashId == -1) {
// record key
data.inputChar = key;
data.lastEvent = "input";
} else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
// check for repeated keypress
if (data.lastEvent == "input") {
data.lastEvent = "input1";
} else if (data.lastEvent == "input1") {
// simulate textinput
return true;
}
} else {
// reset
data.$lastHash = hashId;
data.$lastKey = key;
data.lastEvent = "keypress";
}
},
handleKeyboard: function(data, hashId, key, keyCode, e) {
// ignore command keys (shift, ctrl etc.)
if (hashId != 0 && (key == "" || key == "\x00"))
return null;
if (hashId == 1)
key = "ctrl-" + key;
if ((key == "esc" && hashId == 0) || key == "ctrl-[") {
return {command: coreCommands.stop};
} else if (data.state == "start") {
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
hashId = -1;
key = data.inputChar;
}
if (hashId == -1 || hashId == 1) {
if (cmds.inputBuffer.idle && startCommands[key])
return startCommands[key];
return {
command: {
exec: function(editor) {cmds.inputBuffer.push(editor, key);}
}
};
} // if no modifier || shift: wait for input.
else if (key.length == 1 && (hashId == 0 || hashId == 4)) {
return {command: "null", passEvent: true};
} else if (key == "esc" && hashId == 0) {
return {command: coreCommands.stop};
}
} else {
if (key == "ctrl-w") {
return {command: "removewordleft"};
}
}
},
attach: function(editor) {
editor.on("click", exports.onCursorMove);
if (util.currentMode !== "insert")
cmds.coreCommands.stop.exec(editor);
editor.$vimModeHandler = this;
},
detach: function(editor) {
editor.removeListener("click", exports.onCursorMove);
util.noMode(editor);
util.currentMode = "normal";
},
actions: cmds.actions,
getStatusText: function() {
if (util.currentMode == "insert")
return "INSERT";
if (util.onVisualMode)
return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status;
return cmds.inputBuffer.status;
}
};
exports.onCursorMove = function(e) {
cmds.onCursorMove(e.editor, e);
exports.onCursorMove.scheduled = false;
};
});
@@ -1,561 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"never use strict";
var util = require("./maps/util");
var motions = require("./maps/motions");
var operators = require("./maps/operators");
var alias = require("./maps/aliases");
var registers = require("./registers");
var NUMBER = 1;
var OPERATOR = 2;
var MOTION = 3;
var ACTION = 4;
var HMARGIN = 8; // Minimum amount of line separation between margins;
var repeat = function repeat(fn, count, args) {
while (0 < count--)
fn.apply(this, args);
};
var ensureScrollMargin = function(editor) {
var renderer = editor.renderer;
var pos = renderer.$cursorLayer.getPixelPosition();
var top = pos.top;
var margin = HMARGIN * renderer.layerConfig.lineHeight;
if (2 * margin > renderer.$size.scrollerHeight)
margin = renderer.$size.scrollerHeight / 2;
if (renderer.scrollTop > top - margin) {
renderer.session.setScrollTop(top - margin);
}
if (renderer.scrollTop + renderer.$size.scrollerHeight < top + margin + renderer.lineHeight) {
renderer.session.setScrollTop(top + margin + renderer.lineHeight - renderer.$size.scrollerHeight);
}
};
var actions = exports.actions = {
"z": {
param: true,
fn: function(editor, range, count, param) {
switch (param) {
case "z":
editor.renderer.alignCursor(null, 0.5);
break;
case "t":
editor.renderer.alignCursor(null, 0);
break;
case "b":
editor.renderer.alignCursor(null, 1);
break;
}
}
},
"r": {
param: true,
fn: function(editor, range, count, param) {
if (param && param.length) {
repeat(function() { editor.insert(param); }, count || 1);
editor.navigateLeft();
}
}
},
"R": {
fn: function(editor, range, count, param) {
util.insertMode(editor);
editor.setOverwrite(true);
}
},
"~": {
fn: function(editor, range, count) {
repeat(function() {
var range = editor.selection.getRange();
if (range.isEmpty())
range.end.column++;
var text = editor.session.getTextRange(range);
var toggled = text.toUpperCase();
if (toggled == text)
editor.navigateRight();
else
editor.session.replace(range, toggled);
}, count || 1);
}
},
"*": {
fn: function(editor, range, count, param) {
editor.selection.selectWord();
editor.findNext();
ensureScrollMargin(editor);
var r = editor.selection.getRange();
editor.selection.setSelectionRange(r, true);
}
},
"#": {
fn: function(editor, range, count, param) {
editor.selection.selectWord();
editor.findPrevious();
ensureScrollMargin(editor);
var r = editor.selection.getRange();
editor.selection.setSelectionRange(r, true);
}
},
"n": {
fn: function(editor, range, count, param) {
var options = editor.getLastSearchOptions();
options.backwards = false;
editor.selection.moveCursorRight();
editor.selection.clearSelection();
editor.findNext(options);
ensureScrollMargin(editor);
var r = editor.selection.getRange();
r.end.row = r.start.row;
r.end.column = r.start.column;
editor.selection.setSelectionRange(r, true);
}
},
"N": {
fn: function(editor, range, count, param) {
var options = editor.getLastSearchOptions();
options.backwards = true;
editor.findPrevious(options);
ensureScrollMargin(editor);
var r = editor.selection.getRange();
r.end.row = r.start.row;
r.end.column = r.start.column;
editor.selection.setSelectionRange(r, true);
}
},
"v": {
fn: function(editor, range, count, param) {
editor.selection.selectRight();
util.visualMode(editor, false);
},
acceptsMotion: true
},
"V": {
fn: function(editor, range, count, param) {
//editor.selection.selectLine();
//editor.selection.selectLeft();
var row = editor.getCursorPosition().row;
editor.selection.clearSelection();
editor.selection.moveCursorTo(row, 0);
editor.selection.selectLineEnd();
editor.selection.visualLineStart = row;
util.visualMode(editor, true);
},
acceptsMotion: true
},
"Y": {
fn: function(editor, range, count, param) {
util.copyLine(editor);
}
},
"p": {
fn: function(editor, range, count, param) {
var defaultReg = registers._default;
editor.setOverwrite(false);
if (defaultReg.isLine) {
var pos = editor.getCursorPosition();
var lines = defaultReg.text.split("\n");
editor.session.getDocument().insertLines(pos.row + 1, lines);
editor.moveCursorTo(pos.row + 1, 0);
}
else {
editor.navigateRight();
editor.insert(defaultReg.text);
editor.navigateLeft();
}
editor.setOverwrite(true);
editor.selection.clearSelection();
}
},
"P": {
fn: function(editor, range, count, param) {
var defaultReg = registers._default;
editor.setOverwrite(false);
if (defaultReg.isLine) {
var pos = editor.getCursorPosition();
var lines = defaultReg.text.split("\n");
editor.session.getDocument().insertLines(pos.row, lines);
editor.moveCursorTo(pos.row, 0);
}
else {
editor.insert(defaultReg.text);
}
editor.setOverwrite(true);
editor.selection.clearSelection();
}
},
"J": {
fn: function(editor, range, count, param) {
var session = editor.session;
range = editor.getSelectionRange();
var pos = {row: range.start.row, column: range.start.column};
count = count || range.end.row - range.start.row;
var maxRow = Math.min(pos.row + (count || 1), session.getLength() - 1);
range.start.column = session.getLine(pos.row).length;
range.end.column = session.getLine(maxRow).length;
range.end.row = maxRow;
var text = "";
for (var i = pos.row; i < maxRow; i++) {
var nextLine = session.getLine(i + 1);
text += " " + /^\s*(.*)$/.exec(nextLine)[1] || "";
}
session.replace(range, text);
editor.moveCursorTo(pos.row, pos.column);
}
},
"u": {
fn: function(editor, range, count, param) {
count = parseInt(count || 1, 10);
for (var i = 0; i < count; i++) {
editor.undo();
}
editor.selection.clearSelection();
}
},
"ctrl-r": {
fn: function(editor, range, count, param) {
count = parseInt(count || 1, 10);
for (var i = 0; i < count; i++) {
editor.redo();
}
editor.selection.clearSelection();
}
},
":": {
fn: function(editor, range, count, param) {
// not implemented
}
},
"/": {
fn: function(editor, range, count, param) {
// not implemented
}
},
"?": {
fn: function(editor, range, count, param) {
// not implemented
}
},
".": {
fn: function(editor, range, count, param) {
util.onInsertReplaySequence = inputBuffer.lastInsertCommands;
var previous = inputBuffer.previous;
if (previous) // If there is a previous action
inputBuffer.exec(editor, previous.action, previous.param);
}
}
};
var inputBuffer = exports.inputBuffer = {
accepting: [NUMBER, OPERATOR, MOTION, ACTION],
currentCmd: null,
//currentMode: 0,
currentCount: "",
status: "",
// Types
operator: null,
motion: null,
lastInsertCommands: [],
push: function(editor, ch, keyId) {
this.idle = false;
var wObj = this.waitingForParam;
if (wObj) {
this.exec(editor, wObj, ch);
}
// If input is a number (that doesn't start with 0)
else if (!(ch === "0" && !this.currentCount.length) &&
(ch.match(/^\d+$/) && this.isAccepting(NUMBER))) {
// Assuming that ch is always of type String, and not Number
this.currentCount += ch;
this.currentCmd = NUMBER;
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
}
else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) {
this.operator = {
ch: ch,
count: this.getCount()
};
this.currentCmd = OPERATOR;
this.accepting = [NUMBER, MOTION, ACTION];
this.exec(editor, { operator: this.operator });
}
else if (motions[ch] && this.isAccepting(MOTION)) {
this.currentCmd = MOTION;
var ctx = {
operator: this.operator,
motion: {
ch: ch,
count: this.getCount()
}
};
if (motions[ch].param)
this.waitForParam(ctx);
else
this.exec(editor, ctx);
}
else if (alias[ch] && this.isAccepting(MOTION)) {
alias[ch].operator.count = this.getCount();
this.exec(editor, alias[ch]);
}
else if (actions[ch] && this.isAccepting(ACTION)) {
var actionObj = {
action: {
fn: actions[ch].fn,
count: this.getCount()
}
};
if (actions[ch].param) {
this.waitForParam(actionObj);
}
else {
this.exec(editor, actionObj);
}
if (actions[ch].acceptsMotion)
this.idle = false;
}
else if (this.operator) {
this.exec(editor, { operator: this.operator }, ch);
}
else {
this.reset();
}
if (this.waitingForParam || this.motion || this.operator) {
this.status += ch;
} else if (this.currentCount) {
this.status = this.currentCount;
} else if (this.status) {
this.status = "";
} else {
return;
}
editor._emit("changeStatus");
},
waitForParam: function(cmd) {
this.waitingForParam = cmd;
},
getCount: function() {
var count = this.currentCount;
this.currentCount = "";
return count && parseInt(count, 10);
},
exec: function(editor, action, param) {
var m = action.motion;
var o = action.operator;
var a = action.action;
if (!param)
param = action.param;
if (o) {
this.previous = {
action: action,
param: param
};
}
if (o && !editor.selection.isEmpty()) {
if (operators[o.ch].selFn) {
operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param);
this.reset();
}
return;
}
// There is an operator, but no motion or action. We try to pass the
// current ch to the operator to see if it responds to it (an example
// of this is the 'dd' operator).
else if (!m && !a && o && param) {
operators[o.ch].fn(editor, null, o.count, param);
this.reset();
}
else if (m) {
var run = function(fn) {
if (fn && typeof fn === "function") { // There should always be a motion
if (m.count && !motionObj.handlesCount)
repeat(fn, m.count, [editor, null, m.count, param]);
else
fn(editor, null, m.count, param);
}
};
var motionObj = motions[m.ch];
var selectable = motionObj.sel;
if (!o) {
if ((util.onVisualMode || util.onVisualLineMode) && selectable)
run(motionObj.sel);
else
run(motionObj.nav);
}
else if (selectable) {
repeat(function() {
run(motionObj.sel);
operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
}, o.count || 1);
}
this.reset();
}
else if (a) {
a.fn(editor, editor.getSelectionRange(), a.count, param);
this.reset();
}
handleCursorMove(editor);
},
isAccepting: function(type) {
return this.accepting.indexOf(type) !== -1;
},
reset: function() {
this.operator = null;
this.motion = null;
this.currentCount = "";
this.status = "";
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
this.idle = true;
this.waitingForParam = null;
}
};
function setPreviousCommand(fn) {
inputBuffer.previous = { action: { action: { fn: fn } } };
}
exports.coreCommands = {
start: {
exec: function start(editor) {
util.insertMode(editor);
setPreviousCommand(start);
}
},
startBeginning: {
exec: function startBeginning(editor) {
editor.navigateLineStart();
util.insertMode(editor);
setPreviousCommand(startBeginning);
}
},
// Stop Insert mode as soon as possible. Works like typing <Esc> in
// insert mode.
stop: {
exec: function stop(editor) {
inputBuffer.reset();
util.onVisualMode = false;
util.onVisualLineMode = false;
inputBuffer.lastInsertCommands = util.normalMode(editor);
}
},
append: {
exec: function append(editor) {
var pos = editor.getCursorPosition();
var lineLen = editor.session.getLine(pos.row).length;
if (lineLen)
editor.navigateRight();
util.insertMode(editor);
setPreviousCommand(append);
}
},
appendEnd: {
exec: function appendEnd(editor) {
editor.navigateLineEnd();
util.insertMode(editor);
setPreviousCommand(appendEnd);
}
}
};
var handleCursorMove = exports.onCursorMove = function(editor, e) {
if (util.currentMode === 'insert' || handleCursorMove.running)
return;
else if(!editor.selection.isEmpty()) {
handleCursorMove.running = true;
if (util.onVisualLineMode) {
var originRow = editor.selection.visualLineStart;
var cursorRow = editor.getCursorPosition().row;
if(originRow <= cursorRow) {
var endLine = editor.session.getLine(cursorRow);
editor.selection.clearSelection();
editor.selection.moveCursorTo(originRow, 0);
editor.selection.selectTo(cursorRow, endLine.length);
} else {
var endLine = editor.session.getLine(originRow);
editor.selection.clearSelection();
editor.selection.moveCursorTo(originRow, endLine.length);
editor.selection.selectTo(cursorRow, 0);
}
}
handleCursorMove.running = false;
return;
}
else {
if (e && (util.onVisualLineMode || util.onVisualMode)) {
editor.selection.clearSelection();
util.normalMode(editor);
}
handleCursorMove.running = true;
var pos = editor.getCursorPosition();
var lineLen = editor.session.getLine(pos.row).length;
if (lineLen && pos.column === lineLen)
editor.navigateLeft();
handleCursorMove.running = false;
}
};
});
@@ -1,94 +0,0 @@
/* ***** 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"
define(function(require, exports, module) {
module.exports = {
"x": {
operator: {
ch: "d",
count: 1
},
motion: {
ch: "l",
count: 1
}
},
"X": {
operator: {
ch: "d",
count: 1
},
motion: {
ch: "h",
count: 1
}
},
"D": {
operator: {
ch: "d",
count: 1
},
motion: {
ch: "$",
count: 1
}
},
"C": {
operator: {
ch: "c",
count: 1
},
motion: {
ch: "$",
count: 1
}
},
"s": {
operator: {
ch: "c",
count: 1
},
motion: {
ch: "l",
count: 1
}
},
"S": {
operator: {
ch: "c",
count: 1
},
param: "c"
}
};
});
@@ -1,593 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var util = require("./util");
var keepScrollPosition = function(editor, fn) {
var scrollTopRow = editor.renderer.getScrollTopRow();
var initialRow = editor.getCursorPosition().row;
var diff = initialRow - scrollTopRow;
fn && fn.call(editor);
editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
};
function Motion(m) {
if (typeof m == "function") {
var getPos = m;
m = this;
} else {
var getPos = m.getPos;
}
m.nav = function(editor, range, count, param) {
var a = getPos(editor, range, count, param, false);
if (!a)
return;
editor.clearSelection();
editor.moveCursorTo(a.row, a.column);
};
m.sel = function(editor, range, count, param) {
var a = getPos(editor, range, count, param, true);
if (!a)
return;
editor.selection.selectTo(a.row, a.column);
};
return m;
}
var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
var whiteRe = /\s/;
var StringStream = function(editor, cursor) {
var sel = editor.selection;
this.range = sel.getRange();
cursor = cursor || sel.selectionLead;
this.row = cursor.row;
this.col = cursor.column;
var line = editor.session.getLine(this.row);
var maxRow = editor.session.getLength();
this.ch = line[this.col] || '\n';
this.skippedLines = 0;
this.next = function() {
this.ch = line[++this.col] || this.handleNewLine(1);
//this.debug()
return this.ch;
};
this.prev = function() {
this.ch = line[--this.col] || this.handleNewLine(-1);
//this.debug()
return this.ch;
};
this.peek = function(dir) {
var ch = line[this.col + dir];
if (ch)
return ch;
if (dir == -1)
return '\n';
if (this.col == line.length - 1)
return '\n';
return editor.session.getLine(this.row + 1)[0] || '\n';
};
this.handleNewLine = function(dir) {
if (dir == 1){
if (this.col == line.length)
return '\n';
if (this.row == maxRow - 1)
return '';
this.col = 0;
this.row ++;
line = editor.session.getLine(this.row);
this.skippedLines++;
return line[0] || '\n';
}
if (dir == -1) {
if (this.row === 0)
return '';
this.row --;
line = editor.session.getLine(this.row);
this.col = line.length;
this.skippedLines--;
return '\n';
}
};
this.debug = function() {
console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
};
};
var Search = require("../../../search").Search;
var search = new Search();
function find(editor, needle, dir) {
search.$options.needle = needle;
search.$options.backwards = dir == -1;
return search.find(editor.session);
}
var Range = require("../../../range").Range;
module.exports = {
"w": new Motion(function(editor) {
var str = new StringStream(editor);
if (str.ch && wordSeparatorRe.test(str.ch)) {
while (str.ch && wordSeparatorRe.test(str.ch))
str.next();
} else {
while (str.ch && !nonWordRe.test(str.ch))
str.next();
}
while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2)
str.next();
str.skippedLines == 2 && str.prev();
return {column: str.col, row: str.row};
}),
"W": new Motion(function(editor) {
var str = new StringStream(editor);
while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2)
str.next();
if (str.skippedLines == 2)
str.prev();
else
str.next();
return {column: str.col, row: str.row};
}),
"b": new Motion(function(editor) {
var str = new StringStream(editor);
str.prev();
while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2)
str.prev();
if (str.ch && wordSeparatorRe.test(str.ch)) {
while (str.ch && wordSeparatorRe.test(str.ch))
str.prev();
} else {
while (str.ch && !nonWordRe.test(str.ch))
str.prev();
}
str.ch && str.next();
return {column: str.col, row: str.row};
}),
"B": new Motion(function(editor) {
var str = new StringStream(editor);
str.prev();
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
str.prev();
if (str.skippedLines == -2)
str.next();
return {column: str.col, row: str.row};
}),
"e": new Motion(function(editor) {
var str = new StringStream(editor);
str.next();
while (str.ch && whiteRe.test(str.ch))
str.next();
if (str.ch && wordSeparatorRe.test(str.ch)) {
while (str.ch && wordSeparatorRe.test(str.ch))
str.next();
} else {
while (str.ch && !nonWordRe.test(str.ch))
str.next();
}
str.ch && str.prev();
return {column: str.col, row: str.row};
}),
"E": new Motion(function(editor) {
var str = new StringStream(editor);
str.next();
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1))))
str.next();
return {column: str.col, row: str.row};
}),
"l": {
nav: function(editor) {
editor.navigateRight();
},
sel: function(editor) {
var pos = editor.getCursorPosition();
var col = pos.column;
var lineLen = editor.session.getLine(pos.row).length;
// Solving the behavior at the end of the line due to the
// different 0 index-based colum positions in ACE.
if (lineLen && col !== lineLen) //In selection mode you can select the newline
editor.selection.selectRight();
}
},
"h": {
nav: function(editor) {
var pos = editor.getCursorPosition();
if (pos.column > 0)
editor.navigateLeft();
},
sel: function(editor) {
var pos = editor.getCursorPosition();
if (pos.column > 0)
editor.selection.selectLeft();
}
},
"H": {
nav: function(editor) {
var row = editor.renderer.getScrollTopRow();
editor.moveCursorTo(row);
},
sel: function(editor) {
var row = editor.renderer.getScrollTopRow();
editor.selection.selectTo(row);
}
},
"M": {
nav: function(editor) {
var topRow = editor.renderer.getScrollTopRow();
var bottomRow = editor.renderer.getScrollBottomRow();
var row = topRow + ((bottomRow - topRow) / 2);
editor.moveCursorTo(row);
},
sel: function(editor) {
var topRow = editor.renderer.getScrollTopRow();
var bottomRow = editor.renderer.getScrollBottomRow();
var row = topRow + ((bottomRow - topRow) / 2);
editor.selection.selectTo(row);
}
},
"L": {
nav: function(editor) {
var row = editor.renderer.getScrollBottomRow();
editor.moveCursorTo(row);
},
sel: function(editor) {
var row = editor.renderer.getScrollBottomRow();
editor.selection.selectTo(row);
}
},
"k": {
nav: function(editor) {
editor.navigateUp();
},
sel: function(editor) {
editor.selection.selectUp();
}
},
"j": {
nav: function(editor) {
editor.navigateDown();
},
sel: function(editor) {
editor.selection.selectDown();
}
},
"i": {
param: true,
sel: function(editor, range, count, param) {
switch (param) {
case "w":
editor.selection.selectWord();
break;
case "W":
editor.selection.selectAWord();
break;
case "(":
case "{":
case "[":
var cursor = editor.getCursorPosition();
var end = editor.session.$findClosingBracket(param, cursor, /paren/);
if (!end)
return;
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
if (!start)
return;
start.column ++;
editor.selection.setSelectionRange(Range.fromPoints(start, end));
break;
case "'":
case '"':
case "/":
var end = find(editor, param, 1);
if (!end)
return;
var start = find(editor, param, -1);
if (!start)
return;
editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start));
break;
}
}
},
"a": {
param: true,
sel: function(editor, range, count, param) {
switch (param) {
case "w":
editor.selection.selectAWord();
break;
case "W":
editor.selection.selectAWord();
break;
case "(":
case "{":
case "[":
var cursor = editor.getCursorPosition();
var end = editor.session.$findClosingBracket(param, cursor, /paren/);
if (!end)
return;
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
if (!start)
return;
end.column ++;
editor.selection.setSelectionRange(Range.fromPoints(start, end));
break;
case "'":
case "\"":
case "/":
var end = find(editor, param, 1);
if (!end)
return;
var start = find(editor, param, -1);
if (!start)
return;
end.column ++;
editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end));
break;
}
}
},
"f": new Motion({
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel) {
var cursor = editor.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
cursor.column += column + (isSel ? 2 : 1);
return cursor;
}
}
}),
"F": new Motion({
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel) {
var cursor = editor.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
cursor.column -= column + 1;
return cursor;
}
}
}),
"t": new Motion({
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel) {
var cursor = editor.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
cursor.column += column + (isSel ? 1 : 0);
return cursor;
}
}
}),
"T": new Motion({
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel) {
var cursor = editor.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
cursor.column -= column;
return cursor;
}
}
}),
"^": {
nav: function(editor) {
editor.navigateLineStart();
},
sel: function(editor) {
editor.selection.selectLineStart();
}
},
"$": {
nav: function(editor) {
editor.navigateLineEnd();
},
sel: function(editor) {
editor.selection.selectLineEnd();
}
},
"0": new Motion(function(ed) {
return {row: ed.selection.lead.row, column: 0};
}),
"G": {
nav: function(editor, range, count, param) {
if (!count && count !== 0) { // Stupid JS
count = editor.session.getLength();
}
editor.gotoLine(count);
},
sel: function(editor, range, count, param) {
if (!count && count !== 0) { // Stupid JS
count = editor.session.getLength();
}
editor.selection.selectTo(count, 0);
}
},
"g": {
param: true,
nav: function(editor, range, count, param) {
switch(param) {
case "m":
console.log("Middle line");
break;
case "e":
console.log("End of prev word");
break;
case "g":
editor.gotoLine(count || 0);
case "u":
editor.gotoLine(count || 0);
case "U":
editor.gotoLine(count || 0);
}
},
sel: function(editor, range, count, param) {
switch(param) {
case "m":
console.log("Middle line");
break;
case "e":
console.log("End of prev word");
break;
case "g":
editor.selection.selectTo(count || 0, 0);
}
}
},
"o": {
nav: function(editor, range, count, param) {
count = count || 1;
var content = "";
while (0 < count--)
content += "\n";
if (content.length) {
editor.navigateLineEnd()
editor.insert(content);
util.insertMode(editor);
}
}
},
"O": {
nav: function(editor, range, count, param) {
var row = editor.getCursorPosition().row;
count = count || 1;
var content = "";
while (0 < count--)
content += "\n";
if (content.length) {
if(row > 0) {
editor.navigateUp();
editor.navigateLineEnd()
editor.insert(content);
} else {
editor.session.insert({row: 0, column: 0}, content);
editor.navigateUp();
}
util.insertMode(editor);
}
}
},
"%": new Motion(function(editor){
var brRe = /[\[\]{}()]/g;
var cursor = editor.getCursorPosition();
var ch = editor.session.getLine(cursor.row)[cursor.column];
if (!brRe.test(ch)) {
var range = find(editor, brRe);
if (!range)
return;
cursor = range.start;
}
var match = editor.session.findMatchingBracket({
row: cursor.row,
column: cursor.column + 1
});
return match;
}),
"{": new Motion(function(ed) {
var session = ed.session;
var row = session.selection.lead.row;
while(row > 0 && !/\S/.test(session.getLine(row)))
row--;
while(/\S/.test(session.getLine(row)))
row--;
return {column: 0, row: row};
}),
"}": new Motion(function(ed) {
var session = ed.session;
var l = session.getLength();
var row = session.selection.lead.row;
while(row < l && !/\S/.test(session.getLine(row)))
row++;
while(/\S/.test(session.getLine(row)))
row++;
return {column: 0, row: row};
}),
"ctrl-d": {
nav: function(editor, range, count, param) {
editor.selection.clearSelection();
keepScrollPosition(editor, editor.gotoPageDown);
},
sel: function(editor, range, count, param) {
keepScrollPosition(editor, editor.selectPageDown);
}
},
"ctrl-u": {
nav: function(editor, range, count, param) {
editor.selection.clearSelection();
keepScrollPosition(editor, editor.gotoPageUp);
},
sel: function(editor, range, count, param) {
keepScrollPosition(editor, editor.selectPageUp);
}
}
};
module.exports.backspace = module.exports.left = module.exports.h;
module.exports.right = module.exports.l;
module.exports.up = module.exports.k;
module.exports.down = module.exports.j;
module.exports.pagedown = module.exports["ctrl-d"];
module.exports.pageup = module.exports["ctrl-u"];
});
@@ -1,196 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"never use strict";
var util = require("./util");
var registers = require("../registers");
module.exports = {
"d": {
selFn: function(editor, range, count, param) {
registers._default.text = editor.getCopyText();
registers._default.isLine = util.onVisualLineMode;
if(util.onVisualLineMode)
editor.removeLines();
else
editor.session.remove(range);
util.normalMode(editor);
},
fn: function(editor, range, count, param) {
count = count || 1;
switch (param) {
case "d":
registers._default.text = "";
registers._default.isLine = true;
for (var i = 0; i < count; i++) {
editor.selection.selectLine();
registers._default.text += editor.getCopyText();
var selRange = editor.getSelectionRange();
// check if end of the document was reached
if (!selRange.isMultiLine()) {
lastLineReached = true
var row = selRange.start.row - 1;
var col = editor.session.getLine(row).length
selRange.setStart(row, col);
editor.session.remove(selRange);
editor.selection.clearSelection();
break;
}
editor.session.remove(selRange);
editor.selection.clearSelection();
}
registers._default.text = registers._default.text.replace(/\n$/, "");
break;
default:
if (range) {
editor.selection.setSelectionRange(range);
registers._default.text = editor.getCopyText();
registers._default.isLine = false;
editor.session.remove(range);
editor.selection.clearSelection();
}
}
}
},
"c": {
selFn: function(editor, range, count, param) {
editor.session.remove(range);
util.insertMode(editor);
},
fn: function(editor, range, count, param) {
count = count || 1;
switch (param) {
case "c":
for (var i = 0; i < count; i++) {
editor.removeLines();
util.insertMode(editor);
}
break;
default:
if (range) {
// range.end.column ++;
editor.session.remove(range);
util.insertMode(editor);
}
}
}
},
"y": {
selFn: function(editor, range, count, param) {
registers._default.text = editor.getCopyText();
registers._default.isLine = util.onVisualLineMode;
editor.selection.clearSelection();
util.normalMode(editor);
},
fn: function(editor, range, count, param) {
count = count || 1;
switch (param) {
case "y":
var pos = editor.getCursorPosition();
editor.selection.selectLine();
for (var i = 0; i < count - 1; i++) {
editor.selection.moveCursorDown();
}
registers._default.text = editor.getCopyText().replace(/\n$/, "");
editor.selection.clearSelection();
registers._default.isLine = true;
editor.moveCursorToPosition(pos);
break;
default:
if (range) {
var pos = editor.getCursorPosition();
editor.selection.setSelectionRange(range);
registers._default.text = editor.getCopyText();
registers._default.isLine = false;
editor.selection.clearSelection();
editor.moveCursorTo(pos.row, pos.column);
}
}
}
},
">": {
selFn: function(editor, range, count, param) {
count = count || 1;
for (var i = 0; i < count; i++) {
editor.indent();
}
util.normalMode(editor);
},
fn: function(editor, range, count, param) {
count = parseInt(count || 1, 10);
switch (param) {
case ">":
var pos = editor.getCursorPosition();
editor.selection.selectLine();
for (var i = 0; i < count - 1; i++) {
editor.selection.moveCursorDown();
}
editor.indent();
editor.selection.clearSelection();
editor.moveCursorToPosition(pos);
editor.navigateLineEnd();
editor.navigateLineStart();
break;
}
}
},
"<": {
selFn: function(editor, range, count, param) {
count = count || 1;
for (var i = 0; i < count; i++) {
editor.blockOutdent();
}
util.normalMode(editor);
},
fn: function(editor, range, count, param) {
count = count || 1;
switch (param) {
case "<":
var pos = editor.getCursorPosition();
editor.selection.selectLine();
for (var i = 0; i < count - 1; i++) {
editor.selection.moveCursorDown();
}
editor.blockOutdent();
editor.selection.clearSelection();
editor.moveCursorToPosition(pos);
editor.navigateLineEnd();
editor.navigateLineStart();
break;
}
}
}
};
});
@@ -1,134 +0,0 @@
define(function(require, exports, module) {
var registers = require("../registers");
var dom = require("../../../lib/dom");
dom.importCssString('.insert-mode .ace_cursor{\
border-left: 2px solid #333333;\
}\
.ace_dark.insert-mode .ace_cursor{\
border-left: 2px solid #eeeeee;\
}\
.normal-mode .ace_cursor{\
border: 0!important;\
background-color: red;\
opacity: 0.5;\
}', 'vimMode');
module.exports = {
onVisualMode: false,
onVisualLineMode: false,
currentMode: 'normal',
noMode: function(editor) {
editor.unsetStyle('insert-mode');
editor.unsetStyle('normal-mode');
if (editor.commands.recording)
editor.commands.toggleRecording(editor);
editor.setOverwrite(false);
},
insertMode: function(editor) {
this.currentMode = 'insert';
// Switch editor to insert mode
editor.setStyle('insert-mode');
editor.unsetStyle('normal-mode');
editor.setOverwrite(false);
editor.keyBinding.$data.buffer = "";
editor.keyBinding.$data.state = "insertMode";
this.onVisualMode = false;
this.onVisualLineMode = false;
if(this.onInsertReplaySequence) {
// Ok, we're apparently replaying ("."), so let's do it
editor.commands.macro = this.onInsertReplaySequence;
editor.commands.replay(editor);
this.onInsertReplaySequence = null;
this.normalMode(editor);
} else {
editor._emit("changeStatus");
// Record any movements, insertions in insert mode
if(!editor.commands.recording)
editor.commands.toggleRecording(editor);
}
},
normalMode: function(editor) {
// Switch editor to normal mode
this.currentMode = 'normal';
editor.unsetStyle('insert-mode');
editor.setStyle('normal-mode');
editor.clearSelection();
var pos;
if (!editor.getOverwrite()) {
pos = editor.getCursorPosition();
if (pos.column > 0)
editor.navigateLeft();
}
editor.setOverwrite(true);
editor.keyBinding.$data.buffer = "";
editor.keyBinding.$data.state = "start";
this.onVisualMode = false;
this.onVisualLineMode = false;
editor._emit("changeStatus");
// Save recorded keystrokes
if (editor.commands.recording) {
editor.commands.toggleRecording(editor);
return editor.commands.macro;
}
else {
return [];
}
},
visualMode: function(editor, lineMode) {
if (
(this.onVisualLineMode && lineMode)
|| (this.onVisualMode && !lineMode)
) {
this.normalMode(editor);
return;
}
editor.setStyle('insert-mode');
editor.unsetStyle('normal-mode');
editor._emit("changeStatus");
if (lineMode) {
this.onVisualLineMode = true;
} else {
this.onVisualMode = true;
this.onVisualLineMode = false;
}
},
getRightNthChar: function(editor, cursor, ch, n) {
var line = editor.getSession().getLine(cursor.row);
var matches = line.substr(cursor.column + 1).split(ch);
return n < matches.length ? matches.slice(0, n).join(ch).length : null;
},
getLeftNthChar: function(editor, cursor, ch, n) {
var line = editor.getSession().getLine(cursor.row);
var matches = line.substr(0, cursor.column).split(ch);
return n < matches.length ? matches.slice(-1 * n).join(ch).length : null;
},
toRealChar: function(ch) {
if (ch.length === 1)
return ch;
if (/^shift-./.test(ch))
return ch[ch.length - 1].toUpperCase();
else
return "";
},
copyLine: function(editor) {
var pos = editor.getCursorPosition();
editor.selection.clearSelection();
editor.moveCursorTo(pos.row, pos.column);
editor.selection.selectLine();
registers._default.isLine = true;
registers._default.text = editor.getCopyText().replace(/\n$/, "");
editor.selection.clearSelection();
editor.moveCursorTo(pos.row, pos.column);
}
};
});
@@ -1,95 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("./oop");
var event = require("./event");
var EventEmitter = require("./event_emitter").EventEmitter;
/*
* This class keeps track of the focus state of the given window.
* Focus changes for example when the user switches a browser tab,
* goes to the location bar or switches to another application.
*/
var BrowserFocus = function(win) {
win = win || window;
this.lastFocus = new Date().getTime();
this._isFocused = true;
var _self = this;
// IE < 9 supports focusin and focusout events
if ("onfocusin" in win.document) {
event.addListener(win.document, "focusin", function(e) {
_self._setFocused(true);
});
event.addListener(win.document, "focusout", function(e) {
_self._setFocused(!!e.toElement);
});
}
else {
event.addListener(win, "blur", function(e) {
_self._setFocused(false);
});
event.addListener(win, "focus", function(e) {
_self._setFocused(true);
});
}
};
(function(){
oop.implement(this, EventEmitter);
this.isFocused = function() {
return this._isFocused;
};
this._setFocused = function(isFocused) {
if (this._isFocused == isFocused)
return;
if (isFocused)
this.lastFocus = new Date().getTime();
this._isFocused = isFocused;
this._emit("changeFocus");
};
}).call(BrowserFocus.prototype);
exports.BrowserFocus = BrowserFocus;
});
@@ -1,69 +0,0 @@
/*
* 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
*/
define(function(require, exports, module) {
"use strict";
var useragent = require("./useragent");
exports.get = function (url, callback) {
var xhr = exports.createXhr();
xhr.open('GET', url, true);
xhr.onreadystatechange = function (evt) {
//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);
};
var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
exports.createXhr = function() {
//Would love to dump the ActiveX crap in here. Need IE 6 to die first.
var xhr, i, progId;
if (typeof XMLHttpRequest !== "undefined") {
return new XMLHttpRequest();
} else {
for (i = 0; i < 3; i++) {
progId = progIds[i];
try {
xhr = new ActiveXObject(progId);
} catch (e) {}
if (xhr) {
progIds = [progId]; // so faster next time
break;
}
}
}
if (!xhr) {
throw new Error("createXhr(): XMLHttpRequest not available");
}
return xhr;
};
exports.loadScript = function(path, callback) {
var head = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.src = path;
head.appendChild(s);
if (useragent.isOldIE)
s.onreadystatechange = function () {
this.readyState == 'loaded' && callback();
};
else
s.onload = callback;
};
});
@@ -1,144 +0,0 @@
var fs = require("fs");
if (!fs.existsSync)
fs.existsSync = require("path").existsSync;
require("amd-loader");
var cwd = __dirname + "/";
function generateTestData() {
var root = Array(5).join("../") + "/demo/kitchen-sink/docs";
var docs = fs.readdirSync(cwd + root);
var specialDocs = fs.readdirSync(cwd);
var modes = fs.readdirSync(cwd + "../").filter(function(x){
return /^\w+_highlight_rules.js$/.test(x);
}).map(function(x) {
return x.replace(/_highlight_rules.js$/, "");
});
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]];
var filePath = "text_" + modeName + ".txt";
if (specialDocs.indexOf(filePath) == -1) {
filePath = root + "/" + docName;
}
var text = fs.readFileSync(cwd + filePath, "utf8");
try {
var Mode = require("../" + modeName).Mode;
} catch(e) {
console.warn("Can't load mode :" + modeName, e);
return;
}
var tokenizer = new Mode().getTokenizer();
var state = "start";
var data = text.split(/\n|\r|\r\n/).map(function(line) {
var tokens = tokenizer.getLineTokens(line, state);
state = tokens.state;
tokens = tokens.tokens;
return {
state: state,
data: tokens.map(function(x) {return [x.type, x.value]})
};
});
var jsonStr = JSON.stringify(data, null, 1);
jsonStr = jsonStr.replace(/\n {4}/g, " ").replace(/\n {3}]/g, " ]");
fs.writeFileSync(cwd + "tokens_" + modeName + ".json", jsonStr, "utf8");
});
}
function test(startAt) {
var docs = fs.readdirSync(cwd).filter(function(x) {
return /^tokens_\w+.json$/.test(x);
});
if (startAt && startAt > 1)
docs = docs.slice(startAt - 1);
docs.forEach(function(x, i) {
var modeName = x.match(/tokens_(.*).json/)[1];
console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m");
var text = fs.readFileSync(cwd + x, "utf8");
var data = JSON.parse(text);
var Mode = require("../" + modeName).Mode;
var tokenizer = new Mode().getTokenizer();
var state = "start";
data.forEach(function(lineData) {
lineData.values = [];
lineData.types = [];
lineData.data.forEach(function(x) {
lineData.types.push(x[0]);
lineData.values.push(x[1]);
});
var 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 success = true;
testEqual([
lineData.state, tokens.state,
lineData.types, types,
lineData.values, values]);
state = lineData.state;
});
});
console.log("\u001b[32m" + "all ok" + "\u001b[0m");
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;
}
if (err) {
throw "error";
}
}
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], " != ", a2[i], "\u001b[0m");
else
out.push(a1[i]);
}
console.log(out.join(""));
}
function padNumber(num, digits) {
return (" " + num).slice(-digits);
}
}
if (process.argv[2] == "gen")
generateTestData(process.argv.splice(3));
else
test(parseInt(process.argv[2],10) || 0);
@@ -1,175 +0,0 @@
[
{
"state": "start",
"data": [
[ "text", "Searching for 'var' in /workspace/configs" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "string", "configs/default.js" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", " 1" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var fs = require(\"fs\");" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t2" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var argv = require('optimist').argv;" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t3" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var path = require(\"path\");" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t5" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var clientExtensions = {};" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t6" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var clientDirs = fs.readdirSync(__dirname + \"/../plugins-client\");" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t7" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "for (var i = 0; i < clientDirs.length; i++) {" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t8" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var dir = clientDirs[i];" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t12" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var name = dir.split(\".\")[1];" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t16" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var projectDir = (argv.w && path.resolve(process.cwd(), argv.w)) || process.cwd();" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t17" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var fsUrl = \"/workspace\";" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t19" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var port = argv.p || process.env.PORT || 3131;" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t20" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var host = argv.l || \"localhost\";" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t22" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var config = {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "string", "configs/local.js" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t2" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var config = require(\"./default\");" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "string", "configs/packed.js" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t1" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var config = require(\"./default\");" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "Found 15 matches in 3 files" ]
]
}
]
@@ -1,124 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "// compound assignment operators" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "#include" ],
[ "text", " " ],
[ "constant", "<iostream>" ]
]
},
{
"state": "start",
"data": [
[ "keyword.control", "using" ],
[ "text", " " ],
[ "keyword.operator", "namespace" ],
[ "text", " " ],
[ "identifier", "std" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "storage.type", "int" ],
[ "text", " " ],
[ "entity.name.function", "main" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "storage.type", "int" ],
[ "text", " " ],
[ "identifier", "a" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "b" ],
[ "keyword.operator", "=" ],
[ "constant.numeric", "3" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "comment", "/*" ],
[ "comment", " foobar */" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "a" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "b" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "a" ],
[ "keyword.operator", "+" ],
[ "keyword.operator", "=" ],
[ "constant.numeric", "2" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "comment", "// equivalent to a=a+2" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "cout" ],
[ "text", " " ],
[ "keyword.operator", "<" ],
[ "keyword.operator", "<" ],
[ "text", " " ],
[ "identifier", "a" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword.control", "return" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -1,248 +0,0 @@
[
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "defn" ],
[ "text", " " ],
[ "identifier", "parting" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"returns a String parting in a given language" ],
[ "string", "\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "keyword", "[" ],
[ "keyword", "]" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "string", "\"World" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "keyword", "[" ],
[ "support.function", "name" ],
[ "keyword", "]" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "support.function", "name" ],
[ "text", " " ],
[ "string", "\"en" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "keyword", "[" ],
[ "support.function", "name" ],
[ "text", " " ],
[ "identifier", "language" ],
[ "keyword", "]" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "; condp is similar to a case statement in other languages." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "; It is described in more detail later." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "; It is used here to take different actions based on whether the" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "; parameter \"language\" is set to \"en\", \"es\" or something else." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "support.function", "condp" ],
[ "text", " " ],
[ "constant.language", "=" ],
[ "text", " " ],
[ "identifier", "language" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"en" ],
[ "string", "\"" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "support.function", "str" ],
[ "text", " " ],
[ "string", "\"Goodbye, " ],
[ "string", "\"" ],
[ "text", " " ],
[ "support.function", "name" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"es" ],
[ "string", "\"" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "support.function", "str" ],
[ "text", " " ],
[ "string", "\"Adios, " ],
[ "string", "\"" ],
[ "text", " " ],
[ "support.function", "name" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "keyword", "throw" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "IllegalArgumentException" ],
[ "text", "." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "support.function", "str" ],
[ "text", " " ],
[ "string", "\"unsupported language " ],
[ "string", "\"" ],
[ "text", " " ],
[ "identifier", "language" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "println" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "text", " " ],
[ "comment", "; -> Goodbye, World" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "println" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "string", "\"Mark" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "text", " " ],
[ "comment", "; -> Goodbye, Mark" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "println" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "string", "\"Mark" ],
[ "string", "\"" ],
[ "text", " " ],
[ "string", "\"es" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "text", " " ],
[ "comment", "; -> Adios, Mark" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "println" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "string", "\"Mark" ],
[ "string", "\"" ],
[ "text", ", " ],
[ "string", "\"xy" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "text", " " ],
[ "comment", "; -> java.lang.IllegalArgumentException: unsupported language xy" ]
]
}
]
@@ -1,188 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "#!/usr/bin/env coffee" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "try" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "throw" ],
[ "text", " " ],
[ "language.support.class", "URIError" ],
[ "text", " " ],
[ "language.support.function", "decodeURI" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "0xC0ffee" ],
[ "text", " " ],
[ "keyword.operator", "*" ],
[ "text", " " ],
[ "constant.numeric", "123456.7e-8" ],
[ "text", " " ],
[ "keyword.operator", "/" ],
[ "text", " " ],
[ "constant.numeric", ".9" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "catch" ],
[ "text", " " ],
[ "identifier", "e" ]
]
},
{
"state": "qdoc",
"data": [
[ "text", " " ],
[ "identifier", "console" ],
[ "identifier", ".log" ],
[ "text", " " ],
[ "string", "'qstring'" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "string", "\"qqstring\"" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "string", "'''" ]
]
},
{
"state": "qdoc",
"data": [
[ "string", " qdoc" ]
]
},
{
"state": "qqdoc",
"data": [
[ "string", " '''" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "string", "\"\"\"" ]
]
},
{
"state": "qqdoc",
"data": [
[ "string", " qqdoc" ]
]
},
{
"state": "start",
"data": [
[ "string", " \"\"\"" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "do" ],
[ "text", " " ],
[ "keyword.operator", "->" ]
]
},
{
"state": "comment",
"data": [
[ "text", " " ],
[ "comment", "###" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " herecomment" ]
]
},
{
"state": "start",
"data": [
[ "comment", " ###" ]
]
},
{
"state": "heregex",
"data": [
[ "text", " " ],
[ "identifier", "re" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regex", "/regex/imgy" ],
[ "identifier", ".test" ],
[ "text", " " ],
[ "string.regex", "///" ]
]
},
{
"state": "heregex",
"data": [
[ "comment.regex", " " ],
[ "string.regex", "heregex" ],
[ "comment.regex", " # comment" ]
]
},
{
"state": "start",
"data": [
[ "string.regex", " ///imgy" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "this" ],
[ "text", " " ],
[ "keyword", "isnt" ],
[ "punctuation.operator", ":" ],
[ "text", " " ],
[ "string", "`just JavaScript`" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "undefined" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "identifier", "sentence" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "\"#{ 22 / 7 } is a decent approximation of π\"" ]
]
}
]
@@ -1,41 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "<!--" ],
[ "comment", "- hello world --->" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "cfset" ],
[ "text", " " ],
[ "entity.other.attribute-name", "welcome" ],
[ "keyword.operator", "=" ],
[ "string", "\"Hello World!\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "cfoutput" ],
[ "meta.tag", ">" ],
[ "text", "#welcome#" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "cfoutput" ],
[ "meta.tag", ">" ]
]
}
]
@@ -1,42 +0,0 @@
[
{
"state": "start",
"data": [
[ "keyword", "public" ],
[ "text", " " ],
[ "keyword", "void" ],
[ "text", " " ],
[ "identifier", "HelloWorld" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "//Say Hello!" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "Console" ],
[ "punctuation.operator", "." ],
[ "identifier", "WriteLine" ],
[ "paren.lparen", "(" ],
[ "string", "\"Hello World\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -1,231 +0,0 @@
[
{
"state": "ruleset",
"data": [
[ "variable", ".text-layer" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "font-family" ],
[ "text", ": Monaco, " ],
[ "string", "\"Courier New\"" ],
[ "text", ", " ],
[ "support.constant.fonts", "monospace" ],
[ "text", ";" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "font-size" ],
[ "text", ": " ],
[ "constant.numeric", "12" ],
[ "keyword", "px" ],
[ "text", ";" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "cursor" ],
[ "text", ": " ],
[ "support.constant", "text" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "ruleset",
"data": [
[ "variable", ".blinker" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-duration" ],
[ "text", ": " ],
[ "constant.numeric", "1" ],
[ "keyword", "s" ],
[ "text", ";" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-name" ],
[ "text", ": blink;" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-iteration-count" ],
[ "text", ": infinite;" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-direction" ],
[ "text", ": alternate;" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-timing-function" ],
[ "text", ": " ],
[ "support.constant", "linear" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "media",
"data": [
[ "string", "@keyframes blink {" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "constant", "0" ],
[ "text", "% " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "support.type", "opacity" ],
[ "text", ": " ],
[ "constant.numeric", "0" ],
[ "text", ";" ]
]
},
{
"state": "media",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "constant", "40" ],
[ "text", "% " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "support.type", "opacity" ],
[ "text", ": " ],
[ "constant.numeric", "0" ],
[ "text", ";" ]
]
},
{
"state": "media",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "constant", "40" ],
[ "variable", ".5" ],
[ "text", "% " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "support.type", "opacity" ],
[ "text", ": " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "media",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "constant", "100" ],
[ "text", "% " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "support.type", "opacity" ],
[ "text", ": " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "media",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "string", "}" ]
]
}
]
@@ -1,732 +0,0 @@
[
{
"state": "start",
"data": [
[ "variable", "diff" ],
[ "variable", " --git" ],
[ "keyword", " a/lib/ace/edit_session.js" ],
[ "variable", " b/lib/ace/edit_session.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "index 23fc3fc..ed3b273 100644" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "---" ],
[ "meta.tag", " a/lib/ace/edit_session.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "+++" ],
[ "meta.tag", " b/lib/ace/edit_session.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -51,6 +51,7 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var TextMode = require(\"./mode/text\").Mode;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " var Range = require(\"./range\").Range;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " var Document = require(\"./document\").Document;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", "var SearchHighlight = require(\"./search_highlight\").SearchHighlight;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " /**" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " * class EditSession" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -307,6 +308,13 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var EditSession = function(text, mode) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " return token;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " };" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " this.highlight = function(re) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " if (!this.$searchHighlight) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " this.$searchHighlight = this.addDynamicMarker(highlight);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " }" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " this.$searchHighlight.setRegexp(re);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " }" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " /**" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " * EditSession.setUndoManager(undoManager)" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " * - undoManager (UndoManager): The new undo manager" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -556,7 +564,8 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var EditSession = function(text, mode) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " type : type || \"line\"," ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " renderer: typeof type == \"function\" ? type : null," ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " clazz : clazz," ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " inFront: !!inFront" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " inFront: !!inFront," ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " id: id" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " }" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " if (inFront) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "diff" ],
[ "variable", " --git" ],
[ "keyword", " a/lib/ace/editor.js" ],
[ "variable", " b/lib/ace/editor.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "index 834e603..b27ec73 100644" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "---" ],
[ "meta.tag", " a/lib/ace/editor.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "+++" ],
[ "meta.tag", " b/lib/ace/editor.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -494,7 +494,7 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var Editor = function(renderer, session) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " * Emitted when a selection has changed." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " **/" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " this.onSelectionChange = function(e) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " var session = this.getSession();" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " var session = this.session;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " if (session.$selectionMarker) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " session.removeMarker(session.$selectionMarker);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -509,12 +509,40 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var Editor = function(renderer, session) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " this.$updateHighlightActiveLine();" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " }" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " var self = this;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " if (this.$highlightSelectedWord && !this.$wordHighlightTimer)" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " this.$wordHighlightTimer = setTimeout(function() {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " self.session.$mode.highlightSelection(self);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " self.$wordHighlightTimer = null;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " }, 30, this);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " };" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "diff" ],
[ "variable", " --git" ],
[ "keyword", " a/lib/ace/search_highlight.js" ],
[ "variable", " b/lib/ace/search_highlight.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", "new file mode 100644" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "index 0000000..b2df779" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "---" ],
[ "meta.tag", " /dev/null" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "+++" ],
[ "meta.tag", " b/lib/ace/search_highlight.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -0,0 +1,3 " ],
[ "constant", "@@" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", "new" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", "empty file" ]
]
}
]
@@ -1,185 +0,0 @@
[
{
"state": "start",
"data": [
[ "keyword", "uniform" ],
[ "text", " " ],
[ "keyword", "float" ],
[ "text", " " ],
[ "identifier", "amplitude" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "attribute" ],
[ "text", " " ],
[ "keyword", "float" ],
[ "text", " " ],
[ "identifier", "displacement" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "varying" ],
[ "text", " " ],
[ "keyword", "vec3" ],
[ "text", " " ],
[ "identifier", "vNormal" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "void" ],
[ "text", " " ],
[ "entity.name.function", "main" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "vNormal" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "normal" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// multiply our displacement by the" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// amplitude. The amp will get animated" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// so we'll have animated displacement" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "vec3" ],
[ "text", " " ],
[ "identifier", "newPosition" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "position" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "normal" ],
[ "text", " " ],
[ "keyword.operator", "*" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "vec3" ],
[ "paren.lparen", "(" ],
[ "identifier", "displacement" ],
[ "text", " " ],
[ "keyword.operator", "*" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "amplitude" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "gl_Position" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "projectionMatrix" ],
[ "text", " " ],
[ "keyword.operator", "*" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "modelViewMatrix" ],
[ "text", " " ],
[ "keyword.operator", "*" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "vec4" ],
[ "paren.lparen", "(" ],
[ "identifier", "newPosition" ],
[ "punctuation.operator", "," ],
[ "constant.numeric", "1.0" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -1,362 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "// Concurrent computation of pi." ]
]
},
{
"state": "start",
"data": [
[ "comment", "// See http://goo.gl/ZuTZM." ]
]
},
{
"state": "start",
"data": [
[ "comment", "//" ]
]
},
{
"state": "start",
"data": [
[ "comment", "// This demonstrates Go's ability to handle" ]
]
},
{
"state": "start",
"data": [
[ "comment", "// large numbers of concurrent processes." ]
]
},
{
"state": "start",
"data": [
[ "comment", "// It is an unreasonable way to calculate pi." ]
]
},
{
"state": "start",
"data": [
[ "keyword", "package" ],
[ "text", " " ],
[ "identifier", "main" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "import" ],
[ "text", " " ],
[ "paren.lparen", "(" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"fmt\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"math\"" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "func" ],
[ "text", " " ],
[ "identifier", "main" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "fmt" ],
[ "punctuation.operator", "." ],
[ "identifier", "Println" ],
[ "paren.lparen", "(" ],
[ "identifier", "pi" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "5000" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "// pi launches n goroutines to compute an" ]
]
},
{
"state": "start",
"data": [
[ "comment", "// approximation of pi." ]
]
},
{
"state": "start",
"data": [
[ "keyword", "func" ],
[ "text", " " ],
[ "identifier", "pi" ],
[ "paren.lparen", "(" ],
[ "identifier", "n" ],
[ "text", " " ],
[ "identifier", "int" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "ch" ],
[ "text", " " ],
[ "punctuation.operator", ":" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "make" ],
[ "paren.lparen", "(" ],
[ "keyword", "chan" ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "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", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "go" ],
[ "text", " " ],
[ "identifier", "term" ],
[ "paren.lparen", "(" ],
[ "identifier", "ch" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "paren.lparen", "(" ],
[ "identifier", "k" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "f" ],
[ "text", " " ],
[ "punctuation.operator", ":" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "0.0" ]
]
},
{
"state": "start",
"data": [
[ "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", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "f" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "keyword.operator", "<" ],
[ "keyword.operator", "-" ],
[ "identifier", "ch" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "return" ],
[ "text", " " ],
[ "identifier", "f" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "func" ],
[ "text", " " ],
[ "identifier", "term" ],
[ "paren.lparen", "(" ],
[ "identifier", "ch" ],
[ "text", " " ],
[ "keyword", "chan" ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "k" ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "ch" ],
[ "text", " " ],
[ "keyword.operator", "<" ],
[ "keyword.operator", "-" ],
[ "text", " " ],
[ "constant.numeric", "4" ],
[ "text", " " ],
[ "keyword.operator", "*" ],
[ "text", " " ],
[ "identifier", "math" ],
[ "punctuation.operator", "." ],
[ "identifier", "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", ")" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,529 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "//http://groovy.codehaus.org/Martin+Fowler%27s+closure+examples+in+Groovy" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "class" ],
[ "text", " " ],
[ "identifier", "Employee" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "name" ],
[ "text", ", " ],
[ "identifier", "salary" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "boolean" ],
[ "text", " " ],
[ "identifier", "manager" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.function", "String" ],
[ "text", " " ],
[ "identifier", "toString" ],
[ "lparen", "(" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ],
[ "text", " " ],
[ "keyword", "return" ],
[ "text", " " ],
[ "identifier", "name" ],
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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", "," ]
]
},
{
"state": "start",
"data": [
[ "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", "," ]
]
},
{
"state": "start",
"data": [
[ "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", "," ]
]
},
{
"state": "start",
"data": [
[ "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", ")" ],
[ "rparen", "]" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "managers" ],
[ "lparen", "(" ],
[ "identifier", "emps" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "emps" ],
[ "text", "." ],
[ "identifier", "findAll" ],
[ "text", " " ],
[ "lparen", "{" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", "." ],
[ "identifier", "isManager" ],
[ "lparen", "(" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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]" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "highPaid" ],
[ "lparen", "(" ],
[ "identifier", "emps" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "threshold" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "150" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "emps" ],
[ "text", "." ],
[ "identifier", "findAll" ],
[ "text", " " ],
[ "lparen", "{" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", "." ],
[ "identifier", "salary" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "threshold" ],
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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]" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "paidMore" ],
[ "lparen", "(" ],
[ "identifier", "amount" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "lparen", "{" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", "." ],
[ "identifier", "salary" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "amount" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "highPaid" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "paidMore" ],
[ "lparen", "(" ],
[ "constant.numeric", "150" ],
[ "rparen", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "assert" ],
[ "text", " " ],
[ "identifier", "highPaid" ],
[ "lparen", "(" ],
[ "identifier", "emps" ],
[ "lparen", "[" ],
[ "constant.numeric", "0" ],
[ "rparen", "]" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "comment", "// true" ]
]
},
{
"state": "start",
"data": [
[ "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", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "filename" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "'test.txt'" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "new" ],
[ "text", " " ],
[ "identifier", "File" ],
[ "lparen", "(" ],
[ "identifier", "filename" ],
[ "rparen", ")" ],
[ "text", "." ],
[ "identifier", "withReader" ],
[ "lparen", "{" ],
[ "text", " " ],
[ "identifier", "reader" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "doSomethingWith" ],
[ "lparen", "(" ],
[ "identifier", "reader" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "readersText" ]
]
},
{
"state": "start",
"data": [
[ "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", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "assert" ],
[ "text", " " ],
[ "keyword", "new" ],
[ "text", " " ],
[ "identifier", "File" ],
[ "lparen", "(" ],
[ "identifier", "filename" ],
[ "rparen", ")" ],
[ "text", "." ],
[ "identifier", "text" ],
[ "text", " " ],
[ "keyword.operator", "==" ],
[ "text", " " ],
[ "identifier", "readersText" ]
]
}
]
@@ -1,195 +0,0 @@
[
{
"state": "start",
"data": [
[ "keyword", "class" ],
[ "text", " " ],
[ "identifier", "Haxe" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "public" ],
[ "text", " " ],
[ "keyword", "static" ],
[ "text", " " ],
[ "keyword", "function" ],
[ "text", " " ],
[ "identifier", "main" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// Say Hello!" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "var" ],
[ "text", " " ],
[ "identifier", "greeting" ],
[ "punctuation.operator", ":" ],
[ "keyword", "String" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "\"Hello World\"" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "trace" ],
[ "paren.lparen", "(" ],
[ "identifier", "greeting" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "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", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "trace" ],
[ "paren.lparen", "(" ],
[ "string", "\"Haxe is a great language that can target:\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "for" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "target" ],
[ "text", " " ],
[ "keyword", "in" ],
[ "text", " " ],
[ "identifier", "targets" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "trace" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "string", "\" - \"" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "identifier", "target" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "trace" ],
[ "paren.lparen", "(" ],
[ "string", "\"And many more!\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -1,150 +0,0 @@
[
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "html" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "head" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "css-start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.style", "style" ],
[ "text", " " ],
[ "entity.other.attribute-name", "type" ],
[ "keyword.operator", "=" ],
[ "string", "\"text/css\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "css-ruleset",
"data": [
[ "text", " " ],
[ "variable", ".text-layer" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "css-ruleset",
"data": [
[ "text", " " ],
[ "support.type", "font-family" ],
[ "text", ": Monaco, " ],
[ "string", "\"Courier New\"" ],
[ "text", ", " ],
[ "support.constant.fonts", "monospace" ],
[ "text", ";" ]
]
},
{
"state": "css-ruleset",
"data": [
[ "text", " " ],
[ "support.type", "font-size" ],
[ "text", ": " ],
[ "constant.numeric", "12" ],
[ "keyword", "px" ],
[ "text", ";" ]
]
},
{
"state": "css-ruleset",
"data": [
[ "text", " " ],
[ "support.type", "cursor" ],
[ "text", ": " ],
[ "support.constant", "text" ],
[ "text", ";" ]
]
},
{
"state": "css-start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.style", "style" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "head" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "body" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h1" ],
[ "text", " " ],
[ "entity.other.attribute-name", "style" ],
[ "keyword.operator", "=" ],
[ "string", "\"color:red\"" ],
[ "meta.tag", ">" ],
[ "text", "Juhu Kinners" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h1" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "body" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "html" ],
[ "meta.tag", ">" ]
]
}
]
@@ -1,139 +0,0 @@
[
{
"state": "start",
"data": [
[ "keyword", "public" ],
[ "text", " " ],
[ "keyword", "class" ],
[ "text", " " ],
[ "identifier", "InfiniteLoop" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "comment",
"data": [
[ "text", " " ],
[ "comment", "/*" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " * This will cause the program to hang..." ]
]
},
{
"state": "comment",
"data": [
[ "comment", " *" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " * Taken from:" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/" ]
]
},
{
"state": "start",
"data": [
[ "comment", " */" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "public" ],
[ "text", " " ],
[ "keyword", "static" ],
[ "text", " " ],
[ "keyword", "void" ],
[ "text", " " ],
[ "identifier", "main" ],
[ "lparen", "(" ],
[ "support.function", "String" ],
[ "lparen", "[" ],
[ "rparen", "]" ],
[ "text", " " ],
[ "identifier", "args" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "double" ],
[ "text", " " ],
[ "identifier", "d" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "support.function", "Double" ],
[ "text", "." ],
[ "identifier", "parseDouble" ],
[ "lparen", "(" ],
[ "string", "\"2.2250738585072012e-308\"" ],
[ "rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// unreachable code" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.function", "System" ],
[ "text", "." ],
[ "identifier", "out" ],
[ "text", "." ],
[ "identifier", "println" ],
[ "lparen", "(" ],
[ "string", "\"Value: \"" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "identifier", "d" ],
[ "rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
}
]
@@ -1,555 +0,0 @@
[
{
"state": "regex_allowed",
"data": [
[ "storage.type", "function" ],
[ "text", " " ],
[ "entity.name.function", "foo" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "items" ],
[ "punctuation.operator", ", " ],
[ "variable.parameter", "nada" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "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", "{" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "text", " " ],
[ "identifier", "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", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "\t" ],
[ "comment", "// Real Tab." ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "identifier", "regexp" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regexp", "/p" ],
[ "constant.language.escape", "|" ],
[ "string.regexp", "p/" ],
[ "text", " " ],
[ "comment", "// ends here" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "identifier", "r" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regexp", "/d" ],
[ "constant.language.escape", "{1,2}" ],
[ "constant.language.escape", "?" ],
[ "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.keyword.operator", "\\f" ],
[ "regexp.keyword.operator", "\\f" ],
[ "string.regexp.charachterclass", "[" ],
[ "regexp.keyword.operator", "\\f" ],
[ "constant.language.escape", "]" ],
[ "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", "$" ],
[ "constant.language.escape", "^" ],
[ "constant.language.escape", "(?:" ],
[ "string.regexp", "d" ],
[ "constant.language.escape", "|" ],
[ "string.regexp", "s" ],
[ "constant.language.escape", ")" ],
[ "constant.language.escape", "(?=" ],
[ "string.regexp", "a" ],
[ "constant.language.escape", "|" ],
[ "constant.language.escape", ")" ],
[ "constant.language.escape", "(?!" ],
[ "string.regexp", "y" ],
[ "constant.language.escape", ")[]" ],
[ "constant.language.escape", "|" ],
[ "constant.language.escape", "$" ],
[ "constant.language.escape", "?" ],
[ "constant.language.escape", "|" ],
[ "invalid", "^*" ],
[ "string.regexp", "/" ],
[ "text", " " ],
[ "identifier", "o" ]
]
},
{
"state": "start",
"data": [
[ "identifier", "a" ],
[ "keyword.operator", "=" ],
[ "string.regexp", "/a/" ],
[ "text", " " ],
[ "identifier", "jk" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regexp", "/ /" ],
[ "text", " " ],
[ "keyword.operator", "/" ],
[ "text", " " ],
[ "string.regexp", "/ /" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment.doc", "/************************************/" ]
]
},
{
"state": "start",
"data": [
[ "comment.doc", "/** total mess, tricky to highlight**/" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "regex_allowed",
"data": [
[ "storage.type", "function" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "doc-start",
"data": [
[ "text", "\t" ],
[ "comment.doc", "/**" ]
]
},
{
"state": "doc-start",
"data": [
[ "comment.doc", "\t * docComment" ]
]
},
{
"state": "start",
"data": [
[ "comment.doc", "\t **/" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "identifier", "r" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regexp", "/u" ],
[ "regexp.keyword.operator", "\\t" ],
[ "constant.language.escape", "*" ],
[ "string.regexp", "/" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "identifier", "g" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "1." ],
[ "text", "00" ],
[ "identifier", "E" ],
[ "text", "^" ],
[ "constant.numeric", "1" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "y" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "1.2" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "punctuation.operator", "." ],
[ "constant.numeric", "2" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "constant.numeric", "052" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "constant.numeric", "0x25" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "identifier", "t" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "string", "'d'" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "string", "''" ],
[ "paren.rparen", "]" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "storage.type", "function" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "text", "\t" ],
[ "comment", "/* eee */" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "qqstring",
"data": [
[ "string", "\"s\\" ]
]
},
{
"state": "start",
"data": [
[ "string", "s" ],
[ "constant.language.escape", "\\u7824" ],
[ "string", "sss" ],
[ "constant.language.escape", "\\u" ],
[ "string", "1\"" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "qstring",
"data": [
[ "string", "'\\" ]
]
},
{
"state": "start",
"data": [
[ "string", "string'" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "'" ]
]
},
{
"state": "start",
"data": [
[ "identifier", "string" ],
[ "text", "'" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "string", "\"trailing space" ],
[ "constant.language.escape", "\\ " ],
[ "string", " " ]
]
},
{
"state": "start",
"data": [
[ "string", "\" \"" ],
[ "text", " " ],
[ "keyword.operator", "/" ],
[ "identifier", "not" ],
[ "text", " " ],
[ "identifier", "a" ],
[ "text", " " ],
[ "identifier", "regexp" ],
[ "keyword.operator", "/" ],
[ "identifier", "g" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "doc-start",
"data": [
[ "comment.doc", "/**" ]
]
},
{
"state": "doc-start",
"data": [
[ "comment.doc", " *doc" ]
]
},
{
"state": "start",
"data": [
[ "comment.doc", " */" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "regex_allowed",
"data": [
[ "identifier", "a" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "text", "\t" ],
[ "string", "'a'" ],
[ "punctuation.operator", ":" ],
[ "text", " " ],
[ "identifier", "b" ],
[ "punctuation.operator", "," ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "string", "'g'" ],
[ "text", ": " ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "t" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "entity.name.function", "gta" ],
[ "punctuation.operator", ":" ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "a" ],
[ "punctuation.operator", "," ],
[ "variable.parameter", "b" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "function_arguments",
"data": [
[ "identifier", "foo" ],
[ "punctuation.operator", "." ],
[ "storage.type", "protoype" ],
[ "punctuation.operator", "." ],
[ "entity.name.function", "d" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "a" ],
[ "punctuation.operator", ", " ],
[ "variable.parameter", "b" ],
[ "punctuation.operator", "," ]
]
},
{
"state": "start",
"data": [
[ "punctuation.operator", " " ],
[ "variable.parameter", "c" ],
[ "punctuation.operator", ", " ],
[ "variable.parameter", "d" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "storage.type", "foo" ],
[ "punctuation.operator", "." ],
[ "entity.name.function", "d" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "a" ],
[ "punctuation.operator", ", " ],
[ "variable.parameter", "b" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "storage.type", "foo" ],
[ "punctuation.operator", "." ],
[ "entity.name.function", "d" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "a" ],
[ "punctuation.operator", ", " ],
[ "comment.doc", "/*****/" ],
[ "text", " " ],
[ "identifier", "d" ],
[ "string", "\"string\"" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,611 +0,0 @@
[
{
"state": "start",
"data": [
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"query\"" ],
[ "text", ": " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"count\"" ],
[ "text", ": " ],
[ "constant.numeric", "10" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"created\"" ],
[ "text", ": " ],
[ "string", "\"2011-06-21T08:10:46Z\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"lang\"" ],
[ "text", ": " ],
[ "string", "\"en-US\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"results\"" ],
[ "text", ": " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"photo\"" ],
[ "text", ": " ],
[ "paren.lparen", "[" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"6\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5855620975\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"32021554@N04\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"f1f5e8515d\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"5110\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"7087 bandit cat\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"4\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5856170534\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"32021554@N04\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"ff1efb2a6f\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"3217\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"6975 rusty cat\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"6\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5856172972\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"51249875@N03\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"6c6887347c\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"5192\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"watermarked-cats\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"6\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5856168328\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"32021554@N04\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"0c1cfdf64c\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"5078\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"7020 mandy cat\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"3\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5856171774\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"32021554@N04\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"7f5a3180ab\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"2696\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"7448 bobby cat\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "]" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -1,79 +0,0 @@
[
{
"state": "comment",
"data": [
[ "comment", "/*EXPECTED" ]
]
},
{
"state": "comment",
"data": [
[ "comment", "hello world!" ]
]
},
{
"state": "start",
"data": [
[ "comment", "*/" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "class" ],
[ "text", " " ],
[ "language.support.class", "Test" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "static" ],
[ "text", " " ],
[ "storage.type", "function" ],
[ "text", " " ],
[ "entity.name.function", "run" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "punctuation.operator", ":" ],
[ "text", " " ],
[ "keyword", "void" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// console.log(\"hello world!\");" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "log" ],
[ "text", " " ],
[ "string", "\"hello world!\"" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -1,196 +0,0 @@
[
{
"state": "start",
"data": [
[ "keyword", "\\usepackage" ],
[ "lparen", "{" ],
[ "text", "amsmath" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "\\title" ],
[ "lparen", "{" ],
[ "keyword", "\\LaTeX" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "\\date" ],
[ "lparen", "{" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "\\begin" ],
[ "lparen", "{" ],
[ "text", "document" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "\\maketitle" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "\\LaTeX" ],
[ "lparen", "{" ],
[ "rparen", "}" ],
[ "text", " is a document preparation system for the " ],
[ "keyword", "\\TeX" ],
[ "lparen", "{" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " typesetting program. It offers programmable desktop publishing" ]
]
},
{
"state": "start",
"data": [
[ "text", " features and extensive facilities for automating most aspects of" ]
]
},
{
"state": "start",
"data": [
[ "text", " typesetting and desktop publishing, including numbering and" ]
]
},
{
"state": "start",
"data": [
[ "text", " cross-referencing, tables and figures, page layout, bibliographies," ]
]
},
{
"state": "start",
"data": [
[ "text", " and much more. " ],
[ "keyword", "\\LaTeX" ],
[ "lparen", "{" ],
[ "rparen", "}" ],
[ "text", " was originally written in 1984 by Leslie" ]
]
},
{
"state": "start",
"data": [
[ "text", " Lamport and has become the dominant method for using " ],
[ "keyword", "\\TeX" ],
[ "text", "; few" ]
]
},
{
"state": "start",
"data": [
[ "text", " people write in plain " ],
[ "keyword", "\\TeX" ],
[ "lparen", "{" ],
[ "rparen", "}" ],
[ "text", " anymore. The current version is" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "\\LaTeXe" ],
[ "text", "." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "% This is a comment; it will not be shown in the final output." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "% The following shows a little of the typesetting power of LaTeX:" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "\\begin" ],
[ "lparen", "{" ],
[ "text", "align" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " E &= mc^2 " ],
[ "keyword", "\\\\" ]
]
},
{
"state": "start",
"data": [
[ "text", " m &= " ],
[ "keyword", "\\frac" ],
[ "lparen", "{" ],
[ "text", "m_0" ],
[ "rparen", "}" ],
[ "lparen", "{" ],
[ "keyword", "\\sqrt" ],
[ "lparen", "{" ],
[ "text", "1-" ],
[ "keyword", "\\frac" ],
[ "lparen", "{" ],
[ "text", "v^2" ],
[ "rparen", "}" ],
[ "lparen", "{" ],
[ "text", "c^2" ],
[ "rparen", "}" ],
[ "rparen", "}" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "\\end" ],
[ "lparen", "{" ],
[ "text", "align" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "\\end" ],
[ "lparen", "{" ],
[ "text", "document" ],
[ "rparen", "}" ]
]
}
]
@@ -1,292 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "/*" ],
[ "comment", " styles.less */" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "@base" ],
[ "text", ": " ],
[ "constant.numeric", "#f938ab" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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", ")" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " box-shadow: " ],
[ "variable", "@style" ],
[ "text", " " ],
[ "variable", "@c" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " -webkit-box-shadow: " ],
[ "variable", "@style" ],
[ "text", " " ],
[ "variable", "@c" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " -moz-box-shadow: " ],
[ "variable", "@style" ],
[ "text", " " ],
[ "variable", "@c" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "variable.language", ".box-shadow" ],
[ "paren.lparen", "(" ],
[ "variable", "@style" ],
[ "text", ", " ],
[ "variable", "@alpha" ],
[ "text", ": " ],
[ "constant.numeric", "50%" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "keyword", "when" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "support.function", "isnumber" ],
[ "paren.lparen", "(" ],
[ "variable", "@alpha" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "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", ")" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "// Box styles" ]
]
},
{
"state": "start",
"data": [
[ "variable.language", ".box" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "color" ],
[ "text", ": " ],
[ "support.function", "saturate" ],
[ "paren.lparen", "(" ],
[ "variable", "@base" ],
[ "text", ", " ],
[ "constant.numeric", "5%" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "border-color" ],
[ "text", ": " ],
[ "support.function", "lighten" ],
[ "paren.lparen", "(" ],
[ "variable", "@base" ],
[ "text", ", " ],
[ "constant.numeric", "30%" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable.language", "div" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "text", " " ],
[ "variable.language", ".box-shadow" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "0" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "text", " " ],
[ "constant.numeric", "5px" ],
[ "text", ", " ],
[ "constant.numeric", "30%" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable.language", "a" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "color" ],
[ "text", ": " ],
[ "variable", "@base" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " &" ],
[ "variable.language", ":hover" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "color" ],
[ "text", ": " ],
[ "support.function", "lighten" ],
[ "paren.lparen", "(" ],
[ "variable", "@base" ],
[ "text", ", " ],
[ "constant.numeric", "50%" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,698 +0,0 @@
[
{
"state": "start",
"data": [
[ "text", "The following examples can be found in full at http://liquidmarkup.org/" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "Liquid is an extraction from the e-commerce system Shopify." ]
]
},
{
"state": "start",
"data": [
[ "text", "Shopify powers many thousands of e-commerce stores which all call for unique designs." ]
]
},
{
"state": "start",
"data": [
[ "text", "For this we developed Liquid which allows our customers complete design freedom while" ]
]
},
{
"state": "start",
"data": [
[ "text", "maintaining the integrity of our servers." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "Liquid has been in production use since June 2006 and is now used by many other" ]
]
},
{
"state": "start",
"data": [
[ "text", "hosted web applications." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "It was developed for usage in Ruby on Rails web applications and integrates seamlessly" ]
]
},
{
"state": "start",
"data": [
[ "text", "as a plugin but it also works excellently as a stand alone library." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "Here's what it looks like:" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "ul" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"products\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "for" ],
[ "text", " " ],
[ "identifier", "product" ],
[ "text", " " ],
[ "keyword", "in" ],
[ "text", " " ],
[ "identifier", "products" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "li" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ],
[ "variable", "{{" ],
[ "text", " " ],
[ "identifier", "product" ],
[ "text", "." ],
[ "identifier", "title" ],
[ "text", " " ],
[ "variable", "}}" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " Only {{ product.price | format_as_money }}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ],
[ "variable", "{{" ],
[ "text", " " ],
[ "identifier", "product" ],
[ "text", "." ],
[ "identifier", "description" ],
[ "text", " | " ],
[ "identifier", "prettyprint" ],
[ "text", " | " ],
[ "support.function", "truncate" ],
[ "text", ": " ],
[ "constant.numeric", "200" ],
[ "text", " " ],
[ "variable", "}}" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "li" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "endfor" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "ul" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "Some more features include:" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ],
[ "text", "Filters" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ],
[ "text", " The word \"tobi\" in uppercase: {{ 'tobi' | upcase }} " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ],
[ "text", "The word \"tobi\" has {{ 'tobi' | size }} letters! " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ],
[ "text", "Change \"Hello world\" to \"Hi world\": {{ 'Hello world' | replace: 'Hello', 'Hi' }} " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ],
[ "text", "The date today is {{ 'now' | date: \"%Y %b %d\" }} " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ],
[ "text", "If" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "identifier", "user" ],
[ "text", "." ],
[ "identifier", "name" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "'tobi'" ],
[ "text", " " ],
[ "identifier", "or" ],
[ "text", " " ],
[ "identifier", "user" ],
[ "text", "." ],
[ "identifier", "name" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "'marc'" ],
[ "text", " " ],
[ "variable", "%}" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " hi marc or tobi" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "endif" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ],
[ "text", "Case" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "case" ],
[ "text", " " ],
[ "identifier", "template" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "when" ],
[ "text", " " ],
[ "string", "'index'" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " Welcome" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "when" ],
[ "text", " " ],
[ "string", "'product'" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{{" ],
[ "text", " " ],
[ "identifier", "product" ],
[ "text", "." ],
[ "identifier", "vendor" ],
[ "text", " | " ],
[ "identifier", "link_to_vendor" ],
[ "text", " " ],
[ "variable", "}}" ],
[ "text", " / {{ product.title }}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "else" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{{" ],
[ "text", " " ],
[ "identifier", "page_title" ],
[ "text", " " ],
[ "variable", "}}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "endcase" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ],
[ "text", "For Loops" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "for" ],
[ "text", " " ],
[ "identifier", "item" ],
[ "text", " " ],
[ "keyword", "in" ],
[ "text", " " ],
[ "identifier", "array" ],
[ "text", " " ],
[ "variable", "%}" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{{" ],
[ "text", " " ],
[ "identifier", "item" ],
[ "text", " " ],
[ "variable", "}}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "endfor" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ],
[ "text", "Tables" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "tablerow" ],
[ "text", " " ],
[ "identifier", "item" ],
[ "text", " " ],
[ "keyword", "in" ],
[ "text", " " ],
[ "identifier", "items" ],
[ "text", " " ],
[ "identifier", "cols" ],
[ "text", ": " ],
[ "constant.numeric", "3" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "variable.language", "tablerowloop" ],
[ "text", "." ],
[ "identifier", "col_first" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " First column: {{ item.variable }}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "else" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " Different column: {{ item.variable }}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "endif" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "{%" ],
[ "text", " " ],
[ "keyword", "endtablerow" ],
[ "text", " " ],
[ "variable", "%}" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,451 +0,0 @@
[
{
"state": "qcomment",
"data": [
[ "comment", "--[[--" ]
]
},
{
"state": "qcomment",
"data": [
[ "comment", "num_args takes in 5.1 byte code and extracts the number of arguments" ]
]
},
{
"state": "qcomment",
"data": [
[ "comment", "from its function header." ]
]
},
{
"state": "start",
"data": [
[ "comment", "--]]" ],
[ "comment", "--" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "function" ],
[ "text", " " ],
[ "identifier", "int" ],
[ "paren.lparen", "(" ],
[ "identifier", "t" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "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" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "end" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "function" ],
[ "text", " " ],
[ "identifier", "num_args" ],
[ "paren.lparen", "(" ],
[ "identifier", "func" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "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", ")" ]
]
},
{
"state": "start",
"data": [
[ "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", ")" ],
[ "paren.rparen", ")" ],
[ "text", ", " ],
[ "identifier", "offset" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "constant.numeric", "26" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "comment", "--Get the params and var flag (whether there's a ... in the param)" ]
]
},
{
"state": "start",
"data": [
[ "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", ")" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "end" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "-- Usage:" ]
]
},
{
"state": "start",
"data": [
[ "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" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "-- Python styled string format operator" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "local" ],
[ "text", " " ],
[ "identifier", "gm" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.library", "debug" ],
[ "text", "." ],
[ "support.function", "getmetatable" ],
[ "paren.lparen", "(" ],
[ "string", "\"\"" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "identifier", "gm" ],
[ "text", "." ],
[ "support.function", "__mod" ],
[ "keyword.operator", "=" ],
[ "keyword", "function" ],
[ "paren.lparen", "(" ],
[ "identifier", "self" ],
[ "text", ", " ],
[ "identifier", "other" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "support.function", "type" ],
[ "paren.lparen", "(" ],
[ "identifier", "other" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "keyword.operator", "~" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "\"table\"" ],
[ "text", " " ],
[ "keyword", "then" ],
[ "text", " " ],
[ "identifier", "other" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "identifier", "other" ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "keyword", "end" ]
]
},
{
"state": "start",
"data": [
[ "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" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "return" ],
[ "text", " " ],
[ "identifier", "self" ],
[ "keyword.operator", ":" ],
[ "support.function", "format" ],
[ "paren.lparen", "(" ],
[ "support.function", "unpack" ],
[ "paren.lparen", "(" ],
[ "identifier", "other" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "end" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "qstring3",
"data": [
[ "support.function", "print" ],
[ "paren.lparen", "(" ],
[ "string", "[===[" ]
]
},
{
"state": "qstring3",
"data": [
[ "string", " blah blah %s, (%d %d)" ]
]
},
{
"state": "start",
"data": [
[ "string", "]===]" ],
[ "keyword.operator", "%" ],
[ "paren.lparen", "{" ],
[ "string", "\"blah\"" ],
[ "text", ", " ],
[ "identifier", "num_args" ],
[ "paren.lparen", "(" ],
[ "identifier", "int" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", "}" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "qcomment1",
"data": [
[ "comment", "--[=[--" ]
]
},
{
"state": "qcomment1",
"data": [
[ "comment", "table.maxn is deprecated, use # instead." ]
]
},
{
"state": "start",
"data": [
[ "comment", "--]=]" ],
[ "comment", "--" ]
]
},
{
"state": "start",
"data": [
[ "support.function", "print" ],
[ "paren.lparen", "(" ],
[ "constant.library", "table" ],
[ "text", "." ],
[ "invalid.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" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,824 +0,0 @@
[
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", "" ],
[ "meta.tag", "<" ],
[ "text", "!" ],
[ "entity.other.attribute-name", "DOCTYPE" ],
[ "text", " " ],
[ "entity.other.attribute-name", "html" ],
[ "text", " " ],
[ "entity.other.attribute-name", "PUBLIC" ],
[ "text", " " ],
[ "string", "\"-//W3C//DTD XHTML 1.0 Strict//EN\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "html" ],
[ "meta.tag", ">" ]
]
},
{
"state": "lua-qcomment",
"data": [
[ "keyword", "<%" ],
[ "text", " " ],
[ "comment", "--[[--" ]
]
},
{
"state": "lua-qcomment",
"data": [
[ "comment", " index.lp from the Kepler Project's LuaDoc HTML doclet." ]
]
},
{
"state": "lua-qcomment",
"data": [
[ "comment", " http://keplerproject.github.com/luadoc/" ]
]
},
{
"state": "start",
"data": [
[ "comment", "--]]" ],
[ "text", " " ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "head" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "title" ],
[ "meta.tag", ">" ],
[ "text", "Reference" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "title" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "link" ],
[ "text", " " ],
[ "entity.other.attribute-name", "rel" ],
[ "keyword.operator", "=" ],
[ "string", "\"stylesheet\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "href" ],
[ "keyword.operator", "=" ],
[ "string", "\"<%=luadoc.doclet.html.link(\"" ],
[ "entity.other.attribute-name", "luadoc" ],
[ "text", "." ],
[ "entity.other.attribute-name", "css" ],
[ "string", "\")%>\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "type" ],
[ "keyword.operator", "=" ],
[ "string", "\"text/css\"" ],
[ "text", " " ],
[ "meta.tag", "/>" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "comment", "<!--" ],
[ "comment", "meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/-->" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "head" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "body" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "div" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"container\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "div" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"product\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "div" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"product_logo\"" ],
[ "meta.tag", ">" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "div" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "div" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"product_name\"" ],
[ "meta.tag", ">" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "big" ],
[ "meta.tag", ">" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "b" ],
[ "meta.tag", ">" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "b" ],
[ "meta.tag", ">" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "big" ],
[ "meta.tag", ">" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "div" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "div" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"product_description\"" ],
[ "meta.tag", ">" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "div" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "div" ],
[ "meta.tag", ">" ],
[ "text", " " ],
[ "comment", "<!--" ],
[ "comment", " id=\"product\" -->" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "div" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"main\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "div" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"navigation\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "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", "}" ],
[ "paren.rparen", ")" ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "div" ],
[ "meta.tag", ">" ],
[ "text", " " ],
[ "comment", "<!--" ],
[ "comment", " id=\"navigation\" -->" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "div" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"content\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "<%" ],
[ "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" ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ],
[ "text", "Modules" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.table", "table" ],
[ "text", " " ],
[ "entity.other.attribute-name", "class" ],
[ "keyword.operator", "=" ],
[ "string", "\"module_list\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "comment", "<!--" ],
[ "comment", "<tr><td colspan=\"2\">Modules</td></tr>-->" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "<%" ],
[ "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" ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.table", "tr" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.table", "td" ],
[ "text", " " ],
[ "entity.other.attribute-name", "class" ],
[ "keyword.operator", "=" ],
[ "string", "\"name\"" ],
[ "meta.tag", ">" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.anchor", "a" ],
[ "text", " " ],
[ "entity.other.attribute-name", "href" ],
[ "keyword.operator", "=" ],
[ "string", "\"<%=luadoc.doclet.html.module_link(modulename, doc)%>\"" ],
[ "meta.tag", ">" ],
[ "keyword", "<%=" ],
[ "identifier", "modulename" ],
[ "keyword", "%>" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.anchor", "a" ],
[ "meta.tag", ">" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.table", "td" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.table", "td" ],
[ "text", " " ],
[ "entity.other.attribute-name", "class" ],
[ "keyword.operator", "=" ],
[ "string", "\"summary\"" ],
[ "meta.tag", ">" ],
[ "keyword", "<%=" ],
[ "identifier", "doc" ],
[ "text", "." ],
[ "identifier", "modules" ],
[ "paren.lparen", "[" ],
[ "identifier", "modulename" ],
[ "paren.rparen", "]" ],
[ "text", "." ],
[ "identifier", "summary" ],
[ "keyword", "%>" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.table", "td" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.table", "tr" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "<%" ],
[ "keyword", "end" ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.table", "table" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "<%" ],
[ "keyword", "end" ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "<%" ],
[ "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" ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ],
[ "text", "Files" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h2" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.table", "table" ],
[ "text", " " ],
[ "entity.other.attribute-name", "class" ],
[ "keyword.operator", "=" ],
[ "string", "\"file_list\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "comment", "<!--" ],
[ "comment", "<tr><td colspan=\"2\">Files</td></tr>-->" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "<%" ],
[ "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" ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.table", "tr" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.table", "td" ],
[ "text", " " ],
[ "entity.other.attribute-name", "class" ],
[ "keyword.operator", "=" ],
[ "string", "\"name\"" ],
[ "meta.tag", ">" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.anchor", "a" ],
[ "text", " " ],
[ "entity.other.attribute-name", "href" ],
[ "keyword.operator", "=" ],
[ "string", "\"<%=luadoc.doclet.html.file_link(filepath)%>\"" ],
[ "meta.tag", ">" ],
[ "keyword", "<%=" ],
[ "identifier", "filepath" ],
[ "keyword", "%>" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.anchor", "a" ],
[ "meta.tag", ">" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.table", "td" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.table", "td" ],
[ "text", " " ],
[ "entity.other.attribute-name", "class" ],
[ "keyword.operator", "=" ],
[ "string", "\"summary\"" ],
[ "meta.tag", ">" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.table", "td" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.table", "tr" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "<%" ],
[ "keyword", "end" ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.table", "table" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "<%" ],
[ "keyword", "end" ],
[ "keyword", "%>" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "div" ],
[ "meta.tag", ">" ],
[ "text", " " ],
[ "comment", "<!--" ],
[ "comment", " id=\"content\" -->" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "div" ],
[ "meta.tag", ">" ],
[ "text", " " ],
[ "comment", "<!--" ],
[ "comment", " id=\"main\" -->" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "div" ],
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"about\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.anchor", "a" ],
[ "text", " " ],
[ "entity.other.attribute-name", "href" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://validator.w3.org/check?uri=referer\"" ],
[ "meta.tag", ">" ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.image", "img" ],
[ "text", " " ],
[ "entity.other.attribute-name", "src" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://www.w3.org/Icons/valid-xhtml10\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "alt" ],
[ "keyword.operator", "=" ],
[ "string", "\"Valid XHTML 1.0!\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "height" ],
[ "keyword.operator", "=" ],
[ "string", "\"31\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "width" ],
[ "keyword.operator", "=" ],
[ "string", "\"88\"" ],
[ "text", " " ],
[ "meta.tag", "/>" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.anchor", "a" ],
[ "meta.tag", ">" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "p" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "div" ],
[ "meta.tag", ">" ],
[ "text", " " ],
[ "comment", "<!--" ],
[ "comment", " id=\"about\" -->" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "div" ],
[ "meta.tag", ">" ],
[ "text", " " ],
[ "comment", "<!--" ],
[ "comment", " id=\"container\" -->" ],
[ "text", "\t" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "body" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "html" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,260 +0,0 @@
[
{
"state": "comment",
"data": [
[ "comment", "(*" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " * Example of early return implementation taken from" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " * http://ocaml.janestreet.com/?q=node/91" ]
]
},
{
"state": "start",
"data": [
[ "comment", " *)" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "t" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "keyword.operator", "=" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "let" ],
[ "text", " " ],
[ "keyword", "module" ],
[ "text", " " ],
[ "identifier", "M" ],
[ "text", " " ],
[ "keyword.operator", "=" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "struct" ],
[ "text", " " ],
[ "keyword", "exception" ],
[ "text", " " ],
[ "identifier", "Return" ],
[ "text", " " ],
[ "keyword", "of" ],
[ "text", " " ],
[ "identifier", "t" ],
[ "text", " " ],
[ "keyword", "end" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "in" ]
]
},
{
"state": "start",
"data": [
[ "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", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "support.function", "raise" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "M" ],
[ "text", "." ],
[ "identifier", "Return" ],
[ "text", " " ],
[ "identifier", "x" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", ")" ],
[ "text", "; " ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "keyword", "in" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "try" ],
[ "text", " " ],
[ "identifier", "f" ],
[ "text", " " ],
[ "identifier", "return" ],
[ "text", " " ],
[ "keyword", "with" ],
[ "text", " " ],
[ "identifier", "M" ],
[ "text", "." ],
[ "identifier", "Return" ],
[ "text", " " ],
[ "identifier", "x" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "x" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "(* Function that uses the 'early return' functionality provided by `with_return` *)" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "let" ],
[ "text", " " ],
[ "identifier", "sum_until_first_negative" ],
[ "text", " " ],
[ "support.function", "list" ],
[ "text", " " ],
[ "keyword.operator", "=" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "with_return" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "keyword", "fun" ],
[ "text", " " ],
[ "identifier", "r" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ]
]
},
{
"state": "start",
"data": [
[ "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", "-" ],
[ "keyword.operator", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "identifier", "x" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "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", ")" ],
[ "paren.rparen", ")" ]
]
}
]
@@ -1,311 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "#!/usr/bin/perl" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "use" ],
[ "text", " " ],
[ "identifier", "strict" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "use" ],
[ "text", " " ],
[ "identifier", "warnings" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "my" ],
[ "text", " " ],
[ "identifier", "$num_primes" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "my" ],
[ "text", " @" ],
[ "identifier", "primes" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "# Put 2 as the first prime so we won't have an empty array" ]
]
},
{
"state": "start",
"data": [
[ "identifier", "$primes" ],
[ "lparen", "[" ],
[ "identifier", "$num_primes" ],
[ "rparen", "]" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "2" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "identifier", "$num_primes" ],
[ "keyword.operator", "++" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "identifier", "MAIN_LOOP" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "for" ],
[ "text", " " ],
[ "keyword", "my" ],
[ "text", " " ],
[ "identifier", "$number_to_check" ],
[ "text", " " ],
[ "lparen", "(" ],
[ "constant.numeric", "3" ],
[ "text", " " ],
[ "keyword.operator", ".." ],
[ "text", " " ],
[ "constant.numeric", "200" ],
[ "rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "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", ")" ],
[ "rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "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", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "next" ],
[ "text", " " ],
[ "identifier", "MAIN_LOOP" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "# If we reached this point it means $number_to_check is not" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "# divisable by any prime number that came before it." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "$primes" ],
[ "lparen", "[" ],
[ "identifier", "$num_primes" ],
[ "rparen", "]" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "$number_to_check" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "$num_primes" ],
[ "keyword.operator", "++" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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", ")" ],
[ "rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.function", "print" ],
[ "text", " " ],
[ "identifier", "$primes" ],
[ "lparen", "[" ],
[ "identifier", "$p" ],
[ "rparen", "]" ],
[ "keyword.operator", "," ],
[ "text", " " ],
[ "string", "\", \"" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "support.function", "print" ],
[ "text", " " ],
[ "string", "\"\\n\"" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,238 +0,0 @@
[
{
"state": "php-start",
"data": [
[ "support.php_tag", "<?php" ]
]
},
{
"state": "php-start",
"data": []
},
{
"state": "php-start",
"data": [
[ "keyword", "function" ],
[ "text", " " ],
[ "identifier", "nfact" ],
[ "lparen", "(" ],
[ "variable", "$n" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "php-start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "lparen", "(" ],
[ "variable", "$n" ],
[ "text", " " ],
[ "keyword.operator", "==" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "php-start",
"data": [
[ "text", " " ],
[ "support.function", "return" ],
[ "text", " " ],
[ "constant.numeric", "1" ],
[ "text", ";" ]
]
},
{
"state": "php-start",
"data": [
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "php-start",
"data": [
[ "text", " " ],
[ "keyword", "else" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "php-start",
"data": [
[ "text", " " ],
[ "support.function", "return" ],
[ "text", " " ],
[ "variable", "$n" ],
[ "text", " " ],
[ "keyword.operator", "*" ],
[ "text", " " ],
[ "identifier", "nfact" ],
[ "lparen", "(" ],
[ "variable", "$n" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "text", " " ],
[ "constant.numeric", "1" ],
[ "rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "php-start",
"data": [
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "php-start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "php-start",
"data": []
},
{
"state": "php-start",
"data": [
[ "support.function", "echo" ],
[ "text", " " ],
[ "string", "\"" ],
[ "constant.language.escape", "\\n" ],
[ "constant.language.escape", "\\n" ],
[ "string", "P" ],
[ "string", "l" ],
[ "string", "e" ],
[ "string", "a" ],
[ "string", "s" ],
[ "string", "e" ],
[ "string", " " ],
[ "string", "e" ],
[ "string", "n" ],
[ "string", "t" ],
[ "string", "e" ],
[ "string", "r" ],
[ "string", " " ],
[ "string", "a" ],
[ "string", " " ],
[ "string", "w" ],
[ "string", "h" ],
[ "string", "o" ],
[ "string", "l" ],
[ "string", "e" ],
[ "string", " " ],
[ "string", "n" ],
[ "string", "u" ],
[ "string", "m" ],
[ "string", "b" ],
[ "string", "e" ],
[ "string", "r" ],
[ "string", " " ],
[ "string", "." ],
[ "string", "." ],
[ "string", "." ],
[ "string", " " ],
[ "string", "\"" ],
[ "text", ";" ]
]
},
{
"state": "php-start",
"data": [
[ "variable", "$num" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "support.function", "trim" ],
[ "lparen", "(" ],
[ "support.function", "fgets" ],
[ "lparen", "(" ],
[ "constant.language", "STDIN" ],
[ "rparen", ")" ],
[ "rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "php-start",
"data": []
},
{
"state": "php-start",
"data": [
[ "comment", "// ===== PROCESS - Determing the factorial of the input number =====" ]
]
},
{
"state": "php-start",
"data": [
[ "variable", "$output" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "\"" ],
[ "constant.language.escape", "\\n" ],
[ "constant.language.escape", "\\n" ],
[ "string", "F" ],
[ "string", "a" ],
[ "string", "c" ],
[ "string", "t" ],
[ "string", "o" ],
[ "string", "r" ],
[ "string", "i" ],
[ "string", "a" ],
[ "string", "l" ],
[ "string", " " ],
[ "string", "\"" ],
[ "text", " . " ],
[ "variable", "$num" ],
[ "text", " . " ],
[ "string", "\"" ],
[ "string", " " ],
[ "string", "=" ],
[ "string", " " ],
[ "string", "\"" ],
[ "text", " . " ],
[ "identifier", "nfact" ],
[ "lparen", "(" ],
[ "variable", "$num" ],
[ "rparen", ")" ],
[ "text", " . " ],
[ "string", "\"" ],
[ "constant.language.escape", "\\n" ],
[ "constant.language.escape", "\\n" ],
[ "string", "\"" ],
[ "text", ";" ]
]
},
{
"state": "php-start",
"data": [
[ "support.function", "echo" ],
[ "text", " " ],
[ "variable", "$output" ],
[ "text", ";" ]
]
},
{
"state": "php-start",
"data": []
},
{
"state": "start",
"data": [
[ "support.php_tag", "?>" ]
]
}
]
@@ -1,255 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "# This is a simple comment" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "function" ],
[ "text", " " ],
[ "identifier", "Hello" ],
[ "lparen", "(" ],
[ "variable.instance", "$name" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "Write-host" ],
[ "text", " " ],
[ "string", "\"Hello $name\"" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "function" ],
[ "text", " " ],
[ "identifier", "add" ],
[ "lparen", "(" ],
[ "variable.instance", "$left" ],
[ "text", ", " ],
[ "variable.instance", "$right" ],
[ "keyword.operator", "=" ],
[ "constant.numeric", "4" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "lparen", "(" ],
[ "variable.instance", "$right" ],
[ "text", " " ],
[ "keyword.operator", "-ne" ],
[ "text", " " ],
[ "constant.numeric", "4" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "return" ],
[ "text", " " ],
[ "variable.instance", "$left" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "rparen", "}" ],
[ "text", " " ],
[ "keyword", "elseif" ],
[ "text", " " ],
[ "lparen", "(" ],
[ "variable.instance", "$left" ],
[ "text", " " ],
[ "keyword.operator", "-eq" ],
[ "text", " " ],
[ "constant.language", "$null" ],
[ "text", " " ],
[ "keyword.operator", "-and" ],
[ "text", " " ],
[ "variable.instance", "$right" ],
[ "text", " " ],
[ "keyword.operator", "-eq" ],
[ "text", " " ],
[ "constant.numeric", "2" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "return" ],
[ "text", " " ],
[ "constant.numeric", "3" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "rparen", "}" ],
[ "text", " " ],
[ "keyword", "else" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "return" ],
[ "text", " " ],
[ "constant.numeric", "2" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable.instance", "$number" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "1" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "constant.numeric", "2" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "variable.instance", "$number" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "3" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "Write-Host" ],
[ "text", " " ],
[ "identifier", "Hello" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "name" ],
[ "text", " " ],
[ "string", "\"World\"" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable.instance", "$an_array" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " @" ],
[ "lparen", "(" ],
[ "constant.numeric", "1" ],
[ "text", ", " ],
[ "constant.numeric", "2" ],
[ "text", ", " ],
[ "constant.numeric", "3" ],
[ "rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "variable.instance", "$a_hash" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " @" ],
[ "lparen", "{" ],
[ "string", "\"something\"" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "\"something else\"" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword.operator", "&" ],
[ "text", " " ],
[ "identifier", "notepad" ],
[ "text", " .\\" ],
[ "identifier", "readme" ],
[ "text", "." ],
[ "identifier", "md" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,205 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "#!/usr/local/bin/python" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "import" ],
[ "text", " " ],
[ "identifier", "string" ],
[ "text", ", " ],
[ "identifier", "sys" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "# If no arguments were given, print a helpful message" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "if" ],
[ "text", " " ],
[ "support.function", "len" ],
[ "paren.lparen", "(" ],
[ "identifier", "sys" ],
[ "text", "." ],
[ "identifier", "argv" ],
[ "paren.rparen", ")" ],
[ "keyword.operator", "==" ],
[ "constant.numeric", "1" ],
[ "text", ":" ]
]
},
{
"state": "qstring",
"data": [
[ "text", " " ],
[ "keyword", "print" ],
[ "text", " " ],
[ "string", "'''Usage:" ]
]
},
{
"state": "start",
"data": [
[ "string", "celsius temp1 temp2 ...'''" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "sys" ],
[ "text", "." ],
[ "identifier", "exit" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "0" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "# Loop over the arguments" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "for" ],
[ "text", " " ],
[ "identifier", "i" ],
[ "text", " " ],
[ "keyword", "in" ],
[ "text", " " ],
[ "identifier", "sys" ],
[ "text", "." ],
[ "identifier", "argv" ],
[ "paren.lparen", "[" ],
[ "constant.numeric", "1" ],
[ "text", ":" ],
[ "paren.rparen", "]" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "try" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "fahrenheit" ],
[ "keyword.operator", "=" ],
[ "support.function", "float" ],
[ "paren.lparen", "(" ],
[ "identifier", "string" ],
[ "text", "." ],
[ "identifier", "atoi" ],
[ "paren.lparen", "(" ],
[ "identifier", "i" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "except" ],
[ "text", " " ],
[ "identifier", "string" ],
[ "text", "." ],
[ "identifier", "atoi_error" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "print" ],
[ "text", " " ],
[ "support.function", "repr" ],
[ "paren.lparen", "(" ],
[ "identifier", "i" ],
[ "paren.rparen", ")" ],
[ "text", ", " ],
[ "string", "\"not a numeric value\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "else" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "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" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "print" ],
[ "text", " " ],
[ "string", "'%i\\260F = %i\\260C'" ],
[ "text", " " ],
[ "keyword.operator", "%" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "support.function", "int" ],
[ "paren.lparen", "(" ],
[ "identifier", "fahrenheit" ],
[ "paren.rparen", ")" ],
[ "text", ", " ],
[ "support.function", "int" ],
[ "paren.lparen", "(" ],
[ "identifier", "celsius" ],
[ "keyword.operator", "+" ],
[ "constant.numeric", ".5" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", ")" ]
]
}
]
@@ -1,104 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "#!/usr/bin/ruby" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "# Program to find the factorial of a number" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "fact" ],
[ "paren.lparen", "(" ],
[ "identifier", "n" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "identifier", "n" ],
[ "text", " " ],
[ "keyword.operator", "==" ],
[ "text", " " ],
[ "constant.numeric", "0" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "else" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "n" ],
[ "text", " " ],
[ "keyword.operator", "*" ],
[ "text", " " ],
[ "identifier", "fact" ],
[ "paren.lparen", "(" ],
[ "identifier", "n" ],
[ "constant.numeric", "-1" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "end" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "end" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "puts" ],
[ "text", " " ],
[ "identifier", "fact" ],
[ "paren.lparen", "(" ],
[ "variable.class", "ARGV" ],
[ "paren.lparen", "[" ],
[ "constant.numeric", "0" ],
[ "paren.rparen", "]" ],
[ "text", "." ],
[ "identifier", "to_i" ],
[ "paren.rparen", ")" ]
]
}
]
@@ -1,267 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "// ace can highlight scad!" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "module" ],
[ "text", " " ],
[ "identifier", "Element" ],
[ "paren.lparen", "(" ],
[ "identifier", "xpos" ],
[ "text", ", " ],
[ "identifier", "ypos" ],
[ "text", ", " ],
[ "identifier", "zpos" ],
[ "paren.rparen", ")" ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "identifier", "translate" ],
[ "paren.lparen", "(" ],
[ "paren.lparen", "[" ],
[ "identifier", "xpos" ],
[ "text", "," ],
[ "identifier", "ypos" ],
[ "text", "," ],
[ "identifier", "zpos" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", ")" ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t" ],
[ "identifier", "union" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t\t" ],
[ "identifier", "cube" ],
[ "paren.lparen", "(" ],
[ "paren.lparen", "[" ],
[ "constant.numeric", "10" ],
[ "text", "," ],
[ "constant.numeric", "10" ],
[ "text", "," ],
[ "constant.numeric", "4" ],
[ "paren.rparen", "]" ],
[ "text", "," ],
[ "identifier", "true" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t\t" ],
[ "identifier", "cylinder" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "10" ],
[ "text", "," ],
[ "constant.numeric", "15" ],
[ "text", "," ],
[ "constant.numeric", "5" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t\t" ],
[ "identifier", "translate" ],
[ "paren.lparen", "(" ],
[ "paren.lparen", "[" ],
[ "constant.numeric", "0" ],
[ "text", "," ],
[ "constant.numeric", "0" ],
[ "text", "," ],
[ "constant.numeric", "10" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", ")" ],
[ "identifier", "sphere" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "5" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t" ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "identifier", "union" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "keyword", "for" ],
[ "paren.lparen", "(" ],
[ "identifier", "i" ],
[ "keyword.operator", "=" ],
[ "paren.lparen", "[" ],
[ "constant.numeric", "0" ],
[ "text", ":" ],
[ "constant.numeric", "30" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", ")" ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t# " ],
[ "identifier", "Element" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "0" ],
[ "text", "," ],
[ "constant.numeric", "0" ],
[ "text", "," ],
[ "constant.numeric", "0" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "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", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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.rparen", ")" ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "identifier", "rotate" ],
[ "paren.lparen", "(" ],
[ "paren.lparen", "[" ],
[ "identifier", "i" ],
[ "keyword.operator", "*" ],
[ "constant.numeric", "10" ],
[ "text", "," ],
[ "constant.numeric", "0" ],
[ "text", "," ],
[ "constant.numeric", "0" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", ")" ],
[ "identifier", "scale" ],
[ "paren.lparen", "(" ],
[ "paren.lparen", "[" ],
[ "constant.numeric", "1" ],
[ "text", "," ],
[ "constant.numeric", "1" ],
[ "text", "," ],
[ "identifier", "i" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", ")" ],
[ "identifier", "cube" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "10" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -1,748 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "// http://www.scala-lang.org/node/54" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "package" ],
[ "text", " " ],
[ "identifier", "examples" ],
[ "text", "." ],
[ "identifier", "actors" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "import" ],
[ "text", " " ],
[ "identifier", "scala" ],
[ "text", "." ],
[ "identifier", "actors" ],
[ "text", "." ],
[ "identifier", "Actor" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "import" ],
[ "text", " " ],
[ "identifier", "scala" ],
[ "text", "." ],
[ "identifier", "actors" ],
[ "text", "." ],
[ "identifier", "Actor" ],
[ "text", "." ],
[ "identifier", "_" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "abstract" ],
[ "text", " " ],
[ "keyword", "class" ],
[ "text", " " ],
[ "identifier", "PingMessage" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "case" ],
[ "text", " " ],
[ "keyword", "object" ],
[ "text", " " ],
[ "identifier", "Start" ],
[ "text", " " ],
[ "keyword", "extends" ],
[ "text", " " ],
[ "identifier", "PingMessage" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "case" ],
[ "text", " " ],
[ "keyword", "object" ],
[ "text", " " ],
[ "identifier", "SendPing" ],
[ "text", " " ],
[ "keyword", "extends" ],
[ "text", " " ],
[ "identifier", "PingMessage" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "case" ],
[ "text", " " ],
[ "keyword", "object" ],
[ "text", " " ],
[ "identifier", "Pong" ],
[ "text", " " ],
[ "keyword", "extends" ],
[ "text", " " ],
[ "identifier", "PingMessage" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "abstract" ],
[ "text", " " ],
[ "keyword", "class" ],
[ "text", " " ],
[ "identifier", "PongMessage" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "case" ],
[ "text", " " ],
[ "keyword", "object" ],
[ "text", " " ],
[ "identifier", "Ping" ],
[ "text", " " ],
[ "keyword", "extends" ],
[ "text", " " ],
[ "identifier", "PongMessage" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "case" ],
[ "text", " " ],
[ "keyword", "object" ],
[ "text", " " ],
[ "identifier", "Stop" ],
[ "text", " " ],
[ "keyword", "extends" ],
[ "text", " " ],
[ "identifier", "PongMessage" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "object" ],
[ "text", " " ],
[ "identifier", "pingpong" ],
[ "text", " " ],
[ "keyword", "extends" ],
[ "text", " " ],
[ "identifier", "Application" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "val" ],
[ "text", " " ],
[ "identifier", "pong" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "keyword", "new" ],
[ "text", " " ],
[ "identifier", "Pong" ]
]
},
{
"state": "start",
"data": [
[ "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", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "ping" ],
[ "text", "." ],
[ "identifier", "start" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "pong" ],
[ "text", "." ],
[ "identifier", "start" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "ping" ],
[ "text", " " ],
[ "keyword.operator", "!" ],
[ "text", " " ],
[ "identifier", "Start" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "act" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "println" ],
[ "paren.lparen", "(" ],
[ "string", "\"Ping: Initializing with count \"" ],
[ "keyword.operator", "+" ],
[ "identifier", "count" ],
[ "keyword.operator", "+" ],
[ "string", "\": \"" ],
[ "keyword.operator", "+" ],
[ "identifier", "pong" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "var" ],
[ "text", " " ],
[ "identifier", "pingsLeft" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "count" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "loop" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "react" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "case" ],
[ "text", " " ],
[ "identifier", "Start" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "keyword.operator", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "println" ],
[ "paren.lparen", "(" ],
[ "string", "\"Ping: starting.\"" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "pong" ],
[ "text", " " ],
[ "keyword.operator", "!" ],
[ "text", " " ],
[ "identifier", "Ping" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "pingsLeft" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "pingsLeft" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "case" ],
[ "text", " " ],
[ "identifier", "SendPing" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "keyword.operator", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "pong" ],
[ "text", " " ],
[ "keyword.operator", "!" ],
[ "text", " " ],
[ "identifier", "Ping" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "pingsLeft" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "pingsLeft" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "case" ],
[ "text", " " ],
[ "identifier", "Pong" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "keyword.operator", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "pingsLeft" ],
[ "text", " " ],
[ "keyword.operator", "%" ],
[ "text", " " ],
[ "constant.numeric", "1000" ],
[ "text", " " ],
[ "keyword.operator", "==" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "println" ],
[ "paren.lparen", "(" ],
[ "string", "\"Ping: pong from: \"" ],
[ "keyword.operator", "+" ],
[ "identifier", "sender" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "pingsLeft" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "self" ],
[ "text", " " ],
[ "keyword.operator", "!" ],
[ "text", " " ],
[ "identifier", "SendPing" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "else" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "println" ],
[ "paren.lparen", "(" ],
[ "string", "\"Ping: Stop.\"" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "pong" ],
[ "text", " " ],
[ "keyword.operator", "!" ],
[ "text", " " ],
[ "identifier", "Stop" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "exit" ],
[ "paren.lparen", "(" ],
[ "symbol.constant", "'stop" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "class" ],
[ "text", " " ],
[ "identifier", "Pong" ],
[ "text", " " ],
[ "keyword", "extends" ],
[ "text", " " ],
[ "identifier", "Actor" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "act" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "var" ],
[ "text", " " ],
[ "identifier", "pongCount" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "0" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "loop" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "react" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "case" ],
[ "text", " " ],
[ "identifier", "Ping" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "keyword.operator", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "pongCount" ],
[ "text", " " ],
[ "keyword.operator", "%" ],
[ "text", " " ],
[ "constant.numeric", "1000" ],
[ "text", " " ],
[ "keyword.operator", "==" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "println" ],
[ "paren.lparen", "(" ],
[ "string", "\"Pong: ping \"" ],
[ "keyword.operator", "+" ],
[ "identifier", "pongCount" ],
[ "keyword.operator", "+" ],
[ "string", "\" from \"" ],
[ "keyword.operator", "+" ],
[ "identifier", "sender" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "sender" ],
[ "text", " " ],
[ "keyword.operator", "!" ],
[ "text", " " ],
[ "identifier", "Pong" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "pongCount" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "pongCount" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "case" ],
[ "text", " " ],
[ "identifier", "Stop" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "keyword.operator", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "println" ],
[ "paren.lparen", "(" ],
[ "string", "\"Pong: Stop.\"" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "exit" ],
[ "paren.lparen", "(" ],
[ "symbol.constant", "'stop" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -1,181 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "/*" ],
[ "comment", " style.scss */" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable.language", "#navbar" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "$navbar-width" ],
[ "text", ": " ],
[ "constant.numeric", "800px" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "$items" ],
[ "text", ": " ],
[ "constant.numeric", "5" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "$navbar-color" ],
[ "text", ": " ],
[ "constant.numeric", "#ce4dd6" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "width" ],
[ "text", ": " ],
[ "variable", "$navbar-width" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "border-bottom" ],
[ "text", ": " ],
[ "constant.numeric", "2px" ],
[ "text", " " ],
[ "constant.language", "solid" ],
[ "text", " " ],
[ "variable", "$navbar-color" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable.language", "li" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "float" ],
[ "text", ": " ],
[ "support.type", "left" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "width" ],
[ "text", ": " ],
[ "variable", "$navbar-width" ],
[ "text", "/" ],
[ "variable", "$items" ],
[ "text", " " ],
[ "constant", "-" ],
[ "text", " " ],
[ "constant.numeric", "10px" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "background-color" ],
[ "text", ": " ],
[ "support.function", "lighten" ],
[ "paren.lparen", "(" ],
[ "variable", "$navbar-color" ],
[ "text", ", " ],
[ "constant.numeric", "20%" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " &" ],
[ "variable.language", ":hover" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.type", "background-color" ],
[ "text", ": " ],
[ "support.function", "lighten" ],
[ "paren.lparen", "(" ],
[ "variable", "$navbar-color" ],
[ "text", ", " ],
[ "constant.numeric", "10%" ],
[ "paren.rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -1,434 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "#!/bin/sh" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "# Script to open a browser to current branch" ]
]
},
{
"state": "start",
"data": [
[ "comment", "# Repo formats:" ]
]
},
{
"state": "start",
"data": [
[ "comment", "# ssh git@github.com:richoH/gh_pr.git" ]
]
},
{
"state": "start",
"data": [
[ "comment", "# http https://richoH@github.com/richoH/gh_pr.git" ]
]
},
{
"state": "start",
"data": [
[ "comment", "# git git://github.com/richoH/gh_pr.git" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "username=" ],
[ "text", "`" ],
[ "identifier", "git" ],
[ "text", " " ],
[ "identifier", "config" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", "-" ],
[ "identifier", "get" ],
[ "text", " " ],
[ "identifier", "github" ],
[ "text", "." ],
[ "identifier", "user" ],
[ "text", "`" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "get_repo()" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "git" ],
[ "text", " " ],
[ "identifier", "remote" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "v" ],
[ "text", " | " ],
[ "identifier", "grep" ],
[ "text", " $" ],
[ "paren.lparen", "{" ],
[ "text", "@:" ],
[ "keyword.operator", "-" ],
[ "variable", "$username" ],
[ "paren.rparen", "}" ],
[ "text", " | " ],
[ "keyword", "while" ],
[ "text", " " ],
[ "keyword", "read" ],
[ "text", " " ],
[ "identifier", "remote" ],
[ "text", "; " ],
[ "keyword", "do" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "variable", "repo=" ],
[ "text", "`" ],
[ "constant.language", "echo" ],
[ "text", " " ],
[ "variable", "$remote" ],
[ "text", " | " ],
[ "identifier", "grep" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "E" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "o" ],
[ "text", " " ],
[ "string", "\"git@github.com:[^ ]*\"" ],
[ "text", "`; " ],
[ "keyword", "then" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "echo" ],
[ "text", " " ],
[ "variable", "$repo" ],
[ "text", " | " ],
[ "identifier", "sed" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "e" ],
[ "text", " " ],
[ "string", "\"s/^git@github\\.com://\"" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "e" ],
[ "text", " " ],
[ "string", "\"s/\\.git$//\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "exit" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "fi" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "variable", "repo=" ],
[ "text", "`" ],
[ "constant.language", "echo" ],
[ "text", " " ],
[ "variable", "$remote" ],
[ "text", " | " ],
[ "identifier", "grep" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "E" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "o" ],
[ "text", " " ],
[ "string", "\"https?://([^@]*@)?github.com/[^ ]*\\.git\"" ],
[ "text", "`; " ],
[ "keyword", "then" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "echo" ],
[ "text", " " ],
[ "variable", "$repo" ],
[ "text", " | " ],
[ "identifier", "sed" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "e" ],
[ "text", " " ],
[ "string", "\"s|^https?://||\"" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "e" ],
[ "text", " " ],
[ "string", "\"s/^.*github\\.com\\///\"" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "e" ],
[ "text", " " ],
[ "string", "\"s/\\.git$//\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "exit" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "fi" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "variable", "repo=" ],
[ "text", "`" ],
[ "constant.language", "echo" ],
[ "text", " " ],
[ "variable", "$remote" ],
[ "text", " | " ],
[ "identifier", "grep" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "E" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "o" ],
[ "text", " " ],
[ "string", "\"git://github.com/[^ ]*\\.git\"" ],
[ "text", "`; " ],
[ "keyword", "then" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "echo" ],
[ "text", " " ],
[ "variable", "$repo" ],
[ "text", " | " ],
[ "identifier", "sed" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "e" ],
[ "text", " " ],
[ "string", "\"s|^git://github.com/||\"" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "e" ],
[ "text", " " ],
[ "string", "\"s/\\.git$//\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "exit" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "fi" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "done" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "text", " " ],
[ "variable.language", "$?" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "identifier", "eq" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "text", " " ],
[ "paren.rparen", "]" ],
[ "text", "; " ],
[ "keyword", "then" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "echo" ],
[ "text", " " ],
[ "string", "\"Couldn't find a valid remote\"" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "support.function", "&2" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "exit" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "fi" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "if" ],
[ "text", " " ],
[ "variable", "repo=" ],
[ "text", "`" ],
[ "identifier", "get_repo" ],
[ "text", " $@`; " ],
[ "keyword", "then" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "branch=" ],
[ "text", "`" ],
[ "identifier", "git" ],
[ "text", " " ],
[ "identifier", "symbolic" ],
[ "keyword.operator", "-" ],
[ "identifier", "ref" ],
[ "text", " " ],
[ "identifier", "HEAD" ],
[ "text", " " ],
[ "constant.numeric", "2" ],
[ "keyword.operator", ">" ],
[ "keyword.operator", "/" ],
[ "identifier", "dev" ],
[ "keyword.operator", "/" ],
[ "identifier", "null" ],
[ "text", "`" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "echo" ],
[ "text", " " ],
[ "string", "\"http://github.com/$repo/pull/new/${branch##refs/heads/}\"" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "else" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "exit" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "fi" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,73 +0,0 @@
[
{
"state": "start",
"data": [
[ "keyword", "SELECT" ],
[ "text", " " ],
[ "identifier", "city" ],
[ "text", ", " ],
[ "support.function", "COUNT" ],
[ "paren.lparen", "(" ],
[ "identifier", "id" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "keyword", "AS" ],
[ "text", " " ],
[ "identifier", "users_count" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "FROM" ],
[ "text", " " ],
[ "identifier", "users" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "WHERE" ],
[ "text", " " ],
[ "identifier", "group_name" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "'salesman'" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "AND" ],
[ "text", " " ],
[ "identifier", "created" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "string", "'2011-05-21'" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "GROUP" ],
[ "text", " " ],
[ "keyword", "BY" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "ORDER" ],
[ "text", " " ],
[ "keyword", "BY" ],
[ "text", " " ],
[ "constant.numeric", "2" ],
[ "text", " " ],
[ "keyword", "DESC" ]
]
}
]
@@ -1,931 +0,0 @@
[
{
"state": "tag_embed_attribute_list",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "svg" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "width" ],
[ "keyword.operator", "=" ],
[ "string", "\"800\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "height" ],
[ "keyword.operator", "=" ],
[ "string", "\"600\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "xmlns" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://www.w3.org/2000/svg\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "onload" ],
[ "keyword.operator", "=" ],
[ "string", "\"StartAnimation(evt)\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "title" ],
[ "meta.tag", ">" ],
[ "text", "Test Tube Progress Bar" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "title" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "desc" ],
[ "meta.tag", ">" ],
[ "text", "Created for the Web Directions SVG competition" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "desc" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "script" ],
[ "text", " " ],
[ "entity.other.attribute-name", "type" ],
[ "keyword.operator", "=" ],
[ "string", "\"text/ecmascript\"" ],
[ "meta.tag", ">" ],
[ "keyword.operator", "<" ],
[ "keyword.operator", "!" ],
[ "paren.lparen", "[" ],
[ "identifier", "CDATA" ],
[ "paren.lparen", "[" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "storage.type", "var" ],
[ "text", " " ],
[ "identifier", "timevalue" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "storage.type", "var" ],
[ "text", " " ],
[ "identifier", "timer_increment" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "1" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "storage.type", "var" ],
[ "text", " " ],
[ "identifier", "max_time" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "100" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "storage.type", "var" ],
[ "text", " " ],
[ "identifier", "hickory" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "storage.type", "var" ],
[ "text", " " ],
[ "identifier", "dickory" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "storage.type", "var" ],
[ "text", " " ],
[ "identifier", "dock" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "storage.type", "var" ],
[ "text", " " ],
[ "identifier", "i" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-start",
"data": []
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "storage.type", "function" ],
[ "text", " " ],
[ "entity.name.function", "StartAnimation" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "evt" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "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", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "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", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "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", ";" ]
]
},
{
"state": "js-start",
"data": []
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "identifier", "ShowAndGrowElement" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "storage.type", "function" ],
[ "text", " " ],
[ "entity.name.function", "ShowAndGrowElement" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "identifier", "timevalue" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "timevalue" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "identifier", "timer_increment" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "timevalue" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "max_time" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "keyword", "return" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "comment", "// Scale the text string gradually until it is 20 times larger" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "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", ";" ]
]
},
{
"state": "js-start",
"data": []
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "timevalue" ],
[ "text", " " ],
[ "keyword.operator", "<" ],
[ "text", " " ],
[ "constant.numeric", "30" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "identifier", "hickory" ],
[ "punctuation.operator", "." ],
[ "support.function.dom", "setAttribute" ],
[ "paren.lparen", "(" ],
[ "string", "\"display\"" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "string", "\"\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "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", ";" ]
]
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "js-start",
"data": []
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "timevalue" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "constant.numeric", "30" ],
[ "text", " " ],
[ "keyword.operator", "&" ],
[ "keyword.operator", "&" ],
[ "text", " " ],
[ "identifier", "timevalue" ],
[ "text", " " ],
[ "keyword.operator", "<" ],
[ "text", " " ],
[ "constant.numeric", "66" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "identifier", "dickory" ],
[ "punctuation.operator", "." ],
[ "support.function.dom", "setAttribute" ],
[ "paren.lparen", "(" ],
[ "string", "\"display\"" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "string", "\"\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "identifier", "dickory" ],
[ "punctuation.operator", "." ],
[ "support.function.dom", "setAttribute" ],
[ "paren.lparen", "(" ],
[ "string", "\"transform\"" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "string", "\"translate(\"" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "-795" ],
[ "keyword.operator", "+" ],
[ "identifier", "scalefactor" ],
[ "keyword.operator", "*" ],
[ "constant.numeric", "2" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "string", "\", 0 )\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "timevalue" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "constant.numeric", "66" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "text", " " ],
[ "identifier", "dock" ],
[ "punctuation.operator", "." ],
[ "support.function.dom", "setAttribute" ],
[ "paren.lparen", "(" ],
[ "string", "\"display\"" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "string", "\"\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "js-regex_allowed",
"data": [
[ "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", ";" ]
]
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "js-start",
"data": []
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "comment", "// Call ShowAndGrowElement again <timer_increment> milliseconds later." ]
]
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "identifier", "setTimeout" ],
[ "paren.lparen", "(" ],
[ "string", "\"ShowAndGrowElement()\"" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "timer_increment" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "js-start",
"data": [
[ "text", " " ],
[ "variable.language", "window" ],
[ "punctuation.operator", "." ],
[ "identifier", "ShowAndGrowElement" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "ShowAndGrowElement" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "]" ],
[ "paren.rparen", "]" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "script" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "rect" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "fill" ],
[ "keyword.operator", "=" ],
[ "string", "\"#2e3436\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "fill-rule" ],
[ "keyword.operator", "=" ],
[ "string", "\"nonzero\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "stroke-width" ],
[ "keyword.operator", "=" ],
[ "string", "\"3\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "y" ],
[ "keyword.operator", "=" ],
[ "string", "\"0\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "x" ],
[ "keyword.operator", "=" ],
[ "string", "\"0\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "height" ],
[ "keyword.operator", "=" ],
[ "string", "\"600\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "width" ],
[ "keyword.operator", "=" ],
[ "string", "\"800\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"rect3590\"" ],
[ "meta.tag", "/>" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "text" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "style" ],
[ "keyword.operator", "=" ],
[ "string", "\"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\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "x" ],
[ "keyword.operator", "=" ],
[ "string", "\"50\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "y" ],
[ "keyword.operator", "=" ],
[ "string", "\"350\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"hickory\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "display" ],
[ "keyword.operator", "=" ],
[ "string", "\"none\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " Hickory," ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "text" ],
[ "meta.tag", ">" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "text" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "style" ],
[ "keyword.operator", "=" ],
[ "string", "\"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\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "x" ],
[ "keyword.operator", "=" ],
[ "string", "\"50\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "y" ],
[ "keyword.operator", "=" ],
[ "string", "\"350\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"dickory\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "display" ],
[ "keyword.operator", "=" ],
[ "string", "\"none\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " dickory," ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "text" ],
[ "meta.tag", ">" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "text" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "style" ],
[ "keyword.operator", "=" ],
[ "string", "\"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\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "x" ],
[ "keyword.operator", "=" ],
[ "string", "\"50\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "y" ],
[ "keyword.operator", "=" ],
[ "string", "\"350\"" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "id" ],
[ "keyword.operator", "=" ],
[ "string", "\"dock\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "display" ],
[ "keyword.operator", "=" ],
[ "string", "\"none\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " dock!" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "text" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "svg" ],
[ "meta.tag", ">" ]
]
}
]
@@ -1,536 +0,0 @@
[
{
"state": "commandItem",
"data": []
},
{
"state": "commandItem",
"data": [
[ "keyword", "proc" ],
[ "text", " " ],
[ "identifier", "dijkstra" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "keyword", "graph" ],
[ "text", " " ],
[ "identifier", "origin" ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "# Initialize" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", " " ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "for" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "keyword", "vertex" ],
[ "text", " " ],
[ "identifier", "distmap" ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "graph" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "set" ],
[ "text", " " ],
[ "identifier", "dist" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "vertex" ],
[ "text", " " ],
[ "identifier", "Inf" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t" ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "set" ],
[ "text", " " ],
[ "identifier", "path" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "vertex" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "text", "}" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", " }" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "set" ],
[ "text", " " ],
[ "identifier", "dist" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "origin" ],
[ "text", " 0" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "set" ],
[ "text", " " ],
[ "identifier", "path" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "origin" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "keyword", "list" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "origin" ],
[ "paren.rparen", "]" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", " " ]
]
},
{
"state": "commandItem",
"data": [
[ "text", " " ],
[ "keyword", "while" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "text", "[" ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "size" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "graph" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "comment", "# Find unhandled node with least weight" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "keyword", "set" ],
[ "text", " " ],
[ "identifier", "d" ],
[ "text", " " ],
[ "identifier", "Inf" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t" ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "for" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "keyword", "uu" ],
[ "text", " " ],
[ "support.function", "-" ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "graph" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "d" ],
[ "text", " " ],
[ "support.function", ">" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "keyword", "set" ],
[ "text", " " ],
[ "identifier", "dd" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "get" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "dist" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "uu" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t" ],
[ "keyword", "set" ],
[ "text", " " ],
[ "identifier", "u" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "uu" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t" ],
[ "keyword", "set" ],
[ "text", " " ],
[ "identifier", "d" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "dd" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t }" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t}" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "comment", "# No such node; graph must be disconnected" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "d" ],
[ "text", " " ],
[ "support.function", "==" ],
[ "text", " " ],
[ "identifier", "Inf" ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "identifier", "break" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", " " ]
]
},
{
"state": "commentfollow",
"data": [
[ "text", "\t" ],
[ "comment", "# Update the weights for nodes\\" ]
]
},
{
"state": "start",
"data": [
[ "comment", "\t lead to by the node we've picked" ]
]
},
{
"state": "commandItem",
"data": [
[ "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.instancce", "$" ],
[ "variable.instancce", "graph" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "u" ],
[ "paren.rparen", "]" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t " ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "text", "[" ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "exists" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "graph" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "v" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t" ],
[ "keyword", "set" ],
[ "text", " " ],
[ "identifier", "alt" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "keyword", "expr" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "d" ],
[ "text", " " ],
[ "support.function", "+" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "dd" ],
[ "paren.rparen", "}" ],
[ "paren.rparen", "]" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t\t" ],
[ "keyword", "if" ],
[ "text", " " ],
[ "paren.lparen", "{" ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "alt" ],
[ "text", " " ],
[ "support.function", "<" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "get" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "dist" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "v" ],
[ "paren.rparen", "]" ],
[ "paren.rparen", "}" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t " ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "set" ],
[ "text", " " ],
[ "identifier", "dist" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "v" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "alt" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t\t " ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "set" ],
[ "text", " " ],
[ "identifier", "path" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "v" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "keyword", "list" ],
[ "text", " " ],
[ "support.function", "{*}" ],
[ "paren.lparen", "[" ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "get" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "path" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "u" ],
[ "paren.rparen", "]" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "v" ],
[ "paren.rparen", "]" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t\t}" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t }" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "\t}" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "comment", "# Remove chosen node from graph still to be handled" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "keyword", "dict" ],
[ "text", " " ],
[ "identifier", "unset" ],
[ "text", " " ],
[ "identifier", "graph" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "u" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", " }" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "return" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "keyword", "list" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "dist" ],
[ "text", " " ],
[ "variable.instancce", "$" ],
[ "variable.instancce", "path" ],
[ "paren.rparen", "]" ]
]
},
{
"state": "commandItem",
"data": [
[ "text", "}" ]
]
}
]
@@ -1,58 +0,0 @@
[
{
"state": "start",
"data": [
[ "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." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "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" ]
]
}
]
@@ -1,195 +0,0 @@
[
{
"state": "start",
"data": [
[ "markup.heading.1", "h1" ],
[ "keyword", ". " ],
[ "text", "Textile document" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "markup.heading.2", "h2" ],
[ "keyword", ". " ],
[ "text", "Heading Two" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "markup.heading.3", "h3" ],
[ "keyword", ". " ],
[ "text", "A two-line" ]
]
},
{
"state": "start",
"data": [
[ "text", " header" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "markup.heading.2", "h2" ],
[ "keyword", ". " ],
[ "text", "Another two-line" ]
]
},
{
"state": "start",
"data": [
[ "text", "header" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "Paragraph:" ]
]
},
{
"state": "start",
"data": [
[ "text", "one, two," ]
]
},
{
"state": "start",
"data": [
[ "text", "thee lines!" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "markup.heading", "p" ],
[ "keyword", "(" ],
[ "string", "classone" ],
[ "text", " " ],
[ "string", "two" ],
[ "text", " " ],
[ "string", "three" ],
[ "keyword", ")" ],
[ "keyword", ". " ],
[ "text", "This is a paragraph with classes" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "markup.heading", "p" ],
[ "keyword", "(" ],
[ "keyword", "#" ],
[ "string", "id" ],
[ "keyword", ")" ],
[ "keyword", ". " ],
[ "text", "(one with an id)" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "markup.heading", "p" ],
[ "keyword", "(" ],
[ "string", "one" ],
[ "text", " " ],
[ "string", "two" ],
[ "text", " " ],
[ "string", "three" ],
[ "keyword", "#" ],
[ "string", "my_id" ],
[ "keyword", ")" ],
[ "keyword", ". " ],
[ "text", "..classes + id" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "*" ],
[ "text", " Unordered list" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "**" ],
[ "text", " sublist" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "*" ],
[ "text", " back again!" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "**" ],
[ "text", " sublist again.." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "#" ],
[ "text", " ordered" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "bg. Blockquote!" ]
]
},
{
"state": "start",
"data": [
[ "text", " This is a two-list blockquote..!" ]
]
}
]
@@ -1,705 +0,0 @@
[
{
"state": "start",
"data": [
[ "xml-pe", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "query" ],
[ "text", " " ],
[ "entity.other.attribute-name", "xmlns:yahoo" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://www.yahooapis.com/v1/base.rng\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:count" ],
[ "keyword.operator", "=" ],
[ "string", "\"7\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:created" ],
[ "keyword.operator", "=" ],
[ "string", "\"2011-10-11T08:40:23Z\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:lang" ],
[ "keyword.operator", "=" ],
[ "string", "\"en-US\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "diagnostics" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "publiclyCallable" ],
[ "meta.tag", ">" ],
[ "text", "true" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "publiclyCallable" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "url" ],
[ "text", " " ],
[ "entity.other.attribute-name", "execution-start-time" ],
[ "keyword.operator", "=" ],
[ "string", "\"0\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "execution-stop-time" ],
[ "keyword.operator", "=" ],
[ "string", "\"25\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "execution-time" ],
[ "keyword.operator", "=" ],
[ "string", "\"25\"" ],
[ "meta.tag", ">" ],
[ "text", "<![CDATA[http://where.yahooapis.com/v1/continents;start=0;count=10]]>" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "url" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "user-time" ],
[ "meta.tag", ">" ],
[ "text", "26" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "user-time" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "service-time" ],
[ "meta.tag", ">" ],
[ "text", "25" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "service-time" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "build-version" ],
[ "meta.tag", ">" ],
[ "text", "21978" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "build-version" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "diagnostics" ],
[ "meta.tag", ">" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "results" ],
[ "meta.tag", ">" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "place" ],
[ "text", " " ],
[ "entity.other.attribute-name", "xmlns" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/schema.rng\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "xml:lang" ],
[ "keyword.operator", "=" ],
[ "string", "\"en-US\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:uri" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/place/24865670\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ],
[ "text", "24865670" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "text", " " ],
[ "entity.other.attribute-name", "code" ],
[ "keyword.operator", "=" ],
[ "string", "\"29\"" ],
[ "meta.tag", ">" ],
[ "text", "Continent" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ],
[ "text", "Africa" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "place" ],
[ "meta.tag", ">" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "place" ],
[ "text", " " ],
[ "entity.other.attribute-name", "xmlns" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/schema.rng\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "xml:lang" ],
[ "keyword.operator", "=" ],
[ "string", "\"en-US\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:uri" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/place/24865675\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ],
[ "text", "24865675" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "text", " " ],
[ "entity.other.attribute-name", "code" ],
[ "keyword.operator", "=" ],
[ "string", "\"29\"" ],
[ "meta.tag", ">" ],
[ "text", "Continent" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ],
[ "text", "Europe" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "place" ],
[ "meta.tag", ">" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "place" ],
[ "text", " " ],
[ "entity.other.attribute-name", "xmlns" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/schema.rng\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "xml:lang" ],
[ "keyword.operator", "=" ],
[ "string", "\"en-US\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:uri" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/place/24865673\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ],
[ "text", "24865673" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "text", " " ],
[ "entity.other.attribute-name", "code" ],
[ "keyword.operator", "=" ],
[ "string", "\"29\"" ],
[ "meta.tag", ">" ],
[ "text", "Continent" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ],
[ "text", "South America" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "place" ],
[ "meta.tag", ">" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "place" ],
[ "text", " " ],
[ "entity.other.attribute-name", "xmlns" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/schema.rng\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "xml:lang" ],
[ "keyword.operator", "=" ],
[ "string", "\"en-US\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:uri" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/place/28289421\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ],
[ "text", "28289421" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "text", " " ],
[ "entity.other.attribute-name", "code" ],
[ "keyword.operator", "=" ],
[ "string", "\"29\"" ],
[ "meta.tag", ">" ],
[ "text", "Continent" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ],
[ "text", "Antarctic" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "place" ],
[ "meta.tag", ">" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "place" ],
[ "text", " " ],
[ "entity.other.attribute-name", "xmlns" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/schema.rng\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "xml:lang" ],
[ "keyword.operator", "=" ],
[ "string", "\"en-US\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:uri" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/place/24865671\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ],
[ "text", "24865671" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "text", " " ],
[ "entity.other.attribute-name", "code" ],
[ "keyword.operator", "=" ],
[ "string", "\"29\"" ],
[ "meta.tag", ">" ],
[ "text", "Continent" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ],
[ "text", "Asia" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "place" ],
[ "meta.tag", ">" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "place" ],
[ "text", " " ],
[ "entity.other.attribute-name", "xmlns" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/schema.rng\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "xml:lang" ],
[ "keyword.operator", "=" ],
[ "string", "\"en-US\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:uri" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/place/24865672\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ],
[ "text", "24865672" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "text", " " ],
[ "entity.other.attribute-name", "code" ],
[ "keyword.operator", "=" ],
[ "string", "\"29\"" ],
[ "meta.tag", ">" ],
[ "text", "Continent" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ],
[ "text", "North America" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "place" ],
[ "meta.tag", ">" ]
]
},
{
"state": "tag_embed_attribute_list",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "place" ],
[ "text", " " ],
[ "entity.other.attribute-name", "xmlns" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/schema.rng\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "entity.other.attribute-name", "xml:lang" ],
[ "keyword.operator", "=" ],
[ "string", "\"en-US\"" ],
[ "text", " " ],
[ "entity.other.attribute-name", "yahoo:uri" ],
[ "keyword.operator", "=" ],
[ "string", "\"http://where.yahooapis.com/v1/place/55949070\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ],
[ "text", "55949070" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "woeid" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "text", " " ],
[ "entity.other.attribute-name", "code" ],
[ "keyword.operator", "=" ],
[ "string", "\"29\"" ],
[ "meta.tag", ">" ],
[ "text", "Continent" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "placeTypeName" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ],
[ "text", "Australia" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "name" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "place" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "results" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "query" ],
[ "meta.tag", ">" ]
]
}
]
@@ -1,64 +0,0 @@
[
{
"state": "start",
"data": [
[ "keyword", "xquery" ],
[ "text", " " ],
[ "keyword", "version" ],
[ "text", " " ],
[ "string", "\"1.0\"" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "let" ],
[ "text", " " ],
[ "variable", "$message" ],
[ "text", " :" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "\"Hello World!\"" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "return" ],
[ "text", " <" ],
[ "meta.tag", "results" ],
[ "text", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " <" ],
[ "meta.tag", "message" ],
[ "text", ">" ],
[ "lparen", "{" ],
[ "variable", "$message" ],
[ "rparen", "}" ],
[ "text", "</" ],
[ "meta.tag", "message" ],
[ "text", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", "</" ],
[ "meta.tag", "results" ],
[ "text", ">" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -1,260 +0,0 @@
[
{
"state": "start",
"data": [
[ "comment", "# This sample document was taken from wikipedia:" ]
]
},
{
"state": "start",
"data": [
[ "comment", "# http://en.wikipedia.org/wiki/YAML#Sample_document" ]
]
},
{
"state": "start",
"data": [
[ "comment", "---" ]
]
},
{
"state": "start",
"data": [
[ "identifier", "receipt:" ],
[ "text", " Oz-Ware Purchase Invoice" ]
]
},
{
"state": "start",
"data": [
[ "identifier", "date:" ],
[ "text", " " ],
[ "constant.numeric", "2007" ],
[ "constant.numeric", "-08" ],
[ "constant.numeric", "-06" ]
]
},
{
"state": "start",
"data": [
[ "identifier", "customer:" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "given:" ],
[ "text", " Dorothy" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "family:" ],
[ "text", " Gale" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "identifier", "items:" ]
]
},
{
"state": "start",
"data": [
[ "text", " - " ],
[ "identifier", "part_no:" ],
[ "text", " " ],
[ "string", "'A4786'" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "descrip:" ],
[ "text", " Water Bucket " ],
[ "paren.lparen", "(" ],
[ "text", "Filled" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "price:" ],
[ "text", " " ],
[ "constant.numeric", "1.47" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "quantity:" ],
[ "text", " " ],
[ "constant.numeric", "4" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " - " ],
[ "identifier", "part_no:" ],
[ "text", " " ],
[ "string", "'E1628'" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "descrip:" ],
[ "text", " High Heeled " ],
[ "string", "\"Ruby\"" ],
[ "text", " Slippers" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "size:" ],
[ "text", " " ],
[ "constant.numeric", "8" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "price:" ],
[ "text", " " ],
[ "constant.numeric", "100.27" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "quantity:" ],
[ "text", " " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "bill-" ],
[ "identifier", "to:" ],
[ "text", " " ],
[ "variable", "&id001" ]
]
},
{
"state": "qqstring",
"data": [
[ "text", " " ],
[ "identifier", "street:" ],
[ "text", " " ],
[ "string", "|" ]
]
},
{
"state": "qqstring",
"data": [
[ "string", " 123 Tornado Alley" ]
]
},
{
"state": "qqstring",
"data": [
[ "string", " Suite 16" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "city:" ],
[ "text", " East Centerville" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "state:" ],
[ "text", " KS" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "ship-" ],
[ "identifier", "to:" ],
[ "text", " " ],
[ "variable", "*id001" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "qqstring",
"data": [
[ "identifier", "specialDelivery:" ],
[ "text", " " ],
[ "string", ">" ]
]
},
{
"state": "qqstring",
"data": [
[ "string", " Follow the Yellow Brick" ]
]
},
{
"state": "qqstring",
"data": [
[ "string", " Road to the Emerald City." ]
]
},
{
"state": "qqstring",
"data": [
[ "string", " Pay no attention to the" ]
]
},
{
"state": "qqstring",
"data": [
[ "string", " man behind the curtain." ]
]
},
{
"state": "qqstring",
"data": []
}
]
@@ -1,68 +0,0 @@
/*
* eXide - web-based XQuery IDE
*
* Copyright (C) 2011 Wolfgang Meier
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Behaviour = require('../behaviour').Behaviour;
var CstyleBehaviour = require('./cstyle').CstyleBehaviour;
var XQueryBehaviour = function (parent) {
this.inherit(CstyleBehaviour, ["braces", "parens", "string_dquotes"]); // Get string behaviour
this.parent = parent;
// this.add("brackets", "insertion", function (state, action, editor, session, text) {
// if (text == "\n") {
// var cursor = editor.getCursorPosition();
// var line = session.doc.getLine(cursor.row);
// var rightChars = line.substring(cursor.column, cursor.column + 2);
// if (rightChars == '</') {
// var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
// var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
//
// return {
// text: '\n' + indent + '\n' + next_indent,
// selection: [1, indent.length, 1, indent.length]
// }
// }
// }
// return false;
// });
// Check for open tag if user enters / and auto-close it.
// this.add("slash", "insertion", function (state, action, editor, session, text) {
// if (text == "/") {
// var cursor = editor.getCursorPosition();
// var line = session.doc.getLine(cursor.row);
// if (cursor.column > 0 && line.charAt(cursor.column - 1) == "<") {
// line = line.substring(0, cursor.column) + "/" + line.substring(cursor.column);
// var lines = session.doc.getAllLines();
// lines[cursor.row] = line;
// // call mode helper to close the tag if possible
// parent.exec("closeTag", lines.join(session.doc.getNewLineCharacter()), cursor.row);
// }
// }
// return false;
// });
}
oop.inherits(XQueryBehaviour, Behaviour);
exports.XQueryBehaviour = XQueryBehaviour;
});
@@ -1,187 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
// used by objective-c
var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b"
var c_cppHighlightRules = function() {
var keywordControls = (
"break|case|continue|default|do|else|for|goto|if|_Pragma|" +
"return|switch|while|catch|operator|try|throw|using"
);
var storageType = (
"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
"_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
"class|wchar_t|template"
);
var storageModifiers = (
"const|extern|register|restrict|static|volatile|inline|private:|" +
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
);
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"
);
var keywordMapper = this.$keywords = this.createKeywordMapper({
"keyword.control" : keywordControls,
"storage.type" : storageType,
"storage.modifier" : storageModifiers,
"keyword.operator" : keywordOperators,
"variable.language": "this",
"constant.language": builtinConstants
}, "identifier");
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
// 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
merge : true,
regex : "\\/\\*",
next : "comment"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // multi line string start
merge : true,
regex : '["].*\\\\$',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "string", // multi line string start
merge : true,
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 : "(?:#include|#import|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"
}, {
token : "support.function.C99.c",
regex : cFunctions
}, {
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|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"
}, {
token : "comment", // comment spanning whole line
merge : true,
regex : ".+"
}
],
"qqstring" : [
{
token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start"
}, {
token : "string",
merge : true,
regex : '.+'
}
],
"qstring" : [
{
token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start"
}, {
token : "string",
merge : true,
regex : '.+'
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(c_cppHighlightRules, TextHighlightRules);
exports.c_cppHighlightRules = c_cppHighlightRules;
});
@@ -1,115 +0,0 @@
/**
* Copyright (c) 2009-2012 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.3.3
var extend, flatten, _ref;
exports.starts = function(string, literal, start) {
return literal === string.substr(start, literal.length);
};
exports.ends = function(string, literal, back) {
var len;
len = literal.length;
return literal === string.substr(string.length - len - (back || 0), len);
};
exports.compact = function(array) {
var item, _i, _len, _results;
_results = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
item = array[_i];
if (item) {
_results.push(item);
}
}
return _results;
};
exports.count = function(string, substr) {
var num, pos;
num = pos = 0;
if (!substr.length) {
return 1 / 0;
}
while (pos = 1 + string.indexOf(substr, pos)) {
num++;
}
return num;
};
exports.merge = function(options, overrides) {
return extend(extend({}, options), overrides);
};
extend = exports.extend = function(object, properties) {
var key, val;
for (key in properties) {
val = properties[key];
object[key] = val;
}
return object;
};
exports.flatten = flatten = function(array) {
var element, flattened, _i, _len;
flattened = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
element = array[_i];
if (element instanceof Array) {
flattened = flattened.concat(flatten(element));
} else {
flattened.push(element);
}
}
return flattened;
};
exports.del = function(obj, key) {
var val;
val = obj[key];
delete obj[key];
return val;
};
exports.last = function(array, back) {
return array[array.length - (back || 0) - 1];
};
exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) {
var e, _i, _len;
for (_i = 0, _len = this.length; _i < _len; _i++) {
e = this[_i];
if (fn(e)) {
return true;
}
}
return false;
};
});
File diff suppressed because one or more lines are too long
@@ -1,376 +0,0 @@
/**
* Copyright (c) 2009-2012 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.3.3
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__slice = [].slice;
exports.Rewriter = (function() {
function Rewriter() {}
Rewriter.prototype.rewrite = function(tokens) {
this.tokens = tokens;
this.removeLeadingNewlines();
this.removeMidExpressionNewlines();
this.closeOpenCalls();
this.closeOpenIndexes();
this.addImplicitIndentation();
this.tagPostfixConditionals();
this.addImplicitBraces();
this.addImplicitParentheses();
return this.tokens;
};
Rewriter.prototype.scanTokens = function(block) {
var i, token, tokens;
tokens = this.tokens;
i = 0;
while (token = tokens[i]) {
i += block.call(this, token, i, tokens);
}
return true;
};
Rewriter.prototype.detectEnd = function(i, condition, action) {
var levels, token, tokens, _ref, _ref1;
tokens = this.tokens;
levels = 0;
while (token = tokens[i]) {
if (levels === 0 && condition.call(this, token, i)) {
return action.call(this, token, i);
}
if (!token || levels < 0) {
return action.call(this, token, i - 1);
}
if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) {
levels += 1;
} else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) {
levels -= 1;
}
i += 1;
}
return i - 1;
};
Rewriter.prototype.removeLeadingNewlines = function() {
var i, tag, _i, _len, _ref;
_ref = this.tokens;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
tag = _ref[i][0];
if (tag !== 'TERMINATOR') {
break;
}
}
if (i) {
return this.tokens.splice(0, i);
}
};
Rewriter.prototype.removeMidExpressionNewlines = function() {
return this.scanTokens(function(token, i, tokens) {
var _ref;
if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) {
return 1;
}
tokens.splice(i, 1);
return 0;
});
};
Rewriter.prototype.closeOpenCalls = function() {
var action, condition;
condition = function(token, i) {
var _ref;
return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')';
};
action = function(token, i) {
return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END';
};
return this.scanTokens(function(token, i) {
if (token[0] === 'CALL_START') {
this.detectEnd(i + 1, condition, action);
}
return 1;
});
};
Rewriter.prototype.closeOpenIndexes = function() {
var action, condition;
condition = function(token, i) {
var _ref;
return (_ref = token[0]) === ']' || _ref === 'INDEX_END';
};
action = function(token, i) {
return token[0] = 'INDEX_END';
};
return this.scanTokens(function(token, i) {
if (token[0] === 'INDEX_START') {
this.detectEnd(i + 1, condition, action);
}
return 1;
});
};
Rewriter.prototype.addImplicitBraces = function() {
var action, condition, sameLine, stack, start, startIndent, startIndex, startsLine;
stack = [];
start = null;
startsLine = null;
sameLine = true;
startIndent = 0;
startIndex = 0;
condition = function(token, i) {
var one, tag, three, two, _ref, _ref1;
_ref = this.tokens.slice(i + 1, +(i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2];
if ('HERECOMMENT' === (one != null ? one[0] : void 0)) {
return false;
}
tag = token[0];
if (__indexOf.call(LINEBREAKS, tag) >= 0) {
sameLine = false;
}
return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine && !(i - startIndex === 1))) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref1 = one[0]) !== 'IDENTIFIER' && _ref1 !== 'NUMBER' && _ref1 !== 'STRING' && _ref1 !== '@' && _ref1 !== 'TERMINATOR' && _ref1 !== 'OUTDENT'));
};
action = function(token, i) {
var tok;
tok = this.generate('}', '}', token[2]);
return this.tokens.splice(i, 0, tok);
};
return this.scanTokens(function(token, i, tokens) {
var ago, idx, prevTag, tag, tok, value, _ref, _ref1;
if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) {
stack.push([(tag === 'INDENT' && this.tag(i - 1) === '{' ? '{' : tag), i]);
return 1;
}
if (__indexOf.call(EXPRESSION_END, tag) >= 0) {
start = stack.pop();
return 1;
}
if (!(tag === ':' && ((ago = this.tag(i - 2)) === ':' || ((_ref1 = stack[stack.length - 1]) != null ? _ref1[0] : void 0) !== '{'))) {
return 1;
}
sameLine = true;
startIndex = i + 1;
stack.push(['{']);
idx = ago === '@' ? i - 2 : i - 1;
while (this.tag(idx - 2) === 'HERECOMMENT') {
idx -= 2;
}
prevTag = this.tag(idx - 1);
startsLine = !prevTag || (__indexOf.call(LINEBREAKS, prevTag) >= 0);
value = new String('{');
value.generated = true;
tok = this.generate('{', value, token[2]);
tokens.splice(idx, 0, tok);
this.detectEnd(i + 2, condition, action);
return 2;
});
};
Rewriter.prototype.addImplicitParentheses = function() {
var action, condition, noCall, seenControl, seenSingle;
noCall = seenSingle = seenControl = false;
condition = function(token, i) {
var post, tag, _ref, _ref1;
tag = token[0];
if (!seenSingle && token.fromThen) {
return true;
}
if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>' || tag === 'CLASS') {
seenSingle = true;
}
if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY' || tag === '=') {
seenControl = true;
}
if ((tag === '.' || tag === '?.' || tag === '::') && this.tag(i - 1) === 'OUTDENT') {
return true;
}
return !token.generated && this.tag(i - 1) !== ',' && (__indexOf.call(IMPLICIT_END, tag) >= 0 || (tag === 'INDENT' && !seenControl)) && (tag !== 'INDENT' || (((_ref = this.tag(i - 2)) !== 'CLASS' && _ref !== 'EXTENDS') && (_ref1 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref1) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{')));
};
action = function(token, i) {
return this.tokens.splice(i, 0, this.generate('CALL_END', ')', token[2]));
};
return this.scanTokens(function(token, i, tokens) {
var callObject, current, next, prev, tag, _ref, _ref1, _ref2;
tag = token[0];
if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') {
noCall = true;
}
_ref = tokens.slice(i - 1, +(i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2];
callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref1 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref1) >= 0);
seenSingle = false;
seenControl = false;
if (__indexOf.call(LINEBREAKS, tag) >= 0) {
noCall = false;
}
if (prev && !prev.spaced && tag === '?') {
token.call = true;
}
if (token.fromThen) {
return 1;
}
if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) {
return 1;
}
tokens.splice(i, 0, this.generate('CALL_START', '(', token[2]));
this.detectEnd(i + 1, condition, action);
if (prev[0] === '?') {
prev[0] = 'FUNC_EXIST';
}
return 2;
});
};
Rewriter.prototype.addImplicitIndentation = function() {
var action, condition, indent, outdent, starter;
starter = indent = outdent = null;
condition = function(token, i) {
var _ref;
return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN'));
};
action = function(token, i) {
return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
};
return this.scanTokens(function(token, i, tokens) {
var tag, _ref, _ref1;
tag = token[0];
if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') {
tokens.splice(i, 1);
return 0;
}
if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation(token))));
return 2;
}
if (tag === 'CATCH' && ((_ref = this.tag(i + 2)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) {
tokens.splice.apply(tokens, [i + 2, 0].concat(__slice.call(this.indentation(token))));
return 4;
}
if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
starter = tag;
_ref1 = this.indentation(token, true), indent = _ref1[0], outdent = _ref1[1];
if (starter === 'THEN') {
indent.fromThen = true;
}
tokens.splice(i + 1, 0, indent);
this.detectEnd(i + 2, condition, action);
if (tag === 'THEN') {
tokens.splice(i, 1);
}
return 1;
}
return 1;
});
};
Rewriter.prototype.tagPostfixConditionals = function() {
var action, condition, original;
original = null;
condition = function(token, i) {
var _ref;
return (_ref = token[0]) === 'TERMINATOR' || _ref === 'INDENT';
};
action = function(token, i) {
if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) {
return original[0] = 'POST_' + original[0];
}
};
return this.scanTokens(function(token, i) {
if (token[0] !== 'IF') {
return 1;
}
original = token;
this.detectEnd(i + 1, condition, action);
return 1;
});
};
Rewriter.prototype.indentation = function(token, implicit) {
var indent, outdent;
if (implicit == null) {
implicit = false;
}
indent = ['INDENT', 2, token[2]];
outdent = ['OUTDENT', 2, token[2]];
if (implicit) {
indent.generated = outdent.generated = true;
}
return [indent, outdent];
};
Rewriter.prototype.generate = function(tag, value, line) {
var tok;
tok = [tag, value, line];
tok.generated = true;
return tok;
};
Rewriter.prototype.tag = function(i) {
var _ref;
return (_ref = this.tokens[i]) != null ? _ref[0] : void 0;
};
return Rewriter;
})();
BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']];
exports.INVERSES = INVERSES = {};
EXPRESSION_START = [];
EXPRESSION_END = [];
for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) {
_ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1];
EXPRESSION_START.push(INVERSES[rite] = left);
EXPRESSION_END.push(INVERSES[left] = rite);
}
EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++'];
IMPLICIT_UNSPACED_CALL = ['+', '-'];
IMPLICIT_BLOCK = ['->', '=>', '{', '[', ','];
IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR'];
SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN'];
SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN'];
LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
});
@@ -1,328 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
oop.inherits(CoffeeHighlightRules, TextHighlightRules);
function CoffeeHighlightRules() {
var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
var stringfill = {
token : "string",
merge : true,
regex : ".+"
};
var keywords = (
"this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
"catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" +
"finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
"or|on|unless|until|and|yes"
);
var langConstant = (
"true|false|null|undefined|NaN|Infinity"
);
var illegal = (
"case|const|default|function|var|void|with|enum|export|implements|" +
"interface|let|package|private|protected|public|static|yield|" +
"__hasProp|slice|bind|indexOf"
);
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 functionRules = {
"({args})->": {
token: ["paren.lparen", "text", "paren.lparen", "text", "variable.parameter", "text", "paren.rparen", "text", "paren.rparen", "text", "storage.type"],
regex: "(\\()(\\s*)(\\{)(\\s*)([$@A-Za-z_\\x7f-\\uffff][$@\\w\\s,\\x7f-\\uffff]*)(\\s*)(\\})(\\s*)(\\))(\\s*)([\\-=]>)"
},
"({})->": {
token: ["paren.lparen", "text", "paren.lparen", "text", "paren.rparen", "text", "paren.rparen", "text", "storage.type"],
regex: "(\\()(\\s*)(\\{)(\\s*)(\\})(\\s*)(\\))(\\s*)([\\-=]>)"
},
"(args)->": {
token: ["paren.lparen", "text", "variable.parameter", "text", "paren.rparen", "text", "storage.type"],
regex: "(\\()(\\s*)([$@A-Za-z_\\x7f-\\uffff][\\s\\x21-\\uffff]*)(\\s*)(\\))(\\s*)([\\-=]>)"
},
"()->": {
token: ["paren.lparen", "text", "paren.rparen", "text", "storage.type"],
regex: "(\\()(\\s*)(\\))(\\s*)([\\-=]>)"
}
};
this.$rules = {
start : [
{
token : "constant.numeric",
regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
}, {
token : "string",
merge : true,
regex : "'''",
next : "qdoc"
}, {
token : "string",
merge : true,
regex : '"""',
next : "qqdoc"
}, {
token : "string",
merge : true,
regex : "'",
next : "qstring"
}, {
token : "string",
merge : true,
regex : '"',
next : "qqstring"
}, {
token : "string",
merge : true,
regex : "`",
next : "js"
}, {
token : "string.regex",
merge : true,
regex : "///",
next : "heregex"
}, {
token : "string.regex",
regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
}, {
token : "comment",
merge : true,
regex : "###(?!#)",
next : "comment"
}, {
token : "comment",
regex : "#.*"
}, {
token : [
"punctuation.operator", "identifier"
],
regex : "(\\.)(" + illegal + ")"
}, {
token : "punctuation.operator",
regex : "\\."
}, {
//class A extends B
token : [
"keyword", "text", "language.support.class", "text", "keyword", "text", "language.support.class"
],
regex : "(class)(\\s+)(" + identifier + ")(\\s+)(extends)(\\s+)(" + identifier + ")"
}, {
//class A
token : [
"keyword", "text", "language.support.class"
],
regex : "(class)(\\s+)(" + identifier + ")"
}, {
//play = ({args}) ->
token : [
"entity.name.function", "text", "keyword.operator", "text"
].concat(functionRules["({args})->"].token),
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["({args})->"].regex
}, {
//play : ({args}) ->
token : [
"entity.name.function", "text", "punctuation.operator", "text"
].concat(functionRules["({args})->"].token),
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["({args})->"].regex
}, {
//play = ({}) ->
token : [
"entity.name.function", "text", "keyword.operator", "text"
].concat(functionRules["({})->"].token),
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["({})->"].regex
}, {
//play : ({}) ->
token : [
"entity.name.function", "text", "punctuation.operator", "text"
].concat(functionRules["({})->"].token),
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["({})->"].regex
}, {
//play = (args) ->
token : [
"entity.name.function", "text", "keyword.operator", "text"
].concat(functionRules["(args)->"].token),
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["(args)->"].regex
}, {
//play : (args) ->
token : [
"entity.name.function", "text", "punctuation.operator", "text"
].concat(functionRules["(args)->"].token),
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["(args)->"].regex
}, {
//play = () ->
token : [
"entity.name.function", "text", "keyword.operator", "text"
].concat(functionRules["()->"].token),
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["()->"].regex
}, {
//play : () ->
token : [
"entity.name.function", "text", "punctuation.operator", "text"
].concat(functionRules["()->"].token),
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["()->"].regex
}, {
//play = ->
token : [
"entity.name.function", "text", "keyword.operator", "text", "storage.type"
],
regex : "(" + identifier + ")(\\s*)(=)(\\s*)([\\-=]>)"
}, {
//play : ->
token : [
"entity.name.function", "text", "punctuation.operator", "text", "storage.type"
],
regex : "(" + identifier + ")(\\s*)(:)(\\s*)([\\-=]>)"
},
functionRules["({args})->"],
functionRules["({})->"],
functionRules["(args)->"],
functionRules["()->"]
, {
token : "identifier",
regex : "(?:(?:\\.|::)\\s*)" + identifier
}, {
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+"
}],
qdoc : [{
token : "string",
regex : ".*?'''",
next : "start"
}, stringfill],
qqdoc : [{
token : "string",
regex : '.*?"""',
next : "start"
}, stringfill],
qstring : [{
token : "string",
regex : "[^\\\\']*(?:\\\\.[^\\\\']*)*'",
merge : true,
next : "start"
}, stringfill],
qqstring : [{
token : "string",
regex : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
merge : true,
next : "start"
}, stringfill],
js : [{
token : "string",
merge : true,
regex : "[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",
next : "start"
}, stringfill],
heregex : [{
token : "string.regex",
regex : '.*?///[imgy]{0,4}',
next : "start"
}, {
token : "comment.regex",
regex : "\\s+(?:#.*)?"
}, {
token : "string.regex",
merge : true,
regex : "\\S+"
}],
comment : [{
token : "comment",
regex : '.*?###',
next : "start"
}, {
token : "comment",
merge : true,
regex : ".+"
}]
};
}
exports.CoffeeHighlightRules = CoffeeHighlightRules;
});
@@ -1,266 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var Mode = require("./coffee").Mode;
var assert = require("../test/assertions");
module.exports = {
setUp : function() {
this.tokenizer = new Mode().getTokenizer();
this.testTokens = function(tokens, correct) {
assert.equal(tokens.length, correct.length);
correct.forEach(function(type, i) {
assert.equal(tokens[i].type, type);
});
};
},
"test: tokenize keyword": function() {
var tokens = this.tokenizer.getLineTokens("for", "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, "keyword");
},
"test: tokenize regexp": function() {
var tokens = this.tokenizer.getLineTokens('/"[a]/', "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, "string.regex");
},
"test: tokenize function: 'foo = ({args}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = ({args}) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "paren.lparen", "variable.parameter", "paren.rparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = ({a1, a2}) ->", "start").tokens;
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = ({@a1, a2}) ->", "start").tokens;
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo : ({args}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo : ({args}) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text",
"paren.lparen", "paren.lparen", "variable.parameter", "paren.rparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: invalid case: 'foo = ({args}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = ({0abc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({/abc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({abc/}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({#abc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({abc#}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({)abc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({abc)}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({a{bc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
},
"test: tokenize function: 'foo = ({}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = ({}) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "paren.lparen", "paren.rparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = ({ }) ->", "start").tokens;
correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "paren.lparen", "text", "paren.rparen", "paren.rparen", "text", "storage.type"
];
assert.equal(tokens.length, 11);
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo : ({}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo : ({}) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text",
"paren.lparen", "paren.lparen", "paren.rparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo = (args) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = (args) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = (arg1, arg2) ->", "start").tokens;
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = (arg1 = 1, arg2 = 'name') ->", "start").tokens;
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = (@arg1 = /abc/, arg2 = 'name') ->", "start").tokens;
this.testTokens(tokens, correct);
},
"test: tokenize function: invalid case: 'foo=(args) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo=(/args) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
},
"test: tokenize function: 'foo = () ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = () ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = ( ) ->", "start").tokens;
correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "text", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo : () ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo : () ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text",
"paren.lparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo : ( ) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text",
"paren.lparen", "text", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'window.foo = (args) ->'": function() {
var tokens = this.tokenizer.getLineTokens("window.foo = (args) ->", "start").tokens;
var correct = [
"variable.language", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo = ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo : ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo : ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize callback function: 'foo bar: 1, (args) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo bar: 1, (args) ->", "start").tokens;
var correct = [
"identifier", "text", "identifier", "punctuation.operator", "text", "constant.numeric", "punctuation.operator", "text",
"paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize class: 'class Foo'": function() {
var tokens = this.tokenizer.getLineTokens("class Foo", "start").tokens;
var correct = [
"keyword", "text", "language.support.class"
];
this.testTokens(tokens, correct);
},
"test: tokenize class 'class Foo extends Bar'": function() {
var tokens = this.tokenizer.getLineTokens("class Foo extends Bar", "start").tokens;
var correct = [
"keyword", "text", "language.support.class", "text", "keyword", "text", "language.support.class"
];
this.testTokens(tokens, correct);
},
"test: tokenize illegal name property: 'foo.static.function'": function() {
var tokens = this.tokenizer.getLineTokens("foo.static.function", "start").tokens;
var correct = [
"identifier", "punctuation.operator", "identifier", "punctuation.operator", "identifier"
];
this.testTokens(tokens, correct);
},
// TODO: disable. not yet implemented
"!test tokenize string with interpolation": function() {
var tokens = this.tokenizer.getLineTokens('"#{ 22 / 7 } is a decent approximation of π"', "start").tokens;
console.log(tokens);
assert.equal(tokens.length, 12);
//assert.equal(tokens[0].type, "keyword");
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}
@@ -1,128 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var xml_util = require("./xml_util");
var ColdfusionHighlightRules = function() {
// regexp must not have capturing parentheses
// regexps are ordered -> the first match is used
this.$rules = {
start : [ {
token : "text",
merge : true,
regex : "<\\!\\[CDATA\\[",
next : "cdata"
}, {
token : "xml-pe",
regex : "<\\?.*?\\?>"
}, {
token : "comment",
merge : true,
regex : "<\\!--",
next : "comment"
}, {
token : "meta.tag",
regex : "<(?=script)",
next : "script"
}, {
token : "meta.tag",
regex : "<(?=style)",
next : "style"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
next : "tag"
}, {
token : "text",
regex : "\\s+"
}, {
token : "text",
regex : "[^<]+"
} ],
cdata : [ {
token : "text",
regex : "\\]\\]>",
next : "start"
}, {
token : "text",
merge : true,
regex : "\\s+"
}, {
token : "text",
merge : true,
regex : ".+"
} ],
comment : [ {
token : "comment",
regex : ".*?-->",
next : "start"
}, {
token : "comment",
merge : true,
regex : ".+"
} ]
};
xml_util.tag(this.$rules, "tag", "start");
xml_util.tag(this.$rules, "style", "css-start");
xml_util.tag(this.$rules, "script", "js-start");
this.embedRules(JavaScriptHighlightRules, "js-", [{
token: "comment",
regex: "\\/\\/.*(?=<\\/script>)",
next: "tag"
}, {
token: "meta.tag",
regex: "<\\/(?=script)",
next: "tag"
}]);
this.embedRules(CssHighlightRules, "css-", [{
token: "meta.tag",
regex: "<\\/(?=style)",
next: "tag"
}]);
};
oop.inherits(ColdfusionHighlightRules, TextHighlightRules);
exports.ColdfusionHighlightRules = ColdfusionHighlightRules;
});
@@ -1,192 +0,0 @@
/*
THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 958518BC-799F-477A-99F9-5B28EBF230F6) */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
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|break|case|continue|default|do|else|for|if|in|return|switch|while|new";
var keywordDeclaration = "abstract|class|extends|external|factory|implements|interface|get|native|operator|set|typedef";
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 : "string",
merge : true,
regex : ".+"
};
// 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
"merge" : true,
"regex" : /\/\*/,
"next" : "comment"
},
{
"token": ["meta.preprocessor.script.dart"],
"regex": "^(#!.*)$"
},
{
"token": [ "keyword.other.import.dart", "meta.declaration.dart"],
"regex": "#(?:\\b)(?:library|import|source|resource)(?:\\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",
"merge" : true,
"regex" : "'''",
"next" : "qdoc"
},
{
"token" : "string",
"merge" : true,
"regex" : '"""',
"next" : "qqdoc"
},
{
"token" : "string",
"merge" : true,
"regex" : "'",
"next" : "qstring"
},
{
"token" : "string",
"merge" : true,
"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 : ".*?\\*\\/",
merge : true,
next : "start"
}, {
token : "comment", // comment spanning whole line
merge : true,
regex : ".+"
}
],
"qdoc" : [
{
"token" : "string",
"regex" : ".*?'''",
"next" : "start"
}, stringfill],
"qqdoc" : [
{
"token" : "string",
"regex" : '.*?"""',
"next" : "start"
}, stringfill],
"qstring" : [
{
"token" : "string",
"regex" : "[^\\\\']*(?:\\\\.[^\\\\']*)*'",
"merge" : true,
"next" : "start"
}, stringfill],
"qqstring" : [
{
"token" : "string",
"regex" : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
"merge" : true,
"next" : "start"
}, stringfill]
}
};
oop.inherits(DartHighlightRules, TextHighlightRules);
exports.DartHighlightRules = DartHighlightRules;
});
@@ -1,80 +0,0 @@
define(function(require, exports, module) {
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
this.$tokenizer = new Tokenizer(new GolangHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
this.toggleCommentLines = function(state, doc, startRow, endRow) {
var outdent = true;
var re = /^(\s*)\/\//;
for (var i=startRow; i<= endRow; i++) {
if (!re.test(doc.getLine(i))) {
outdent = false;
break;
}
}
if (outdent) {
var deleteRange = new Range(0, 0, 0, 0);
for (var i=startRow; i<= endRow; i++)
{
var line = doc.getLine(i);
var m = line.match(re);
deleteRange.start.row = i;
deleteRange.end.row = i;
deleteRange.end.column = m[0].length;
doc.replace(deleteRange, m[1]);
}
}
else {
doc.indentRows(startRow, endRow, "//");
}
};
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.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);
};
}).call(Mode.prototype);
exports.Mode = Mode;
});
@@ -1,186 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var HtmlMode = require("./html").Mode;
var assert = require("../test/assertions");
var testData = {
"test: tokenize embedded script" : [{
text: "<script a='a'>var</script>'123'",
state: ["start", "start"],
tokens: [{
type: "meta.tag",
value: "<"
}, {
type: "meta.tag.tag-name.script",
value: "script"
}, {
type: "text",
value: " "
}, {
type: "entity.other.attribute-name",
value: "a"
}, {
type: "keyword.operator",
value: "="
}, {
type: "string",
value: "'a'"
}, {
type: "meta.tag",
value: ">"
}, {
type: "storage.type",
value: "var"
}, {
type: "meta.tag",
value: "</"
}, {
type: "meta.tag.tag-name.script",
value: "script"
}, {
type: "meta.tag",
value: ">"
}, {
type: "text",
value: "'123'"
}]
}],
"test: tokenize multiline attribute value with double quotes": [{
text: "<a href=\"abc",
state: [ "start", "tag_qqstring"],
tokens: [{
type: "meta.tag",
value: "<"
}, {
type: "meta.tag.tag-name.anchor",
value: "a"
}, {
type: "text",
value: " "
}, {
type: "entity.other.attribute-name",
value: "href"
}, {
type: "keyword.operator",
value: "="
}, {
type: "string",
value: "\"abc"
}
]
}, {
text: "def\">",
state: [ "tag_qqstring", "start" ],
tokens: [ {
type: "string",
value: "def\""
}, {
type: "meta.tag",
value: ">"
}
]
}],
"test: tokenize multiline attribute value with single quotes": [{
text: "<a href='abc",
state: ["start", "tag_qstring"],
tokens: [{
type: "meta.tag",
value: "<"
}, {
type: "meta.tag.tag-name.anchor",
value: "a"
}, {
type: "text",
value: " "
}, {
type: "entity.other.attribute-name",
value: "href"
}, {
type: "keyword.operator",
value: "="
}, {
type: "string",
value: "'abc"
}
]
}, {
text: "def\"'>",
state: [ "tag_qstring", "start" ],
tokens: [ {
type: "string",
value: "def\"'"
}, {
type: "meta.tag",
value: ">"
}
]
}]
};
function generateTest(exampleData) {
return function testTokenizer() {
for (var i = 0; i < exampleData.length; i++) {
var s = exampleData[i];
var lineTokens = tokenizer.getLineTokens(s.text, s.state[0]);
assert.equal(
JSON.stringify(lineTokens, null, 4),
JSON.stringify({tokens:s.tokens, state: s.state[1]}, null, 4)
);
}
}
}
var tokenizer;
module.exports = {
setUp : function() {
tokenizer = new HtmlMode().getTokenizer();
}
}
for (var i in testData) {
module.exports[i] = generateTest(testData[i])
}
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}
@@ -1,218 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var JavaScriptMode = require("./javascript").Mode;
var assert = require("../test/assertions");
module.exports = {
name: "JavaScript Tokenizer",
setUp : function() {
this.tokenizer = new JavaScriptMode().getTokenizer();
},
"test: tokenize1" : function() {
var line = "foo = function";
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(5, tokens.length);
assert.equal("identifier", tokens[0].type);
assert.equal("text", tokens[1].type);
assert.equal("keyword.operator", tokens[2].type);
assert.equal("text", tokens[3].type);
assert.equal("storage.type", tokens[4].type);
},
"test: tokenize 'standard' functions" : function() {
var line = "string.charCodeAt(23); document.getElementById('test'); console.log('Here it is');";
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(23, tokens.length);
assert.equal("support.function", tokens[2].type); // charCodeAt
assert.equal("support.function.dom", tokens[10].type); // getElementById
assert.equal("support.function.firebug", tokens[18].type); // log
},
"test: tokenize doc comment" : function() {
var line = "abc /** de */ fg";
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(5, tokens.length);
assert.equal("identifier", tokens[0].type);
assert.equal("text", tokens[1].type);
assert.equal("comment.doc", tokens[2].type);
assert.equal("text", tokens[3].type);
assert.equal("identifier", tokens[4].type);
},
"test: tokenize doc comment with tag" : function() {
var line = "/** @param {} */";
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(3, tokens.length);
assert.equal("comment.doc", tokens[0].type);
assert.equal("comment.doc.tag", tokens[1].type);
assert.equal("comment.doc", tokens[2].type);
},
"test: tokenize parens" : function() {
var line = "[{( )}]";
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(7, tokens.length);
assert.equal("paren.lparen", tokens[0].type);
assert.equal("paren.lparen", tokens[1].type);
assert.equal("paren.lparen", tokens[2].type);
assert.equal("text", tokens[3].type);
assert.equal("paren.rparen", tokens[4].type);
assert.equal("paren.rparen", tokens[5].type);
assert.equal("paren.rparen", tokens[6].type);
},
"test for last rule in ruleset to catch capturing group bugs" : function() {
var tokens = this.tokenizer.getLineTokens("}", "start").tokens;
assert.equal(1, tokens.length);
assert.equal("paren.rparen", tokens[0].type);
},
"test tokenize arithmetic expression which looks like a regexp": function() {
var tokens = this.tokenizer.getLineTokens("a/b/c", "start").tokens;
assert.equal(5, tokens.length);
var tokens = this.tokenizer.getLineTokens("a/=b/c", "start").tokens;
assert.equal(5, tokens.length);
},
"test tokenize reg exps" : function() {
var tokens = this.tokenizer.getLineTokens("a=/b/g", "start").tokens;
assert.equal(3, tokens.length);
assert.equal("string.regexp", tokens[2].type);
var tokens = this.tokenizer.getLineTokens("a+/b/g", "start").tokens;
assert.equal(3, tokens.length);
assert.equal("string.regexp", tokens[2].type);
var tokens = this.tokenizer.getLineTokens("a = 1 + /2 + 1/b", "start").tokens;
assert.equal(11, tokens.length);
assert.equal("string.regexp", tokens[8].type);
var tokens = this.tokenizer.getLineTokens("a=/a/ / /a/", "start").tokens;
assert.equal(7, tokens.length);
assert.equal("string.regexp", tokens[2].type);
assert.equal("string.regexp", tokens[6].type);
var tokens = this.tokenizer.getLineTokens("case /a/.test(c)", "start").tokens;
assert.equal(8, tokens.length);
assert.equal("string.regexp", tokens[2].type);
},
"test tokenize multi-line comment containing a single line comment" : function() {
var tokens = this.tokenizer.getLineTokens("/* foo // bar */", "start").tokens;
assert.equal(1, tokens.length);
assert.equal("comment", tokens[0].type);
var tokens = this.tokenizer.getLineTokens("/* foo // bar */", "regex_allowed").tokens;
assert.equal(1, tokens.length);
assert.equal("comment", tokens[0].type);
},
"test tokenize identifier with umlauts": function() {
var tokens = this.tokenizer.getLineTokens("füße", "start").tokens;
assert.equal(1, tokens.length);
},
"test // is not a regexp": function() {
var tokens = this.tokenizer.getLineTokens("{ // 123", "start").tokens;
assert.equal(3, tokens.length);
assert.equal("paren.lparen", tokens[0].type);
assert.equal("text", tokens[1].type);
assert.equal("comment", tokens[2].type);
},
"test skipping escaped chars": function() {
var line = "console.log('Meh\\nNeh');"
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(9, tokens.length);
assert.equal("constant.language.escape", tokens[5].type);
line = "console.log('\\u1232Feh');";
tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(9, tokens.length);
assert.equal("constant.language.escape", tokens[5].type);
},
"test multiline strings": function() {
var line = "console.log('Meh\\"
var data = this.tokenizer.getLineTokens(line, "start")
assert.equal(5, data.tokens.length);
assert.equal(data.state, "qstring");
line = "console.log('Meh\\ "
data = this.tokenizer.getLineTokens(line, "start")
assert.equal(6, data.tokens.length);
assert.equal(data.state, "start");
line = 'console.log("\\'
data = this.tokenizer.getLineTokens(line, "start")
assert.equal(5, data.tokens.length);
assert.equal(data.state, "qqstring");
line = 'a="'
data = this.tokenizer.getLineTokens(line, "start")
assert.equal(3, data.tokens.length);
assert.equal(data.state, "start");
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
@@ -1,53 +0,0 @@
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var JsxHighlightRules = require("./jsx_highlight_rules").JsxHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
function Mode() {
this.$tokenizer = new Tokenizer(new JsxHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode();
}
oop.inherits(Mode, TextMode);
(function() {
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.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);
};
}).call(Mode.prototype);
exports.Mode = Mode;
});
@@ -1,122 +0,0 @@
define(function(require, exports, module) {
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 JsxHighlightRules = function() {
var keywords = lang.arrayToMap(
("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" +
"if|throw|" +
"delete|in|try|" +
"class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" +
"number|int|string|boolean|variant|" +
"log|assert").split("|")
);
var buildinConstants = lang.arrayToMap(
("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|")
);
var reserved = lang.arrayToMap(
("debugger|with|" +
"const|export|" +
"let|private|public|yield|protected|" +
"extern|native|as|operator|__fake__|__readonly__").split("|")
);
var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b";
this.$rules = {
"start" : [
{
token : "comment",
regex : "\\/\\/.*$"
},
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
regex : "\\/\\*",
merge : true,
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 : [
"storage.type",
"text",
"entity.name.function"
],
regex : "(function)(\\s+)(" + identifierRe + ")"
}, {
token : function(value) {
if (value == "this")
return "variable.language";
else if (value == "function")
return "storage.type";
else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
return "language.support.class";
else
return "identifier";
},
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : identifierRe
}, {
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"
}, {
token : "comment", // comment spanning whole line
merge : true,
regex : ".+"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(JsxHighlightRules, TextHighlightRules);
exports.JsxHighlightRules = JsxHighlightRules;
});
@@ -1,58 +0,0 @@
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var LatexHighlightRules = require("./latex_highlight_rules").LatexHighlightRules;
var LatexFoldMode = require("./folding/latex").FoldMode;
var Range = require("../range").Range;
var Mode = function() {
this.$tokenizer = new Tokenizer(new LatexHighlightRules().getRules());
this.foldingRules = new LatexFoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
this.toggleCommentLines = function(state, doc, startRow, endRow) {
// This code is adapted from ruby.js
var outdent = true;
// LaTeX comments begin with % and go to the end of the line
var commentRegEx = /^(\s*)\%/;
for (var i = startRow; i <= endRow; i++) {
if (!commentRegEx.test(doc.getLine(i))) {
outdent = false;
break;
}
}
if (outdent) {
var deleteRange = new Range(0, 0, 0, 0);
for (var i = startRow; i <= endRow; i++) {
var line = doc.getLine(i);
var m = line.match(commentRegEx);
deleteRange.start.row = i;
deleteRange.end.row = i;
deleteRange.end.column = m[0].length;
doc.replace(deleteRange, m[1]);
}
}
else {
doc.indentRows(startRow, endRow, "%");
}
};
// There is no universally accepted way of indenting a tex document
// so just maintain the indentation of the previous line
this.getNextLineIndent = function(state, line, tab) {
return this.$getIndent(line);
};
}).call(Mode.prototype);
exports.Mode = Mode;
});
@@ -1,38 +0,0 @@
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LatexHighlightRules = function() {
this.$rules = {
"start" : [{
// A tex command e.g. \foo
token : "keyword",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
}, {
// Curly and square braces
token : "lparen",
regex : "[[({]"
}, {
// Curly and square braces
token : "rparen",
regex : "[\\])}]"
}, {
// Inline math between two $ symbols
token : "string",
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
}, {
// A comment. Tex comments start with % and go to
// the end of the line
token : "comment",
regex : "%.*$"
}]
};
};
oop.inherits(LatexHighlightRules, TextHighlightRules);
exports.LatexHighlightRules = LatexHighlightRules;
});
@@ -1,109 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var LiquidHighlightRules = require("./liquid_highlight_rules").LiquidHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Range = require("../range").Range;
var Mode = function() {
this.$tokenizer = new Tokenizer(new LiquidHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
};
oop.inherits(Mode, TextMode);
(function() {
this.toggleCommentLines = function(state, doc, startRow, endRow) {
var outdent = true;
var outentedRows = [];
var re = /^(\s*)#/;
for (var i=startRow; i<= endRow; i++) {
if (!re.test(doc.getLine(i))) {
outdent = false;
break;
}
}
if (outdent) {
var deleteRange = new Range(0, 0, 0, 0);
for (var i=startRow; i<= endRow; i++)
{
var line = doc.getLine(i);
var m = line.match(re);
deleteRange.start.row = i;
deleteRange.end.row = i;
deleteRange.end.column = m[0].length;
doc.replace(deleteRange, m[1]);
}
}
else {
doc.indentRows(startRow, endRow, "#");
}
};
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.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);
};
}).call(Mode.prototype);
exports.Mode = Mode;
});
@@ -1,410 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var 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 futureReserved = "";
var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn");
var keywordMapper = this.createKeywordMapper({
"keyword": keywords,
"support.function": functions,
"invalid.deprecated": deprecatedIn5152,
"constant.library": stdLibaries,
"constant.language": builtinConstants,
"invalid.illegal": futureReserved,
"variable.language": "this"
}, "identifier");
var strPre = "";
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 + ")";
var comment_stack = [];
this.$rules = {
"start" :
// bracketed comments
[{
token : "comment", // --[[ comment
regex : strPre + '\\-\\-\\[\\[.*\\]\\]'
}, {
token : "comment", // --[=[ comment
regex : strPre + '\\-\\-\\[\\=\\[.*\\]\\=\\]'
}, {
token : "comment", // --[==[ comment
regex : strPre + '\\-\\-\\[\\={2}\\[.*\\]\\={2}\\]'
}, {
token : "comment", // --[===[ comment
regex : strPre + '\\-\\-\\[\\={3}\\[.*\\]\\={3}\\]'
}, {
token : "comment", // --[====[ comment
regex : strPre + '\\-\\-\\[\\={4}\\[.*\\]\\={4}\\]'
}, {
token : "comment", // --[====+[ comment
regex : strPre + '\\-\\-\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]'
},
// multiline bracketed comments
{
token : "comment", // --[[ comment
regex : strPre + '\\-\\-\\[\\[.*$',
merge : true,
next : "qcomment"
}, {
token : "comment", // --[=[ comment
regex : strPre + '\\-\\-\\[\\=\\[.*$',
merge : true,
next : "qcomment1"
}, {
token : "comment", // --[==[ comment
regex : strPre + '\\-\\-\\[\\={2}\\[.*$',
merge : true,
next : "qcomment2"
}, {
token : "comment", // --[===[ comment
regex : strPre + '\\-\\-\\[\\={3}\\[.*$',
merge : true,
next : "qcomment3"
}, {
token : "comment", // --[====[ comment
regex : strPre + '\\-\\-\\[\\={4}\\[.*$',
merge : true,
next : "qcomment4"
}, {
token : function(value){ // --[====+[ comment
// WARNING: EXTREMELY SLOW, but this is the only way to circumvent the
// limits imposed by the current automaton.
// I've never personally seen any practical code where 5 or more '='s are
// used for string or commenting, so this will rarely be invoked.
var pattern = /\-\-\[(\=+)\[/, match;
// you can never be too paranoid ;)
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined)
comment_stack.push(match.length);
return "comment";
},
regex : strPre + '\\-\\-\\[\\={5}\\=*\\[.*$',
merge : true,
next : "qcomment5"
},
// single line comments
{
token : "comment",
regex : "\\-\\-.*$"
},
// bracketed strings
{
token : "string", // [[ string
regex : strPre + '\\[\\[.*\\]\\]'
}, {
token : "string", // [=[ string
regex : strPre + '\\[\\=\\[.*\\]\\=\\]'
}, {
token : "string", // [==[ string
regex : strPre + '\\[\\={2}\\[.*\\]\\={2}\\]'
}, {
token : "string", // [===[ string
regex : strPre + '\\[\\={3}\\[.*\\]\\={3}\\]'
}, {
token : "string", // [====[ string
regex : strPre + '\\[\\={4}\\[.*\\]\\={4}\\]'
}, {
token : "string", // [====+[ string
regex : strPre + '\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]'
},
// multiline bracketed strings
{
token : "string", // [[ string
regex : strPre + '\\[\\[.*$',
merge : true,
next : "qstring"
}, {
token : "string", // [=[ string
regex : strPre + '\\[\\=\\[.*$',
merge : true,
next : "qstring1"
}, {
token : "string", // [==[ string
regex : strPre + '\\[\\={2}\\[.*$',
merge : true,
next : "qstring2"
}, {
token : "string", // [===[ string
regex : strPre + '\\[\\={3}\\[.*$',
merge : true,
next : "qstring3"
}, {
token : "string", // [====[ string
regex : strPre + '\\[\\={4}\\[.*$',
merge : true,
next : "qstring4"
}, {
token : function(value){ // --[====+[ string
// WARNING: EXTREMELY SLOW, see above.
var pattern = /\[(\=+)\[/, match;
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined)
comment_stack.push(match.length);
return "string";
},
regex : strPre + '\\[\\={5}\\=*\\[.*$',
merge : true,
next : "qstring5"
},
{
token : "string", // " string
regex : strPre + '"(?:[^\\\\]|\\\\.)*?"'
}, {
token : "string", // ' string
regex : strPre + "'(?:[^\\\\]|\\\\.)*?'"
}, {
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+"
} ],
"qcomment": [ {
token : "comment",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\]",
next : "start"
}, {
token : "comment",
merge : true,
regex : '.+'
} ],
"qcomment1": [ {
token : "comment",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\=\\]",
next : "start"
}, {
token : "comment",
merge : true,
regex : '.+'
} ],
"qcomment2": [ {
token : "comment",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={2}\\]",
next : "start"
}, {
token : "comment",
merge : true,
regex : '.+'
} ],
"qcomment3": [ {
token : "comment",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={3}\\]",
next : "start"
}, {
token : "comment",
merge : true,
regex : '.+'
} ],
"qcomment4": [ {
token : "comment",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={4}\\]",
next : "start"
}, {
token : "comment",
merge : true,
regex : '.+'
} ],
"qcomment5": [ {
token : function(value){
// very hackish, mutates the qcomment5 field on the fly.
var pattern = /\](\=+)\]/, rule = this.rules.qcomment5[0], match;
rule.next = "start";
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined){
var found = match.length, expected;
if ((expected = comment_stack.pop()) != found){
comment_stack.push(expected);
rule.next = "qcomment5";
}
}
return "comment";
},
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={5}\\=*\\]",
next : "start"
}, {
token : "comment",
merge : true,
regex : '.+'
} ],
"qstring": [ {
token : "string",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\]",
next : "start"
}, {
token : "string",
merge : true,
regex : '.+'
} ],
"qstring1": [ {
token : "string",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\=\\]",
next : "start"
}, {
token : "string",
merge : true,
regex : '.+'
} ],
"qstring2": [ {
token : "string",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={2}\\]",
next : "start"
}, {
token : "string",
merge : true,
regex : '.+'
} ],
"qstring3": [ {
token : "string",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={3}\\]",
next : "start"
}, {
token : "string",
merge : true,
regex : '.+'
} ],
"qstring4": [ {
token : "string",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={4}\\]",
next : "start"
}, {
token : "string",
merge : true,
regex : '.+'
} ],
"qstring5": [ {
token : function(value){
// very hackish, mutates the qstring5 field on the fly.
var pattern = /\](\=+)\]/, rule = this.rules.qstring5[0], match;
rule.next = "start";
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined){
var found = match.length, expected;
if ((expected = comment_stack.pop()) != found){
comment_stack.push(expected);
rule.next = "qstring5";
}
}
return "string";
},
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={5}\\=*\\]",
next : "start"
}, {
token : "string",
merge : true,
regex : '.+'
} ]
};
}
oop.inherits(LuaHighlightRules, TextHighlightRules);
exports.LuaHighlightRules = LuaHighlightRules;
});
@@ -1,99 +0,0 @@
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var LuceneMode = require("./lucene").Mode;
var assert = require("../test/assertions");
module.exports = {
name: "Lucene Tokenizer",
setUp : function() {
this.tokenizer = new LuceneMode().getTokenizer();
},
"test: recognises AND as keyword" : function() {
var tokens = this.tokenizer.getLineTokens("AND", "start").tokens;
assert.equal("keyword.operator", tokens[0].type);
},
"test: recognises OR as keyword" : function() {
var tokens = this.tokenizer.getLineTokens("OR", "start").tokens;
assert.equal("keyword.operator", tokens[0].type);
},
"test: recognises NOT as keyword" : function() {
var tokens = this.tokenizer.getLineTokens("NOT", "start").tokens;
assert.equal("keyword.operator", tokens[0].type);
},
'test: recognises "hello this is dog" as string' : function() {
var tokens = this.tokenizer.getLineTokens('"hello this is dog"', "start").tokens;
assert.equal("string", tokens[0].type);
},
'test: recognises -"hello this is dog" as negation with string' : function() {
var tokens = this.tokenizer.getLineTokens('-"hello this is dog"', "start").tokens;
assert.equal("constant.character.negation", tokens[0].type);
assert.equal("string", tokens[1].type);
},
'test: recognises ~100 as text with proximity' : function() {
var tokens = this.tokenizer.getLineTokens('~100', "start").tokens;
assert.equal("constant.character.proximity", tokens[0].type);
},
'test: recognises "hello this is dog"~100 as string with proximity' : function() {
var tokens = this.tokenizer.getLineTokens('"hello this is dog"~100', "start").tokens;
assert.equal("string", tokens[0].type);
assert.equal("constant.character.proximity", tokens[1].type);
},
'test: recognises raw:"hello this is dog" as keyword' : function() {
var tokens = this.tokenizer.getLineTokens('raw:"hello this is dog"', "start").tokens;
assert.equal("keyword", tokens[0].type);
},
'test: recognises raw:foo as"keyword' : function() {
var tokens = this.tokenizer.getLineTokens('raw:foo', "start").tokens;
assert.equal("keyword", tokens[0].type);
},
'test: recognises "(" as opening parenthesis' : function() {
var tokens = this.tokenizer.getLineTokens('(', "start").tokens;
assert.equal("paren.lparen", tokens[0].type);
},
'test: recognises ")" as closing parenthesis' : function() {
var tokens = this.tokenizer.getLineTokens(')', "start").tokens;
assert.equal("paren.rparen", tokens[0].type);
},
'test: recognises foo* as text with asterisk' : function() {
var tokens = this.tokenizer.getLineTokens('foo*', "start").tokens;
assert.equal("text", tokens[0].type);
assert.equal("constant.character.asterisk", tokens[1].type);
},
'test: recognises foo? as text with interro' : function() {
var tokens = this.tokenizer.getLineTokens('foo?', "start").tokens;
assert.equal("text", tokens[0].type);
assert.equal("constant.character.interro", tokens[1].type);
},
'test: recognises single word as text' : function() {
var tokens = this.tokenizer.getLineTokens(' foo', "start").tokens;
assert.equal("text", tokens[0].type);
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}
@@ -1,100 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
* quexer <quexer AT gmail DOT com>
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var Mode = require("./markdown").Mode;
var assert = require("../test/assertions");
module.exports = {
setUp : function() {
this.tokenizer = new Mode().getTokenizer();
},
"test: header 1 ": function() {
var tokens = this.tokenizer.getLineTokens("#f", "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, 'markup.heading.1');
},
"test: header 2": function() {
var tokens = this.tokenizer.getLineTokens("## foo", "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, 'markup.heading.2');
},
"test: header ends with ' #'": function() {
var tokens = this.tokenizer.getLineTokens("# # # ", "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, 'markup.heading.1');
},
"test: header ends with '#'": function() {
var tokens = this.tokenizer.getLineTokens("#foo# ", "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, 'markup.heading.1');
},
"test: 6+ #s is not a valid header": function() {
var tokens = this.tokenizer.getLineTokens("####### foo", "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, 'text');
},
"test: # followed be only space is not a valid header": function() {
var tokens = this.tokenizer.getLineTokens("# ", "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, 'text');
},
"test: only space between #s is not a valid header": function() {
var tokens = this.tokenizer.getLineTokens("# #", "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, 'text');
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}
File diff suppressed because one or more lines are too long
@@ -1,87 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var oop = require("../lib/oop");
var TextMode = require("../mode/text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules;
var Range = require("../range").Range;
var Mode = function() {
this.$tokenizer = new Tokenizer(new PgsqlHighlightRules().getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.toggleCommentLines = function(state, doc, startRow, endRow) {
var outdent = true;
// var outentedRows = [];
var re = /^(\s*)--/;
for (var i=startRow; i<= endRow; i++) {
if (!re.test(doc.getLine(i))) {
outdent = false;
break;
}
}
if (outdent) {
var deleteRange = new Range(0, 0, 0, 0);
for (var i=startRow; i<= endRow; i++)
{
var line = doc.getLine(i);
var m = line.match(re);
deleteRange.start.row = i;
deleteRange.end.row = i;
deleteRange.end.column = m[0].length;
doc.replace(deleteRange, m[1]);
}
}
else {
doc.indentRows(startRow, endRow, "--");
}
};
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
}
}
}).call(Mode.prototype);
exports.Mode = Mode;
});

Some files were not shown because too many files have changed in this diff Show More