fix #582: auto-type custom fields with spaces

This commit is contained in:
antelle 2017-05-06 19:28:22 +02:00
parent 3978f3c11d
commit 7ef2dba018
1 changed files with 3 additions and 10 deletions

View File

@ -6,7 +6,7 @@ const AutoTypeParser = function(sequence) {
this.states = [];
};
AutoTypeParser.opSepRegex = /[\s:=]+/;
AutoTypeParser.opRegex = /^(.*?)(?:([\s:=])[\s:=]*(.*))?$/;
AutoTypeParser.prototype.parse = function() {
const len = this.sequence.length;
@ -75,15 +75,8 @@ AutoTypeParser.prototype.readOp = function() {
this.addChar(contents);
return;
}
const parts = contents.split(AutoTypeParser.opSepRegex, 2);
if (parts.length > 1 && parts[0].length && parts[1].length) {
const op = parts[0];
const sep = contents.substr(op.length, 1);
const arg = parts[1];
this.addOp(op, sep, arg);
} else {
this.addOp(contents);
}
const [, op, sep, arg] = contents.match(AutoTypeParser.opRegex);
this.addOp(op, sep, arg);
};
AutoTypeParser.prototype.readModifier = function(modifier) {