deprecate substr method and use existing strip function in grammar
This commit is contained in:
@@ -24,7 +24,7 @@ export function SourceLocation(source, locInfo) {
|
|||||||
|
|
||||||
export function id(token) {
|
export function id(token) {
|
||||||
if (/^\[.*\]$/.test(token)) {
|
if (/^\[.*\]$/.test(token)) {
|
||||||
return token.substr(1, token.length - 2);
|
return token.substring(1, token.length - 1);
|
||||||
} else {
|
} else {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@
|
|||||||
%{
|
%{
|
||||||
|
|
||||||
function strip(start, end) {
|
function strip(start, end) {
|
||||||
return yytext = yytext.substr(start, yyleng-end);
|
return yytext = yytext.substring(start, yyleng - end + start);
|
||||||
}
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
@@ -59,7 +59,7 @@ ID [^\s!"#%-,\.\/;->@\[-\^`\{-~]+/{LOOKAHEAD}
|
|||||||
if (this.conditionStack[this.conditionStack.length-1] === 'raw') {
|
if (this.conditionStack[this.conditionStack.length-1] === 'raw') {
|
||||||
return 'CONTENT';
|
return 'CONTENT';
|
||||||
} else {
|
} else {
|
||||||
yytext = yytext.substr(5, yyleng-9);
|
strip(5, 9);
|
||||||
return 'END_RAW_BLOCK';
|
return 'END_RAW_BLOCK';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user