Comparing version 1.0.0-alpha.32 to 1.0.0-alpha.33
@@ -0,1 +1,6 @@ | ||
## 1.0.0-alpha.33 (July 12, 2019) | ||
- Lexer | ||
- Fixed low priority productions matching by changing an approach for robust one (#103) | ||
## 1.0.0-alpha.32 (July 12, 2019) | ||
@@ -2,0 +7,0 @@ |
@@ -73,6 +73,2 @@ var parse = require('./grammar/parse'); | ||
); | ||
if (i > 0) { | ||
result.checkStash = true; | ||
} | ||
}; | ||
@@ -286,3 +282,2 @@ | ||
result.checkStash = true; | ||
result.then = createCondition( | ||
@@ -321,3 +316,2 @@ MATCH, | ||
); | ||
result.checkStash = true; | ||
} | ||
@@ -324,0 +318,0 @@ } |
@@ -102,3 +102,3 @@ var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
thenStack: thenStack, | ||
tokenCursor: tokenIndex, | ||
tokenIndex: tokenIndex, | ||
token: token, | ||
@@ -131,7 +131,4 @@ prev: prev | ||
moveToNextToken(); | ||
syntaxStash = null; | ||
if (syntaxStash !== null) { | ||
syntaxStash = null; | ||
} | ||
if (tokenIndex > longestMatch) { | ||
@@ -248,13 +245,15 @@ longestMatch = tokenIndex; | ||
case 'Mismatch': | ||
if (elseStack === null) { | ||
if (syntaxStash === null || syntaxStash === false) { | ||
// no else branches and no stashed syntax -> break the main loop | ||
// return a result - MISMATCH | ||
exitReason = EXIT_REASON_MISMATCH; | ||
break; | ||
// when some syntax is stashed | ||
if (syntaxStash !== null && syntaxStash !== false) { | ||
// there is no else branches or a branch reduce match stack | ||
if (elseStack === null || tokenIndex > elseStack.tokenIndex) { | ||
// restore state from the stash | ||
elseStack = syntaxStash; | ||
syntaxStash = false; // disable stashing | ||
} | ||
// restore from the stash | ||
elseStack = syntaxStash; | ||
syntaxStash = false; // disable stashing | ||
} else if (elseStack === null) { | ||
// no else branches -> break the main loop | ||
// return a result - MISMATCH | ||
exitReason = EXIT_REASON_MISMATCH; | ||
break; | ||
} | ||
@@ -269,3 +268,3 @@ | ||
matchStack = elseStack.matchStack; | ||
tokenIndex = elseStack.tokenCursor; | ||
tokenIndex = elseStack.tokenIndex; | ||
token = elseStack.token; | ||
@@ -282,15 +281,2 @@ | ||
case 'If': | ||
if (state.checkStash) { | ||
if (syntaxStash !== null) { | ||
if (syntaxStash !== false) { | ||
elseStack = syntaxStash; | ||
syntaxStash = false; // disable stashing | ||
state = MISMATCH; | ||
break; | ||
} | ||
syntaxStash = null; | ||
} | ||
} | ||
// IMPORTANT: else stack push must go first, | ||
@@ -297,0 +283,0 @@ // since it stores the state of thenStack before changes |
{ | ||
"name": "css-tree", | ||
"version": "1.0.0-alpha.32", | ||
"version": "1.0.0-alpha.33", | ||
"description": "CSSTree is a tool set to work with CSS, including fast detailed parser (string->AST), walker (AST traversal), generator (AST->string) and lexer (validation and matching) based on knowledge of spec and browser implementations", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
615164
9707