add several autoconverted modes

This commit is contained in:
nightwing 2013-04-05 22:02:32 +04:00
commit 03fe8a3576
18 changed files with 3481 additions and 0 deletions

View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var ActionScriptHighlightRules = require("./actionscript_highlight_rules").ActionScriptHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new ActionScriptHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

File diff suppressed because one or more lines are too long

64
lib/ace/mode/erlang.js Normal file
View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var ErlangHighlightRules = require("./erlang_highlight_rules").ErlangHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new ErlangHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "%";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,876 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/* This file was autogenerated from tm bundles\erlang.tmbundle\Syntaxes\Erlang.plist (uuid: ) */
/****************************************************************************************
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
* fileTypes *
****************************************************************************************/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var ErlangHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = { start:
[ { include: '#module-directive' },
{ include: '#import-export-directive' },
{ include: '#behaviour-directive' },
{ include: '#record-directive' },
{ include: '#define-directive' },
{ include: '#macro-directive' },
{ include: '#directive' },
{ include: '#function' },
{ include: '#everything-else' } ],
'#atom':
[ { token: 'punctuation.definition.symbol.begin.erlang',
regex: '\'',
push:
[ { token: 'punctuation.definition.symbol.end.erlang',
regex: '\'',
next: 'pop' },
{ token:
[ 'punctuation.definition.escape.erlang',
'constant.other.symbol.escape.erlang',
'punctuation.definition.escape.erlang',
'constant.other.symbol.escape.erlang',
'constant.other.symbol.escape.erlang' ],
regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
{ token: 'invalid.illegal.atom.erlang', regex: '\\\\\\^?.?' },
{ defaultToken: 'constant.other.symbol.quoted.single.erlang' } ] },
{ token: 'constant.other.symbol.unquoted.erlang',
regex: '[a-z][a-zA-Z\\d@_]*' } ],
'#behaviour-directive':
[ { token:
[ 'meta.directive.behaviour.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.behaviour.erlang',
'keyword.control.directive.behaviour.erlang',
'meta.directive.behaviour.erlang',
'punctuation.definition.parameters.begin.erlang',
'meta.directive.behaviour.erlang',
'entity.name.type.class.behaviour.definition.erlang',
'meta.directive.behaviour.erlang',
'punctuation.definition.parameters.end.erlang',
'meta.directive.behaviour.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '^(\\s*)(-)(\\s*)(behaviour)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
'#binary':
[ { token: 'punctuation.definition.binary.begin.erlang',
regex: '<<',
push:
[ { token: 'punctuation.definition.binary.end.erlang',
regex: '>>',
next: 'pop' },
{ token:
[ 'punctuation.separator.binary.erlang',
'punctuation.separator.value-size.erlang' ],
regex: '(,)|(:)' },
{ include: '#internal-type-specifiers' },
{ include: '#everything-else' },
{ defaultToken: 'meta.structure.binary.erlang' } ] } ],
'#character':
[ { token:
[ 'punctuation.definition.character.erlang',
'punctuation.definition.escape.erlang',
'constant.character.escape.erlang',
'punctuation.definition.escape.erlang',
'constant.character.escape.erlang',
'constant.character.escape.erlang' ],
regex: '(\\$)(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
{ token: 'invalid.illegal.character.erlang',
regex: '\\$\\\\\\^?.?' },
{ token:
[ 'punctuation.definition.character.erlang',
'constant.character.erlang' ],
regex: '(\\$)(\\S)' },
{ token: 'invalid.illegal.character.erlang', regex: '\\$.?' } ],
'#comment':
[ { token: 'punctuation.definition.comment.erlang',
regex: '%',
push:
[ { token: 'comment.line.percentage.erlang',
regex: '$',
next: 'pop' },
{ defaultToken: 'comment.line.percentage.erlang' } ] } ],
'#define-directive':
[ { token:
[ 'meta.directive.define.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.define.erlang',
'keyword.control.directive.define.erlang',
'meta.directive.define.erlang',
'punctuation.definition.parameters.begin.erlang',
'meta.directive.define.erlang',
'entity.name.function.macro.definition.erlang',
'meta.directive.define.erlang',
'punctuation.separator.parameters.erlang' ],
regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(,)',
push:
[ { token:
[ 'punctuation.definition.parameters.end.erlang',
'meta.directive.define.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '(\\))(\\s*)(\\.)',
next: 'pop' },
{ include: '#everything-else' },
{ defaultToken: 'meta.directive.define.erlang' } ] },
{ token: 'meta.directive.define.erlang',
regex: '(?=^\\s*-\\s*define\\s*\\(\\s*[a-zA-Z\\d@_]+\\s*\\()',
push:
[ { token:
[ 'punctuation.definition.parameters.end.erlang',
'meta.directive.define.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '(\\))(\\s*)(\\.)',
next: 'pop' },
{ token:
[ 'text',
'punctuation.section.directive.begin.erlang',
'text',
'keyword.control.directive.define.erlang',
'text',
'punctuation.definition.parameters.begin.erlang',
'text',
'entity.name.function.macro.definition.erlang',
'text',
'punctuation.definition.parameters.begin.erlang' ],
regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\()',
push:
[ { token:
[ 'punctuation.definition.parameters.end.erlang',
'text',
'punctuation.separator.parameters.erlang' ],
regex: '(\\))(\\s*)(,)',
next: 'pop' },
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
{ include: '#everything-else' } ] },
{ token: 'punctuation.separator.define.erlang',
regex: '\\|\\||\\||:|;|,|\\.|->' },
{ include: '#everything-else' },
{ defaultToken: 'meta.directive.define.erlang' } ] } ],
'#directive':
[ { token:
[ 'meta.directive.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.erlang',
'keyword.control.directive.erlang',
'meta.directive.erlang',
'punctuation.definition.parameters.begin.erlang' ],
regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\(?)',
push:
[ { token:
[ 'punctuation.definition.parameters.end.erlang',
'meta.directive.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '(\\)?)(\\s*)(\\.)',
next: 'pop' },
{ include: '#everything-else' },
{ defaultToken: 'meta.directive.erlang' } ] },
{ token:
[ 'meta.directive.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.erlang',
'keyword.control.directive.erlang',
'meta.directive.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\.)' } ],
'#everything-else':
[ { include: '#comment' },
{ include: '#record-usage' },
{ include: '#macro-usage' },
{ include: '#expression' },
{ include: '#keyword' },
{ include: '#textual-operator' },
{ include: '#function-call' },
{ include: '#tuple' },
{ include: '#list' },
{ include: '#binary' },
{ include: '#parenthesized-expression' },
{ include: '#character' },
{ include: '#number' },
{ include: '#atom' },
{ include: '#string' },
{ include: '#symbolic-operator' },
{ include: '#variable' } ],
'#expression':
[ { token: 'keyword.control.if.erlang',
regex: '\\bif\\b',
push:
[ { token: 'keyword.control.end.erlang',
regex: '\\bend\\b',
next: 'pop' },
{ include: '#internal-expression-punctuation' },
{ include: '#everything-else' },
{ defaultToken: 'meta.expression.if.erlang' } ] },
{ token: 'keyword.control.case.erlang',
regex: '\\bcase\\b',
push:
[ { token: 'keyword.control.end.erlang',
regex: '\\bend\\b',
next: 'pop' },
{ include: '#internal-expression-punctuation' },
{ include: '#everything-else' },
{ defaultToken: 'meta.expression.case.erlang' } ] },
{ token: 'keyword.control.receive.erlang',
regex: '\\breceive\\b',
push:
[ { token: 'keyword.control.end.erlang',
regex: '\\bend\\b',
next: 'pop' },
{ include: '#internal-expression-punctuation' },
{ include: '#everything-else' },
{ defaultToken: 'meta.expression.receive.erlang' } ] },
{ token:
[ 'keyword.control.fun.erlang',
'text',
'entity.name.type.class.module.erlang',
'text',
'punctuation.separator.module-function.erlang',
'text',
'entity.name.function.erlang',
'text',
'punctuation.separator.function-arity.erlang' ],
regex: '\\b(fun)(\\s*)(?:([a-z][a-zA-Z\\d@_]*)(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*)(\\s*)(/)' },
{ token: 'keyword.control.fun.erlang',
regex: '\\bfun\\b',
push:
[ { token: 'keyword.control.end.erlang',
regex: '\\bend\\b',
next: 'pop' },
{ token: 'text',
regex: '(?=\\()',
push:
[ { token: 'punctuation.separator.clauses.erlang',
regex: ';|(?=\\bend\\b)',
next: 'pop' },
{ include: '#internal-function-parts' } ] },
{ include: '#everything-else' },
{ defaultToken: 'meta.expression.fun.erlang' } ] },
{ token: 'keyword.control.try.erlang',
regex: '\\btry\\b',
push:
[ { token: 'keyword.control.end.erlang',
regex: '\\bend\\b',
next: 'pop' },
{ include: '#internal-expression-punctuation' },
{ include: '#everything-else' },
{ defaultToken: 'meta.expression.try.erlang' } ] },
{ token: 'keyword.control.begin.erlang',
regex: '\\bbegin\\b',
push:
[ { token: 'keyword.control.end.erlang',
regex: '\\bend\\b',
next: 'pop' },
{ include: '#internal-expression-punctuation' },
{ include: '#everything-else' },
{ defaultToken: 'meta.expression.begin.erlang' } ] },
{ token: 'keyword.control.query.erlang',
regex: '\\bquery\\b',
push:
[ { token: 'keyword.control.end.erlang',
regex: '\\bend\\b',
next: 'pop' },
{ include: '#everything-else' },
{ defaultToken: 'meta.expression.query.erlang' } ] } ],
'#function':
[ { token:
[ 'meta.function.erlang',
'entity.name.function.definition.erlang',
'meta.function.erlang' ],
regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()',
push:
[ { token: 'punctuation.terminator.function.erlang',
regex: '\\.',
next: 'pop' },
{ token: [ 'text', 'entity.name.function.erlang', 'text' ],
regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()' },
{ token: 'text',
regex: '(?=\\()',
push:
[ { token: 'punctuation.separator.clauses.erlang',
regex: ';|(?=\\.)',
next: 'pop' },
{ include: '#parenthesized-expression' },
{ include: '#internal-function-parts' } ] },
{ include: '#everything-else' },
{ defaultToken: 'meta.function.erlang' } ] } ],
'#function-call':
[ { token: 'meta.function-call.erlang',
regex: '(?=(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*(?:\\(|:\\s*(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*\\())',
push:
[ { token: 'punctuation.definition.parameters.end.erlang',
regex: '\\)',
next: 'pop' },
{ token:
[ 'entity.name.type.class.module.erlang',
'text',
'punctuation.separator.module-function.erlang',
'text',
'entity.name.function.guard.erlang',
'text',
'punctuation.definition.parameters.begin.erlang' ],
regex: '(?:(erlang)(\\s*)(:)(\\s*))?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)(\\s*)(\\()',
push:
[ { token: 'text', regex: '(?=\\))', next: 'pop' },
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
{ include: '#everything-else' } ] },
{ token:
[ 'entity.name.type.class.module.erlang',
'text',
'punctuation.separator.module-function.erlang',
'text',
'entity.name.function.erlang',
'text',
'punctuation.definition.parameters.begin.erlang' ],
regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\()',
push:
[ { token: 'text', regex: '(?=\\))', next: 'pop' },
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
{ include: '#everything-else' } ] },
{ defaultToken: 'meta.function-call.erlang' } ] } ],
'#import-export-directive':
[ { token:
[ 'meta.directive.import.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.import.erlang',
'keyword.control.directive.import.erlang',
'meta.directive.import.erlang',
'punctuation.definition.parameters.begin.erlang',
'meta.directive.import.erlang',
'entity.name.type.class.module.erlang',
'meta.directive.import.erlang',
'punctuation.separator.parameters.erlang' ],
regex: '^(\\s*)(-)(\\s*)(import)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
push:
[ { token:
[ 'punctuation.definition.parameters.end.erlang',
'meta.directive.import.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '(\\))(\\s*)(\\.)',
next: 'pop' },
{ include: '#internal-function-list' },
{ defaultToken: 'meta.directive.import.erlang' } ] },
{ token:
[ 'meta.directive.export.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.export.erlang',
'keyword.control.directive.export.erlang',
'meta.directive.export.erlang',
'punctuation.definition.parameters.begin.erlang' ],
regex: '^(\\s*)(-)(\\s*)(export)(\\s*)(\\()',
push:
[ { token:
[ 'punctuation.definition.parameters.end.erlang',
'meta.directive.export.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '(\\))(\\s*)(\\.)',
next: 'pop' },
{ include: '#internal-function-list' },
{ defaultToken: 'meta.directive.export.erlang' } ] } ],
'#internal-expression-punctuation':
[ { token:
[ 'punctuation.separator.clause-head-body.erlang',
'punctuation.separator.clauses.erlang',
'punctuation.separator.expressions.erlang' ],
regex: '(->)|(;)|(,)' } ],
'#internal-function-list':
[ { token: 'punctuation.definition.list.begin.erlang',
regex: '\\[',
push:
[ { token: 'punctuation.definition.list.end.erlang',
regex: '\\]',
next: 'pop' },
{ token:
[ 'entity.name.function.erlang',
'text',
'punctuation.separator.function-arity.erlang' ],
regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(/)',
push:
[ { token: 'punctuation.separator.list.erlang',
regex: ',|(?=\\])',
next: 'pop' },
{ include: '#everything-else' } ] },
{ include: '#everything-else' },
{ defaultToken: 'meta.structure.list.function.erlang' } ] } ],
'#internal-function-parts':
[ { token: 'text',
regex: '(?=\\()',
push:
[ { token: 'punctuation.separator.clause-head-body.erlang',
regex: '->',
next: 'pop' },
{ token: 'punctuation.definition.parameters.begin.erlang',
regex: '\\(',
push:
[ { token: 'punctuation.definition.parameters.end.erlang',
regex: '\\)',
next: 'pop' },
{ token: 'punctuation.separator.parameters.erlang', regex: ',' },
{ include: '#everything-else' } ] },
{ token: 'punctuation.separator.guards.erlang', regex: ',|;' },
{ include: '#everything-else' } ] },
{ token: 'punctuation.separator.expressions.erlang',
regex: ',' },
{ include: '#everything-else' } ],
'#internal-record-body':
[ { token: 'punctuation.definition.class.record.begin.erlang',
regex: '\\{',
push:
[ { token: 'meta.structure.record.erlang',
regex: '(?=\\})',
next: 'pop' },
{ token:
[ 'variable.other.field.erlang',
'variable.language.omitted.field.erlang',
'text',
'keyword.operator.assignment.erlang' ],
regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')|(_))(\\s*)(=|::)',
push:
[ { token: 'punctuation.separator.class.record.erlang',
regex: ',|(?=\\})',
next: 'pop' },
{ include: '#everything-else' } ] },
{ token:
[ 'variable.other.field.erlang',
'text',
'punctuation.separator.class.record.erlang' ],
regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)((?:,)?)' },
{ include: '#everything-else' },
{ defaultToken: 'meta.structure.record.erlang' } ] } ],
'#internal-type-specifiers':
[ { token: 'punctuation.separator.value-type.erlang',
regex: '/',
push:
[ { token: 'text', regex: '(?=,|:|>>)', next: 'pop' },
{ token:
[ 'storage.type.erlang',
'storage.modifier.signedness.erlang',
'storage.modifier.endianness.erlang',
'storage.modifier.unit.erlang',
'punctuation.separator.type-specifiers.erlang' ],
regex: '(integer|float|binary|bytes|bitstring|bits)|(signed|unsigned)|(big|little|native)|(unit)|(-)' } ] } ],
'#keyword':
[ { token: 'keyword.control.erlang',
regex: '\\b(?:after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\\b' } ],
'#list':
[ { token: 'punctuation.definition.list.begin.erlang',
regex: '\\[',
push:
[ { token: 'punctuation.definition.list.end.erlang',
regex: '\\]',
next: 'pop' },
{ token: 'punctuation.separator.list.erlang',
regex: '\\||\\|\\||,' },
{ include: '#everything-else' },
{ defaultToken: 'meta.structure.list.erlang' } ] } ],
'#macro-directive':
[ { token:
[ 'meta.directive.ifdef.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.ifdef.erlang',
'keyword.control.directive.ifdef.erlang',
'meta.directive.ifdef.erlang',
'punctuation.definition.parameters.begin.erlang',
'meta.directive.ifdef.erlang',
'entity.name.function.macro.erlang',
'meta.directive.ifdef.erlang',
'punctuation.definition.parameters.end.erlang',
'meta.directive.ifdef.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '^(\\s*)(-)(\\s*)(ifdef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
{ token:
[ 'meta.directive.ifndef.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.ifndef.erlang',
'keyword.control.directive.ifndef.erlang',
'meta.directive.ifndef.erlang',
'punctuation.definition.parameters.begin.erlang',
'meta.directive.ifndef.erlang',
'entity.name.function.macro.erlang',
'meta.directive.ifndef.erlang',
'punctuation.definition.parameters.end.erlang',
'meta.directive.ifndef.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '^(\\s*)(-)(\\s*)(ifndef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
{ token:
[ 'meta.directive.undef.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.undef.erlang',
'keyword.control.directive.undef.erlang',
'meta.directive.undef.erlang',
'punctuation.definition.parameters.begin.erlang',
'meta.directive.undef.erlang',
'entity.name.function.macro.erlang',
'meta.directive.undef.erlang',
'punctuation.definition.parameters.end.erlang',
'meta.directive.undef.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '^(\\s*)(-)(\\s*)(undef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' } ],
'#macro-usage':
[ { token:
[ 'keyword.operator.macro.erlang',
'meta.macro-usage.erlang',
'entity.name.function.macro.erlang' ],
regex: '(\\?\\??)(\\s*)([a-zA-Z\\d@_]+)' } ],
'#module-directive':
[ { token:
[ 'meta.directive.module.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.module.erlang',
'keyword.control.directive.module.erlang',
'meta.directive.module.erlang',
'punctuation.definition.parameters.begin.erlang',
'meta.directive.module.erlang',
'entity.name.type.class.module.definition.erlang',
'meta.directive.module.erlang',
'punctuation.definition.parameters.end.erlang',
'meta.directive.module.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '^(\\s*)(-)(\\s*)(module)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
'#number':
[ { token: 'text',
regex: '(?=\\d)',
push:
[ { token: 'text', regex: '(?!\\d)', next: 'pop' },
{ token:
[ 'constant.numeric.float.erlang',
'punctuation.separator.integer-float.erlang',
'constant.numeric.float.erlang',
'punctuation.separator.float-exponent.erlang' ],
regex: '(\\d+)(\\.)(\\d+)((?:[eE][\\+\\-]?\\d+)?)' },
{ token:
[ 'constant.numeric.integer.binary.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.binary.erlang' ],
regex: '(2)(#)([0-1]+)' },
{ token:
[ 'constant.numeric.integer.base-3.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-3.erlang' ],
regex: '(3)(#)([0-2]+)' },
{ token:
[ 'constant.numeric.integer.base-4.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-4.erlang' ],
regex: '(4)(#)([0-3]+)' },
{ token:
[ 'constant.numeric.integer.base-5.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-5.erlang' ],
regex: '(5)(#)([0-4]+)' },
{ token:
[ 'constant.numeric.integer.base-6.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-6.erlang' ],
regex: '(6)(#)([0-5]+)' },
{ token:
[ 'constant.numeric.integer.base-7.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-7.erlang' ],
regex: '(7)(#)([0-6]+)' },
{ token:
[ 'constant.numeric.integer.octal.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.octal.erlang' ],
regex: '(8)(#)([0-7]+)' },
{ token:
[ 'constant.numeric.integer.base-9.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-9.erlang' ],
regex: '(9)(#)([0-8]+)' },
{ token:
[ 'constant.numeric.integer.decimal.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.decimal.erlang' ],
regex: '(10)(#)(\\d+)' },
{ token:
[ 'constant.numeric.integer.base-11.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-11.erlang' ],
regex: '(11)(#)([\\daA]+)' },
{ token:
[ 'constant.numeric.integer.base-12.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-12.erlang' ],
regex: '(12)(#)([\\da-bA-B]+)' },
{ token:
[ 'constant.numeric.integer.base-13.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-13.erlang' ],
regex: '(13)(#)([\\da-cA-C]+)' },
{ token:
[ 'constant.numeric.integer.base-14.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-14.erlang' ],
regex: '(14)(#)([\\da-dA-D]+)' },
{ token:
[ 'constant.numeric.integer.base-15.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-15.erlang' ],
regex: '(15)(#)([\\da-eA-E]+)' },
{ token:
[ 'constant.numeric.integer.hexadecimal.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.hexadecimal.erlang' ],
regex: '(16)(#)([\\da-fA-F]+)' },
{ token:
[ 'constant.numeric.integer.base-17.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-17.erlang' ],
regex: '(17)(#)([\\da-gA-G]+)' },
{ token:
[ 'constant.numeric.integer.base-18.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-18.erlang' ],
regex: '(18)(#)([\\da-hA-H]+)' },
{ token:
[ 'constant.numeric.integer.base-19.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-19.erlang' ],
regex: '(19)(#)([\\da-iA-I]+)' },
{ token:
[ 'constant.numeric.integer.base-20.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-20.erlang' ],
regex: '(20)(#)([\\da-jA-J]+)' },
{ token:
[ 'constant.numeric.integer.base-21.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-21.erlang' ],
regex: '(21)(#)([\\da-kA-K]+)' },
{ token:
[ 'constant.numeric.integer.base-22.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-22.erlang' ],
regex: '(22)(#)([\\da-lA-L]+)' },
{ token:
[ 'constant.numeric.integer.base-23.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-23.erlang' ],
regex: '(23)(#)([\\da-mA-M]+)' },
{ token:
[ 'constant.numeric.integer.base-24.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-24.erlang' ],
regex: '(24)(#)([\\da-nA-N]+)' },
{ token:
[ 'constant.numeric.integer.base-25.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-25.erlang' ],
regex: '(25)(#)([\\da-oA-O]+)' },
{ token:
[ 'constant.numeric.integer.base-26.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-26.erlang' ],
regex: '(26)(#)([\\da-pA-P]+)' },
{ token:
[ 'constant.numeric.integer.base-27.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-27.erlang' ],
regex: '(27)(#)([\\da-qA-Q]+)' },
{ token:
[ 'constant.numeric.integer.base-28.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-28.erlang' ],
regex: '(28)(#)([\\da-rA-R]+)' },
{ token:
[ 'constant.numeric.integer.base-29.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-29.erlang' ],
regex: '(29)(#)([\\da-sA-S]+)' },
{ token:
[ 'constant.numeric.integer.base-30.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-30.erlang' ],
regex: '(30)(#)([\\da-tA-T]+)' },
{ token:
[ 'constant.numeric.integer.base-31.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-31.erlang' ],
regex: '(31)(#)([\\da-uA-U]+)' },
{ token:
[ 'constant.numeric.integer.base-32.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-32.erlang' ],
regex: '(32)(#)([\\da-vA-V]+)' },
{ token:
[ 'constant.numeric.integer.base-33.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-33.erlang' ],
regex: '(33)(#)([\\da-wA-W]+)' },
{ token:
[ 'constant.numeric.integer.base-34.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-34.erlang' ],
regex: '(34)(#)([\\da-xA-X]+)' },
{ token:
[ 'constant.numeric.integer.base-35.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-35.erlang' ],
regex: '(35)(#)([\\da-yA-Y]+)' },
{ token:
[ 'constant.numeric.integer.base-36.erlang',
'punctuation.separator.base-integer.erlang',
'constant.numeric.integer.base-36.erlang' ],
regex: '(36)(#)([\\da-zA-Z]+)' },
{ token: 'invalid.illegal.integer.erlang',
regex: '\\d+#[\\da-zA-Z]+' },
{ token: 'constant.numeric.integer.decimal.erlang',
regex: '\\d+' } ] } ],
'#parenthesized-expression':
[ { token: 'punctuation.section.expression.begin.erlang',
regex: '\\(',
push:
[ { token: 'punctuation.section.expression.end.erlang',
regex: '\\)',
next: 'pop' },
{ include: '#everything-else' },
{ defaultToken: 'meta.expression.parenthesized' } ] } ],
'#record-directive':
[ { token:
[ 'meta.directive.record.erlang',
'punctuation.section.directive.begin.erlang',
'meta.directive.record.erlang',
'keyword.control.directive.import.erlang',
'meta.directive.record.erlang',
'punctuation.definition.parameters.begin.erlang',
'meta.directive.record.erlang',
'entity.name.type.class.record.definition.erlang',
'meta.directive.record.erlang',
'punctuation.separator.parameters.erlang' ],
regex: '^(\\s*)(-)(\\s*)(record)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
push:
[ { token:
[ 'punctuation.definition.class.record.end.erlang',
'meta.directive.record.erlang',
'punctuation.definition.parameters.end.erlang',
'meta.directive.record.erlang',
'punctuation.section.directive.end.erlang' ],
regex: '(\\})(\\s*)(\\))(\\s*)(\\.)',
next: 'pop' },
{ include: '#internal-record-body' },
{ defaultToken: 'meta.directive.record.erlang' } ] } ],
'#record-usage':
[ { token:
[ 'keyword.operator.record.erlang',
'meta.record-usage.erlang',
'entity.name.type.class.record.erlang',
'meta.record-usage.erlang',
'punctuation.separator.record-field.erlang',
'meta.record-usage.erlang',
'variable.other.field.erlang' ],
regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\.)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')' },
{ token:
[ 'keyword.operator.record.erlang',
'meta.record-usage.erlang',
'entity.name.type.class.record.erlang' ],
regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')',
push:
[ { token: 'punctuation.definition.class.record.end.erlang',
regex: '\\}',
next: 'pop' },
{ include: '#internal-record-body' },
{ defaultToken: 'meta.record-usage.erlang' } ] } ],
'#string':
[ { token: 'punctuation.definition.string.begin.erlang',
regex: '"',
push:
[ { token: 'punctuation.definition.string.end.erlang',
regex: '"',
next: 'pop' },
{ token:
[ 'punctuation.definition.escape.erlang',
'constant.character.escape.erlang',
'punctuation.definition.escape.erlang',
'constant.character.escape.erlang',
'constant.character.escape.erlang' ],
regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
{ token: 'invalid.illegal.string.erlang', regex: '\\\\\\^?.?' },
{ token:
[ 'punctuation.definition.placeholder.erlang',
'punctuation.separator.placeholder-parts.erlang',
'constant.other.placeholder.erlang',
'punctuation.separator.placeholder-parts.erlang',
'punctuation.separator.placeholder-parts.erlang',
'constant.other.placeholder.erlang',
'punctuation.separator.placeholder-parts.erlang',
'punctuation.separator.placeholder-parts.erlang',
'punctuation.separator.placeholder-parts.erlang',
'constant.other.placeholder.erlang',
'constant.other.placeholder.erlang' ],
regex: '(~)(?:((?:\\-)?)(\\d+)|(\\*))?(?:(\\.)(?:(\\d+)|(\\*)))?(?:(\\.)(?:(\\*)|(.)))?([~cfegswpWPBX#bx\\+ni])' },
{ token:
[ 'punctuation.definition.placeholder.erlang',
'punctuation.separator.placeholder-parts.erlang',
'constant.other.placeholder.erlang',
'constant.other.placeholder.erlang' ],
regex: '(~)((?:\\*)?)((?:\\d+)?)([~du\\-#fsacl])' },
{ token: 'invalid.illegal.string.erlang', regex: '~.?' },
{ defaultToken: 'string.quoted.double.erlang' } ] } ],
'#symbolic-operator':
[ { token: 'keyword.operator.symbolic.erlang',
regex: '\\+\\+|\\+|--|-|\\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|!|::' } ],
'#textual-operator':
[ { token: 'keyword.operator.textual.erlang',
regex: '\\b(?:andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\\b' } ],
'#tuple':
[ { token: 'punctuation.definition.tuple.begin.erlang',
regex: '\\{',
push:
[ { token: 'punctuation.definition.tuple.end.erlang',
regex: '\\}',
next: 'pop' },
{ token: 'punctuation.separator.tuple.erlang', regex: ',' },
{ include: '#everything-else' },
{ defaultToken: 'meta.structure.tuple.erlang' } ] } ],
'#variable':
[ { token: [ 'variable.other.erlang', 'variable.language.omitted.erlang' ],
regex: '(_[a-zA-Z\\d@_]+|[A-Z][a-zA-Z\\d@_]*)|(_)' } ] }
this.normalizeRules();
};
ErlangHighlightRules.metaData = { comment: 'The recognition of function definitions and compiler directives (such as module, record and macro definitions) requires that each of the aforementioned constructs must be the first string inside a line (except for whitespace). Also, the function/module/record/macro names must be given unquoted. -- desp',
fileTypes: [ 'erl', 'hrl' ],
keyEquivalent: '^~E',
name: 'Erlang',
scopeName: 'source.erlang' }
oop.inherits(ErlangHighlightRules, TextHighlightRules);
exports.ErlangHighlightRules = ErlangHighlightRules;
});

64
lib/ace/mode/forth.js Normal file
View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var ForthHighlightRules = require("./forth_highlight_rules").ForthHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new ForthHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "(?<=^|\\s)\\.?\\( [^)]*\\)";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,201 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/* This file was autogenerated from https://raw.github.com/vze26m98/Forth.tmbundle/master/Syntaxes/Forth.tmLanguage (uuid: ) */
/****************************************************************************************
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
* fileTypes *
****************************************************************************************/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var ForthHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = { start: [ { include: '#forth' } ],
'#comment':
[ { token: 'comment.line.double-dash.forth',
regex: '(?<=^|\\s)--\\s.*$',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(--\\s.*$)',
comment: 'line comments for iForth' },
{ token: 'comment.line.backslash.forth',
regex: '(?<=^|\\s)\\\\[\\s\\S]*$',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(\\\\[\\s\\S]*$)',
comment: 'ANSI line comment' },
{ token: 'comment.line.backslash-g.forth',
regex: '(?<=^|\\s)\\\\[Gg] .*$',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(\\\\[Gg] .*$)',
comment: 'gForth line comment' },
{ token: 'comment.block.forth',
regex: '(?<=^|\\s)\\(\\*(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(\\(\\*)(?=\\s)',
push:
[ { token: 'comment.block.forth',
regex: '(?<=^|\\s)\\*\\)(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(\\*\\))(?=\\s)',
next: 'pop' },
{ defaultToken: 'comment.block.forth' } ],
comment: 'multiline comments for iForth' },
{ token: 'comment.block.documentation.forth',
regex: '\\bDOC\\b',
caseInsensitive: true,
push:
[ { token: 'comment.block.documentation.forth',
regex: '\\bENDDOC\\b',
caseInsensitive: true,
next: 'pop' },
{ defaultToken: 'comment.block.documentation.forth' } ],
comment: 'documentation comments for iForth' },
{ token: 'comment.line.parentheses.forth',
regex: '(?<=^|\\s)\\.?\\( [^)]*\\)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(\\.?\\( [^)]*\\))',
comment: 'ANSI line comment' } ],
'#constant':
[ { token: 'constant.language.forth',
regex: '(?<=^|\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s)',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?i:(?<=^|\\s)(TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s))' },
{ token: 'constant.numeric.forth',
regex: '(?<=^|\\s)[$#%]?[-+]?[0-9]+(?:\\.[0-9]*e-?[0-9]+|\\.?[0-9a-fA-F]*)(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)([$#%]?[-+]?[0-9]+(\\.[0-9]*e(-?[0-9]+)|\\.?[0-9a-fA-F]*))(?=\\s)' },
{ token: 'constant.character.forth',
regex: '(?<=^|\\s)(?:[&^]\\S|(?:"|\')\\S(?:"|\'))(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(([&^]\\S)|(("|\')\\S("|\')))(?=\\s)' } ],
'#forth':
[ { include: '#constant' },
{ include: '#comment' },
{ include: '#string' },
{ include: '#word' },
{ include: '#variable' },
{ include: '#storage' },
{ include: '#word-def' } ],
'#storage':
[ { token: 'storage.type.forth',
regex: '(?<=^|\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\s)',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(?i:(2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY))(?=\\s)' } ],
'#string':
[ { token: 'string.quoted.double.forth',
regex: '(?:(?<=ABORT" )|(?<=BREAK" )|(?<=\\." )|C" |0"|S\\\\?" )[^"]+"',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?i:((?<=ABORT" )|(?<=BREAK" )|(?<=\\." )|(C" )|(0")|(S\\\\?" )))[^"]+"' },
{ token: 'string.unquoted.forth',
regex: '(?:(?<=INCLUDE)|(?<=NEEDS)|(?<=REQUIRE)|(?<=USE))[ ]\\S+(?=\\s)',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?i:((?<=INCLUDE)|(?<=NEEDS)|(?<=REQUIRE)|(?<=USE)))[ ]\\S+(?=\\s)' } ],
'#variable':
[ { token: 'variable.language.forth',
regex: '\\b(?:I|J)\\b',
caseInsensitive: true } ],
'#word':
[ { token: 'keyword.control.immediate.forth',
regex: '(?<=^|\\s)\\[(?:\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\](?=\\s)',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)\\[(?i:(\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE))\\](?=\\s)' },
{ token: 'keyword.other.immediate.forth',
regex: '(?<=^|\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|])(?=\\s)',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(?i:(COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|]))(?=\\s)' },
{ token: 'keyword.control.compile-only.forth',
regex: '(?<=^|\\s)(?:-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE)(?=\\s)',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(?i:(-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE))(?=\\s)' },
{ token: 'keyword.other.compile-only.forth',
regex: '(?<=^|\\s)(?:\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\s)',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(?i:(\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE))(?=\\s)' },
{ token: 'keyword.other.non-immediate.forth',
regex: '(?<=^|\\s)(?:\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\s)',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(?i:(\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE))(?=\\s)' },
{ token: 'keyword.other.warning.forth',
regex: '(?<=^|\\s)(?:~~|BREAK:|BREAK"|DBG)(?=\\s)',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=^|\\s)(?i:(~~|BREAK:|BREAK"|DBG))(?=\\s)' } ],
'#word-def':
[ { token:
[ 'keyword.other.compile-only.forth',
'meta.block.forth',
'entity.name.function.forth',
'meta.block.forth',
'keyword.other.compile-only.forth' ],
regex: '(^:|\\s:)(\\s)(\\S+)(\\s)|(:NONAME)',
caseInsensitive: true,
push:
[ { token: 'keyword.other.compile-only.forth',
regex: ';(?:CODE)?',
caseInsensitive: true,
next: 'pop' },
{ include: '#constant' },
{ include: '#comment' },
{ include: '#string' },
{ include: '#word' },
{ include: '#variable' },
{ include: '#storage' },
{ defaultToken: 'meta.block.forth' } ] } ] }
this.normalizeRules();
};
ForthHighlightRules.metaData = { fileTypes: [ 'frt', 'fs', 'ldr' ],
foldingStartMarker: '/\\*\\*|\\{\\s*$',
foldingStopMarker: '\\*\\*/|^\\s*\\}',
keyEquivalent: '^~F',
name: 'Forth',
scopeName: 'source.forth' }
oop.inherits(ForthHighlightRules, TextHighlightRules);
exports.ForthHighlightRules = ForthHighlightRules;
});

View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var FortranModernHighlightRules = require("./fortran_modern_highlight_rules").FortranModernHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new FortranModernHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "!";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,187 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/* This file was autogenerated from tm bundles\fortran.tmbundle\Syntaxes\Fortran - Modern.tmLanguage (uuid: ) */
/****************************************************************************************
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
* fileTypes *
****************************************************************************************/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var FortranModernHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = { start:
[ { include: 'source.fortran' },
{ todo:
{ token:
[ 'meta.function.interface.operator.fortran.modern',
'storage.type.function.fortran',
'meta.function.interface.operator.fortran.modern',
'storage.type.fortran',
'meta.function.interface.operator.fortran.modern',
'keyword.operator.fortran',
'meta.function.interface.operator.fortran.modern' ],
regex: '^(\\s*)(interface)(\\s+)(operator|assignment)(\\()(\\.[a-zA-Z0-9_]+\\.|[\\+\\-\\=\\/\\*]+)(\\))',
caseInsensitive: true,
push:
[ { token:
[ 'keyword.other.fortran',
'meta.function.interface.operator.fortran.modern',
'storage.type.function.fortran' ],
regex: '(end)(\\s*)((?:interface)?)',
caseInsensitive: true,
next: 'pop' },
{ include: '$self' },
{ defaultToken: 'meta.function.interface.operator.fortran.modern' } ] },
comment: 'Interface declaration of operator/assignments' },
{ todo:
{ token:
[ 'meta.function.interface.fortran.modern',
'storage.type.function.fortran',
'meta.function.interface.fortran.modern',
'entity.name.function.fortran' ],
regex: '^(\\s*)(interface)(\\s+)([A-Za-z_][A-Za-z0-9_]*)',
caseInsensitive: true,
push:
[ { token:
[ 'keyword.other.fortran',
'meta.function.interface.fortran.modern',
'storage.type.function.fortran' ],
regex: '(end)(\\s*)((?:interface)?)',
caseInsensitive: true,
next: 'pop' },
{ include: '$self' },
{ defaultToken: 'meta.function.interface.fortran.modern' } ] },
comment: 'Interface declaration of function/subroutines' },
{ todo:
{ token:
[ 'meta.type-definition.fortran.modern',
'storage.type.fortran.modern',
'meta.type-definition.fortran.modern',
'entity.name.type.fortran.modern' ],
regex: '^(\\s*)(type)(\\s+)([a-zA-Z_][a-zA-Z0-9_]*)',
caseInsensitive: true,
push:
[ { token:
[ 'keyword.other.fortran',
'meta.type-definition.fortran.modern',
'storage.type.fortran.modern',
'entity.name.type.end.fortran.modern' ],
regex: '(end)(\\s*)(?:(type))?((?:\\s+[A-Za-z_][A-Za-z0-9_]*)?)',
caseInsensitive: true,
next: 'pop' },
{ include: '$self' },
{ defaultToken: 'meta.type-definition.fortran.modern' } ] },
comment: 'Type definition' },
{ token: 'punctuation.definition.comment.fortran',
regex: '!-',
push:
[ { token: 'comment.line.exclamation.mark.fortran.modern',
regex: '$',
next: 'pop' },
{ token: 'text', regex: '\\\\\\s*$' },
{ defaultToken: 'comment.line.exclamation.mark.fortran.modern' } ] },
{ token: 'punctuation.definition.comment.fortran',
regex: '!',
push:
[ { token: 'comment.line.exclamation.fortran.modern',
regex: '$',
next: 'pop' },
{ token: 'text', regex: '\\\\\\s*$' },
{ defaultToken: 'comment.line.exclamation.fortran.modern' } ] },
{ token: 'keyword.control.fortran.modern',
regex: '\\b(?:select\\s+case|case(?:\\s+default)?|end\\s+select|use|(?:end\\s+)?forall)\\b',
caseInsensitive: true,
comment: 'statements controling the flow of the program' },
{ token: 'keyword.control.io.fortran.modern',
regex: '\\b(?:access|action|advance|append|apostrophe|asis|blank|delete|delim|direct|end|eor|err|exist|file|fmt|form|formatted|iolength|iostat|keep|name|named|nextrec|new|nml|no|null|number|old|opened|pad|position|quote|read|readwrite|rec|recl|replace|scratch|sequential|size|status|undefined|unformatted|unit|unknown|write|yes|zero|namelist)(?=\\()',
caseInsensitive: true,
comment: 'input/output instrinsics' },
{ token: 'keyword.operator.logical.fortran.modern',
regex: '\\b(?:\\=\\=|\\/\\=|\\>\\=|\\>|\\<|\\<\\=)\\b',
comment: 'logical operators in symbolic format' },
{ token: 'keyword.operator.fortran.modern',
regex: '\\%|\\=\\>',
comment: 'operators' },
{ token: 'keyword.other.instrinsic.numeric.fortran.modern',
regex: '\\b(?:ceiling|floor|modulo)(?=\\()',
caseInsensitive: true,
comment: 'numeric instrinsics' },
{ token: 'keyword.other.instrinsic.array.fortran.modern',
regex: '\\b(?:allocate|allocated|deallocate)(?=\\()',
caseInsensitive: true,
comment: 'matrix/vector/array instrinsics' },
{ token: 'keyword.other.instrinsic.pointer.fortran.modern',
regex: '\\bassociated(?=\\()',
caseInsensitive: true,
comment: 'pointer instrinsics' },
{ token: 'keyword.other.programming-units.fortran.modern',
regex: '\\b(?:end\\s*)?(?:interface|procedure|module)\\b',
caseInsensitive: true,
comment: 'programming units' },
{ token: 'storage.type.fortran.modern',
regex: '\\btype(?=\\s*\\()\\b(?=.*::)',
caseInsensitive: true,
push:
[ { token: 'meta.specification.fortran.modern',
regex: '(?=!)|$',
next: 'pop' },
{ include: '$base' },
{ defaultToken: 'meta.specification.fortran.modern' } ],
comment: 'Line of type specification' },
{ token: 'storage.type.fortran.modern',
regex: '\\btype(?=\\s*\\()\\b',
caseInsensitive: true },
{ token: 'storage.modifier.fortran.modern',
regex: '\\b(?:optional|recursive|pointer|allocatable|target|private|public)\\b',
caseInsensitive: true } ] }
this.normalizeRules();
};
FortranModernHighlightRules.metaData = { comment: 'Specificities of Fortran >= 90',
fileTypes: [ 'f90', 'F90', 'f95', 'F95', 'f03', 'F03', 'f08', 'F08' ],
firstLineMatch: '(?i)-[*]- mode: f90 -[*]-',
keyEquivalent: '^~F',
name: 'Fortran - Modern',
scopeName: 'source.fortran.modern' }
oop.inherits(FortranModernHighlightRules, TextHighlightRules);
exports.FortranModernHighlightRules = FortranModernHighlightRules;
});

64
lib/ace/mode/haskell.js Normal file
View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var HaskellHighlightRules = require("./haskell_highlight_rules").HaskellHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new HaskellHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "--";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,246 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/* This file was autogenerated from tm bundles\haskell.tmbundle\Syntaxes\Haskell.plist (uuid: ) */
/****************************************************************************************
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
* fileTypes *
****************************************************************************************/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var HaskellHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = { start:
[ { token:
[ 'punctuation.definition.entity.haskell',
'keyword.operator.function.infix.haskell',
'punctuation.definition.entity.haskell' ],
regex: '(`)([a-zA-Z_\']*?)(`)',
comment: 'In case this regex seems unusual for an infix operator, note that Haskell allows any ordinary function application (elem 4 [1..10]) to be rewritten as an infix expression (4 `elem` [1..10]).' },
{ token: 'constant.language.unit.haskell', regex: '\\(\\)' },
{ token: 'constant.language.empty-list.haskell',
regex: '\\[\\]' },
{ token: 'keyword.other.haskell',
regex: 'module',
push:
[ { token: 'keyword.other.haskell', regex: 'where', next: 'pop' },
{ include: '#module_name' },
{ include: '#module_exports' },
{ token: 'invalid', regex: '[a-z]+' },
{ defaultToken: 'meta.declaration.module.haskell' } ] },
{ token: 'keyword.other.haskell',
regex: '\\bclass\\b',
push:
[ { token: 'keyword.other.haskell',
regex: '\\bwhere\\b',
next: 'pop' },
{ token: 'support.class.prelude.haskell',
regex: '\\b(?:Monad|Functor|Eq|Ord|Read|Show|Num|(?:Frac|Ra)tional|Enum|Bounded|Real(?:Frac|Float)?|Integral|Floating)\\b' },
{ token: 'entity.other.inherited-class.haskell',
regex: '[A-Z][A-Za-z_\']*' },
{ token: 'variable.other.generic-type.haskell',
regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' },
{ defaultToken: 'meta.declaration.class.haskell' } ] },
{ token: 'keyword.other.haskell',
regex: '\\binstance\\b',
push:
[ { token: 'keyword.other.haskell',
regex: '\\bwhere\\b|$',
next: 'pop' },
{ include: '#type_signature' },
{ defaultToken: 'meta.declaration.instance.haskell' } ] },
{ token: 'keyword.other.haskell',
regex: 'import',
push:
[ { token: 'meta.import.haskell', regex: '$|;', next: 'pop' },
{ token: 'keyword.other.haskell', regex: 'qualified|as|hiding' },
{ include: '#module_name' },
{ include: '#module_exports' },
{ defaultToken: 'meta.import.haskell' } ] },
{ token: [ 'keyword.other.haskell', 'meta.deriving.haskell' ],
regex: '(deriving)(\\s*\\()',
push:
[ { token: 'meta.deriving.haskell', regex: '\\)', next: 'pop' },
{ token: 'entity.other.inherited-class.haskell',
regex: '\\b[A-Z][a-zA-Z_\']*' },
{ defaultToken: 'meta.deriving.haskell' } ] },
{ token: 'keyword.other.haskell',
regex: '\\b(?:deriving|where|data|type|case|of|let|in|newtype|default)\\b' },
{ token: 'keyword.operator.haskell', regex: '\\binfix[lr]?\\b' },
{ token: 'keyword.control.haskell',
regex: '\\b(?:do|if|then|else)\\b' },
{ token: 'constant.numeric.float.haskell',
regex: '\\b(?:[0-9]+\\.[0-9]+(?:[eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\\b',
comment: 'Floats are always decimal' },
{ token: 'constant.numeric.haskell',
regex: '\\b(?:[0-9]+|0(?:[xX][0-9a-fA-F]+|[oO][0-7]+))\\b' },
{ token:
[ 'meta.preprocessor.c',
'punctuation.definition.preprocessor.c',
'meta.preprocessor.c' ],
regex: '^(\\s*)(#)(\\s*\\w+)',
comment: 'In addition to Haskell\'s "native" syntax, GHC permits the C preprocessor to be run on a source file.' },
{ include: '#pragma' },
{ token: 'punctuation.definition.string.begin.haskell',
regex: '"',
push:
[ { token: 'punctuation.definition.string.end.haskell',
regex: '"',
next: 'pop' },
{ token: 'constant.character.escape.haskell',
regex: '\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&])' },
{ token: 'constant.character.escape.octal.haskell',
regex: '\\\\o[0-7]+|\\\\x[0-9A-Fa-f]+|\\\\[0-9]+' },
{ token: 'constant.character.escape.control.haskell',
regex: '\\^[A-Z@\\[\\]\\\\\\^_]' },
{ defaultToken: 'string.quoted.double.haskell' } ] },
{ token:
[ 'punctuation.definition.string.begin.haskell',
'string.quoted.single.haskell',
'constant.character.escape.haskell',
'constant.character.escape.octal.haskell',
'constant.character.escape.hexadecimal.haskell',
'constant.character.escape.control.haskell',
'punctuation.definition.string.end.haskell' ],
regex: '(\')(?:([\\ -\\[\\]-~])|(\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&]))|(\\\\o[0-7]+)|(\\\\x[0-9A-Fa-f]+)|(\\^[A-Z@\\[\\]\\\\\\^_]))(\')' },
{ token:
[ 'meta.function.type-declaration.haskell',
'entity.name.function.haskell',
'meta.function.type-declaration.haskell',
'keyword.other.double-colon.haskell' ],
regex: '^(\\s*)([a-z_][a-zA-Z0-9_\']*|\\([|!%$+\\-.,=</>]+\\))(\\s*)(::)',
push:
[ { token: 'meta.function.type-declaration.haskell',
regex: '$',
next: 'pop' },
{ include: '#type_signature' },
{ defaultToken: 'meta.function.type-declaration.haskell' } ] },
{ token: 'support.constant.haskell',
regex: '\\b(?:Just|Nothing|Left|Right|True|False|LT|EQ|GT|\\(\\)|\\[\\])\\b' },
{ token: 'constant.other.haskell', regex: '\\b[A-Z]\\w*\\b' },
{ include: '#comments' },
{ token: 'support.function.prelude.haskell',
regex: '\\b(?:abs|acos|acosh|all|and|any|appendFile|applyM|asTypeOf|asin|asinh|atan|atan2|atanh|break|catch|ceiling|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|div|divMod|drop|dropWhile|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromEnum|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|head|id|init|interact|ioError|isDenormalized|isIEEE|isInfinite|isNaN|isNegativeZero|iterate|last|lcm|length|lex|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|odd|or|otherwise|pi|pred|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|read|readFile|readIO|readList|readLn|readParen|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showList|showParen|showString|shows|showsPrec|significand|signum|sin|sinh|snd|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|toEnum|toInteger|toRational|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\\b' },
{ include: '#infix_op' },
{ token: 'keyword.operator.haskell',
regex: '[|!%$?~+:\\-.=</>\\\\]+',
comment: 'In case this regex seems overly general, note that Haskell permits the definition of new operators which can be nearly any string of punctuation characters, such as $%^&*.' },
{ token: 'punctuation.separator.comma.haskell', regex: ',' } ],
'#block_comment':
[ { token: 'punctuation.definition.comment.haskell',
regex: '\\{-(?!#)',
push:
[ { include: '#block_comment' },
{ token: 'punctuation.definition.comment.haskell',
regex: '-\\}',
next: 'pop' },
{ defaultToken: 'comment.block.haskell' } ] } ],
'#comments':
[ { token: 'punctuation.definition.comment.haskell',
regex: '--',
push:
[ { token: 'comment.line.double-dash.haskell',
regex: '$',
next: 'pop' },
{ defaultToken: 'comment.line.double-dash.haskell' } ] },
{ include: '#block_comment' } ],
'#infix_op':
[ { token: 'entity.name.function.infix.haskell',
regex: '\\([|!%$+:\\-.=</>]+\\)|\\(,+\\)' } ],
'#module_exports':
[ { token: 'meta.declaration.exports.haskell',
regex: '\\(',
push:
[ { token: 'meta.declaration.exports.haskell',
regex: '\\)',
next: 'pop' },
{ token: 'entity.name.function.haskell',
regex: '\\b[a-z][a-zA-Z_\']*' },
{ token: 'storage.type.haskell', regex: '\\b[A-Z][A-Za-z_\']*' },
{ token: 'punctuation.separator.comma.haskell', regex: ',' },
{ include: '#infix_op' },
{ token: 'meta.other.unknown.haskell',
regex: '\\(.*?\\)',
comment: 'So named because I don\'t know what to call this.' },
{ defaultToken: 'meta.declaration.exports.haskell' } ] } ],
'#module_name':
[ { token: 'support.other.module.haskell',
regex: '[A-Z][A-Za-z._\']*' } ],
'#pragma':
[ { token: 'meta.preprocessor.haskell',
regex: '\\{-#',
push:
[ { token: 'meta.preprocessor.haskell',
regex: '#-\\}',
next: 'pop' },
{ token: 'keyword.other.preprocessor.haskell',
regex: '\\b(?:LANGUAGE|UNPACK|INLINE)\\b' },
{ defaultToken: 'meta.preprocessor.haskell' } ] } ],
'#type_signature':
[ { token:
[ 'meta.class-constraint.haskell',
'entity.other.inherited-class.haskell',
'meta.class-constraint.haskell',
'variable.other.generic-type.haskell',
'meta.class-constraint.haskell',
'keyword.other.big-arrow.haskell' ],
regex: '(\\(\\s*)([A-Z][A-Za-z]*)(\\s+)([a-z][A-Za-z_\']*)(\\)\\s*)(=>)' },
{ include: '#pragma' },
{ token: 'keyword.other.arrow.haskell', regex: '->' },
{ token: 'keyword.other.big-arrow.haskell', regex: '=>' },
{ token: 'support.type.prelude.haskell',
regex: '\\b(?:Int(?:eger)?|Maybe|Either|Bool|Float|Double|Char|String|Ordering|ShowS|ReadS|FilePath|IO(?:Error)?)\\b' },
{ token: 'variable.other.generic-type.haskell',
regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' },
{ token: 'storage.type.haskell',
regex: '\\b[A-Z][a-zA-Z0-9_\']*\\b' },
{ token: 'support.constant.unit.haskell', regex: '\\(\\)' },
{ include: '#comments' } ] }
this.normalizeRules();
};
HaskellHighlightRules.metaData = { fileTypes: [ 'hs' ],
keyEquivalent: '^~H',
name: 'Haskell',
scopeName: 'source.haskell' }
oop.inherits(HaskellHighlightRules, TextHighlightRules);
exports.HaskellHighlightRules = HaskellHighlightRules;
});

64
lib/ace/mode/html_twig.js Normal file
View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var HTMLTwigHighlightRules = require("./html_twig_highlight_rules").HTMLTwigHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new HTMLTwigHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "<%+#";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,687 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/* This file was autogenerated from https://raw.github.com/Anomareh/PHP-Twig.tmbundle/master/Syntaxes/HTML (Twig).tmLanguage (uuid: ) */
/****************************************************************************************
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
* fileTypes *
****************************************************************************************/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var HTMLTwigHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = { start:
[ { token: [ 'punctuation.definition.tag.html', 'entity.name.tag.html' ],
regex: '(<)([a-zA-Z0-9:]+)(?=[^>]*></\\2>)',
push:
[ { token:
[ 'punctuation.definition.tag.html',
'meta.scope.between-tag-pair.html',
'punctuation.definition.tag.html',
'entity.name.tag.html',
'punctuation.definition.tag.html' ],
regex: '(>)(<)(/)([a-zA-Z0-9:]+)(>)',
next: 'pop' },
{ include: '#tag-stuff' },
{ defaultToken: 'meta.tag.any.html' } ] },
{ token:
[ 'punctuation.definition.tag.html',
'entity.name.tag.xml.html' ],
regex: '(<\\?)(xml)',
push:
[ { token: 'punctuation.definition.tag.html',
regex: '\\?>',
next: 'pop' },
{ include: '#tag-generic-attribute' },
{ include: '#string-double-quoted' },
{ include: '#string-single-quoted' },
{ defaultToken: 'meta.tag.preprocessor.xml.html' } ] },
{ token: 'punctuation.definition.comment.html',
regex: '<!--',
push:
[ { token: 'punctuation.definition.comment.html',
regex: '--\\s*>',
next: 'pop' },
{ token: 'invalid.illegal.bad-comments-or-CDATA.html',
regex: '--' },
{ include: '#embedded-code' },
{ defaultToken: 'comment.block.html' } ] },
{ token: 'punctuation.definition.tag.html',
regex: '<!',
push:
[ { token: 'punctuation.definition.tag.html',
regex: '>',
next: 'pop' },
{ token: 'entity.name.tag.doctype.html',
regex: 'DOCTYPE',
push:
[ { token: [], regex: '(?=>)', next: 'pop' },
{ token: 'string.quoted.double.doctype.identifiers-and-DTDs.html',
regex: '"[^">]*"' },
{ defaultToken: 'meta.tag.sgml.doctype.html' } ] },
{ token: 'constant.other.inline-data.html',
regex: '\\[CDATA\\[',
push:
[ { token: 'constant.other.inline-data.html',
regex: ']](?=>)',
next: 'pop' },
{ defaultToken: 'constant.other.inline-data.html' } ] },
{ token: 'invalid.illegal.bad-comments-or-CDATA.html',
regex: '\\s*(?!--|>)\\S\\s*' },
{ defaultToken: 'meta.tag.sgml.html' } ] },
{ include: '#embedded-code' },
{ token:
[ 'punctuation.definition.tag.html',
'entity.name.tag.style.html' ],
regex: '(?:^\\s+)?(<)(style)\\b(?![^>]*/>)',
caseInsensitive: true,
push:
[ { token:
[ 'punctuation.definition.tag.html',
'entity.name.tag.style.html',
'punctuation.definition.tag.html' ],
regex: '(</)(style)(>)(?:\\s*$)?',
caseInsensitive: true,
next: 'pop' },
{ include: '#tag-stuff' },
{ token: 'punctuation.definition.tag.html',
regex: '>',
push:
[ { token: 'text',
regex: '(?=</style)',
caseInsensitive: true,
next: 'pop' },
{ include: '#embedded-code' },
{ include: 'source.css' } ] },
{ defaultToken: 'source.css.embedded.html' } ] },
{ token:
[ 'punctuation.definition.tag.html',
'entity.name.tag.script.html' ],
regex: '(?:^\\s+)?(<)(script)\\b(?![^>]*/>)',
caseInsensitive: true,
push:
[ { token: 'punctuation.definition.tag.html',
regex: '(?<=</(?:script|SCRIPT))>(?:\\s*$)?',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=</(script|SCRIPT))(>)(?:\\s*\\n)?',
next: 'pop' },
{ include: '#tag-stuff' },
{ token: 'punctuation.definition.tag.html',
regex: '(?<!</(?:script|SCRIPT))>',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<!</(?:script|SCRIPT))(>)',
push:
[ { token:
[ 'punctuation.definition.tag.html',
'entity.name.tag.script.html' ],
regex: '(</)(script)',
caseInsensitive: true,
next: 'pop' },
{ token:
[ 'punctuation.definition.comment.js',
'comment.line.double-slash.js',
'comment.line.double-slash.js' ],
regex: '(//)(.*?)((?=</script)|$)' },
{ token: 'punctuation.definition.comment.js',
regex: '/\\*',
push:
[ { token: 'punctuation.definition.comment.js',
regex: '\\*/|(?=</script)',
next: 'pop' },
{ defaultToken: 'comment.block.js' } ] },
{ include: '#php' },
{ include: 'source.js' } ] },
{ defaultToken: 'source.js.embedded.html' } ] },
{ token:
[ 'punctuation.definition.tag.html',
'entity.name.tag.structure.any.html' ],
regex: '(</?)((?:body|head|html)\\b)',
caseInsensitive: true,
push:
[ { token: 'punctuation.definition.tag.html',
regex: '>',
next: 'pop' },
{ include: '#tag-stuff' },
{ defaultToken: 'meta.tag.structure.any.html' } ] },
{ token:
[ 'punctuation.definition.tag.begin.html',
'entity.name.tag.block.any.html' ],
regex: '(</?)((?:address|blockquote|dd|div|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|menu|pre)\\b)',
caseInsensitive: true,
push:
[ { token: 'punctuation.definition.tag.end.html',
regex: '>',
next: 'pop' },
{ include: '#tag-stuff' },
{ defaultToken: 'meta.tag.block.any.html' } ] },
{ token:
[ 'punctuation.definition.tag.begin.html',
'entity.name.tag.inline.any.html' ],
regex: '(</?)((?:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)\\b)',
caseInsensitive: true,
push:
[ { token: 'punctuation.definition.tag.end.html',
regex: '(?: ?/)?>',
next: 'pop' },
{ include: '#tag-stuff' },
{ defaultToken: 'meta.tag.inline.any.html' } ] },
{ token:
[ 'punctuation.definition.tag.begin.html',
'entity.name.tag.other.html' ],
regex: '(</?)([a-zA-Z0-9:]+)',
push:
[ { token: 'punctuation.definition.tag.end.html',
regex: '>',
next: 'pop' },
{ include: '#tag-stuff' },
{ defaultToken: 'meta.tag.other.html' } ] },
{ include: '#entities' },
{ token: 'invalid.illegal.incomplete.html', regex: '<>' },
{ token: 'invalid.illegal.bad-angle-bracket.html', regex: '<' },
{ include: '#twig-variable-tags' },
{ include: '#twig-expression-tags' },
{ include: '#twig-comment-tags' } ],
'#embedded-code':
[ { include: '#ruby' },
{ include: '#php' },
{ include: '#twig-variable-tags' },
{ include: '#twig-expression-tags' },
{ include: '#twig-comment-tags' },
{ include: '#python' } ],
'#entities':
[ { token:
[ 'punctuation.definition.entity.html',
'constant.character.entity.html',
'punctuation.definition.entity.html' ],
regex: '(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)' },
{ token: 'invalid.illegal.bad-ampersand.html', regex: '&' } ],
'#twig-variable-tags':
[ { token: 'punctuation.section.tag.twig',
regex: '\\{\\{-?',
push:
[ { token: 'punctuation.section.tag.twig',
regex: '-?\\}\\}',
next: 'pop' },
{ include: '#twig-constants' },
{ include: '#twig-operators' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions' },
{ include: '#twig-macros' },
{ include: '#twig-objects' },
{ include: '#twig-properties' },
{ include: '#twig-filters-warg' },
{ include: '#twig-filters' },
{ include: '#twig-filters-warg-ud' },
{ include: '#twig-filters-ud' },
{ include: '#twig-strings' },
{ include: '#twig-arrays' },
{ include: '#twig-hashes' },
{ defaultToken: 'meta.tag.template.value.twig' } ] } ],
'#twig-expression-tags':
[ { token: 'punctuation.section.tag.twig',
regex: '\\{%-?',
push:
[ { token: 'punctuation.section.tag.twig',
regex: '-?%\\}',
next: 'pop' },
{ include: '#twig-constants' },
{ include: '#twig-keywords' },
{ include: '#twig-operators' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions' },
{ include: '#twig-macros' },
{ include: '#twig-filters-warg' },
{ include: '#twig-filters' },
{ include: '#twig-filters-warg-ud' },
{ include: '#twig-filters-ud' },
{ include: '#twig-objects' },
{ include: '#twig-properties' },
{ include: '#twig-strings' },
{ include: '#twig-arrays' },
{ include: '#twig-hashes' },
{ defaultToken: 'meta.tag.template.block.twig' } ] } ],
'#twig-comment-tags':
[ { token: 'punctuation.definition.comment.begin.twig',
regex: '\\{#-?',
push:
[ { token: 'punctuation.definition.comment.end.twig',
regex: '-?#\\}',
next: 'pop' },
{ defaultToken: 'comment.block.twig' } ] } ],
'#twig-constants':
[ { token: 'constant.language.twig',
regex: '(?<=[\\s\\[\\(\\{:,])(?:true|false|null|none)(?=[\\s\\)\\]\\}\\,])',
caseInsensitive: true,
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?i)(?<=[\\s\\[\\(\\{:,])(?:true|false|null|none)(?=[\\s\\)\\]\\}\\,])' },
{ token: 'constant.numeric.twig',
regex: '(?<=[\\s\\[\\(\\{:,]|\\.\\.|\\*\\*)[0-9]+(?:\\.[0-9]+)?(?=[\\s\\)\\]\\}\\,]|\\.\\.|\\*\\*)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=[\\s\\[\\(\\{:,]|\\.\\.|\\*\\*)[0-9]+(?:\\.[0-9]+)?(?=[\\s\\)\\]\\}\\,]|\\.\\.|\\*\\*)' } ],
'#twig-operators':
[ { token: 'keyword.operator.arithmetic.twig',
regex: '(?<=\\s)(?:\\+|-|\\*|/|%|//)(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=\\s)(\\+|-|\\*|/|%|//)(?=\\s)' },
{ token: 'keyword.operator.assignment.twig',
regex: '(?<=\\s)(?:=|~)(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=\\s)(=|~)(?=\\s)' },
{ token: 'keyword.operator.bitwise.twig',
regex: '(?<=\\s)(?:&|\\||\\^)(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=\\s)(&|\\||\\^)(?=\\s)' },
{ token: 'keyword.operator.comparison.twig',
regex: '(?<=\\s)(?:(?:!|=)=|<=?|>=?|i(?:s|n))(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=\\s)((?:!|=)=|<=?|>=?|i(?:s|n))(?=\\s)' },
{ token: 'keyword.operator.logical.twig',
regex: '(?<=\\s)(?:not|or|and|\\?|:)(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=\\s)(not|or|and|\\?|:)(?=\\s)' },
{ token: 'keyword.operator.arithmetic.twig',
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff\\]\\)\'"])\\*\\*(?=[a-zA-Z0-9_\\x7f-\\xff\'"])',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=[a-zA-Z0-9_\\x{7f}-\\x{ff}\\]\\)\'"])\\*\\*(?=[a-zA-Z0-9_\\x{7f}-\\x{ff}\'"])' },
{ token: 'keyword.operator.other.twig',
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff\\]\\)\'"])\\.\\.(?=[a-zA-Z0-9_\\x7f-\\xff\'"])',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=[a-zA-Z0-9_\\x{7f}-\\x{ff}\\]\\)\'"])\\.\\.(?=[a-zA-Z0-9_\\x{7f}-\\x{ff}\'"])' },
{ token: 'keyword.operator.other.twig',
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff\\]\\}\\)\'"])\\|(?=[a-zA-Z_\\x7f-\\xff])',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=[a-zA-Z0-9_\\x{7f}-\\x{ff}\\]\\}\\)\'"])\\|(?=[a-zA-Z_\\x{7f}-\\x{ff}])' } ],
'#twig-objects':
[ { token: 'variable.other.twig',
regex: '(?<=[\\s\\{\\[\\(:,])[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(?=[\\s\\}\\[\\]\\(\\)\\.\\|,:])',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=[\\s\\{\\[\\(:,])([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)(?=[\\s\\}\\[\\]\\(\\)\\.\\|,:])' } ],
'#twig-properties':
[ { token:
[ 'punctuation.separator.property.twig',
'variable.other.property.twig' ],
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff])(\\.)([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)(?=[\\.\\s\\|\\[\\)\\]\\}:,])',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?x)\n (?<=[a-zA-Z0-9_\\x{7f}-\\x{ff}])\n (\\.)([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n (?=[\\.\\s\\|\\[\\)\\]\\}:,])\n ' },
{ token:
[ 'punctuation.separator.property.twig',
'variable.other.property.twig',
'punctuation.definition.parameters.begin.twig' ],
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff])(\\.)([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)(\\()',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?x)\n (?<=[a-zA-Z0-9_\\x{7f}-\\x{ff}])\n (\\.)([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n (\\()\n ',
push:
[ { token: 'punctuation.definition.parameters.end.twig',
regex: '\\)',
next: 'pop' },
{ include: '#twig-constants' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions' },
{ include: '#twig-macros' },
{ include: '#twig-objects' },
{ include: '#twig-properties' },
{ include: '#twig-filters-warg' },
{ include: '#twig-filters' },
{ include: '#twig-filters-warg-ud' },
{ include: '#twig-filters-ud' },
{ include: '#twig-strings' },
{ include: '#twig-arrays' },
{ defaultToken: 'meta.function.arguments.twig' } ] },
{ token:
[ 'punctuation.section.array.begin.twig',
'variable.other.property.twig',
'punctuation.section.array.end.twig',
'punctuation.section.array.begin.twig',
'variable.other.property.twig',
'punctuation.section.array.end.twig',
'punctuation.section.array.begin.twig',
'variable.other.property.twig',
'punctuation.section.array.end.twig' ],
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff\\]])(?:(\\[)(\'[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*\')(\\])|(\\[)("[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*")(\\])|(\\[)([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)(\\]))',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?x)\n (?<=[a-zA-Z0-9_\\x{7f}-\\x{ff}\\]])\n (?:\n (\\[)(\'[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*\')(\\])\n |(\\[)("[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*")(\\])\n |(\\[)([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)(\\])\n )\n ' } ],
'#twig-strings':
[ { token: 'punctuation.definition.string.begin.twig',
regex: '\'',
push:
[ { token: 'punctuation.definition.string.end.twig',
regex: '\'',
next: 'pop' },
{ defaultToken: 'string.quoted.single.twig' } ] },
{ token: 'punctuation.definition.string.begin.twig',
regex: '"',
push:
[ { token: 'punctuation.definition.string.end.twig',
regex: '"',
next: 'pop' },
{ defaultToken: 'string.quoted.double.twig' } ] } ],
'#twig-arrays':
[ { token: 'punctuation.section.array.begin.twig',
regex: '(?<=[\\s\\(\\{\\[:,])\\[',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=[\\s\\(\\{\\[:,])\\[',
push:
[ { token: 'punctuation.section.array.end.twig',
regex: '\\]',
next: 'pop' },
{ include: '#twig-arrays' },
{ include: '#twig-hashes' },
{ include: '#twig-constants' },
{ include: '#twig-strings' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions' },
{ include: '#twig-macros' },
{ include: '#twig-objects' },
{ include: '#twig-properties' },
{ include: '#twig-filters-warg' },
{ include: '#twig-filters' },
{ include: '#twig-filters-warg-ud' },
{ include: '#twig-filters-ud' },
{ token: 'punctuation.separator.object.twig', regex: ',' },
{ defaultToken: 'meta.array.twig' } ] } ],
'#twig-hashes':
[ { token: 'punctuation.section.hash.begin.twig',
regex: '(?<=[\\s\\(\\{\\[:,])\\{',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=[\\s\\(\\{\\[:,])\\{',
push:
[ { token: 'punctuation.section.hash.end.twig',
regex: '\\}',
next: 'pop' },
{ include: '#twig-hashes' },
{ include: '#twig-arrays' },
{ include: '#twig-constants' },
{ include: '#twig-strings' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions' },
{ include: '#twig-macros' },
{ include: '#twig-objects' },
{ include: '#twig-properties' },
{ include: '#twig-filters-warg' },
{ include: '#twig-filters' },
{ include: '#twig-filters-warg-ud' },
{ include: '#twig-filters-ud' },
{ token: 'punctuation.separator.key-value.twig', regex: ':' },
{ token: 'punctuation.separator.object.twig', regex: ',' },
{ defaultToken: 'meta.hash.twig' } ] } ],
'#twig-keywords':
[ { token: 'keyword.control.twig',
regex: '(?<=\\s)(?:(?:end)?(?:autoescape|block|embed|filter|for|if|macro|raw|sandbox|set|spaceless)|as|do|else|elseif|extends|flush|from|ignore missing|import|include|only|use|with)(?=\\s)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=\\s)((?:end)?(?:autoescape|block|embed|filter|for|if|macro|raw|sandbox|set|spaceless)|as|do|else|elseif|extends|flush|from|ignore missing|import|include|only|use|with)(?=\\s)' } ],
'#twig-functions-warg':
[ { token:
[ 'support.function.twig',
'punctuation.definition.parameters.begin.twig' ],
regex: '(?<=[\\s\\(\\[\\{:,])(attribute|block|constant|cycle|date|divisibleby|dump|parent|random|range|sameas|template_from_string)(\\()',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=[\\s\\(\\[\\{:,])(attribute|block|constant|cycle|date|divisibleby|dump|parent|random|range|sameas|template_from_string)(\\()',
push:
[ { token: 'punctuation.definition.parameters.end.twig',
regex: '\\)',
next: 'pop' },
{ include: '#twig-constants' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions' },
{ include: '#twig-macros' },
{ include: '#twig-objects' },
{ include: '#twig-properties' },
{ include: '#twig-filters-warg' },
{ include: '#twig-filters' },
{ include: '#twig-filters-warg-ud' },
{ include: '#twig-filters-ud' },
{ include: '#twig-strings' },
{ include: '#twig-arrays' },
{ defaultToken: 'meta.function.arguments.twig' } ] } ],
'#twig-functions':
[ { token: 'support.function.twig',
regex: '(?<=is\\s)(?:defined|empty|even|iterable|none|null|odd)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=is\\s)(defined|empty|even|iterable|none|null|odd)' } ],
'#twig-macros':
[ { token:
[ 'meta.function-call.twig',
'punctuation.separator.property.twig',
'variable.other.property.twig',
'punctuation.definition.parameters.begin.twig' ],
regex: '(?<=[\\s\\(\\[\\{:,])([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)(\\.)([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)(\\()',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?x)\n (?<=[\\s\\(\\[\\{:,])\n ([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n (?:\n (\\.)([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n )\n (\\()\n ',
push:
[ { token: 'punctuation.definition.parameters.end.twig',
regex: '\\)',
next: 'pop' },
{ include: '#twig-constants' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions' },
{ include: '#twig-macros' },
{ include: '#twig-objects' },
{ include: '#twig-properties' },
{ include: '#twig-filters-warg' },
{ include: '#twig-filters' },
{ include: '#twig-filters-warg-ud' },
{ include: '#twig-filters-ud' },
{ include: '#twig-strings' },
{ include: '#twig-arrays' },
{ include: '#twig-hashes' },
{ defaultToken: 'meta.function.arguments.twig' } ] } ],
'#twig-filters-warg':
[ { token:
[ 'support.function.twig',
'punctuation.definition.parameters.begin.twig' ],
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff\\]\\)\\\'\\"]\\||\\{%\\sfilter\\s)(convert_encoding|date|date_modify|default|e|escape|format|join|merge|number_format|replace|slice|split|trim)(\\()',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=(?:[a-zA-Z0-9_\\x{7f}-\\x{ff}\\]\\)\\\'\\"]\\|)|\\{%\\sfilter\\s)(convert_encoding|date|date_modify|default|e|escape|format|join|merge|number_format|replace|slice|split|trim)(\\()',
push:
[ { token: 'punctuation.definition.parameters.end.twig',
regex: '\\)',
next: 'pop' },
{ include: '#twig-constants' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions' },
{ include: '#twig-macros' },
{ include: '#twig-objects' },
{ include: '#twig-properties' },
{ include: '#twig-filters-warg' },
{ include: '#twig-filters' },
{ include: '#twig-filters-warg-ud' },
{ include: '#twig-filters-ud' },
{ include: '#twig-strings' },
{ include: '#twig-arrays' },
{ include: '#twig-hashes' },
{ defaultToken: 'meta.function.arguments.twig' } ] } ],
'#twig-filters':
[ { token: 'support.function.twig',
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff\\]\\)\\\'\\"]\\||\\{%\\sfilter\\s)(?:abs|capitalize|e(?:scape)?|join|(?:json|url)_encode|keys|length|lower|nl2br|number_format|raw|reverse|sort|striptags|title|trim|upper)(?=[\\s\\|\\]\\}\\):,]|\\.\\.|\\*\\*)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=(?:[a-zA-Z0-9_\\x{7f}-\\x{ff}\\]\\)\\\'\\"]\\|)|\\{%\\sfilter\\s)(abs|capitalize|e(?:scape)?|join|(?:json|url)_encode|keys|length|lower|nl2br|number_format|raw|reverse|sort|striptags|title|trim|upper)(?=[\\s\\|\\]\\}\\):,]|\\.\\.|\\*\\*)' } ],
'#twig-filters-warg-ud':
[ { token:
[ 'meta.function-call.other.twig',
'punctuation.definition.parameters.begin.twig' ],
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff\\]\\)\\\'\\"]\\||\\{%\\sfilter\\s)([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)(\\()',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=(?:[a-zA-Z0-9_\\x{7f}-\\x{ff}\\]\\)\\\'\\"]\\|)|\\{%\\sfilter\\s)([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)(\\()',
push:
[ { token: 'punctuation.definition.parameters.end.twig',
regex: '\\)',
next: 'pop' },
{ include: '#twig-constants' },
{ include: '#twig-functions-warg' },
{ include: '#twig-functions' },
{ include: '#twig-macros' },
{ include: '#twig-objects' },
{ include: '#twig-properties' },
{ include: '#twig-filters-warg' },
{ include: '#twig-filters' },
{ include: '#twig-filters-warg-ud' },
{ include: '#twig-filters-ud' },
{ include: '#twig-strings' },
{ include: '#twig-arrays' },
{ include: '#twig-hashes' },
{ defaultToken: 'meta.function.arguments.twig' } ] } ],
'#twig-filters-ud':
[ { token: 'meta.function-call.other.twig',
regex: '(?<=[a-zA-Z0-9_\\x7f-\\xff\\]\\)\\\'\\"]\\||\\{%\\sfilter\\s)[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=(?:[a-zA-Z0-9_\\x{7f}-\\x{ff}\\]\\)\\\'\\"]\\|)|\\{%\\sfilter\\s)([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)' } ],
'#php':
[ { token: 'text',
regex: '(?=(?:^\\s*)?<\\?)',
push:
[ { token: 'text', regex: '(?!(?:^\\s*)?<\\?)', next: 'pop' },
{ include: 'source.php' } ] } ],
'#python':
[ { token: 'source.python.embedded.html',
regex: '^\\s*<\\?python(?!.*\\?>)',
push:
[ { token: 'source.python.embedded.html',
regex: '\\?>(?:\\s*$)?',
next: 'pop' },
{ include: 'source.python' },
{ defaultToken: 'source.python.embedded.html' } ] } ],
'#ruby':
[ { token: 'punctuation.definition.comment.erb',
regex: '<%+#',
push:
[ { token: 'punctuation.definition.comment.erb',
regex: '%>',
next: 'pop' },
{ defaultToken: 'comment.block.erb' } ] },
{ token: 'punctuation.section.embedded.ruby',
regex: '<%+(?!>)=?',
push:
[ { token: 'punctuation.section.embedded.ruby',
regex: '-?%>',
next: 'pop' },
{ token:
[ 'punctuation.definition.comment.ruby',
'comment.line.number-sign.ruby' ],
regex: '(#)(.*?)(?=-?%>)' },
{ include: 'source.ruby' },
{ defaultToken: 'source.ruby.embedded.html' } ] },
{ token: 'punctuation.section.embedded.ruby.nitro',
regex: '<\\?r(?!>)=?',
push:
[ { token: 'punctuation.section.embedded.ruby.nitro',
regex: '-?\\?>',
next: 'pop' },
{ token:
[ 'punctuation.definition.comment.ruby.nitro',
'comment.line.number-sign.ruby.nitro' ],
regex: '(#)(.*?)(?=-?\\?>)' },
{ include: 'source.ruby' },
{ defaultToken: 'source.ruby.nitro.embedded.html' } ] } ],
'#string-double-quoted':
[ { token: 'punctuation.definition.string.begin.html',
regex: '"',
push:
[ { token: 'punctuation.definition.string.end.html',
regex: '"',
next: 'pop' },
{ include: '#embedded-code' },
{ include: '#entities' },
{ defaultToken: 'string.quoted.double.html' } ] } ],
'#string-single-quoted':
[ { token: 'punctuation.definition.string.begin.html',
regex: '\'',
push:
[ { token: 'punctuation.definition.string.end.html',
regex: '\'',
next: 'pop' },
{ include: '#embedded-code' },
{ include: '#entities' },
{ defaultToken: 'string.quoted.single.html' } ] } ],
'#tag-generic-attribute':
[ { token: 'entity.other.attribute-name.html',
regex: '\\b[a-zA-Z\\-:]+' } ],
'#tag-id-attribute':
[ { token:
[ 'entity.other.attribute-name.id.html',
'meta.attribute-with-value.id.html',
'punctuation.separator.key-value.html' ],
regex: '\\b(id)\\b(\\s*)(=)',
push:
[ { token: [],
regex: '(?<=\'|")',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<=\'|")',
next: 'pop' },
{ token: 'punctuation.definition.string.begin.html',
regex: '"',
push:
[ { token: 'punctuation.definition.string.end.html',
regex: '"',
next: 'pop' },
{ include: '#embedded-code' },
{ include: '#entities' },
{ defaultToken: 'string.quoted.double.html' } ] },
{ token: 'punctuation.definition.string.begin.html',
regex: '\'',
push:
[ { token: 'punctuation.definition.string.end.html',
regex: '\'',
next: 'pop' },
{ include: '#embedded-code' },
{ include: '#entities' },
{ defaultToken: 'string.quoted.single.html' } ] },
{ defaultToken: 'meta.attribute-with-value.id.html' } ] } ],
'#tag-stuff':
[ { include: '#tag-id-attribute' },
{ include: '#tag-generic-attribute' },
{ include: '#string-double-quoted' },
{ include: '#string-single-quoted' },
{ include: '#embedded-code' } ] }
this.normalizeRules();
};
HTMLTwigHighlightRules.metaData = { fileTypes: [ 'twig', 'html.twig' ],
firstLineMatch: '<!DOCTYPE|<(?i:html)|<\\?(?i:php)|\\{\\{|\\{%|\\{#',
foldingStartMarker: '(?x)\n (<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl)\\b.*?>\n |<!--(?!.*--\\s*>)\n |^<!--\\ \\#tminclude\\ (?>.*?-->)$\n |\\{%\\s+(if|for|spaceless|raw|autoescape|macro|)\n )',
foldingStopMarker: '(?x)\n (</(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl)>\n |^(?!.*?<!--).*?--\\s*>\n |^<!--\\ end\\ tminclude\\ -->$\n |\\{%\\s+end(if|for|spaceless|raw|autoescape|macro|)\n )',
keyEquivalent: '^~T',
name: 'HTML (Twig)',
scopeName: 'text.html.twig' }
oop.inherits(HTMLTwigHighlightRules, TextHighlightRules);
exports.HTMLTwigHighlightRules = HTMLTwigHighlightRules;
});

64
lib/ace/mode/julia.js Normal file
View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var JuliaHighlightRules = require("./julia_highlight_rules").JuliaHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new JuliaHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,200 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/* This file was autogenerated from https://raw.github.com/JuliaLang/julia/master/contrib/Julia.tmbundle/Syntaxes/Julia.tmLanguage (uuid: ) */
/****************************************************************************************
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
* fileTypes *
****************************************************************************************/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var JuliaHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = { start:
[ { include: '#function_decl' },
{ include: '#function_call' },
{ include: '#type_decl' },
{ include: '#keyword' },
{ include: '#operator' },
{ include: '#number' },
{ include: '#string' },
{ include: '#comment' } ],
'#bracket':
[ { token: 'keyword.bracket.julia',
regex: '\\(|\\)|\\[|\\]|\\{|\\}|,' } ],
'#comment':
[ { token:
[ 'punctuation.definition.comment.julia',
'comment.line.number-sign.julia' ],
regex: '(?<!\\$)(#)(?!\\{)(.*$)',
TODO: 'FIXME: regexp doesn\'t have js equivalent',
originalRegex: '(?<!\\$)(#)(?!\\{).*$\\n?' } ],
'#function_call':
[ { todo:
{ token: [ 'support.function.julia', 'text' ],
regex: '([a-zA-Z0-9_]+!?)(\\w*\\()',
push:
[ { token: [ 'text', 'keyword.operator.transposed-func.julia' ],
regex: '(\\))((?:(?:\'|\\.\')*\\.?\')?)',
next: 'pop' },
{ include: '$self' } ] } } ],
'#function_decl':
[ { todo:
{ token:
[ 'keyword.other.julia',
'meta.function.julia',
'entity.name.function.julia',
'meta.function.julia',
'meta.function.julia' ],
regex: '(function|macro)(\\s*)([a-zA-Z0-9_\\{]+!?)(\\w*)([(\\\\{])',
push:
[ { token: 'meta.function.julia', regex: '[)\\\\}]', next: 'pop' },
{ include: '$self' },
{ defaultToken: 'meta.function.julia' } ] } } ],
'#keyword':
[ { token: 'keyword.other.julia',
regex: '\\b(?:function|type|immutable|macro|quote|abstract|bitstype|typealias|module|baremodule|new)\\b' },
{ token: 'keyword.control.julia',
regex: '\\b(?:if|else|elseif|while|for|in|begin|let|end|do|try|catch|finally|return|break|continue)\\b' },
{ token: 'storage.modifier.variable.julia',
regex: '\\b(?:global|local|const|export|import|importall|using)\\b' },
{ token: 'variable.macro.julia', regex: '@\\w+\\b' } ],
'#number':
[ { token: 'constant.numeric.julia',
regex: '\\b0(?:x|X)[0-9a-fA-F]*|(?:\\b[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]*)?(?:im)?|\\bInf(?:32)?\\b|\\bNaN(?:32)?\\b|\\btrue\\b|\\bfalse\\b' } ],
'#operator':
[ { token: 'keyword.operator.update.julia',
regex: '=|:=|\\+=|-=|\\*=|/=|//=|\\.//=|\\.\\*=|\\\\=|\\.\\\\=|^=|\\.^=|%=|\\|=|&=|\\$=|<<=|>>=' },
{ token: 'keyword.operator.ternary.julia', regex: '\\?|:' },
{ token: 'keyword.operator.boolean.julia',
regex: '\\|\\||&&|!' },
{ token: 'keyword.operator.arrow.julia', regex: '->|<-|-->' },
{ token: 'keyword.operator.relation.julia',
regex: '>|<|>=|<=|==|!=|\\.>|\\.<|\\.>=|\\.>=|\\.==|\\.!=|\\.=|\\.!|<:|:>' },
{ token: 'keyword.operator.range.julia', regex: ':' },
{ token: 'keyword.operator.shift.julia', regex: '<<|>>' },
{ token: 'keyword.operator.bitwise.julia', regex: '\\||\\&|~' },
{ token: 'keyword.operator.arithmetic.julia',
regex: '\\+|-|\\*|\\.\\*|/|\\./|//|\\.//|%|\\.%|\\\\|\\.\\\\|\\^|\\.\\^' },
{ token: 'keyword.operator.isa.julia', regex: '::' },
{ token: 'keyword.operator.dots.julia',
regex: '\\.(?=[a-zA-Z])|\\.\\.+' },
{ token: 'keyword.operator.interpolation.julia',
regex: '\\$(?=.+)' },
{ token: [ 'variable', 'keyword.operator.transposed-variable.julia' ],
regex: '(\\w+)((?:\'|\\.\')*\\.?\')' },
{ todo:
{ token: 'test',
regex: '\\[',
push:
[ { token: [ 'test', 'keyword.operator.transposed-matrix.julia' ],
regex: '(\\])((?:\'|\\.\')*\\.?\')',
next: 'pop' },
{ include: '$self' },
{ defaultToken: 'test' } ] } },
{ todo:
{ token: 'text',
regex: '\\(',
push:
[ { token: [ 'text', 'keyword.operator.transposed-parens.julia' ],
regex: '(\\))((?:\'|\\.\')*\\.?\')',
next: 'pop' },
{ include: '$self' } ] } } ],
'#string':
[ { token: 'punctuation.definition.string.begin.julia',
regex: '\'',
push:
[ { token: 'punctuation.definition.string.end.julia',
regex: '\'',
next: 'pop' },
{ include: '#string_escaped_char' },
{ defaultToken: 'string.quoted.single.julia' } ] },
{ token: 'punctuation.definition.string.begin.julia',
regex: '"',
push:
[ { token: 'punctuation.definition.string.end.julia',
regex: '"',
next: 'pop' },
{ include: '#string_escaped_char' },
{ defaultToken: 'string.quoted.double.julia' } ] },
{ token: 'punctuation.definition.string.begin.julia',
regex: '\\b\\w+"',
push:
[ { token: 'punctuation.definition.string.end.julia',
regex: '"\\w*',
next: 'pop' },
{ include: '#string_custom_escaped_char' },
{ defaultToken: 'string.quoted.custom-double.julia' } ] },
{ token: 'punctuation.definition.string.begin.julia',
regex: '`',
push:
[ { token: 'punctuation.definition.string.end.julia',
regex: '`',
next: 'pop' },
{ include: '#string_escaped_char' },
{ defaultToken: 'string.quoted.backtick.julia' } ] } ],
'#string_custom_escaped_char': [ { token: 'constant.character.escape.julia', regex: '\\\\"' } ],
'#string_escaped_char':
[ { token: 'constant.character.escape.julia',
regex: '\\\\(?:\\\\|[0-3]\\d{,2}|[4-7]\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}|.)' } ],
'#type_decl':
[ { token:
[ 'keyword.control.type.julia',
'meta.type.julia',
'entity.name.type.julia',
'entity.other.inherited-class.julia',
'punctuation.separator.inheritance.julia',
'entity.other.inherited-class.julia' ],
regex: '(type|immutable)(\\s+)([a-zA-Z0-9_]+)(?:(\\s*)(<:)(\\s*[.a-zA-Z0-9_:]+))?' },
{ token: [ 'other.typed-variable.julia', 'support.type.julia' ],
regex: '([a-zA-Z0-9_]+)(::[a-zA-Z0-9_{}]+)' } ] }
this.normalizeRules();
};
JuliaHighlightRules.metaData = { fileTypes: [ 'jl' ],
firstLineMatch: '^#!.*\\bjulia\\s*$',
foldingStartMarker: '^\\s*(?:if|while|for|begin|function|macro|module|baremodule|type|immutable|let)\\b(?!.*\\bend\\b).*$',
foldingStopMarker: '^\\s*(?:end)\\b.*$',
name: 'Julia',
scopeName: 'source.julia' }
oop.inherits(JuliaHighlightRules, TextHighlightRules);
exports.JuliaHighlightRules = JuliaHighlightRules;
});

64
lib/ace/mode/prolog.js Normal file
View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var PrologHighlightRules = require("./prolog_highlight_rules").PrologHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new PrologHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "/\\*";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,238 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/* This file was autogenerated from https://raw.github.com/stephenroller/prolog-tmbundle/master/Syntaxes/Prolog.tmLanguage (uuid: ) */
/****************************************************************************************
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
* fileTypes *
****************************************************************************************/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PrologHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = { start:
[ { include: '#comment' },
{ include: '#basic_fact' },
{ include: '#rule' },
{ include: '#directive' },
{ include: '#fact' } ],
'#atom':
[ { token: 'constant.other.atom.prolog',
regex: '\\b[a-z][a-zA-Z0-9_]*\\b' },
{ token: 'constant.numeric.prolog',
regex: '-?\\d+(?:\\.\\d+)?' },
{ include: '#string' } ],
'#basic_elem':
[ { include: '#comment' },
{ include: '#statement' },
{ include: '#constants' },
{ include: '#operators' },
{ include: '#builtins' },
{ include: '#list' },
{ include: '#atom' },
{ include: '#variable' } ],
'#basic_fact':
[ { token:
[ 'entity.name.function.fact.basic.prolog',
'punctuation.end.fact.basic.prolog' ],
regex: '([a-z]\\w*)(\\.)' } ],
'#builtins':
[ { token: 'support.function.builtin.prolog',
regex: '\\b(?:\n\t\t\t\t\t\tabolish|abort|ancestors|arg|ascii|assert[az]|\n\t\t\t\t\t\tatom(?:ic)?|body|char|close|conc|concat|consult|\n\t\t\t\t\t\tdefine|definition|dynamic|dump|fail|file|free|\n\t\t\t\t\t\tfree_proc|functor|getc|goal|halt|head|head|integer|\n\t\t\t\t\t\tlength|listing|match_args|member|next_clause|nl|\n\t\t\t\t\t\tnonvar|nth|number|cvars|nvars|offset|op|\n\t\t\t\t\t\tprint?|prompt|putc|quoted|ratom|read|redefine|\n\t\t\t\t\t\trename|retract(?:all)?|see|seeing|seen|skip|spy|\n\t\t\t\t\t\tstatistics|system|tab|tell|telling|term|\n\t\t\t\t\t\ttime|told|univ|unlink_clause|unspy_predicate|\n\t\t\t\t\t\tvar|write\n\t\t\t\t\t)\\b' } ],
'#comment':
[ { token:
[ 'punctuation.definition.comment.prolog',
'comment.line.percentage.prolog' ],
regex: '(%)(.*$)' },
{ token: 'punctuation.definition.comment.prolog',
regex: '/\\*',
push:
[ { token: 'punctuation.definition.comment.prolog',
regex: '\\*/',
next: 'pop' },
{ defaultToken: 'comment.block.prolog' } ] } ],
'#constants':
[ { token: 'constant.language.prolog',
regex: '\\b(?:true|false|yes|no)\\b' } ],
'#directive':
[ { token: 'keyword.operator.directive.prolog',
regex: ':-',
push:
[ { token: 'meta.directive.prolog', regex: '\\.', next: 'pop' },
{ include: '#comment' },
{ include: '#statement' },
{ defaultToken: 'meta.directive.prolog' } ] } ],
'#expr':
[ { include: '#comments' },
{ token: 'meta.expression.prolog',
regex: '\\(',
push:
[ { token: 'meta.expression.prolog', regex: '\\)', next: 'pop' },
{ include: '#expr' },
{ defaultToken: 'meta.expression.prolog' } ] },
{ token: 'keyword.control.cutoff.prolog', regex: '!' },
{ token: 'punctuation.control.and.prolog', regex: ',' },
{ token: 'punctuation.control.or.prolog', regex: ';' },
{ include: '#basic_elem' } ],
'#fact':
[ { token:
[ 'entity.name.function.fact.prolog',
'punctuation.begin.fact.parameters.prolog' ],
regex: '([a-z]\\w*)(\\()(?!.*:-)',
push:
[ { token:
[ 'punctuation.end.fact.parameters.prolog',
'punctuation.end.fact.prolog' ],
regex: '(\\))(\\.)',
next: 'pop' },
{ include: '#parameter' },
{ defaultToken: 'meta.fact.prolog' } ] } ],
'#list':
[ { token: 'punctuation.begin.list.prolog',
regex: '\\[(?=.*\\])',
push:
[ { token: 'punctuation.end.list.prolog',
regex: '\\]',
next: 'pop' },
{ include: '#comment' },
{ token: 'punctuation.separator.list.prolog', regex: ',' },
{ token: 'punctuation.concat.list.prolog',
regex: '\\|',
push:
[ { token: 'meta.list.concat.prolog',
regex: '(?=\\s*\\])',
next: 'pop' },
{ include: '#basic_elem' },
{ defaultToken: 'meta.list.concat.prolog' } ] },
{ include: '#basic_elem' },
{ defaultToken: 'meta.list.prolog' } ] } ],
'#operators':
[ { token: 'keyword.operator.prolog',
regex: '\\\\\\+|\\bnot\\b|\\bis\\b|->|[><]|[><\\\\:=]?=|(?:=\\\\|\\\\=)=' } ],
'#parameter':
[ { token: 'variable.language.anonymous.prolog',
regex: '\\b_\\b' },
{ token: 'variable.parameter.prolog',
regex: '\\b[A-Z_]\\w*\\b' },
{ token: 'punctuation.separator.parameters.prolog', regex: ',' },
{ include: '#basic_elem' },
{ token: 'invalid.illegal.invalidchar.prolog', regex: '[^\\s]' } ],
'#rule':
[ { token: 'meta.rule.prolog',
regex: '(?=[a-z]\\w*.*:-)',
push:
[ { token: 'punctuation.rule.end.prolog',
regex: '\\.',
next: 'pop' },
{ token: 'meta.rule.signature.prolog',
regex: '(?=[a-z]\\w*.*:-)',
push:
[ { token: 'meta.rule.signature.prolog',
regex: '(?=:-)',
next: 'pop' },
{ token: 'entity.name.function.rule.prolog',
regex: '[a-z]\\w*(?=\\(|\\s*:-)' },
{ token: 'punctuation.rule.parameters.begin.prolog',
regex: '\\(',
push:
[ { token: 'punctuation.rule.parameters.end.prolog',
regex: '\\)',
next: 'pop' },
{ include: '#parameter' },
{ defaultToken: 'meta.rule.parameters.prolog' } ] },
{ defaultToken: 'meta.rule.signature.prolog' } ] },
{ token: 'keyword.operator.definition.prolog',
regex: ':-',
push:
[ { token: 'meta.rule.definition.prolog',
regex: '(?=\\.)',
next: 'pop' },
{ include: '#comment' },
{ include: '#expr' },
{ defaultToken: 'meta.rule.definition.prolog' } ] },
{ defaultToken: 'meta.rule.prolog' } ] } ],
'#statement':
[ { token: 'meta.statement.prolog',
regex: '(?=[a-z]\\w*\\()',
push:
[ { token: 'punctuation.end.statement.parameters.prolog',
regex: '\\)',
next: 'pop' },
{ include: '#builtins' },
{ include: '#atom' },
{ token: 'punctuation.begin.statement.parameters.prolog',
regex: '\\(',
push:
[ { token: 'meta.statement.parameters.prolog',
regex: '(?=\\))',
next: 'pop' },
{ token: 'punctuation.separator.statement.prolog', regex: ',' },
{ include: '#basic_elem' },
{ defaultToken: 'meta.statement.parameters.prolog' } ] },
{ defaultToken: 'meta.statement.prolog' } ] } ],
'#string':
[ { token: 'punctuation.definition.string.begin.prolog',
regex: '\'',
push:
[ { token: 'punctuation.definition.string.end.prolog',
regex: '\'',
next: 'pop' },
{ token: 'constant.character.escape.prolog', regex: '\\\\.' },
{ token: 'constant.character.escape.quote.prolog',
regex: '\'\'' },
{ defaultToken: 'string.quoted.single.prolog' } ] } ],
'#variable':
[ { token: 'variable.language.anonymous.prolog',
regex: '\\b_\\b' },
{ token: 'variable.other.prolog',
regex: '\\b[A-Z_][a-zA-Z0-9_]*\\b' } ] }
this.normalizeRules();
};
PrologHighlightRules.metaData = { fileTypes: [ 'plg', 'prolog' ],
foldingStartMarker: '(%\\s*region \\w*)|([a-z]\\w*.*:- ?)',
foldingStopMarker: '(%\\s*end(\\s*region)?)|(?=\\.)',
keyEquivalent: '^~P',
name: 'Prolog',
scopeName: 'source.prolog' }
oop.inherits(PrologHighlightRules, TextHighlightRules);
exports.PrologHighlightRules = PrologHighlightRules;
});

64
lib/ace/mode/rust.js Normal file
View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var RustHighlightRules = require("./rust_highlight_rules").RustHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new RustHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "/\\*";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,129 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/* This file was autogenerated from https://raw.github.com/dbp/sublime-rust/master/Rust.tmLanguage (uuid: ) */
/****************************************************************************************
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
* fileTypes *
****************************************************************************************/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var RustHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = { start:
[ { token: 'variable.other.source.rust',
regex: '\'[a-zA-Z_][a-zA-Z0-9_]*[^\\\']' },
{ token: 'string.quoted.single.source.rust',
regex: '\'',
push:
[ { token: 'string.quoted.single.source.rust',
regex: '\'',
next: 'pop' },
{ include: '#rust_escaped_character' },
{ defaultToken: 'string.quoted.single.source.rust' } ] },
{ token: 'string.quoted.double.source.rust',
regex: '"',
push:
[ { token: 'string.quoted.double.source.rust',
regex: '"',
next: 'pop' },
{ include: '#rust_escaped_character' },
{ defaultToken: 'string.quoted.double.source.rust' } ] },
{ token:
[ 'keyword.source.rust',
'meta.function.source.rust',
'entity.name.function.source.rust',
'meta.function.source.rust' ],
regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_][\\w\\:,+ \\\'<>]*)(\\s*\\()' },
{ token: 'keyword.source.rust',
regex: '\\b(?:as|assert|break|claim|const|copy|Copy|do|drop|else|extern|fail|for|if|impl|in|let|log|loop|match|mod|module|move|mut|Owned|priv|pub|pure|ref|return|unchecked|unsafe|use|while|mod|Send|static|trait|class|struct|enum|type)\\b' },
{ token: 'storage.type.source.rust',
regex: '\\b(?:Self|m32|m64|m128|f80|f16|f128|int|uint|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b' },
{ token: 'variable.language.source.rust', regex: '\\bself\\b' },
{ token: 'constant.language.source.rust',
regex: '\\b(?:true|false|Some|None|Left|Right|Ok|Err)\\b' },
{ token: 'support.constant.source.rust',
regex: '\\b(?:EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b' },
{ token: 'meta.preprocessor.source.rust',
regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b' },
{ token: 'constant.numeric.integer.source.rust',
regex: '\\b(?:[0-9][0-9_]*|[0-9][0-9_]*(?:u|u8|u16|u32|u64)|[0-9][0-9_]*(?:i|i8|i16|i32|i64))\\b' },
{ token: 'constant.numeric.hex.source.rust',
regex: '\\b(?:0x[a-fA-F0-9_]+|0x[a-fA-F0-9_]+(?:u|u8|u16|u32|u64)|0x[a-fA-F0-9_]+(?:i|i8|i16|i32|i64))\\b' },
{ token: 'constant.numeric.binary.source.rust',
regex: '\\b(?:0b[01_]+|0b[01_]+(?:u|u8|u16|u32|u64)|0b[01_]+(?:i|i8|i16|i32|i64))\\b' },
{ token: 'constant.numeric.float.source.rust',
regex: '[0-9][0-9_]*(?:f32|f64|f)|[0-9][0-9_]*[eE][+-]=[0-9_]+|[0-9][0-9_]*[eE][+-]=[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+|[0-9][0-9_]*\\.[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+(?:f32|f64|f)' },
{ token: 'comment.line.documentation.source.rust',
regex: '//!',
push:
[ { token: 'comment.line.documentation.source.rust',
regex: '$',
next: 'pop' },
{ defaultToken: 'comment.line.documentation.source.rust' } ] },
{ token: 'comment.line.double-dash.source.rust',
regex: '//',
push:
[ { token: 'comment.line.double-dash.source.rust',
regex: '$',
next: 'pop' },
{ defaultToken: 'comment.line.double-dash.source.rust' } ] },
{ token: 'comment.block.source.rust',
regex: '/\\*',
push:
[ { token: 'comment.block.source.rust',
regex: '\\*/',
next: 'pop' },
{ defaultToken: 'comment.block.source.rust' } ] } ],
'#rust_escaped_character':
[ { token: 'constant.character.escape.source.rust',
regex: '\\\\(?:x[\\da-fA-F]{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)' } ] }
this.normalizeRules();
};
RustHighlightRules.metaData = { fileTypes: [ 'rs', 'rc' ],
foldingStartMarker: '^.*\\bfn\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$',
foldingStopMarker: '^\\s*\\}',
name: 'Rust',
scopeName: 'source.rust' }
oop.inherits(RustHighlightRules, TextHighlightRules);
exports.RustHighlightRules = RustHighlightRules;
});