parent
b06e57b4c2
commit
92935b4896
1 changed files with 16 additions and 101 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010, Ajax.org B.V.
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* * Neither the name of Ajax.org B.V. nor the
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* 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
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
|
@ -86,23 +86,9 @@ define(function(require, exports, module) {
|
||||||
"variable.language": variableLanguage
|
"variable.language": variableLanguage
|
||||||
}, "identifier");
|
}, "identifier");
|
||||||
|
|
||||||
var functionRules = {
|
var functionRule = {
|
||||||
"({args})->": {
|
token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
|
||||||
token: ["paren.lparen", "text", "paren.lparen", "text", "variable.parameter", "text", "paren.rparen", "text", "paren.rparen", "text", "storage.type"],
|
regex: /(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()\"'\/])*?)(\))(\s*)([\-=]>)/
|
||||||
regex: "(\\()(\\s*)(\\{)(\\s*)([$@A-Za-z_\\x7f-\\uffff][$@\\w\\s,\\x7f-\\uffff]*)(\\s*)(\\})(\\s*)(\\))(\\s*)([\\-=]>)"
|
|
||||||
},
|
|
||||||
"({})->": {
|
|
||||||
token: ["paren.lparen", "text", "paren.lparen", "text", "paren.rparen", "text", "paren.rparen", "text", "storage.type"],
|
|
||||||
regex: "(\\()(\\s*)(\\{)(\\s*)(\\})(\\s*)(\\))(\\s*)([\\-=]>)"
|
|
||||||
},
|
|
||||||
"(args)->": {
|
|
||||||
token: ["paren.lparen", "text", "variable.parameter", "text", "paren.rparen", "text", "storage.type"],
|
|
||||||
regex: "(\\()(\\s*)([$@A-Za-z_\\x7f-\\uffff][\\s\\x21-\\uffff]*)(\\s*)(\\))(\\s*)([\\-=]>)"
|
|
||||||
},
|
|
||||||
"()->": {
|
|
||||||
token: ["paren.lparen", "text", "paren.rparen", "text", "storage.type"],
|
|
||||||
regex: "(\\()(\\s*)(\\))(\\s*)([\\-=]>)"
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
|
|
@ -145,94 +131,23 @@ define(function(require, exports, module) {
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "#.*"
|
regex : "#.*"
|
||||||
}, {
|
}, {
|
||||||
token : [
|
token : ["punctuation.operator", "text", "identifier"],
|
||||||
"punctuation.operator", "identifier"
|
regex : "(\\.)(\\s*)(" + identifier + ")"
|
||||||
],
|
|
||||||
regex : "(\\.)(" + illegal + ")"
|
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\."
|
regex : "\\."
|
||||||
}, {
|
}, {
|
||||||
//class A extends B
|
//class A extends B
|
||||||
token : [
|
token : ["keyword", "text", "language.support.class",
|
||||||
"keyword", "text", "language.support.class", "text", "keyword", "text", "language.support.class"
|
"text", "keyword", "text", "language.support.class"],
|
||||||
],
|
regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
|
||||||
regex : "(class)(\\s+)(" + identifier + ")(\\s+)(extends)(\\s+)(" + identifier + ")"
|
|
||||||
}, {
|
}, {
|
||||||
//class A
|
//play = (...) ->
|
||||||
token : [
|
token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
|
||||||
"keyword", "text", "language.support.class"
|
regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
|
||||||
],
|
|
||||||
regex : "(class)(\\s+)(" + identifier + ")"
|
|
||||||
}, {
|
|
||||||
//play = ({args}) ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "keyword.operator", "text"
|
|
||||||
].concat(functionRules["({args})->"].token),
|
|
||||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["({args})->"].regex
|
|
||||||
}, {
|
|
||||||
//play : ({args}) ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "punctuation.operator", "text"
|
|
||||||
].concat(functionRules["({args})->"].token),
|
|
||||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["({args})->"].regex
|
|
||||||
}, {
|
|
||||||
//play = ({}) ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "keyword.operator", "text"
|
|
||||||
].concat(functionRules["({})->"].token),
|
|
||||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["({})->"].regex
|
|
||||||
}, {
|
|
||||||
//play : ({}) ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "punctuation.operator", "text"
|
|
||||||
].concat(functionRules["({})->"].token),
|
|
||||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["({})->"].regex
|
|
||||||
}, {
|
|
||||||
//play = (args) ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "keyword.operator", "text"
|
|
||||||
].concat(functionRules["(args)->"].token),
|
|
||||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["(args)->"].regex
|
|
||||||
}, {
|
|
||||||
//play : (args) ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "punctuation.operator", "text"
|
|
||||||
].concat(functionRules["(args)->"].token),
|
|
||||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["(args)->"].regex
|
|
||||||
}, {
|
|
||||||
//play = () ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "keyword.operator", "text"
|
|
||||||
].concat(functionRules["()->"].token),
|
|
||||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["()->"].regex
|
|
||||||
}, {
|
|
||||||
//play : () ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "punctuation.operator", "text"
|
|
||||||
].concat(functionRules["()->"].token),
|
|
||||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["()->"].regex
|
|
||||||
}, {
|
|
||||||
//play = ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "keyword.operator", "text", "storage.type"
|
|
||||||
],
|
|
||||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)([\\-=]>)"
|
|
||||||
}, {
|
|
||||||
//play : ->
|
|
||||||
token : [
|
|
||||||
"entity.name.function", "text", "punctuation.operator", "text", "storage.type"
|
|
||||||
],
|
|
||||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)([\\-=]>)"
|
|
||||||
},
|
},
|
||||||
functionRules["({args})->"],
|
functionRule,
|
||||||
functionRules["({})->"],
|
{
|
||||||
functionRules["(args)->"],
|
|
||||||
functionRules["()->"]
|
|
||||||
, {
|
|
||||||
token : "identifier",
|
|
||||||
regex : "(?:(?:\\.|::)\\s*)" + identifier
|
|
||||||
}, {
|
|
||||||
token : "variable",
|
token : "variable",
|
||||||
regex : "@(?:" + identifier + ")?"
|
regex : "@(?:" + identifier + ")?"
|
||||||
}, {
|
}, {
|
||||||
|
|
@ -240,7 +155,7 @@ define(function(require, exports, module) {
|
||||||
regex : identifier
|
regex : identifier
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\."
|
regex : "\\,|\\."
|
||||||
}, {
|
}, {
|
||||||
token : "storage.type",
|
token : "storage.type",
|
||||||
regex : "[\\-=]>"
|
regex : "[\\-=]>"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue