good-enough-parser
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -35,2 +35,3 @@ "use strict"; | ||
const result = { ...strState }; | ||
let strStateName = null; | ||
Object.entries(result).forEach(([key, val]) => { | ||
@@ -46,3 +47,4 @@ if (val.t !== 'fallback') { | ||
else { | ||
result[key] = { ...val }; | ||
delete result[key]; | ||
strStateName = key; | ||
} | ||
@@ -67,2 +69,8 @@ }); | ||
} | ||
if (strStateName) { | ||
result[strStateName] = { t: 'regex', match: /./, lineBreaks: true, pop: 1 }; | ||
} | ||
else { | ||
throw new Error(`Fallback value is missing for variable-style template`); | ||
} | ||
return result; | ||
@@ -69,0 +77,0 @@ } |
@@ -93,2 +93,7 @@ "use strict"; | ||
} | ||
if (token.type === 'string-value' && prevToken.type === 'string-value') { | ||
prevToken.value += token.value; | ||
prevToken.lineBreaks += token.lineBreaks; | ||
continue; | ||
} | ||
if (token.type === 'bracket-left') { | ||
@@ -95,0 +100,0 @@ stack.push(currentTree); |
@@ -32,2 +32,3 @@ import { getCounterpartBracketKey, isBracketKey, isRightKey } from './bracket'; | ||
const result = { ...strState }; | ||
let strStateName = null; | ||
Object.entries(result).forEach(([key, val]) => { | ||
@@ -43,3 +44,4 @@ if (val.t !== 'fallback') { | ||
else { | ||
result[key] = { ...val }; | ||
delete result[key]; | ||
strStateName = key; | ||
} | ||
@@ -64,2 +66,8 @@ }); | ||
} | ||
if (strStateName) { | ||
result[strStateName] = { t: 'regex', match: /./, lineBreaks: true, pop: 1 }; | ||
} | ||
else { | ||
throw new Error(`Fallback value is missing for variable-style template`); | ||
} | ||
return result; | ||
@@ -66,0 +74,0 @@ } |
@@ -90,2 +90,7 @@ function specialToken(type, prevToken, nextToken) { | ||
} | ||
if (token.type === 'string-value' && prevToken.type === 'string-value') { | ||
prevToken.value += token.value; | ||
prevToken.lineBreaks += token.lineBreaks; | ||
continue; | ||
} | ||
if (token.type === 'bracket-left') { | ||
@@ -92,0 +97,0 @@ stack.push(currentTree); |
{ | ||
"name": "good-enough-parser", | ||
"description": "Parse and query computer programs source code", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"repository": "git@github.com:zharinov/good-enough-parser.git", | ||
@@ -45,9 +45,9 @@ "author": "Sergei Zharinov", | ||
"@renovate/eslint-plugin": "https://github.com/renovatebot/eslint-plugin#v0.0.4", | ||
"@types/jest": "27.0.3", | ||
"@types/node": "16.11.15", | ||
"@typescript-eslint/eslint-plugin": "5.8.0", | ||
"@typescript-eslint/parser": "5.8.0", | ||
"eslint": "8.5.0", | ||
"@types/jest": "27.4.0", | ||
"@types/node": "16.11.18", | ||
"@typescript-eslint/eslint-plugin": "5.9.0", | ||
"@typescript-eslint/parser": "5.9.0", | ||
"eslint": "8.6.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-import": "2.25.3", | ||
"eslint-plugin-import": "2.25.4", | ||
"eslint-plugin-only-warn": "1.0.3", | ||
@@ -62,3 +62,3 @@ "http-server": "14.0.0", | ||
"prettier": "2.5.1", | ||
"pretty-quick": "3.1.2", | ||
"pretty-quick": "3.1.3", | ||
"release-it": "14.11.8", | ||
@@ -65,0 +65,0 @@ "ts-jest": "27.1.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
374620
4986