commit
0d303296fe
18 changed files with 112 additions and 40 deletions
|
|
@ -2197,7 +2197,7 @@ config.defineOptions(Editor.prototype, "editor", {
|
||||||
this.onSelectionChange();
|
this.onSelectionChange();
|
||||||
this._emit("changeSelectionStyle", {data: style});
|
this._emit("changeSelectionStyle", {data: style});
|
||||||
},
|
},
|
||||||
initialValue: "line",
|
initialValue: "line"
|
||||||
},
|
},
|
||||||
highlightActiveLine: {
|
highlightActiveLine: {
|
||||||
set: function() {this.$updateHighlightActiveLine();},
|
set: function() {this.$updateHighlightActiveLine();},
|
||||||
|
|
|
||||||
|
|
@ -651,7 +651,7 @@ module.exports = {
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.backspace = module.exports.left = module.exports.h;
|
module.exports.backspace = module.exports.left = module.exports.h;
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ define(function(require, exports, module) {
|
||||||
regex : '###',
|
regex : '###',
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
defaultToken : "comment",
|
defaultToken : "comment"
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
this.normalizeRules();
|
this.normalizeRules();
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
||||||
"elseif": -1,
|
"elseif": -1,
|
||||||
"end": -1,
|
"end": -1,
|
||||||
"repeat": 1,
|
"repeat": 1,
|
||||||
"until": -1,
|
"until": -1
|
||||||
};
|
};
|
||||||
|
|
||||||
var token = stream.getCurrentToken();
|
var token = stream.getCurrentToken();
|
||||||
|
|
|
||||||
|
|
@ -263,15 +263,15 @@ var JadeHighlightRules = function() {
|
||||||
regex : escapedRe
|
regex : escapedRe
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '[^"\\\\]+',
|
regex : '[^"\\\\]+'
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "\\\\$",
|
regex : "\\\\$",
|
||||||
next : "qqstring",
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '"|$',
|
regex : '"|$',
|
||||||
next : "tag_attributes",
|
next : "tag_attributes"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"qstring" : [
|
"qstring" : [
|
||||||
|
|
@ -280,15 +280,15 @@ var JadeHighlightRules = function() {
|
||||||
regex : escapedRe
|
regex : escapedRe
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "[^'\\\\]+",
|
regex : "[^'\\\\]+"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "\\\\$",
|
regex : "\\\\$",
|
||||||
next : "qstring",
|
next : "qstring"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "'|$",
|
regex : "'|$",
|
||||||
next : "tag_attributes",
|
next : "tag_attributes"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ var JavaScriptHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token: "string.regexp",
|
token: "string.regexp",
|
||||||
regex: "\\/",
|
regex: "\\/",
|
||||||
next: "regex",
|
next: "regex"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+|^$",
|
regex : "\\s+|^$",
|
||||||
|
|
@ -242,7 +242,7 @@ var JavaScriptHighlightRules = function() {
|
||||||
// flag
|
// flag
|
||||||
token: "string.regexp",
|
token: "string.regexp",
|
||||||
regex: "/\\w*",
|
regex: "/\\w*",
|
||||||
next: "no_regex",
|
next: "no_regex"
|
||||||
}, {
|
}, {
|
||||||
// invalid operators
|
// invalid operators
|
||||||
token : "invalid",
|
token : "invalid",
|
||||||
|
|
@ -257,7 +257,7 @@ var JavaScriptHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token: "constant.language.escape",
|
token: "constant.language.escape",
|
||||||
regex: /\[\^?/,
|
regex: /\[\^?/,
|
||||||
next: "regex_character_class",
|
next: "regex_character_class"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
regex: "$",
|
regex: "$",
|
||||||
|
|
@ -291,10 +291,10 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex: identifierRe
|
regex: identifierRe
|
||||||
}, {
|
}, {
|
||||||
token: "punctuation.operator",
|
token: "punctuation.operator",
|
||||||
regex: "[, ]+",
|
regex: "[, ]+"
|
||||||
}, {
|
}, {
|
||||||
token: "punctuation.operator",
|
token: "punctuation.operator",
|
||||||
regex: "$",
|
regex: "$"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
regex: "",
|
regex: "",
|
||||||
|
|
@ -316,11 +316,11 @@ var JavaScriptHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "\\\\$",
|
regex : "\\\\$",
|
||||||
next : "qqstring",
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '"|$',
|
regex : '"|$',
|
||||||
next : "no_regex",
|
next : "no_regex"
|
||||||
}, {
|
}, {
|
||||||
defaultToken: "string"
|
defaultToken: "string"
|
||||||
}
|
}
|
||||||
|
|
@ -332,11 +332,11 @@ var JavaScriptHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "\\\\$",
|
regex : "\\\\$",
|
||||||
next : "qstring",
|
next : "qstring"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "'|$",
|
regex : "'|$",
|
||||||
next : "no_regex",
|
next : "no_regex"
|
||||||
}, {
|
}, {
|
||||||
defaultToken: "string"
|
defaultToken: "string"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,15 +79,15 @@ var JsonHighlightRules = function() {
|
||||||
regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
|
regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '[^"\\\\]+',
|
regex : '[^"\\\\]+'
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '"',
|
regex : '"',
|
||||||
next : "start",
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "",
|
regex : "",
|
||||||
next : "start",
|
next : "start"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ var ObjectiveCHighlightRules = function() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
token: ["support.class.cocoa"],
|
token: ["support.class.cocoa"],
|
||||||
regex: "(?:\\b)(NS(?:R(?:u(?:nLoop|ler(?:Marker|View))|e(?:sponder|cursiveLock|lativeSpecifier)|an(?:domSpecifier|geSpecifier))|G(?:etCommand|lyph(?:Generator|Storage|Info)|raphicsContext)|XML(?:Node|D(?:ocument|TD(?:Node)?)|Parser|Element)|M(?:iddleSpecifier|ov(?:ie(?:View)?|eCommand)|utable(?:S(?:tring|et)|C(?:haracterSet|opying)|IndexSet|D(?:ictionary|ata)|URLRequest|ParagraphStyle|A(?:ttributedString|rray))|e(?:ssagePort(?:NameServer)?|nu(?:Item(?:Cell)?|View)?|t(?:hodSignature|adata(?:Item|Query(?:ResultGroup|AttributeValueTuple)?)))|a(?:ch(?:BootstrapServer|Port)|trix))|B(?:itmapImageRep|ox|u(?:ndle|tton(?:Cell)?)|ezierPath|rowser(?:Cell)?)|S(?:hadow|c(?:anner|r(?:ipt(?:SuiteRegistry|C(?:o(?:ercionHandler|mmand(?:Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(?:er|View)|een))|t(?:epper(?:Cell)?|atus(?:Bar|Item)|r(?:ing|eam))|imple(?:HorizontalTypesetter|CString)|o(?:cketPort(?:NameServer)?|und|rtDescriptor)|p(?:e(?:cifierTest|ech(?:Recognizer|Synthesizer)|ll(?:Server|Checker))|litView)|e(?:cureTextField(?:Cell)?|t(?:Command)?|archField(?:Cell)?|rializer|gmentedC(?:ontrol|ell))|lider(?:Cell)?|avePanel)|H(?:ost|TTP(?:Cookie(?:Storage)?|URLResponse)|elpManager)|N(?:ib(?:Con(?:nector|trolConnector)|OutletConnector)?|otification(?:Center|Queue)?|u(?:ll|mber(?:Formatter)?)|etService(?:Browser)?|ameSpecifier)|C(?:ha(?:ngeSpelling|racterSet)|o(?:n(?:stantString|nection|trol(?:ler)?|ditionLock)|d(?:ing|er)|unt(?:Command|edSet)|pying|lor(?:Space|P(?:ick(?:ing(?:Custom|Default)|er)|anel)|Well|List)?|m(?:p(?:oundPredicate|arisonPredicate)|boBox(?:Cell)?))|u(?:stomImageRep|rsor)|IImageRep|ell|l(?:ipView|o(?:seCommand|neCommand)|assDescription)|a(?:ched(?:ImageRep|URLResponse)|lendar(?:Date)?)|reateCommand)|T(?:hread|ypesetter|ime(?:Zone|r)|o(?:olbar(?:Item(?:Validations)?)?|kenField(?:Cell)?)|ext(?:Block|Storage|Container|Tab(?:le(?:Block)?)?|Input|View|Field(?:Cell)?|List|Attachment(?:Cell)?)?|a(?:sk|b(?:le(?:Header(?:Cell|View)|Column|View)|View(?:Item)?))|reeController)|I(?:n(?:dex(?:S(?:pecifier|et)|Path)|put(?:Manager|S(?:tream|erv(?:iceProvider|er(?:MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(?:Rep|Cell|View)?)|O(?:ut(?:putStream|lineView)|pen(?:GL(?:Context|Pixel(?:Buffer|Format)|View)|Panel)|bj(?:CTypeSerializationCallBack|ect(?:Controller)?))|D(?:i(?:st(?:antObject(?:Request)?|ributed(?:NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(?:Controller)?|e(?:serializer|cimalNumber(?:Behaviors|Handler)?|leteCommand)|at(?:e(?:Components|Picker(?:Cell)?|Formatter)?|a)|ra(?:wer|ggingInfo))|U(?:ser(?:InterfaceValidations|Defaults(?:Controller)?)|RL(?:Re(?:sponse|quest)|Handle(?:Client)?|C(?:onnection|ache|redential(?:Storage)?)|Download(?:Delegate)?|Prot(?:ocol(?:Client)?|ectionSpace)|AuthenticationChallenge(?:Sender)?)?|n(?:iqueIDSpecifier|doManager|archiver))|P(?:ipe|o(?:sitionalSpecifier|pUpButton(?:Cell)?|rt(?:Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImageRep|a(?:steboard|nel|ragraphStyle|geLayout)|r(?:int(?:Info|er|Operation|Panel)|o(?:cessInfo|tocolChecker|perty(?:Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(?:numerator|vent|PSImageRep|rror|x(?:ception|istsCommand|pression))|V(?:iew(?:Animation)?|al(?:idated(?:ToobarItem|UserInterfaceItem)|ue(?:Transformer)?))|Keyed(?:Unarchiver|Archiver)|Qui(?:ckDrawView|tCommand)|F(?:ile(?:Manager|Handle|Wrapper)|o(?:nt(?:Manager|Descriptor|Panel)?|rm(?:Cell|atter)))|W(?:hoseSpecifier|indow(?:Controller)?|orkspace)|L(?:o(?:c(?:k(?:ing)?|ale)|gicalTest)|evelIndicator(?:Cell)?|ayoutManager)|A(?:ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(?:ication|e(?:Script|Event(?:Manager|Descriptor)))|ffineTransform|lert|r(?:chiver|ray(?:Controller)?))))(?:\\b)",
|
regex: "(?:\\b)(NS(?:R(?:u(?:nLoop|ler(?:Marker|View))|e(?:sponder|cursiveLock|lativeSpecifier)|an(?:domSpecifier|geSpecifier))|G(?:etCommand|lyph(?:Generator|Storage|Info)|raphicsContext)|XML(?:Node|D(?:ocument|TD(?:Node)?)|Parser|Element)|M(?:iddleSpecifier|ov(?:ie(?:View)?|eCommand)|utable(?:S(?:tring|et)|C(?:haracterSet|opying)|IndexSet|D(?:ictionary|ata)|URLRequest|ParagraphStyle|A(?:ttributedString|rray))|e(?:ssagePort(?:NameServer)?|nu(?:Item(?:Cell)?|View)?|t(?:hodSignature|adata(?:Item|Query(?:ResultGroup|AttributeValueTuple)?)))|a(?:ch(?:BootstrapServer|Port)|trix))|B(?:itmapImageRep|ox|u(?:ndle|tton(?:Cell)?)|ezierPath|rowser(?:Cell)?)|S(?:hadow|c(?:anner|r(?:ipt(?:SuiteRegistry|C(?:o(?:ercionHandler|mmand(?:Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(?:er|View)|een))|t(?:epper(?:Cell)?|atus(?:Bar|Item)|r(?:ing|eam))|imple(?:HorizontalTypesetter|CString)|o(?:cketPort(?:NameServer)?|und|rtDescriptor)|p(?:e(?:cifierTest|ech(?:Recognizer|Synthesizer)|ll(?:Server|Checker))|litView)|e(?:cureTextField(?:Cell)?|t(?:Command)?|archField(?:Cell)?|rializer|gmentedC(?:ontrol|ell))|lider(?:Cell)?|avePanel)|H(?:ost|TTP(?:Cookie(?:Storage)?|URLResponse)|elpManager)|N(?:ib(?:Con(?:nector|trolConnector)|OutletConnector)?|otification(?:Center|Queue)?|u(?:ll|mber(?:Formatter)?)|etService(?:Browser)?|ameSpecifier)|C(?:ha(?:ngeSpelling|racterSet)|o(?:n(?:stantString|nection|trol(?:ler)?|ditionLock)|d(?:ing|er)|unt(?:Command|edSet)|pying|lor(?:Space|P(?:ick(?:ing(?:Custom|Default)|er)|anel)|Well|List)?|m(?:p(?:oundPredicate|arisonPredicate)|boBox(?:Cell)?))|u(?:stomImageRep|rsor)|IImageRep|ell|l(?:ipView|o(?:seCommand|neCommand)|assDescription)|a(?:ched(?:ImageRep|URLResponse)|lendar(?:Date)?)|reateCommand)|T(?:hread|ypesetter|ime(?:Zone|r)|o(?:olbar(?:Item(?:Validations)?)?|kenField(?:Cell)?)|ext(?:Block|Storage|Container|Tab(?:le(?:Block)?)?|Input|View|Field(?:Cell)?|List|Attachment(?:Cell)?)?|a(?:sk|b(?:le(?:Header(?:Cell|View)|Column|View)|View(?:Item)?))|reeController)|I(?:n(?:dex(?:S(?:pecifier|et)|Path)|put(?:Manager|S(?:tream|erv(?:iceProvider|er(?:MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(?:Rep|Cell|View)?)|O(?:ut(?:putStream|lineView)|pen(?:GL(?:Context|Pixel(?:Buffer|Format)|View)|Panel)|bj(?:CTypeSerializationCallBack|ect(?:Controller)?))|D(?:i(?:st(?:antObject(?:Request)?|ributed(?:NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(?:Controller)?|e(?:serializer|cimalNumber(?:Behaviors|Handler)?|leteCommand)|at(?:e(?:Components|Picker(?:Cell)?|Formatter)?|a)|ra(?:wer|ggingInfo))|U(?:ser(?:InterfaceValidations|Defaults(?:Controller)?)|RL(?:Re(?:sponse|quest)|Handle(?:Client)?|C(?:onnection|ache|redential(?:Storage)?)|Download(?:Delegate)?|Prot(?:ocol(?:Client)?|ectionSpace)|AuthenticationChallenge(?:Sender)?)?|n(?:iqueIDSpecifier|doManager|archiver))|P(?:ipe|o(?:sitionalSpecifier|pUpButton(?:Cell)?|rt(?:Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImageRep|a(?:steboard|nel|ragraphStyle|geLayout)|r(?:int(?:Info|er|Operation|Panel)|o(?:cessInfo|tocolChecker|perty(?:Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(?:numerator|vent|PSImageRep|rror|x(?:ception|istsCommand|pression))|V(?:iew(?:Animation)?|al(?:idated(?:ToobarItem|UserInterfaceItem)|ue(?:Transformer)?))|Keyed(?:Unarchiver|Archiver)|Qui(?:ckDrawView|tCommand)|F(?:ile(?:Manager|Handle|Wrapper)|o(?:nt(?:Manager|Descriptor|Panel)?|rm(?:Cell|atter)))|W(?:hoseSpecifier|indow(?:Controller)?|orkspace)|L(?:o(?:c(?:k(?:ing)?|ale)|gicalTest)|evelIndicator(?:Cell)?|ayoutManager)|A(?:ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(?:ication|e(?:Script|Event(?:Manager|Descriptor)))|ffineTransform|lert|r(?:chiver|ray(?:Controller)?))))(?:\\b)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
token: ["support.type.cocoa.leopard"],
|
token: ["support.type.cocoa.leopard"],
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ var SassHighlightRules = function() {
|
||||||
regex: "/\\*|[{;}]"
|
regex: "/\\*|[{;}]"
|
||||||
}, {
|
}, {
|
||||||
token: "support.type",
|
token: "support.type",
|
||||||
regex: /^\s*:[\w\-]+\s/,
|
regex: /^\s*:[\w\-]+\s/
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$rules.comment = [
|
this.$rules.comment = [
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ var TomlHighlightRules = function() {
|
||||||
{
|
{
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "\\\\$",
|
regex : "\\\\$",
|
||||||
next : "qqstring",
|
next : "qqstring"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
token : "constant.language.escape",
|
token : "constant.language.escape",
|
||||||
|
|
@ -87,7 +87,7 @@ var TomlHighlightRules = function() {
|
||||||
{
|
{
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '"|$',
|
regex : '"|$',
|
||||||
next : "start",
|
next : "start"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
defaultToken: "string"
|
defaultToken: "string"
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ var VBScriptHighlightRules = function() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
token: "comment.line.apostrophe.asp",
|
token: "comment.line.apostrophe.asp",
|
||||||
regex: ".",
|
regex: "."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"string": [
|
"string": [
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ module.exports = {
|
||||||
"juhu",
|
"juhu",
|
||||||
"12\t\t34",
|
"12\t\t34",
|
||||||
"ぁぁa",
|
"ぁぁa",
|
||||||
"\t\t34",
|
"\t\t34"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var range = new Range(0, 0, 0, 3);
|
var range = new Range(0, 0, 0, 3);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ var testNames = [
|
||||||
"ace/search_test",
|
"ace/search_test",
|
||||||
"ace/selection_test",
|
"ace/selection_test",
|
||||||
"ace/token_iterator_test",
|
"ace/token_iterator_test",
|
||||||
|
"ace/tokenizer_test",
|
||||||
"ace/virtual_renderer_test"
|
"ace/virtual_renderer_test"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ var Tokenizer = function(rules) {
|
||||||
flag = "gi";
|
flag = "gi";
|
||||||
if (rule.regex == null)
|
if (rule.regex == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (rule.regex instanceof RegExp)
|
if (rule.regex instanceof RegExp)
|
||||||
rule.regex = rule.regex.toString().slice(1, -1);
|
rule.regex = rule.regex.toString().slice(1, -1);
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ var Tokenizer = function(rules) {
|
||||||
else
|
else
|
||||||
rule.onMatch = rule.token;
|
rule.onMatch = rule.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchcount > 1) {
|
if (matchcount > 1) {
|
||||||
if (/\\\d/.test(rule.regex)) {
|
if (/\\\d/.test(rule.regex)) {
|
||||||
// Replace any backreferences and offset appropriately.
|
// Replace any backreferences and offset appropriately.
|
||||||
|
|
@ -106,7 +106,7 @@ var Tokenizer = function(rules) {
|
||||||
matchTotal += matchcount;
|
matchTotal += matchcount;
|
||||||
|
|
||||||
ruleRegExps.push(adjustedregex);
|
ruleRegExps.push(adjustedregex);
|
||||||
|
|
||||||
// makes property access faster
|
// makes property access faster
|
||||||
if (!rule.onMatch)
|
if (!rule.onMatch)
|
||||||
rule.onMatch = null;
|
rule.onMatch = null;
|
||||||
|
|
@ -121,7 +121,7 @@ var Tokenizer = function(rules) {
|
||||||
this.$applyToken = function(str) {
|
this.$applyToken = function(str) {
|
||||||
var values = this.splitRegex.exec(str).slice(1);
|
var values = this.splitRegex.exec(str).slice(1);
|
||||||
var types = this.token.apply(this, values);
|
var types = this.token.apply(this, values);
|
||||||
|
|
||||||
// required for compatibility with old modes
|
// required for compatibility with old modes
|
||||||
if (typeof types === "string")
|
if (typeof types === "string")
|
||||||
return [{type: types, value: str}];
|
return [{type: types, value: str}];
|
||||||
|
|
@ -157,7 +157,7 @@ var Tokenizer = function(rules) {
|
||||||
}
|
}
|
||||||
return tokens;
|
return tokens;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.removeCapturingGroups = function(src) {
|
this.removeCapturingGroups = function(src) {
|
||||||
var r = src.replace(
|
var r = src.replace(
|
||||||
/\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,
|
/\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,
|
||||||
|
|
@ -165,13 +165,13 @@ var Tokenizer = function(rules) {
|
||||||
);
|
);
|
||||||
return r;
|
return r;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createSplitterRegexp = function(src, flag) {
|
this.createSplitterRegexp = function(src, flag) {
|
||||||
if (src.indexOf("(?=") != -1) {
|
if (src.indexOf("(?=") != -1) {
|
||||||
var stack = 0;
|
var stack = 0;
|
||||||
var inChClass = false;
|
var inChClass = false;
|
||||||
var lastCapture = {};
|
var lastCapture = {};
|
||||||
src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([])/g, function(
|
src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function(
|
||||||
m, esc, parenOpen, parenClose, square, index
|
m, esc, parenOpen, parenClose, square, index
|
||||||
) {
|
) {
|
||||||
if (inChClass) {
|
if (inChClass) {
|
||||||
|
|
@ -179,8 +179,10 @@ var Tokenizer = function(rules) {
|
||||||
} else if (square) {
|
} else if (square) {
|
||||||
inChClass = true;
|
inChClass = true;
|
||||||
} else if (parenClose) {
|
} else if (parenClose) {
|
||||||
if (stack == lastCapture.stack)
|
if (stack == lastCapture.stack) {
|
||||||
lastCapture.end = index+1
|
lastCapture.end = index+1;
|
||||||
|
lastCapture.stack = -1;
|
||||||
|
}
|
||||||
stack--;
|
stack--;
|
||||||
} else if (parenOpen) {
|
} else if (parenOpen) {
|
||||||
stack++;
|
stack++;
|
||||||
|
|
|
||||||
69
lib/ace/tokenizer_test.js
Normal file
69
lib/ace/tokenizer_test.js
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Distributed under the BSD license:
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* 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 ***** */
|
||||||
|
|
||||||
|
if (typeof process !== "undefined") {
|
||||||
|
require("amd-loader");
|
||||||
|
}
|
||||||
|
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Tokenizer = require("./tokenizer").Tokenizer;
|
||||||
|
var assert = require("./test/assertions");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
"test: createSplitterRegexp" : function() {
|
||||||
|
var t = new Tokenizer({});
|
||||||
|
var re = t.createSplitterRegexp("(a)(b)(?=[x)(])");
|
||||||
|
assert.equal(re.source, "(a)(b)");
|
||||||
|
var re = t.createSplitterRegexp("xc(?=([x)(]))");
|
||||||
|
assert.equal(re.source, "xc");
|
||||||
|
var re = t.createSplitterRegexp("(xc(?=([x)(])))");
|
||||||
|
assert.equal(re.source, "(xc)");
|
||||||
|
var re = t.createSplitterRegexp("(?=r)[(?=)](?=([x)(]))");
|
||||||
|
assert.equal(re.source, "(?=r)[(?=)]");
|
||||||
|
var re = t.createSplitterRegexp("(?=r)[(?=)](\\?=t)");
|
||||||
|
assert.equal(re.source, "(?=r)[(?=)](\\?=t)");
|
||||||
|
var re = t.createSplitterRegexp("[(?=)](\\?=t)");
|
||||||
|
assert.equal(re.source, "[(?=)](\\?=t)");
|
||||||
|
},
|
||||||
|
|
||||||
|
"test: removeCapturingGroups" : function() {
|
||||||
|
var t = new Tokenizer({});
|
||||||
|
var re = t.removeCapturingGroups("(ax(by))[()]");
|
||||||
|
assert.equal(re, "(?:ax(?:by))[()]");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if (typeof module !== "undefined" && module === require.main) {
|
||||||
|
require("asyncjs").test.testcase(module.exports).exec()
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -203,8 +203,8 @@ function quoteString(str) {
|
||||||
return '"' + str.replace(/\\/, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\\n") + '"';
|
return '"' + str.replace(/\\/, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\\n") + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
var cssTemplate = fs.readFileSync(__dirname + "/Theme.tmpl.css", "utf8");
|
var cssTemplate = fs.readFileSync(__dirname + "/theme.tmpl.css", "utf8");
|
||||||
var jsTemplate = fs.readFileSync(__dirname + "/Theme.tmpl.js", "utf8");
|
var jsTemplate = fs.readFileSync(__dirname + "/theme.tmpl.js", "utf8");
|
||||||
|
|
||||||
function normalizeStylesheet(rules) {
|
function normalizeStylesheet(rules) {
|
||||||
for (var i = rules.length; i--; ) {
|
for (var i = rules.length; i--; ) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue