parent
b06e57b4c2
commit
92935b4896
1 changed files with 16 additions and 101 deletions
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* * 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
|
||||
|
|
@ -86,23 +86,9 @@ define(function(require, exports, module) {
|
|||
"variable.language": variableLanguage
|
||||
}, "identifier");
|
||||
|
||||
var functionRules = {
|
||||
"({args})->": {
|
||||
token: ["paren.lparen", "text", "paren.lparen", "text", "variable.parameter", "text", "paren.rparen", "text", "paren.rparen", "text", "storage.type"],
|
||||
regex: "(\\()(\\s*)(\\{)(\\s*)([$@A-Za-z_\\x7f-\\uffff][$@\\w\\s,\\x7f-\\uffff]*)(\\s*)(\\})(\\s*)(\\))(\\s*)([\\-=]>)"
|
||||
},
|
||||
"({})->": {
|
||||
token: ["paren.lparen", "text", "paren.lparen", "text", "paren.rparen", "text", "paren.rparen", "text", "storage.type"],
|
||||
regex: "(\\()(\\s*)(\\{)(\\s*)(\\})(\\s*)(\\))(\\s*)([\\-=]>)"
|
||||
},
|
||||
"(args)->": {
|
||||
token: ["paren.lparen", "text", "variable.parameter", "text", "paren.rparen", "text", "storage.type"],
|
||||
regex: "(\\()(\\s*)([$@A-Za-z_\\x7f-\\uffff][\\s\\x21-\\uffff]*)(\\s*)(\\))(\\s*)([\\-=]>)"
|
||||
},
|
||||
"()->": {
|
||||
token: ["paren.lparen", "text", "paren.rparen", "text", "storage.type"],
|
||||
regex: "(\\()(\\s*)(\\))(\\s*)([\\-=]>)"
|
||||
}
|
||||
var functionRule = {
|
||||
token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
|
||||
regex: /(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()\"'\/])*?)(\))(\s*)([\-=]>)/
|
||||
};
|
||||
|
||||
this.$rules = {
|
||||
|
|
@ -145,94 +131,23 @@ define(function(require, exports, module) {
|
|||
token : "comment",
|
||||
regex : "#.*"
|
||||
}, {
|
||||
token : [
|
||||
"punctuation.operator", "identifier"
|
||||
],
|
||||
regex : "(\\.)(" + illegal + ")"
|
||||
token : ["punctuation.operator", "text", "identifier"],
|
||||
regex : "(\\.)(\\s*)(" + identifier + ")"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\."
|
||||
}, {
|
||||
//class A extends B
|
||||
token : [
|
||||
"keyword", "text", "language.support.class", "text", "keyword", "text", "language.support.class"
|
||||
],
|
||||
regex : "(class)(\\s+)(" + identifier + ")(\\s+)(extends)(\\s+)(" + identifier + ")"
|
||||
token : ["keyword", "text", "language.support.class",
|
||||
"text", "keyword", "text", "language.support.class"],
|
||||
regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
|
||||
}, {
|
||||
//class A
|
||||
token : [
|
||||
"keyword", "text", "language.support.class"
|
||||
],
|
||||
regex : "(class)(\\s+)(" + identifier + ")"
|
||||
}, {
|
||||
//play = ({args}) ->
|
||||
token : [
|
||||
"entity.name.function", "text", "keyword.operator", "text"
|
||||
].concat(functionRules["({args})->"].token),
|
||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["({args})->"].regex
|
||||
}, {
|
||||
//play : ({args}) ->
|
||||
token : [
|
||||
"entity.name.function", "text", "punctuation.operator", "text"
|
||||
].concat(functionRules["({args})->"].token),
|
||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["({args})->"].regex
|
||||
}, {
|
||||
//play = ({}) ->
|
||||
token : [
|
||||
"entity.name.function", "text", "keyword.operator", "text"
|
||||
].concat(functionRules["({})->"].token),
|
||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["({})->"].regex
|
||||
}, {
|
||||
//play : ({}) ->
|
||||
token : [
|
||||
"entity.name.function", "text", "punctuation.operator", "text"
|
||||
].concat(functionRules["({})->"].token),
|
||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["({})->"].regex
|
||||
}, {
|
||||
//play = (args) ->
|
||||
token : [
|
||||
"entity.name.function", "text", "keyword.operator", "text"
|
||||
].concat(functionRules["(args)->"].token),
|
||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["(args)->"].regex
|
||||
}, {
|
||||
//play : (args) ->
|
||||
token : [
|
||||
"entity.name.function", "text", "punctuation.operator", "text"
|
||||
].concat(functionRules["(args)->"].token),
|
||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["(args)->"].regex
|
||||
}, {
|
||||
//play = () ->
|
||||
token : [
|
||||
"entity.name.function", "text", "keyword.operator", "text"
|
||||
].concat(functionRules["()->"].token),
|
||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["()->"].regex
|
||||
}, {
|
||||
//play : () ->
|
||||
token : [
|
||||
"entity.name.function", "text", "punctuation.operator", "text"
|
||||
].concat(functionRules["()->"].token),
|
||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["()->"].regex
|
||||
}, {
|
||||
//play = ->
|
||||
token : [
|
||||
"entity.name.function", "text", "keyword.operator", "text", "storage.type"
|
||||
],
|
||||
regex : "(" + identifier + ")(\\s*)(=)(\\s*)([\\-=]>)"
|
||||
}, {
|
||||
//play : ->
|
||||
token : [
|
||||
"entity.name.function", "text", "punctuation.operator", "text", "storage.type"
|
||||
],
|
||||
regex : "(" + identifier + ")(\\s*)(:)(\\s*)([\\-=]>)"
|
||||
//play = (...) ->
|
||||
token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
|
||||
regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
|
||||
},
|
||||
functionRules["({args})->"],
|
||||
functionRules["({})->"],
|
||||
functionRules["(args)->"],
|
||||
functionRules["()->"]
|
||||
, {
|
||||
token : "identifier",
|
||||
regex : "(?:(?:\\.|::)\\s*)" + identifier
|
||||
}, {
|
||||
functionRule,
|
||||
{
|
||||
token : "variable",
|
||||
regex : "@(?:" + identifier + ")?"
|
||||
}, {
|
||||
|
|
@ -240,7 +155,7 @@ define(function(require, exports, module) {
|
|||
regex : identifier
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\?|\\:|\\,|\\."
|
||||
regex : "\\,|\\."
|
||||
}, {
|
||||
token : "storage.type",
|
||||
regex : "[\\-=]>"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue