scrivito_codemirror_editor 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +21 -165
- data/README.md +2 -2
- data/app/assets/javascripts/scrivito_codemirror_editor/codemirror_editor.js +29 -0
- data/lib/scrivito_codemirror_editor.rb +0 -2
- data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +203 -0
- data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +157 -0
- data/vendor/assets/javascripts/codemirror/addons/display/autorefresh.js +47 -0
- data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/display/panel.js +112 -0
- data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +62 -0
- data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +51 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +195 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +169 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +120 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/comment-fold.js +59 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +150 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +146 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +60 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +146 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +437 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +271 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/css-lint.js +35 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/html-lint.js +46 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +136 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +31 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +239 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +28 -0
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +773 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +123 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/simple.js +213 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/colorize.js +40 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js +157 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +72 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +179 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/annotatescrollbar.js +118 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +48 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +152 -0
- data/vendor/assets/javascripts/codemirror/addons/search/jump-to-line.js +49 -0
- data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +146 -0
- data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +249 -0
- data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +74 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js +98 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +701 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/worker.js +44 -0
- data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +144 -0
- data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +412 -0
- data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +580 -0
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +5065 -0
- data/vendor/assets/javascripts/codemirror/modes/apl.js +174 -0
- data/vendor/assets/javascripts/codemirror/modes/asciiarmor.js +73 -0
- data/vendor/assets/javascripts/codemirror/modes/asn.1.js +204 -0
- data/vendor/assets/javascripts/codemirror/modes/asterisk.js +196 -0
- data/vendor/assets/javascripts/codemirror/modes/brainfuck.js +85 -0
- data/vendor/assets/javascripts/codemirror/modes/clike.js +786 -0
- data/vendor/assets/javascripts/codemirror/modes/clojure.js +306 -0
- data/vendor/assets/javascripts/codemirror/modes/cmake.js +97 -0
- data/vendor/assets/javascripts/codemirror/modes/cobol.js +255 -0
- data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +355 -0
- data/vendor/assets/javascripts/codemirror/modes/commonlisp.js +123 -0
- data/vendor/assets/javascripts/codemirror/modes/crystal.js +391 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +825 -0
- data/vendor/assets/javascripts/codemirror/modes/cypher.js +146 -0
- data/vendor/assets/javascripts/codemirror/modes/d.js +218 -0
- data/vendor/assets/javascripts/codemirror/modes/dart.js +157 -0
- data/vendor/assets/javascripts/codemirror/modes/diff.js +47 -0
- data/vendor/assets/javascripts/codemirror/modes/django.js +356 -0
- data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +79 -0
- data/vendor/assets/javascripts/codemirror/modes/dtd.js +142 -0
- data/vendor/assets/javascripts/codemirror/modes/dylan.js +344 -0
- data/vendor/assets/javascripts/codemirror/modes/ebnf.js +195 -0
- data/vendor/assets/javascripts/codemirror/modes/ecl.js +206 -0
- data/vendor/assets/javascripts/codemirror/modes/eiffel.js +160 -0
- data/vendor/assets/javascripts/codemirror/modes/elm.js +205 -0
- data/vendor/assets/javascripts/codemirror/modes/erlang.js +618 -0
- data/vendor/assets/javascripts/codemirror/modes/factor.js +83 -0
- data/vendor/assets/javascripts/codemirror/modes/fcl.js +173 -0
- data/vendor/assets/javascripts/codemirror/modes/forth.js +180 -0
- data/vendor/assets/javascripts/codemirror/modes/fortran.js +188 -0
- data/vendor/assets/javascripts/codemirror/modes/gas.js +345 -0
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +130 -0
- data/vendor/assets/javascripts/codemirror/modes/gherkin.js +178 -0
- data/vendor/assets/javascripts/codemirror/modes/go.js +185 -0
- data/vendor/assets/javascripts/codemirror/modes/groovy.js +230 -0
- data/vendor/assets/javascripts/codemirror/modes/haml.js +161 -0
- data/vendor/assets/javascripts/codemirror/modes/handlebars.js +62 -0
- data/vendor/assets/javascripts/codemirror/modes/haskell-literate.js +43 -0
- data/vendor/assets/javascripts/codemirror/modes/haskell.js +267 -0
- data/vendor/assets/javascripts/codemirror/modes/haxe.js +515 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +28 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +152 -0
- data/vendor/assets/javascripts/codemirror/modes/http.js +113 -0
- data/vendor/assets/javascripts/codemirror/modes/idl.js +290 -0
- data/vendor/assets/javascripts/codemirror/modes/jade.js +590 -0
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +748 -0
- data/vendor/assets/javascripts/codemirror/modes/jinja2.js +142 -0
- data/vendor/assets/javascripts/codemirror/modes/jsx.js +147 -0
- data/vendor/assets/javascripts/codemirror/modes/julia.js +392 -0
- data/vendor/assets/javascripts/codemirror/modes/livescript.js +280 -0
- data/vendor/assets/javascripts/codemirror/modes/lua.js +159 -0
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +797 -0
- data/vendor/assets/javascripts/codemirror/modes/mathematica.js +176 -0
- data/vendor/assets/javascripts/codemirror/modes/mbox.js +129 -0
- data/vendor/assets/javascripts/codemirror/modes/mirc.js +193 -0
- data/vendor/assets/javascripts/codemirror/modes/mllike.js +205 -0
- data/vendor/assets/javascripts/codemirror/modes/modelica.js +245 -0
- data/vendor/assets/javascripts/codemirror/modes/mscgen.js +169 -0
- data/vendor/assets/javascripts/codemirror/modes/mumps.js +148 -0
- data/vendor/assets/javascripts/codemirror/modes/nginx.js +178 -0
- data/vendor/assets/javascripts/codemirror/modes/nsis.js +95 -0
- data/vendor/assets/javascripts/codemirror/modes/ntriples.js +186 -0
- data/vendor/assets/javascripts/codemirror/modes/octave.js +135 -0
- data/vendor/assets/javascripts/codemirror/modes/oz.js +252 -0
- data/vendor/assets/javascripts/codemirror/modes/pascal.js +109 -0
- data/vendor/assets/javascripts/codemirror/modes/pegjs.js +114 -0
- data/vendor/assets/javascripts/codemirror/modes/perl.js +837 -0
- data/vendor/assets/javascripts/codemirror/modes/php.js +234 -0
- data/vendor/assets/javascripts/codemirror/modes/pig.js +178 -0
- data/vendor/assets/javascripts/codemirror/modes/powershell.js +396 -0
- data/vendor/assets/javascripts/codemirror/modes/properties.js +78 -0
- data/vendor/assets/javascripts/codemirror/modes/protobuf.js +68 -0
- data/vendor/assets/javascripts/codemirror/modes/puppet.js +220 -0
- data/vendor/assets/javascripts/codemirror/modes/python.js +340 -0
- data/vendor/assets/javascripts/codemirror/modes/q.js +139 -0
- data/vendor/assets/javascripts/codemirror/modes/r.js +164 -0
- data/vendor/assets/javascripts/codemirror/modes/rpm.js +109 -0
- data/vendor/assets/javascripts/codemirror/modes/rst.js +557 -0
- data/vendor/assets/javascripts/codemirror/modes/ruby.js +285 -0
- data/vendor/assets/javascripts/codemirror/modes/rust.js +71 -0
- data/vendor/assets/javascripts/codemirror/modes/sas.js +315 -0
- data/vendor/assets/javascripts/codemirror/modes/sass.js +414 -0
- data/vendor/assets/javascripts/codemirror/modes/scheme.js +249 -0
- data/vendor/assets/javascripts/codemirror/modes/shell.js +139 -0
- data/vendor/assets/javascripts/codemirror/modes/sieve.js +193 -0
- data/vendor/assets/javascripts/codemirror/modes/slim.js +575 -0
- data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +168 -0
- data/vendor/assets/javascripts/codemirror/modes/smarty.js +225 -0
- data/vendor/assets/javascripts/codemirror/modes/solr.js +104 -0
- data/vendor/assets/javascripts/codemirror/modes/soy.js +199 -0
- data/vendor/assets/javascripts/codemirror/modes/sparql.js +180 -0
- data/vendor/assets/javascripts/codemirror/modes/spreadsheet.js +112 -0
- data/vendor/assets/javascripts/codemirror/modes/sql.js +413 -0
- data/vendor/assets/javascripts/codemirror/modes/stex.js +251 -0
- data/vendor/assets/javascripts/codemirror/modes/stylus.js +769 -0
- data/vendor/assets/javascripts/codemirror/modes/swift.js +202 -0
- data/vendor/assets/javascripts/codemirror/modes/tcl.js +139 -0
- data/vendor/assets/javascripts/codemirror/modes/textile.js +469 -0
- data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +308 -0
- data/vendor/assets/javascripts/codemirror/modes/tiki.js +312 -0
- data/vendor/assets/javascripts/codemirror/modes/toml.js +88 -0
- data/vendor/assets/javascripts/codemirror/modes/tornado.js +68 -0
- data/vendor/assets/javascripts/codemirror/modes/troff.js +84 -0
- data/vendor/assets/javascripts/codemirror/modes/ttcn-cfg.js +214 -0
- data/vendor/assets/javascripts/codemirror/modes/ttcn.js +283 -0
- data/vendor/assets/javascripts/codemirror/modes/turtle.js +162 -0
- data/vendor/assets/javascripts/codemirror/modes/twig.js +141 -0
- data/vendor/assets/javascripts/codemirror/modes/vb.js +276 -0
- data/vendor/assets/javascripts/codemirror/modes/vbscript.js +350 -0
- data/vendor/assets/javascripts/codemirror/modes/velocity.js +201 -0
- data/vendor/assets/javascripts/codemirror/modes/verilog.js +537 -0
- data/vendor/assets/javascripts/codemirror/modes/vhdl.js +189 -0
- data/vendor/assets/javascripts/codemirror/modes/vue.js +69 -0
- data/vendor/assets/javascripts/codemirror/modes/webidl.js +195 -0
- data/vendor/assets/javascripts/codemirror/modes/xml.js +394 -0
- data/vendor/assets/javascripts/codemirror/modes/xquery.js +437 -0
- data/vendor/assets/javascripts/codemirror/modes/yacas.js +204 -0
- data/vendor/assets/javascripts/codemirror/modes/yaml-frontmatter.js +68 -0
- data/vendor/assets/javascripts/codemirror/modes/yaml.js +117 -0
- data/vendor/assets/javascripts/codemirror/modes/z80.js +116 -0
- data/vendor/assets/javascripts/codemirror.js +8922 -0
- data/vendor/assets/stylesheets/codemirror/addons/dialog/dialog.css +32 -0
- data/vendor/assets/stylesheets/codemirror/addons/display/fullscreen.css +6 -0
- data/vendor/assets/stylesheets/codemirror/addons/fold/foldgutter.css +20 -0
- data/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css +37 -0
- data/vendor/assets/stylesheets/codemirror/addons/lint/lint.css +73 -0
- data/vendor/assets/stylesheets/codemirror/addons/merge/merge.css +113 -0
- data/vendor/assets/stylesheets/codemirror/addons/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/stylesheets/codemirror/addons/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/stylesheets/codemirror/addons/tern/tern.css +87 -0
- data/vendor/assets/stylesheets/codemirror/modes/tiddlywiki.css +14 -0
- data/vendor/assets/stylesheets/codemirror/modes/tiki.css +26 -0
- data/vendor/assets/stylesheets/codemirror/themes/3024-day.css +41 -0
- data/vendor/assets/stylesheets/codemirror/themes/3024-night.css +39 -0
- data/vendor/assets/stylesheets/codemirror/themes/abcdef.css +32 -0
- data/vendor/assets/stylesheets/codemirror/themes/ambiance-mobile.css +5 -0
- data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +74 -0
- data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/bespin.css +34 -0
- data/vendor/assets/stylesheets/codemirror/themes/blackboard.css +32 -0
- data/vendor/assets/stylesheets/codemirror/themes/cobalt.css +25 -0
- data/vendor/assets/stylesheets/codemirror/themes/colorforth.css +33 -0
- data/vendor/assets/stylesheets/codemirror/themes/dracula.css +41 -0
- data/vendor/assets/stylesheets/codemirror/themes/eclipse.css +23 -0
- data/vendor/assets/stylesheets/codemirror/themes/elegant.css +13 -0
- data/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css +34 -0
- data/vendor/assets/stylesheets/codemirror/themes/hopscotch.css +34 -0
- data/vendor/assets/stylesheets/codemirror/themes/icecoder.css +43 -0
- data/vendor/assets/stylesheets/codemirror/themes/isotope.css +34 -0
- data/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css +47 -0
- data/vendor/assets/stylesheets/codemirror/themes/liquibyte.css +95 -0
- data/vendor/assets/stylesheets/codemirror/themes/material.css +53 -0
- data/vendor/assets/stylesheets/codemirror/themes/mbo.css +37 -0
- data/vendor/assets/stylesheets/codemirror/themes/mdn-like.css +46 -0
- data/vendor/assets/stylesheets/codemirror/themes/midnight.css +45 -0
- data/vendor/assets/stylesheets/codemirror/themes/monokai.css +36 -0
- data/vendor/assets/stylesheets/codemirror/themes/neat.css +12 -0
- data/vendor/assets/stylesheets/codemirror/themes/neo.css +43 -0
- data/vendor/assets/stylesheets/codemirror/themes/night.css +27 -0
- data/vendor/assets/stylesheets/codemirror/themes/paraiso-dark.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/paraiso-light.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css +53 -0
- data/vendor/assets/stylesheets/codemirror/themes/railscasts.css +34 -0
- data/vendor/assets/stylesheets/codemirror/themes/rubyblue.css +25 -0
- data/vendor/assets/stylesheets/codemirror/themes/seti.css +44 -0
- data/vendor/assets/stylesheets/codemirror/themes/solarized.css +169 -0
- data/vendor/assets/stylesheets/codemirror/themes/the-matrix.css +30 -0
- data/vendor/assets/stylesheets/codemirror/themes/tomorrow-night-bright.css +35 -0
- data/vendor/assets/stylesheets/codemirror/themes/tomorrow-night-eighties.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/ttcn.css +64 -0
- data/vendor/assets/stylesheets/codemirror/themes/twilight.css +32 -0
- data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +34 -0
- data/vendor/assets/stylesheets/codemirror/themes/xq-dark.css +53 -0
- data/vendor/assets/stylesheets/codemirror/themes/xq-light.css +43 -0
- data/vendor/assets/stylesheets/codemirror/themes/yeti.css +44 -0
- data/vendor/assets/stylesheets/codemirror/themes/zenburn.css +37 -0
- data/vendor/assets/stylesheets/codemirror.css +347 -0
- metadata +244 -49
- data/app/assets/javascripts/scrivito_codemirror_editor/codemirror_editor.js.coffee +0 -23
@@ -0,0 +1,68 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
|
7
|
+
require("../../addon/mode/overlay"));
|
8
|
+
else if (typeof define == "function" && define.amd) // AMD
|
9
|
+
define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
|
10
|
+
"../../addon/mode/overlay"], mod);
|
11
|
+
else // Plain browser env
|
12
|
+
mod(CodeMirror);
|
13
|
+
})(function(CodeMirror) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
CodeMirror.defineMode("tornado:inner", function() {
|
17
|
+
var keywords = ["and","as","assert","autoescape","block","break","class","comment","context",
|
18
|
+
"continue","datetime","def","del","elif","else","end","escape","except",
|
19
|
+
"exec","extends","false","finally","for","from","global","if","import","in",
|
20
|
+
"include","is","json_encode","lambda","length","linkify","load","module",
|
21
|
+
"none","not","or","pass","print","put","raise","raw","return","self","set",
|
22
|
+
"squeeze","super","true","try","url_escape","while","with","without","xhtml_escape","yield"];
|
23
|
+
keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
|
24
|
+
|
25
|
+
function tokenBase (stream, state) {
|
26
|
+
stream.eatWhile(/[^\{]/);
|
27
|
+
var ch = stream.next();
|
28
|
+
if (ch == "{") {
|
29
|
+
if (ch = stream.eat(/\{|%|#/)) {
|
30
|
+
state.tokenize = inTag(ch);
|
31
|
+
return "tag";
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
function inTag (close) {
|
36
|
+
if (close == "{") {
|
37
|
+
close = "}";
|
38
|
+
}
|
39
|
+
return function (stream, state) {
|
40
|
+
var ch = stream.next();
|
41
|
+
if ((ch == close) && stream.eat("}")) {
|
42
|
+
state.tokenize = tokenBase;
|
43
|
+
return "tag";
|
44
|
+
}
|
45
|
+
if (stream.match(keywords)) {
|
46
|
+
return "keyword";
|
47
|
+
}
|
48
|
+
return close == "#" ? "comment" : "string";
|
49
|
+
};
|
50
|
+
}
|
51
|
+
return {
|
52
|
+
startState: function () {
|
53
|
+
return {tokenize: tokenBase};
|
54
|
+
},
|
55
|
+
token: function (stream, state) {
|
56
|
+
return state.tokenize(stream, state);
|
57
|
+
}
|
58
|
+
};
|
59
|
+
});
|
60
|
+
|
61
|
+
CodeMirror.defineMode("tornado", function(config) {
|
62
|
+
var htmlBase = CodeMirror.getMode(config, "text/html");
|
63
|
+
var tornadoInner = CodeMirror.getMode(config, "tornado:inner");
|
64
|
+
return CodeMirror.overlayMode(htmlBase, tornadoInner);
|
65
|
+
});
|
66
|
+
|
67
|
+
CodeMirror.defineMIME("text/x-tornado", "tornado");
|
68
|
+
});
|
@@ -0,0 +1,84 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object")
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd)
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineMode('troff', function() {
|
15
|
+
|
16
|
+
var words = {};
|
17
|
+
|
18
|
+
function tokenBase(stream) {
|
19
|
+
if (stream.eatSpace()) return null;
|
20
|
+
|
21
|
+
var sol = stream.sol();
|
22
|
+
var ch = stream.next();
|
23
|
+
|
24
|
+
if (ch === '\\') {
|
25
|
+
if (stream.match('fB') || stream.match('fR') || stream.match('fI') ||
|
26
|
+
stream.match('u') || stream.match('d') ||
|
27
|
+
stream.match('%') || stream.match('&')) {
|
28
|
+
return 'string';
|
29
|
+
}
|
30
|
+
if (stream.match('m[')) {
|
31
|
+
stream.skipTo(']');
|
32
|
+
stream.next();
|
33
|
+
return 'string';
|
34
|
+
}
|
35
|
+
if (stream.match('s+') || stream.match('s-')) {
|
36
|
+
stream.eatWhile(/[\d-]/);
|
37
|
+
return 'string';
|
38
|
+
}
|
39
|
+
if (stream.match('\(') || stream.match('*\(')) {
|
40
|
+
stream.eatWhile(/[\w-]/);
|
41
|
+
return 'string';
|
42
|
+
}
|
43
|
+
return 'string';
|
44
|
+
}
|
45
|
+
if (sol && (ch === '.' || ch === '\'')) {
|
46
|
+
if (stream.eat('\\') && stream.eat('\"')) {
|
47
|
+
stream.skipToEnd();
|
48
|
+
return 'comment';
|
49
|
+
}
|
50
|
+
}
|
51
|
+
if (sol && ch === '.') {
|
52
|
+
if (stream.match('B ') || stream.match('I ') || stream.match('R ')) {
|
53
|
+
return 'attribute';
|
54
|
+
}
|
55
|
+
if (stream.match('TH ') || stream.match('SH ') || stream.match('SS ') || stream.match('HP ')) {
|
56
|
+
stream.skipToEnd();
|
57
|
+
return 'quote';
|
58
|
+
}
|
59
|
+
if ((stream.match(/[A-Z]/) && stream.match(/[A-Z]/)) || (stream.match(/[a-z]/) && stream.match(/[a-z]/))) {
|
60
|
+
return 'attribute';
|
61
|
+
}
|
62
|
+
}
|
63
|
+
stream.eatWhile(/[\w-]/);
|
64
|
+
var cur = stream.current();
|
65
|
+
return words.hasOwnProperty(cur) ? words[cur] : null;
|
66
|
+
}
|
67
|
+
|
68
|
+
function tokenize(stream, state) {
|
69
|
+
return (state.tokens[0] || tokenBase) (stream, state);
|
70
|
+
};
|
71
|
+
|
72
|
+
return {
|
73
|
+
startState: function() {return {tokens:[]};},
|
74
|
+
token: function(stream, state) {
|
75
|
+
return tokenize(stream, state);
|
76
|
+
}
|
77
|
+
};
|
78
|
+
});
|
79
|
+
|
80
|
+
CodeMirror.defineMIME('text/troff', 'troff');
|
81
|
+
CodeMirror.defineMIME('text/x-troff', 'troff');
|
82
|
+
CodeMirror.defineMIME('application/x-troff', 'troff');
|
83
|
+
|
84
|
+
});
|
@@ -0,0 +1,214 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineMode("ttcn-cfg", function(config, parserConfig) {
|
15
|
+
var indentUnit = config.indentUnit,
|
16
|
+
keywords = parserConfig.keywords || {},
|
17
|
+
fileNCtrlMaskOptions = parserConfig.fileNCtrlMaskOptions || {},
|
18
|
+
externalCommands = parserConfig.externalCommands || {},
|
19
|
+
multiLineStrings = parserConfig.multiLineStrings,
|
20
|
+
indentStatements = parserConfig.indentStatements !== false;
|
21
|
+
var isOperatorChar = /[\|]/;
|
22
|
+
var curPunc;
|
23
|
+
|
24
|
+
function tokenBase(stream, state) {
|
25
|
+
var ch = stream.next();
|
26
|
+
if (ch == '"' || ch == "'") {
|
27
|
+
state.tokenize = tokenString(ch);
|
28
|
+
return state.tokenize(stream, state);
|
29
|
+
}
|
30
|
+
if (/[:=]/.test(ch)) {
|
31
|
+
curPunc = ch;
|
32
|
+
return "punctuation";
|
33
|
+
}
|
34
|
+
if (ch == "#"){
|
35
|
+
stream.skipToEnd();
|
36
|
+
return "comment";
|
37
|
+
}
|
38
|
+
if (/\d/.test(ch)) {
|
39
|
+
stream.eatWhile(/[\w\.]/);
|
40
|
+
return "number";
|
41
|
+
}
|
42
|
+
if (isOperatorChar.test(ch)) {
|
43
|
+
stream.eatWhile(isOperatorChar);
|
44
|
+
return "operator";
|
45
|
+
}
|
46
|
+
if (ch == "["){
|
47
|
+
stream.eatWhile(/[\w_\]]/);
|
48
|
+
return "number sectionTitle";
|
49
|
+
}
|
50
|
+
|
51
|
+
stream.eatWhile(/[\w\$_]/);
|
52
|
+
var cur = stream.current();
|
53
|
+
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
54
|
+
if (fileNCtrlMaskOptions.propertyIsEnumerable(cur))
|
55
|
+
return "negative fileNCtrlMaskOptions";
|
56
|
+
if (externalCommands.propertyIsEnumerable(cur)) return "negative externalCommands";
|
57
|
+
|
58
|
+
return "variable";
|
59
|
+
}
|
60
|
+
|
61
|
+
function tokenString(quote) {
|
62
|
+
return function(stream, state) {
|
63
|
+
var escaped = false, next, end = false;
|
64
|
+
while ((next = stream.next()) != null) {
|
65
|
+
if (next == quote && !escaped){
|
66
|
+
var afterNext = stream.peek();
|
67
|
+
//look if the character if the quote is like the B in '10100010'B
|
68
|
+
if (afterNext){
|
69
|
+
afterNext = afterNext.toLowerCase();
|
70
|
+
if(afterNext == "b" || afterNext == "h" || afterNext == "o")
|
71
|
+
stream.next();
|
72
|
+
}
|
73
|
+
end = true; break;
|
74
|
+
}
|
75
|
+
escaped = !escaped && next == "\\";
|
76
|
+
}
|
77
|
+
if (end || !(escaped || multiLineStrings))
|
78
|
+
state.tokenize = null;
|
79
|
+
return "string";
|
80
|
+
};
|
81
|
+
}
|
82
|
+
|
83
|
+
function Context(indented, column, type, align, prev) {
|
84
|
+
this.indented = indented;
|
85
|
+
this.column = column;
|
86
|
+
this.type = type;
|
87
|
+
this.align = align;
|
88
|
+
this.prev = prev;
|
89
|
+
}
|
90
|
+
function pushContext(state, col, type) {
|
91
|
+
var indent = state.indented;
|
92
|
+
if (state.context && state.context.type == "statement")
|
93
|
+
indent = state.context.indented;
|
94
|
+
return state.context = new Context(indent, col, type, null, state.context);
|
95
|
+
}
|
96
|
+
function popContext(state) {
|
97
|
+
var t = state.context.type;
|
98
|
+
if (t == ")" || t == "]" || t == "}")
|
99
|
+
state.indented = state.context.indented;
|
100
|
+
return state.context = state.context.prev;
|
101
|
+
}
|
102
|
+
|
103
|
+
//Interface
|
104
|
+
return {
|
105
|
+
startState: function(basecolumn) {
|
106
|
+
return {
|
107
|
+
tokenize: null,
|
108
|
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
109
|
+
indented: 0,
|
110
|
+
startOfLine: true
|
111
|
+
};
|
112
|
+
},
|
113
|
+
|
114
|
+
token: function(stream, state) {
|
115
|
+
var ctx = state.context;
|
116
|
+
if (stream.sol()) {
|
117
|
+
if (ctx.align == null) ctx.align = false;
|
118
|
+
state.indented = stream.indentation();
|
119
|
+
state.startOfLine = true;
|
120
|
+
}
|
121
|
+
if (stream.eatSpace()) return null;
|
122
|
+
curPunc = null;
|
123
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
124
|
+
if (style == "comment") return style;
|
125
|
+
if (ctx.align == null) ctx.align = true;
|
126
|
+
|
127
|
+
if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
|
128
|
+
&& ctx.type == "statement"){
|
129
|
+
popContext(state);
|
130
|
+
}
|
131
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
132
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
133
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
134
|
+
else if (curPunc == "}") {
|
135
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
136
|
+
if (ctx.type == "}") ctx = popContext(state);
|
137
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
138
|
+
}
|
139
|
+
else if (curPunc == ctx.type) popContext(state);
|
140
|
+
else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
|
141
|
+
&& curPunc != ';') || (ctx.type == "statement"
|
142
|
+
&& curPunc == "newstatement")))
|
143
|
+
pushContext(state, stream.column(), "statement");
|
144
|
+
state.startOfLine = false;
|
145
|
+
return style;
|
146
|
+
},
|
147
|
+
|
148
|
+
electricChars: "{}",
|
149
|
+
lineComment: "#",
|
150
|
+
fold: "brace"
|
151
|
+
};
|
152
|
+
});
|
153
|
+
|
154
|
+
function words(str) {
|
155
|
+
var obj = {}, words = str.split(" ");
|
156
|
+
for (var i = 0; i < words.length; ++i)
|
157
|
+
obj[words[i]] = true;
|
158
|
+
return obj;
|
159
|
+
}
|
160
|
+
|
161
|
+
CodeMirror.defineMIME("text/x-ttcn-cfg", {
|
162
|
+
name: "ttcn-cfg",
|
163
|
+
keywords: words("Yes No LogFile FileMask ConsoleMask AppendFile" +
|
164
|
+
" TimeStampFormat LogEventTypes SourceInfoFormat" +
|
165
|
+
" LogEntityName LogSourceInfo DiskFullAction" +
|
166
|
+
" LogFileNumber LogFileSize MatchingHints Detailed" +
|
167
|
+
" Compact SubCategories Stack Single None Seconds" +
|
168
|
+
" DateTime Time Stop Error Retry Delete TCPPort KillTimer" +
|
169
|
+
" NumHCs UnixSocketsEnabled LocalAddress"),
|
170
|
+
fileNCtrlMaskOptions: words("TTCN_EXECUTOR TTCN_ERROR TTCN_WARNING" +
|
171
|
+
" TTCN_PORTEVENT TTCN_TIMEROP TTCN_VERDICTOP" +
|
172
|
+
" TTCN_DEFAULTOP TTCN_TESTCASE TTCN_ACTION" +
|
173
|
+
" TTCN_USER TTCN_FUNCTION TTCN_STATISTICS" +
|
174
|
+
" TTCN_PARALLEL TTCN_MATCHING TTCN_DEBUG" +
|
175
|
+
" EXECUTOR ERROR WARNING PORTEVENT TIMEROP" +
|
176
|
+
" VERDICTOP DEFAULTOP TESTCASE ACTION USER" +
|
177
|
+
" FUNCTION STATISTICS PARALLEL MATCHING DEBUG" +
|
178
|
+
" LOG_ALL LOG_NOTHING ACTION_UNQUALIFIED" +
|
179
|
+
" DEBUG_ENCDEC DEBUG_TESTPORT" +
|
180
|
+
" DEBUG_UNQUALIFIED DEFAULTOP_ACTIVATE" +
|
181
|
+
" DEFAULTOP_DEACTIVATE DEFAULTOP_EXIT" +
|
182
|
+
" DEFAULTOP_UNQUALIFIED ERROR_UNQUALIFIED" +
|
183
|
+
" EXECUTOR_COMPONENT EXECUTOR_CONFIGDATA" +
|
184
|
+
" EXECUTOR_EXTCOMMAND EXECUTOR_LOGOPTIONS" +
|
185
|
+
" EXECUTOR_RUNTIME EXECUTOR_UNQUALIFIED" +
|
186
|
+
" FUNCTION_RND FUNCTION_UNQUALIFIED" +
|
187
|
+
" MATCHING_DONE MATCHING_MCSUCCESS" +
|
188
|
+
" MATCHING_MCUNSUCC MATCHING_MMSUCCESS" +
|
189
|
+
" MATCHING_MMUNSUCC MATCHING_PCSUCCESS" +
|
190
|
+
" MATCHING_PCUNSUCC MATCHING_PMSUCCESS" +
|
191
|
+
" MATCHING_PMUNSUCC MATCHING_PROBLEM" +
|
192
|
+
" MATCHING_TIMEOUT MATCHING_UNQUALIFIED" +
|
193
|
+
" PARALLEL_PORTCONN PARALLEL_PORTMAP" +
|
194
|
+
" PARALLEL_PTC PARALLEL_UNQUALIFIED" +
|
195
|
+
" PORTEVENT_DUALRECV PORTEVENT_DUALSEND" +
|
196
|
+
" PORTEVENT_MCRECV PORTEVENT_MCSEND" +
|
197
|
+
" PORTEVENT_MMRECV PORTEVENT_MMSEND" +
|
198
|
+
" PORTEVENT_MQUEUE PORTEVENT_PCIN" +
|
199
|
+
" PORTEVENT_PCOUT PORTEVENT_PMIN" +
|
200
|
+
" PORTEVENT_PMOUT PORTEVENT_PQUEUE" +
|
201
|
+
" PORTEVENT_STATE PORTEVENT_UNQUALIFIED" +
|
202
|
+
" STATISTICS_UNQUALIFIED STATISTICS_VERDICT" +
|
203
|
+
" TESTCASE_FINISH TESTCASE_START" +
|
204
|
+
" TESTCASE_UNQUALIFIED TIMEROP_GUARD" +
|
205
|
+
" TIMEROP_READ TIMEROP_START TIMEROP_STOP" +
|
206
|
+
" TIMEROP_TIMEOUT TIMEROP_UNQUALIFIED" +
|
207
|
+
" USER_UNQUALIFIED VERDICTOP_FINAL" +
|
208
|
+
" VERDICTOP_GETVERDICT VERDICTOP_SETVERDICT" +
|
209
|
+
" VERDICTOP_UNQUALIFIED WARNING_UNQUALIFIED"),
|
210
|
+
externalCommands: words("BeginControlPart EndControlPart BeginTestCase" +
|
211
|
+
" EndTestCase"),
|
212
|
+
multiLineStrings: true
|
213
|
+
});
|
214
|
+
});
|
@@ -0,0 +1,283 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineMode("ttcn", function(config, parserConfig) {
|
15
|
+
var indentUnit = config.indentUnit,
|
16
|
+
keywords = parserConfig.keywords || {},
|
17
|
+
builtin = parserConfig.builtin || {},
|
18
|
+
timerOps = parserConfig.timerOps || {},
|
19
|
+
portOps = parserConfig.portOps || {},
|
20
|
+
configOps = parserConfig.configOps || {},
|
21
|
+
verdictOps = parserConfig.verdictOps || {},
|
22
|
+
sutOps = parserConfig.sutOps || {},
|
23
|
+
functionOps = parserConfig.functionOps || {},
|
24
|
+
|
25
|
+
verdictConsts = parserConfig.verdictConsts || {},
|
26
|
+
booleanConsts = parserConfig.booleanConsts || {},
|
27
|
+
otherConsts = parserConfig.otherConsts || {},
|
28
|
+
|
29
|
+
types = parserConfig.types || {},
|
30
|
+
visibilityModifiers = parserConfig.visibilityModifiers || {},
|
31
|
+
templateMatch = parserConfig.templateMatch || {},
|
32
|
+
multiLineStrings = parserConfig.multiLineStrings,
|
33
|
+
indentStatements = parserConfig.indentStatements !== false;
|
34
|
+
var isOperatorChar = /[+\-*&@=<>!\/]/;
|
35
|
+
var curPunc;
|
36
|
+
|
37
|
+
function tokenBase(stream, state) {
|
38
|
+
var ch = stream.next();
|
39
|
+
|
40
|
+
if (ch == '"' || ch == "'") {
|
41
|
+
state.tokenize = tokenString(ch);
|
42
|
+
return state.tokenize(stream, state);
|
43
|
+
}
|
44
|
+
if (/[\[\]{}\(\),;\\:\?\.]/.test(ch)) {
|
45
|
+
curPunc = ch;
|
46
|
+
return "punctuation";
|
47
|
+
}
|
48
|
+
if (ch == "#"){
|
49
|
+
stream.skipToEnd();
|
50
|
+
return "atom preprocessor";
|
51
|
+
}
|
52
|
+
if (ch == "%"){
|
53
|
+
stream.eatWhile(/\b/);
|
54
|
+
return "atom ttcn3Macros";
|
55
|
+
}
|
56
|
+
if (/\d/.test(ch)) {
|
57
|
+
stream.eatWhile(/[\w\.]/);
|
58
|
+
return "number";
|
59
|
+
}
|
60
|
+
if (ch == "/") {
|
61
|
+
if (stream.eat("*")) {
|
62
|
+
state.tokenize = tokenComment;
|
63
|
+
return tokenComment(stream, state);
|
64
|
+
}
|
65
|
+
if (stream.eat("/")) {
|
66
|
+
stream.skipToEnd();
|
67
|
+
return "comment";
|
68
|
+
}
|
69
|
+
}
|
70
|
+
if (isOperatorChar.test(ch)) {
|
71
|
+
if(ch == "@"){
|
72
|
+
if(stream.match("try") || stream.match("catch")
|
73
|
+
|| stream.match("lazy")){
|
74
|
+
return "keyword";
|
75
|
+
}
|
76
|
+
}
|
77
|
+
stream.eatWhile(isOperatorChar);
|
78
|
+
return "operator";
|
79
|
+
}
|
80
|
+
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
81
|
+
var cur = stream.current();
|
82
|
+
|
83
|
+
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
84
|
+
if (builtin.propertyIsEnumerable(cur)) return "builtin";
|
85
|
+
|
86
|
+
if (timerOps.propertyIsEnumerable(cur)) return "def timerOps";
|
87
|
+
if (configOps.propertyIsEnumerable(cur)) return "def configOps";
|
88
|
+
if (verdictOps.propertyIsEnumerable(cur)) return "def verdictOps";
|
89
|
+
if (portOps.propertyIsEnumerable(cur)) return "def portOps";
|
90
|
+
if (sutOps.propertyIsEnumerable(cur)) return "def sutOps";
|
91
|
+
if (functionOps.propertyIsEnumerable(cur)) return "def functionOps";
|
92
|
+
|
93
|
+
if (verdictConsts.propertyIsEnumerable(cur)) return "string verdictConsts";
|
94
|
+
if (booleanConsts.propertyIsEnumerable(cur)) return "string booleanConsts";
|
95
|
+
if (otherConsts.propertyIsEnumerable(cur)) return "string otherConsts";
|
96
|
+
|
97
|
+
if (types.propertyIsEnumerable(cur)) return "builtin types";
|
98
|
+
if (visibilityModifiers.propertyIsEnumerable(cur))
|
99
|
+
return "builtin visibilityModifiers";
|
100
|
+
if (templateMatch.propertyIsEnumerable(cur)) return "atom templateMatch";
|
101
|
+
|
102
|
+
return "variable";
|
103
|
+
}
|
104
|
+
|
105
|
+
function tokenString(quote) {
|
106
|
+
return function(stream, state) {
|
107
|
+
var escaped = false, next, end = false;
|
108
|
+
while ((next = stream.next()) != null) {
|
109
|
+
if (next == quote && !escaped){
|
110
|
+
var afterQuote = stream.peek();
|
111
|
+
//look if the character after the quote is like the B in '10100010'B
|
112
|
+
if (afterQuote){
|
113
|
+
afterQuote = afterQuote.toLowerCase();
|
114
|
+
if(afterQuote == "b" || afterQuote == "h" || afterQuote == "o")
|
115
|
+
stream.next();
|
116
|
+
}
|
117
|
+
end = true; break;
|
118
|
+
}
|
119
|
+
escaped = !escaped && next == "\\";
|
120
|
+
}
|
121
|
+
if (end || !(escaped || multiLineStrings))
|
122
|
+
state.tokenize = null;
|
123
|
+
return "string";
|
124
|
+
};
|
125
|
+
}
|
126
|
+
|
127
|
+
function tokenComment(stream, state) {
|
128
|
+
var maybeEnd = false, ch;
|
129
|
+
while (ch = stream.next()) {
|
130
|
+
if (ch == "/" && maybeEnd) {
|
131
|
+
state.tokenize = null;
|
132
|
+
break;
|
133
|
+
}
|
134
|
+
maybeEnd = (ch == "*");
|
135
|
+
}
|
136
|
+
return "comment";
|
137
|
+
}
|
138
|
+
|
139
|
+
function Context(indented, column, type, align, prev) {
|
140
|
+
this.indented = indented;
|
141
|
+
this.column = column;
|
142
|
+
this.type = type;
|
143
|
+
this.align = align;
|
144
|
+
this.prev = prev;
|
145
|
+
}
|
146
|
+
|
147
|
+
function pushContext(state, col, type) {
|
148
|
+
var indent = state.indented;
|
149
|
+
if (state.context && state.context.type == "statement")
|
150
|
+
indent = state.context.indented;
|
151
|
+
return state.context = new Context(indent, col, type, null, state.context);
|
152
|
+
}
|
153
|
+
|
154
|
+
function popContext(state) {
|
155
|
+
var t = state.context.type;
|
156
|
+
if (t == ")" || t == "]" || t == "}")
|
157
|
+
state.indented = state.context.indented;
|
158
|
+
return state.context = state.context.prev;
|
159
|
+
}
|
160
|
+
|
161
|
+
//Interface
|
162
|
+
return {
|
163
|
+
startState: function(basecolumn) {
|
164
|
+
return {
|
165
|
+
tokenize: null,
|
166
|
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
167
|
+
indented: 0,
|
168
|
+
startOfLine: true
|
169
|
+
};
|
170
|
+
},
|
171
|
+
|
172
|
+
token: function(stream, state) {
|
173
|
+
var ctx = state.context;
|
174
|
+
if (stream.sol()) {
|
175
|
+
if (ctx.align == null) ctx.align = false;
|
176
|
+
state.indented = stream.indentation();
|
177
|
+
state.startOfLine = true;
|
178
|
+
}
|
179
|
+
if (stream.eatSpace()) return null;
|
180
|
+
curPunc = null;
|
181
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
182
|
+
if (style == "comment") return style;
|
183
|
+
if (ctx.align == null) ctx.align = true;
|
184
|
+
|
185
|
+
if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
|
186
|
+
&& ctx.type == "statement"){
|
187
|
+
popContext(state);
|
188
|
+
}
|
189
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
190
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
191
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
192
|
+
else if (curPunc == "}") {
|
193
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
194
|
+
if (ctx.type == "}") ctx = popContext(state);
|
195
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
196
|
+
}
|
197
|
+
else if (curPunc == ctx.type) popContext(state);
|
198
|
+
else if (indentStatements &&
|
199
|
+
(((ctx.type == "}" || ctx.type == "top") && curPunc != ';') ||
|
200
|
+
(ctx.type == "statement" && curPunc == "newstatement")))
|
201
|
+
pushContext(state, stream.column(), "statement");
|
202
|
+
|
203
|
+
state.startOfLine = false;
|
204
|
+
|
205
|
+
return style;
|
206
|
+
},
|
207
|
+
|
208
|
+
electricChars: "{}",
|
209
|
+
blockCommentStart: "/*",
|
210
|
+
blockCommentEnd: "*/",
|
211
|
+
lineComment: "//",
|
212
|
+
fold: "brace"
|
213
|
+
};
|
214
|
+
});
|
215
|
+
|
216
|
+
function words(str) {
|
217
|
+
var obj = {}, words = str.split(" ");
|
218
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
219
|
+
return obj;
|
220
|
+
}
|
221
|
+
|
222
|
+
function def(mimes, mode) {
|
223
|
+
if (typeof mimes == "string") mimes = [mimes];
|
224
|
+
var words = [];
|
225
|
+
function add(obj) {
|
226
|
+
if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop))
|
227
|
+
words.push(prop);
|
228
|
+
}
|
229
|
+
|
230
|
+
add(mode.keywords);
|
231
|
+
add(mode.builtin);
|
232
|
+
add(mode.timerOps);
|
233
|
+
add(mode.portOps);
|
234
|
+
|
235
|
+
if (words.length) {
|
236
|
+
mode.helperType = mimes[0];
|
237
|
+
CodeMirror.registerHelper("hintWords", mimes[0], words);
|
238
|
+
}
|
239
|
+
|
240
|
+
for (var i = 0; i < mimes.length; ++i)
|
241
|
+
CodeMirror.defineMIME(mimes[i], mode);
|
242
|
+
}
|
243
|
+
|
244
|
+
def(["text/x-ttcn", "text/x-ttcn3", "text/x-ttcnpp"], {
|
245
|
+
name: "ttcn",
|
246
|
+
keywords: words("activate address alive all alt altstep and and4b any" +
|
247
|
+
" break case component const continue control deactivate" +
|
248
|
+
" display do else encode enumerated except exception" +
|
249
|
+
" execute extends extension external for from function" +
|
250
|
+
" goto group if import in infinity inout interleave" +
|
251
|
+
" label language length log match message mixed mod" +
|
252
|
+
" modifies module modulepar mtc noblock not not4b nowait" +
|
253
|
+
" of on optional or or4b out override param pattern port" +
|
254
|
+
" procedure record recursive rem repeat return runs select" +
|
255
|
+
" self sender set signature system template testcase to" +
|
256
|
+
" type union value valueof var variant while with xor xor4b"),
|
257
|
+
builtin: words("bit2hex bit2int bit2oct bit2str char2int char2oct encvalue" +
|
258
|
+
" decomp decvalue float2int float2str hex2bit hex2int" +
|
259
|
+
" hex2oct hex2str int2bit int2char int2float int2hex" +
|
260
|
+
" int2oct int2str int2unichar isbound ischosen ispresent" +
|
261
|
+
" isvalue lengthof log2str oct2bit oct2char oct2hex oct2int" +
|
262
|
+
" oct2str regexp replace rnd sizeof str2bit str2float" +
|
263
|
+
" str2hex str2int str2oct substr unichar2int unichar2char" +
|
264
|
+
" enum2int"),
|
265
|
+
types: words("anytype bitstring boolean char charstring default float" +
|
266
|
+
" hexstring integer objid octetstring universal verdicttype timer"),
|
267
|
+
timerOps: words("read running start stop timeout"),
|
268
|
+
portOps: words("call catch check clear getcall getreply halt raise receive" +
|
269
|
+
" reply send trigger"),
|
270
|
+
configOps: words("create connect disconnect done kill killed map unmap"),
|
271
|
+
verdictOps: words("getverdict setverdict"),
|
272
|
+
sutOps: words("action"),
|
273
|
+
functionOps: words("apply derefers refers"),
|
274
|
+
|
275
|
+
verdictConsts: words("error fail inconc none pass"),
|
276
|
+
booleanConsts: words("true false"),
|
277
|
+
otherConsts: words("null NULL omit"),
|
278
|
+
|
279
|
+
visibilityModifiers: words("private public friend"),
|
280
|
+
templateMatch: words("complement ifpresent subset superset permutation"),
|
281
|
+
multiLineStrings: true
|
282
|
+
});
|
283
|
+
});
|