marty 2.4.7 → 2.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile.dummy +8 -5
- data/Gemfile.lock +1 -1
- data/README.md +8 -0
- data/app/assets/javascripts/marty/application.js +1 -0
- data/app/assets/javascripts/marty/codemirror/codemirror.js +9730 -0
- data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/delorean/delorean.js +0 -0
- data/app/assets/javascripts/marty/codemirror/mode/javascript/javascript.js +900 -0
- data/app/assets/javascripts/marty/codemirror/mode/python/python.js +399 -0
- data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/ruby/ruby.js +135 -34
- data/app/{components/marty/script_form/client/Ext.ux.form.field.CodeMirror.js → assets/javascripts/marty/extjs/extensions/marty.js} +87 -6
- data/app/assets/stylesheets/marty/application.css +1 -13
- data/app/assets/stylesheets/marty/codemirror/codemirror.css +346 -0
- data/app/{components/marty/script_form/client → assets/stylesheets/marty/codemirror}/delorean.css +0 -0
- data/app/components/marty/auth_app/client/auth_app.js +82 -80
- data/app/components/marty/data_grid_view.rb +1 -54
- data/app/components/marty/data_grid_view/client/data_grid_view.js +49 -0
- data/app/components/marty/form.rb +1 -5
- data/app/components/marty/form/client/form.js +5 -0
- data/app/components/marty/grid.rb +1 -146
- data/app/components/marty/grid/client/grid.js +146 -0
- data/app/components/marty/import_view.rb +1 -32
- data/app/components/marty/import_view/client/import_view.js +32 -0
- data/app/components/marty/live_search_grid_panel.rb +1 -21
- data/app/components/marty/live_search_grid_panel/client/live_search_grid_panel.js +27 -0
- data/app/components/marty/main_auth_app.rb +4 -145
- data/app/components/marty/main_auth_app/client/main_auth_app.js +124 -0
- data/app/components/marty/mcfly_grid_panel.rb +1 -17
- data/app/components/marty/mcfly_grid_panel/client/mcfly_grid_panel.js +37 -0
- data/app/components/marty/new_posting_form.rb +1 -6
- data/app/components/marty/new_posting_form/client/new_posting_form.js +6 -0
- data/app/components/marty/panel.rb +1 -5
- data/app/components/marty/panel/client/panel.js +5 -0
- data/app/components/marty/posting_grid.rb +4 -55
- data/app/components/marty/posting_grid/client/posting_grid.js +50 -0
- data/app/components/marty/promise_view.rb +2 -75
- data/app/components/marty/promise_view/client/promise_view.css +12 -9
- data/app/components/marty/promise_view/client/promise_view.js +57 -0
- data/app/components/marty/report_form.rb +3 -69
- data/app/components/marty/report_form/client/report_form.js +78 -0
- data/app/components/marty/report_select.rb +1 -45
- data/app/components/marty/report_select/client/report_select.js +50 -0
- data/app/components/marty/reporting.rb +1 -8
- data/app/components/marty/reporting/client/reporting.js +8 -0
- data/app/components/marty/script_form.rb +2 -63
- data/app/components/marty/script_form/client/script_form.js +44 -0
- data/app/components/marty/script_tester.rb +1 -7
- data/app/components/marty/script_tester/client/script_tester.js +7 -0
- data/app/components/marty/scripting.rb +1 -55
- data/app/components/marty/scripting/client/scripting.js +62 -0
- data/app/components/marty/simple_app/client/simple_app.js +21 -13
- data/app/models/marty/promise.rb +22 -1
- data/app/views/layouts/marty/application.html.erb +8 -6
- data/docker-compose.dummy.yml +2 -0
- data/lib/marty/monkey.rb +0 -16
- data/lib/marty/version.rb +1 -1
- data/spec/dummy/config/initializers/assets.rb +1 -0
- data/spec/features/reporting_spec.rb +1 -0
- data/spec/features/scripting_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -0
- data/spec/support/chromedriver.rb +5 -1
- data/spec/support/shared_connection_db_helpers.rb +42 -2
- metadata +29 -168
- data/app/assets/images/marty/.gitkeep +0 -0
- data/app/components/marty/mcfly_grid_panel/client/dup_in_form.js +0 -20
- data/app/components/marty/script_form/client/codemirror.css +0 -172
- data/app/components/marty/script_form/client/codemirror.js +0 -3130
- data/app/components/marty/script_form/client/mode/clike/clike.js +0 -284
- data/app/components/marty/script_form/client/mode/clike/index.html +0 -102
- data/app/components/marty/script_form/client/mode/clike/scala.html +0 -766
- data/app/components/marty/script_form/client/mode/clojure/clojure.js +0 -206
- data/app/components/marty/script_form/client/mode/clojure/index.html +0 -67
- data/app/components/marty/script_form/client/mode/coffeescript/LICENSE +0 -22
- data/app/components/marty/script_form/client/mode/coffeescript/coffeescript.js +0 -346
- data/app/components/marty/script_form/client/mode/coffeescript/index.html +0 -728
- data/app/components/marty/script_form/client/mode/commonlisp/commonlisp.js +0 -101
- data/app/components/marty/script_form/client/mode/commonlisp/index.html +0 -165
- data/app/components/marty/script_form/client/mode/css/css.js +0 -448
- data/app/components/marty/script_form/client/mode/css/index.html +0 -58
- data/app/components/marty/script_form/client/mode/css/test.js +0 -501
- data/app/components/marty/script_form/client/mode/diff/diff.js +0 -32
- data/app/components/marty/script_form/client/mode/diff/index.html +0 -105
- data/app/components/marty/script_form/client/mode/ecl/ecl.js +0 -203
- data/app/components/marty/script_form/client/mode/ecl/index.html +0 -42
- data/app/components/marty/script_form/client/mode/erlang/erlang.js +0 -463
- data/app/components/marty/script_form/client/mode/erlang/index.html +0 -63
- data/app/components/marty/script_form/client/mode/gfm/gfm.js +0 -150
- data/app/components/marty/script_form/client/mode/gfm/index.html +0 -48
- data/app/components/marty/script_form/client/mode/go/go.js +0 -170
- data/app/components/marty/script_form/client/mode/go/index.html +0 -73
- data/app/components/marty/script_form/client/mode/groovy/groovy.js +0 -210
- data/app/components/marty/script_form/client/mode/groovy/index.html +0 -72
- data/app/components/marty/script_form/client/mode/haskell/haskell.js +0 -242
- data/app/components/marty/script_form/client/mode/haskell/index.html +0 -61
- data/app/components/marty/script_form/client/mode/haxe/haxe.js +0 -429
- data/app/components/marty/script_form/client/mode/haxe/index.html +0 -91
- data/app/components/marty/script_form/client/mode/htmlembedded/htmlembedded.js +0 -72
- data/app/components/marty/script_form/client/mode/htmlembedded/index.html +0 -50
- data/app/components/marty/script_form/client/mode/htmlmixed/htmlmixed.js +0 -84
- data/app/components/marty/script_form/client/mode/htmlmixed/index.html +0 -52
- data/app/components/marty/script_form/client/mode/javascript/index.html +0 -78
- data/app/components/marty/script_form/client/mode/javascript/javascript.js +0 -361
- data/app/components/marty/script_form/client/mode/jinja2/index.html +0 -38
- data/app/components/marty/script_form/client/mode/jinja2/jinja2.js +0 -42
- data/app/components/marty/script_form/client/mode/less/index.html +0 -740
- data/app/components/marty/script_form/client/mode/less/less.js +0 -266
- data/app/components/marty/script_form/client/mode/lua/index.html +0 -73
- data/app/components/marty/script_form/client/mode/lua/lua.js +0 -140
- data/app/components/marty/script_form/client/mode/markdown/index.html +0 -343
- data/app/components/marty/script_form/client/mode/markdown/markdown.js +0 -382
- data/app/components/marty/script_form/client/mode/markdown/test.js +0 -1084
- data/app/components/marty/script_form/client/mode/mysql/index.html +0 -42
- data/app/components/marty/script_form/client/mode/mysql/mysql.js +0 -186
- data/app/components/marty/script_form/client/mode/ntriples/index.html +0 -33
- data/app/components/marty/script_form/client/mode/ntriples/ntriples.js +0 -172
- data/app/components/marty/script_form/client/mode/ocaml/index.html +0 -130
- data/app/components/marty/script_form/client/mode/ocaml/ocaml.js +0 -114
- data/app/components/marty/script_form/client/mode/pascal/LICENSE +0 -7
- data/app/components/marty/script_form/client/mode/pascal/index.html +0 -49
- data/app/components/marty/script_form/client/mode/pascal/pascal.js +0 -94
- data/app/components/marty/script_form/client/mode/perl/LICENSE +0 -19
- data/app/components/marty/script_form/client/mode/perl/index.html +0 -63
- data/app/components/marty/script_form/client/mode/perl/perl.js +0 -816
- data/app/components/marty/script_form/client/mode/php/index.html +0 -49
- data/app/components/marty/script_form/client/mode/php/php.js +0 -148
- data/app/components/marty/script_form/client/mode/pig/index.html +0 -43
- data/app/components/marty/script_form/client/mode/pig/pig.js +0 -172
- data/app/components/marty/script_form/client/mode/plsql/index.html +0 -63
- data/app/components/marty/script_form/client/mode/plsql/plsql.js +0 -217
- data/app/components/marty/script_form/client/mode/properties/index.html +0 -41
- data/app/components/marty/script_form/client/mode/properties/properties.js +0 -63
- data/app/components/marty/script_form/client/mode/python/LICENSE.txt +0 -21
- data/app/components/marty/script_form/client/mode/python/index.html +0 -123
- data/app/components/marty/script_form/client/mode/python/python.js +0 -338
- data/app/components/marty/script_form/client/mode/r/LICENSE +0 -24
- data/app/components/marty/script_form/client/mode/r/index.html +0 -74
- data/app/components/marty/script_form/client/mode/r/r.js +0 -141
- data/app/components/marty/script_form/client/mode/rpm/changes/changes.js +0 -19
- data/app/components/marty/script_form/client/mode/rpm/changes/index.html +0 -54
- data/app/components/marty/script_form/client/mode/rpm/spec/index.html +0 -100
- data/app/components/marty/script_form/client/mode/rpm/spec/spec.css +0 -5
- data/app/components/marty/script_form/client/mode/rpm/spec/spec.js +0 -66
- data/app/components/marty/script_form/client/mode/rst/index.html +0 -526
- data/app/components/marty/script_form/client/mode/rst/rst.js +0 -326
- data/app/components/marty/script_form/client/mode/ruby/LICENSE +0 -24
- data/app/components/marty/script_form/client/mode/ruby/index.html +0 -172
- data/app/components/marty/script_form/client/mode/rust/index.html +0 -49
- data/app/components/marty/script_form/client/mode/rust/rust.js +0 -432
- data/app/components/marty/script_form/client/mode/scheme/index.html +0 -65
- data/app/components/marty/script_form/client/mode/scheme/scheme.js +0 -230
- data/app/components/marty/script_form/client/mode/shell/index.html +0 -50
- data/app/components/marty/script_form/client/mode/shell/shell.js +0 -118
- data/app/components/marty/script_form/client/mode/sieve/LICENSE +0 -23
- data/app/components/marty/script_form/client/mode/sieve/index.html +0 -81
- data/app/components/marty/script_form/client/mode/sieve/sieve.js +0 -156
- data/app/components/marty/script_form/client/mode/smalltalk/index.html +0 -56
- data/app/components/marty/script_form/client/mode/smalltalk/smalltalk.js +0 -139
- data/app/components/marty/script_form/client/mode/smarty/index.html +0 -83
- data/app/components/marty/script_form/client/mode/smarty/smarty.js +0 -148
- data/app/components/marty/script_form/client/mode/sparql/index.html +0 -41
- data/app/components/marty/script_form/client/mode/sparql/sparql.js +0 -143
- data/app/components/marty/script_form/client/mode/stex/index.html +0 -98
- data/app/components/marty/script_form/client/mode/stex/stex.js +0 -182
- data/app/components/marty/script_form/client/mode/stex/test.js +0 -343
- data/app/components/marty/script_form/client/mode/tiddlywiki/index.html +0 -141
- data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.css +0 -14
- data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.js +0 -384
- data/app/components/marty/script_form/client/mode/tiki/index.html +0 -83
- data/app/components/marty/script_form/client/mode/tiki/tiki.css +0 -26
- data/app/components/marty/script_form/client/mode/tiki/tiki.js +0 -309
- data/app/components/marty/script_form/client/mode/vb/LICENSE.txt +0 -21
- data/app/components/marty/script_form/client/mode/vb/index.html +0 -89
- data/app/components/marty/script_form/client/mode/vb/vb.js +0 -260
- data/app/components/marty/script_form/client/mode/vbscript/index.html +0 -43
- data/app/components/marty/script_form/client/mode/vbscript/vbscript.js +0 -26
- data/app/components/marty/script_form/client/mode/velocity/index.html +0 -104
- data/app/components/marty/script_form/client/mode/velocity/velocity.js +0 -146
- data/app/components/marty/script_form/client/mode/verilog/index.html +0 -211
- data/app/components/marty/script_form/client/mode/verilog/verilog.js +0 -194
- data/app/components/marty/script_form/client/mode/xml/index.html +0 -45
- data/app/components/marty/script_form/client/mode/xml/xml.js +0 -318
- data/app/components/marty/script_form/client/mode/xquery/LICENSE +0 -20
- data/app/components/marty/script_form/client/mode/xquery/index.html +0 -223
- data/app/components/marty/script_form/client/mode/xquery/test/index.html +0 -27
- data/app/components/marty/script_form/client/mode/xquery/test/testBase.js +0 -42
- data/app/components/marty/script_form/client/mode/xquery/test/testEmptySequenceKeyword.js +0 -16
- data/app/components/marty/script_form/client/mode/xquery/test/testMultiAttr.js +0 -16
- data/app/components/marty/script_form/client/mode/xquery/test/testNamespaces.js +0 -91
- data/app/components/marty/script_form/client/mode/xquery/test/testProcessingInstructions.js +0 -16
- data/app/components/marty/script_form/client/mode/xquery/test/testQuotes.js +0 -19
- data/app/components/marty/script_form/client/mode/xquery/xquery.js +0 -451
- data/app/components/marty/script_form/client/mode/yaml/index.html +0 -68
- data/app/components/marty/script_form/client/mode/yaml/yaml.js +0 -95
- data/app/components/marty/script_form/client/theme/ambiance.css +0 -81
- data/app/components/marty/script_form/client/theme/blackboard.css +0 -25
- data/app/components/marty/script_form/client/theme/cobalt.css +0 -18
- data/app/components/marty/script_form/client/theme/eclipse.css +0 -25
- data/app/components/marty/script_form/client/theme/elegant.css +0 -10
- data/app/components/marty/script_form/client/theme/erlang-dark.css +0 -21
- data/app/components/marty/script_form/client/theme/lesser-dark.css +0 -44
- data/app/components/marty/script_form/client/theme/monokai.css +0 -28
- data/app/components/marty/script_form/client/theme/neat.css +0 -9
- data/app/components/marty/script_form/client/theme/night.css +0 -21
- data/app/components/marty/script_form/client/theme/rubyblue.css +0 -21
- data/app/components/marty/script_form/client/theme/vibrant-ink.css +0 -27
- data/app/components/marty/script_form/client/theme/xq-dark.css +0 -46
- data/app/components/marty/script_form/client/util/closetag.js +0 -164
- data/app/components/marty/script_form/client/util/dialog.css +0 -27
- data/app/components/marty/script_form/client/util/dialog.js +0 -70
- data/app/components/marty/script_form/client/util/foldcode.js +0 -196
- data/app/components/marty/script_form/client/util/formatting.js +0 -193
- data/app/components/marty/script_form/client/util/javascript-hint.js +0 -134
- data/app/components/marty/script_form/client/util/loadmode.js +0 -51
- data/app/components/marty/script_form/client/util/match-highlighter.js +0 -44
- data/app/components/marty/script_form/client/util/multiplex.js +0 -77
- data/app/components/marty/script_form/client/util/overlay.js +0 -54
- data/app/components/marty/script_form/client/util/pig-hint.js +0 -123
- data/app/components/marty/script_form/client/util/runmode-standalone.js +0 -90
- data/app/components/marty/script_form/client/util/runmode.js +0 -53
- data/app/components/marty/script_form/client/util/search.js +0 -118
- data/app/components/marty/script_form/client/util/searchcursor.js +0 -119
- data/app/components/marty/script_form/client/util/simple-hint.css +0 -16
- data/app/components/marty/script_form/client/util/simple-hint.js +0 -97
- data/app/components/marty/script_form/client/util/xml-hint.js +0 -137
- data/lib/marty/javascript/grid_view_in_form.js +0 -81
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
CodeMirror.defineMode("python", function(conf, parserConf) {
|
|
2
|
-
var ERRORCLASS = 'error';
|
|
3
|
-
|
|
4
|
-
function wordRegexp(words) {
|
|
5
|
-
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
|
|
9
|
-
var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
|
|
10
|
-
var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
|
|
11
|
-
var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
|
|
12
|
-
var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
|
|
13
|
-
var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
|
|
14
|
-
|
|
15
|
-
var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']);
|
|
16
|
-
var commonkeywords = ['as', 'assert', 'break', 'class', 'continue',
|
|
17
|
-
'def', 'del', 'elif', 'else', 'except', 'finally',
|
|
18
|
-
'for', 'from', 'global', 'if', 'import',
|
|
19
|
-
'lambda', 'pass', 'raise', 'return',
|
|
20
|
-
'try', 'while', 'with', 'yield'];
|
|
21
|
-
var commonBuiltins = ['abs', 'all', 'any', 'bin', 'bool', 'bytearray', 'callable', 'chr',
|
|
22
|
-
'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod',
|
|
23
|
-
'enumerate', 'eval', 'filter', 'float', 'format', 'frozenset',
|
|
24
|
-
'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id',
|
|
25
|
-
'input', 'int', 'isinstance', 'issubclass', 'iter', 'len',
|
|
26
|
-
'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next',
|
|
27
|
-
'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
|
|
28
|
-
'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
|
|
29
|
-
'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple',
|
|
30
|
-
'type', 'vars', 'zip', '__import__', 'NotImplemented',
|
|
31
|
-
'Ellipsis', '__debug__'];
|
|
32
|
-
var py2 = {'builtins': ['apply', 'basestring', 'buffer', 'cmp', 'coerce', 'execfile',
|
|
33
|
-
'file', 'intern', 'long', 'raw_input', 'reduce', 'reload',
|
|
34
|
-
'unichr', 'unicode', 'xrange', 'False', 'True', 'None'],
|
|
35
|
-
'keywords': ['exec', 'print']};
|
|
36
|
-
var py3 = {'builtins': ['ascii', 'bytes', 'exec', 'print'],
|
|
37
|
-
'keywords': ['nonlocal', 'False', 'True', 'None']};
|
|
38
|
-
|
|
39
|
-
if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) {
|
|
40
|
-
commonkeywords = commonkeywords.concat(py3.keywords);
|
|
41
|
-
commonBuiltins = commonBuiltins.concat(py3.builtins);
|
|
42
|
-
var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
|
|
43
|
-
} else {
|
|
44
|
-
commonkeywords = commonkeywords.concat(py2.keywords);
|
|
45
|
-
commonBuiltins = commonBuiltins.concat(py2.builtins);
|
|
46
|
-
var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
|
|
47
|
-
}
|
|
48
|
-
var keywords = wordRegexp(commonkeywords);
|
|
49
|
-
var builtins = wordRegexp(commonBuiltins);
|
|
50
|
-
|
|
51
|
-
var indentInfo = null;
|
|
52
|
-
|
|
53
|
-
// tokenizers
|
|
54
|
-
function tokenBase(stream, state) {
|
|
55
|
-
// Handle scope changes
|
|
56
|
-
if (stream.sol()) {
|
|
57
|
-
var scopeOffset = state.scopes[0].offset;
|
|
58
|
-
if (stream.eatSpace()) {
|
|
59
|
-
var lineOffset = stream.indentation();
|
|
60
|
-
if (lineOffset > scopeOffset) {
|
|
61
|
-
indentInfo = 'indent';
|
|
62
|
-
} else if (lineOffset < scopeOffset) {
|
|
63
|
-
indentInfo = 'dedent';
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
} else {
|
|
67
|
-
if (scopeOffset > 0) {
|
|
68
|
-
dedent(stream, state);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (stream.eatSpace()) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
var ch = stream.peek();
|
|
77
|
-
|
|
78
|
-
// Handle Comments
|
|
79
|
-
if (ch === '#') {
|
|
80
|
-
stream.skipToEnd();
|
|
81
|
-
return 'comment';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Handle Number Literals
|
|
85
|
-
if (stream.match(/^[0-9\.]/, false)) {
|
|
86
|
-
var floatLiteral = false;
|
|
87
|
-
// Floats
|
|
88
|
-
if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
|
|
89
|
-
if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
|
|
90
|
-
if (stream.match(/^\.\d+/)) { floatLiteral = true; }
|
|
91
|
-
if (floatLiteral) {
|
|
92
|
-
// Float literals may be "imaginary"
|
|
93
|
-
stream.eat(/J/i);
|
|
94
|
-
return 'number';
|
|
95
|
-
}
|
|
96
|
-
// Integers
|
|
97
|
-
var intLiteral = false;
|
|
98
|
-
// Hex
|
|
99
|
-
if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
|
|
100
|
-
// Binary
|
|
101
|
-
if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
|
|
102
|
-
// Octal
|
|
103
|
-
if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
|
|
104
|
-
// Decimal
|
|
105
|
-
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
|
|
106
|
-
// Decimal literals may be "imaginary"
|
|
107
|
-
stream.eat(/J/i);
|
|
108
|
-
// TODO - Can you have imaginary longs?
|
|
109
|
-
intLiteral = true;
|
|
110
|
-
}
|
|
111
|
-
// Zero by itself with no other piece of number.
|
|
112
|
-
if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
|
|
113
|
-
if (intLiteral) {
|
|
114
|
-
// Integer literals may be "long"
|
|
115
|
-
stream.eat(/L/i);
|
|
116
|
-
return 'number';
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Handle Strings
|
|
121
|
-
if (stream.match(stringPrefixes)) {
|
|
122
|
-
state.tokenize = tokenStringFactory(stream.current());
|
|
123
|
-
return state.tokenize(stream, state);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Handle operators and Delimiters
|
|
127
|
-
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
if (stream.match(doubleOperators)
|
|
131
|
-
|| stream.match(singleOperators)
|
|
132
|
-
|| stream.match(wordOperators)) {
|
|
133
|
-
return 'operator';
|
|
134
|
-
}
|
|
135
|
-
if (stream.match(singleDelimiters)) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (stream.match(keywords)) {
|
|
140
|
-
return 'keyword';
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (stream.match(builtins)) {
|
|
144
|
-
return 'builtin';
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (stream.match(identifiers)) {
|
|
148
|
-
return 'variable';
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Handle non-detected items
|
|
152
|
-
stream.next();
|
|
153
|
-
return ERRORCLASS;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function tokenStringFactory(delimiter) {
|
|
157
|
-
while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
|
|
158
|
-
delimiter = delimiter.substr(1);
|
|
159
|
-
}
|
|
160
|
-
var singleline = delimiter.length == 1;
|
|
161
|
-
var OUTCLASS = 'string';
|
|
162
|
-
|
|
163
|
-
return function tokenString(stream, state) {
|
|
164
|
-
while (!stream.eol()) {
|
|
165
|
-
stream.eatWhile(/[^'"\\]/);
|
|
166
|
-
if (stream.eat('\\')) {
|
|
167
|
-
stream.next();
|
|
168
|
-
if (singleline && stream.eol()) {
|
|
169
|
-
return OUTCLASS;
|
|
170
|
-
}
|
|
171
|
-
} else if (stream.match(delimiter)) {
|
|
172
|
-
state.tokenize = tokenBase;
|
|
173
|
-
return OUTCLASS;
|
|
174
|
-
} else {
|
|
175
|
-
stream.eat(/['"]/);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (singleline) {
|
|
179
|
-
if (parserConf.singleLineStringErrors) {
|
|
180
|
-
return ERRORCLASS;
|
|
181
|
-
} else {
|
|
182
|
-
state.tokenize = tokenBase;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return OUTCLASS;
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function indent(stream, state, type) {
|
|
190
|
-
type = type || 'py';
|
|
191
|
-
var indentUnit = 0;
|
|
192
|
-
if (type === 'py') {
|
|
193
|
-
if (state.scopes[0].type !== 'py') {
|
|
194
|
-
state.scopes[0].offset = stream.indentation();
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
for (var i = 0; i < state.scopes.length; ++i) {
|
|
198
|
-
if (state.scopes[i].type === 'py') {
|
|
199
|
-
indentUnit = state.scopes[i].offset + conf.indentUnit;
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
} else {
|
|
204
|
-
indentUnit = stream.column() + stream.current().length;
|
|
205
|
-
}
|
|
206
|
-
state.scopes.unshift({
|
|
207
|
-
offset: indentUnit,
|
|
208
|
-
type: type
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function dedent(stream, state, type) {
|
|
213
|
-
type = type || 'py';
|
|
214
|
-
if (state.scopes.length == 1) return;
|
|
215
|
-
if (state.scopes[0].type === 'py') {
|
|
216
|
-
var _indent = stream.indentation();
|
|
217
|
-
var _indent_index = -1;
|
|
218
|
-
for (var i = 0; i < state.scopes.length; ++i) {
|
|
219
|
-
if (_indent === state.scopes[i].offset) {
|
|
220
|
-
_indent_index = i;
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
if (_indent_index === -1) {
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
while (state.scopes[0].offset !== _indent) {
|
|
228
|
-
state.scopes.shift();
|
|
229
|
-
}
|
|
230
|
-
return false;
|
|
231
|
-
} else {
|
|
232
|
-
if (type === 'py') {
|
|
233
|
-
state.scopes[0].offset = stream.indentation();
|
|
234
|
-
return false;
|
|
235
|
-
} else {
|
|
236
|
-
if (state.scopes[0].type != type) {
|
|
237
|
-
return true;
|
|
238
|
-
}
|
|
239
|
-
state.scopes.shift();
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function tokenLexer(stream, state) {
|
|
246
|
-
indentInfo = null;
|
|
247
|
-
var style = state.tokenize(stream, state);
|
|
248
|
-
var current = stream.current();
|
|
249
|
-
|
|
250
|
-
// Handle '.' connected identifiers
|
|
251
|
-
if (current === '.') {
|
|
252
|
-
style = stream.match(identifiers, false) ? null : ERRORCLASS;
|
|
253
|
-
if (style === null && state.lastToken === 'meta') {
|
|
254
|
-
// Apply 'meta' style to '.' connected identifiers when
|
|
255
|
-
// appropriate.
|
|
256
|
-
style = 'meta';
|
|
257
|
-
}
|
|
258
|
-
return style;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Handle decorators
|
|
262
|
-
if (current === '@') {
|
|
263
|
-
return stream.match(identifiers, false) ? 'meta' : ERRORCLASS;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if ((style === 'variable' || style === 'builtin')
|
|
267
|
-
&& state.lastToken === 'meta') {
|
|
268
|
-
style = 'meta';
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// Handle scope changes.
|
|
272
|
-
if (current === 'pass' || current === 'return') {
|
|
273
|
-
state.dedent += 1;
|
|
274
|
-
}
|
|
275
|
-
if (current === 'lambda') state.lambda = true;
|
|
276
|
-
if ((current === ':' && !state.lambda && state.scopes[0].type == 'py')
|
|
277
|
-
|| indentInfo === 'indent') {
|
|
278
|
-
indent(stream, state);
|
|
279
|
-
}
|
|
280
|
-
var delimiter_index = '[({'.indexOf(current);
|
|
281
|
-
if (delimiter_index !== -1) {
|
|
282
|
-
indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
|
|
283
|
-
}
|
|
284
|
-
if (indentInfo === 'dedent') {
|
|
285
|
-
if (dedent(stream, state)) {
|
|
286
|
-
return ERRORCLASS;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
delimiter_index = '])}'.indexOf(current);
|
|
290
|
-
if (delimiter_index !== -1) {
|
|
291
|
-
if (dedent(stream, state, current)) {
|
|
292
|
-
return ERRORCLASS;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') {
|
|
296
|
-
if (state.scopes.length > 1) state.scopes.shift();
|
|
297
|
-
state.dedent -= 1;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return style;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
var external = {
|
|
304
|
-
startState: function(basecolumn) {
|
|
305
|
-
return {
|
|
306
|
-
tokenize: tokenBase,
|
|
307
|
-
scopes: [{offset:basecolumn || 0, type:'py'}],
|
|
308
|
-
lastToken: null,
|
|
309
|
-
lambda: false,
|
|
310
|
-
dedent: 0
|
|
311
|
-
};
|
|
312
|
-
},
|
|
313
|
-
|
|
314
|
-
token: function(stream, state) {
|
|
315
|
-
var style = tokenLexer(stream, state);
|
|
316
|
-
|
|
317
|
-
state.lastToken = style;
|
|
318
|
-
|
|
319
|
-
if (stream.eol() && stream.lambda) {
|
|
320
|
-
state.lambda = false;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
return style;
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
indent: function(state, textAfter) {
|
|
327
|
-
if (state.tokenize != tokenBase) {
|
|
328
|
-
return 0;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return state.scopes[0].offset;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
};
|
|
335
|
-
return external;
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
CodeMirror.defineMIME("text/x-python", "python");
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2011, Ubalo, Inc.
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
|
5
|
-
modification, are permitted provided that the following conditions are met:
|
|
6
|
-
* Redistributions of source code must retain the above copyright
|
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
|
8
|
-
* Redistributions in binary form must reproduce the above copyright
|
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
|
10
|
-
documentation and/or other materials provided with the distribution.
|
|
11
|
-
* Neither the name of the Ubalo, Inc nor the names of its
|
|
12
|
-
contributors may be used to endorse or promote products derived
|
|
13
|
-
from this software without specific prior written permission.
|
|
14
|
-
|
|
15
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
16
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
17
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
-
DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
|
|
19
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
20
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
21
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
22
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
24
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>CodeMirror: R mode</title>
|
|
6
|
-
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
7
|
-
<script src="../../lib/codemirror.js"></script>
|
|
8
|
-
<script src="r.js"></script>
|
|
9
|
-
<style>
|
|
10
|
-
.CodeMirror { border-top: 1px solid silver; border-bottom: 1px solid silver; }
|
|
11
|
-
.cm-s-default span.cm-semi { color: blue; font-weight: bold; }
|
|
12
|
-
.cm-s-default span.cm-dollar { color: orange; font-weight: bold; }
|
|
13
|
-
.cm-s-default span.cm-arrow { color: brown; }
|
|
14
|
-
.cm-s-default span.cm-arg-is { color: brown; }
|
|
15
|
-
</style>
|
|
16
|
-
<link rel="stylesheet" href="../../doc/docs.css">
|
|
17
|
-
</head>
|
|
18
|
-
<body>
|
|
19
|
-
<h1>CodeMirror: R mode</h1>
|
|
20
|
-
<form><textarea id="code" name="code">
|
|
21
|
-
# Code from http://www.mayin.org/ajayshah/KB/R/
|
|
22
|
-
|
|
23
|
-
# FIRST LEARN ABOUT LISTS --
|
|
24
|
-
X = list(height=5.4, weight=54)
|
|
25
|
-
print("Use default printing --")
|
|
26
|
-
print(X)
|
|
27
|
-
print("Accessing individual elements --")
|
|
28
|
-
cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
|
|
29
|
-
|
|
30
|
-
# FUNCTIONS --
|
|
31
|
-
square <- function(x) {
|
|
32
|
-
return(x*x)
|
|
33
|
-
}
|
|
34
|
-
cat("The square of 3 is ", square(3), "\n")
|
|
35
|
-
|
|
36
|
-
# default value of the arg is set to 5.
|
|
37
|
-
cube <- function(x=5) {
|
|
38
|
-
return(x*x*x);
|
|
39
|
-
}
|
|
40
|
-
cat("Calling cube with 2 : ", cube(2), "\n") # will give 2^3
|
|
41
|
-
cat("Calling cube : ", cube(), "\n") # will default to 5^3.
|
|
42
|
-
|
|
43
|
-
# LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS --
|
|
44
|
-
powers <- function(x) {
|
|
45
|
-
parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x);
|
|
46
|
-
return(parcel);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
X = powers(3);
|
|
50
|
-
print("Showing powers of 3 --"); print(X);
|
|
51
|
-
|
|
52
|
-
# WRITING THIS COMPACTLY (4 lines instead of 7)
|
|
53
|
-
|
|
54
|
-
powerful <- function(x) {
|
|
55
|
-
return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x));
|
|
56
|
-
}
|
|
57
|
-
print("Showing powers of 3 --"); print(powerful(3));
|
|
58
|
-
|
|
59
|
-
# In R, the last expression in a function is, by default, what is
|
|
60
|
-
# returned. So you could equally just say:
|
|
61
|
-
powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)}
|
|
62
|
-
</textarea></form>
|
|
63
|
-
<script>
|
|
64
|
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
|
-
<p><strong>MIME types defined:</strong> <code>text/x-rsrc</code>.</p>
|
|
68
|
-
|
|
69
|
-
<p>Development of the CodeMirror R mode was kindly sponsored
|
|
70
|
-
by <a href="http://ubalo.com/">Ubalo</a>, who hold
|
|
71
|
-
the <a href="LICENSE">license</a>.</p>
|
|
72
|
-
|
|
73
|
-
</body>
|
|
74
|
-
</html>
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
CodeMirror.defineMode("r", function(config) {
|
|
2
|
-
function wordObj(str) {
|
|
3
|
-
var words = str.split(" "), res = {};
|
|
4
|
-
for (var i = 0; i < words.length; ++i) res[words[i]] = true;
|
|
5
|
-
return res;
|
|
6
|
-
}
|
|
7
|
-
var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
|
|
8
|
-
var builtins = wordObj("list quote bquote eval return call parse deparse");
|
|
9
|
-
var keywords = wordObj("if else repeat while function for in next break");
|
|
10
|
-
var blockkeywords = wordObj("if else repeat while function for");
|
|
11
|
-
var opChars = /[+\-*\/^<>=!&|~$:]/;
|
|
12
|
-
var curPunc;
|
|
13
|
-
|
|
14
|
-
function tokenBase(stream, state) {
|
|
15
|
-
curPunc = null;
|
|
16
|
-
var ch = stream.next();
|
|
17
|
-
if (ch == "#") {
|
|
18
|
-
stream.skipToEnd();
|
|
19
|
-
return "comment";
|
|
20
|
-
} else if (ch == "0" && stream.eat("x")) {
|
|
21
|
-
stream.eatWhile(/[\da-f]/i);
|
|
22
|
-
return "number";
|
|
23
|
-
} else if (ch == "." && stream.eat(/\d/)) {
|
|
24
|
-
stream.match(/\d*(?:e[+\-]?\d+)?/);
|
|
25
|
-
return "number";
|
|
26
|
-
} else if (/\d/.test(ch)) {
|
|
27
|
-
stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
|
|
28
|
-
return "number";
|
|
29
|
-
} else if (ch == "'" || ch == '"') {
|
|
30
|
-
state.tokenize = tokenString(ch);
|
|
31
|
-
return "string";
|
|
32
|
-
} else if (ch == "." && stream.match(/.[.\d]+/)) {
|
|
33
|
-
return "keyword";
|
|
34
|
-
} else if (/[\w\.]/.test(ch) && ch != "_") {
|
|
35
|
-
stream.eatWhile(/[\w\.]/);
|
|
36
|
-
var word = stream.current();
|
|
37
|
-
if (atoms.propertyIsEnumerable(word)) return "atom";
|
|
38
|
-
if (keywords.propertyIsEnumerable(word)) {
|
|
39
|
-
if (blockkeywords.propertyIsEnumerable(word)) curPunc = "block";
|
|
40
|
-
return "keyword";
|
|
41
|
-
}
|
|
42
|
-
if (builtins.propertyIsEnumerable(word)) return "builtin";
|
|
43
|
-
return "variable";
|
|
44
|
-
} else if (ch == "%") {
|
|
45
|
-
if (stream.skipTo("%")) stream.next();
|
|
46
|
-
return "variable-2";
|
|
47
|
-
} else if (ch == "<" && stream.eat("-")) {
|
|
48
|
-
return "arrow";
|
|
49
|
-
} else if (ch == "=" && state.ctx.argList) {
|
|
50
|
-
return "arg-is";
|
|
51
|
-
} else if (opChars.test(ch)) {
|
|
52
|
-
if (ch == "$") return "dollar";
|
|
53
|
-
stream.eatWhile(opChars);
|
|
54
|
-
return "operator";
|
|
55
|
-
} else if (/[\(\){}\[\];]/.test(ch)) {
|
|
56
|
-
curPunc = ch;
|
|
57
|
-
if (ch == ";") return "semi";
|
|
58
|
-
return null;
|
|
59
|
-
} else {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function tokenString(quote) {
|
|
65
|
-
return function(stream, state) {
|
|
66
|
-
if (stream.eat("\\")) {
|
|
67
|
-
var ch = stream.next();
|
|
68
|
-
if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
|
|
69
|
-
else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
|
|
70
|
-
else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
|
|
71
|
-
else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
|
|
72
|
-
else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
|
|
73
|
-
return "string-2";
|
|
74
|
-
} else {
|
|
75
|
-
var next;
|
|
76
|
-
while ((next = stream.next()) != null) {
|
|
77
|
-
if (next == quote) { state.tokenize = tokenBase; break; }
|
|
78
|
-
if (next == "\\") { stream.backUp(1); break; }
|
|
79
|
-
}
|
|
80
|
-
return "string";
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function push(state, type, stream) {
|
|
86
|
-
state.ctx = {type: type,
|
|
87
|
-
indent: state.indent,
|
|
88
|
-
align: null,
|
|
89
|
-
column: stream.column(),
|
|
90
|
-
prev: state.ctx};
|
|
91
|
-
}
|
|
92
|
-
function pop(state) {
|
|
93
|
-
state.indent = state.ctx.indent;
|
|
94
|
-
state.ctx = state.ctx.prev;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
startState: function(base) {
|
|
99
|
-
return {tokenize: tokenBase,
|
|
100
|
-
ctx: {type: "top",
|
|
101
|
-
indent: -config.indentUnit,
|
|
102
|
-
align: false},
|
|
103
|
-
indent: 0,
|
|
104
|
-
afterIdent: false};
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
token: function(stream, state) {
|
|
108
|
-
if (stream.sol()) {
|
|
109
|
-
if (state.ctx.align == null) state.ctx.align = false;
|
|
110
|
-
state.indent = stream.indentation();
|
|
111
|
-
}
|
|
112
|
-
if (stream.eatSpace()) return null;
|
|
113
|
-
var style = state.tokenize(stream, state);
|
|
114
|
-
if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
|
|
115
|
-
|
|
116
|
-
var ctype = state.ctx.type;
|
|
117
|
-
if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
|
|
118
|
-
if (curPunc == "{") push(state, "}", stream);
|
|
119
|
-
else if (curPunc == "(") {
|
|
120
|
-
push(state, ")", stream);
|
|
121
|
-
if (state.afterIdent) state.ctx.argList = true;
|
|
122
|
-
}
|
|
123
|
-
else if (curPunc == "[") push(state, "]", stream);
|
|
124
|
-
else if (curPunc == "block") push(state, "block", stream);
|
|
125
|
-
else if (curPunc == ctype) pop(state);
|
|
126
|
-
state.afterIdent = style == "variable" || style == "keyword";
|
|
127
|
-
return style;
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
indent: function(state, textAfter) {
|
|
131
|
-
if (state.tokenize != tokenBase) return 0;
|
|
132
|
-
var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
|
|
133
|
-
closing = firstChar == ctx.type;
|
|
134
|
-
if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
|
|
135
|
-
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
|
136
|
-
else return ctx.indent + (closing ? 0 : config.indentUnit);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
CodeMirror.defineMIME("text/x-rsrc", "r");
|