lezer-feel
Advanced tools
Comparing version 1.2.6 to 1.2.7
@@ -12,2 +12,7 @@ import { LRParser, ContextTracker } from '@lezer/lr'; | ||
export class VariableContext { | ||
value: any; | ||
constructor(value: any); | ||
get(key: string): any; | ||
@@ -14,0 +19,0 @@ set(key: string, value: any): this; |
@@ -53,4 +53,9 @@ import { ExternalTokenizer, ContextTracker, LRParser } from '@lezer/lr'; | ||
// @ts-expect-error env access | ||
const LOG_PARSE = typeof process != 'undefined' && process.env && /\bfparse(:dbg)?\b/.test(process.env.LOG); | ||
// @ts-expect-error env access | ||
const LOG_PARSE_DEBUG = typeof process != 'undefined' && process.env && /\bfparse:dbg\b/.test(process.env.LOG); | ||
// @ts-expect-error env access | ||
const LOG_VARS = typeof process != 'undefined' && process.env && /\bcontext\b/.test(process.env.LOG); | ||
@@ -449,3 +454,3 @@ | ||
/** | ||
* @param { Function } | ||
* @param { Function } fn | ||
* | ||
@@ -509,7 +514,9 @@ * @return { ValueProducer } | ||
if (this.constructor.isAtomic(result)) { | ||
const constructor = /** @type { typeof VariableContext } */ (this.constructor); | ||
if (constructor.isAtomic(result)) { | ||
return result; | ||
} | ||
return this.constructor.of(result); | ||
return constructor.of(result); | ||
} | ||
@@ -522,6 +529,10 @@ | ||
* @param {any} value | ||
* | ||
* @returns {VariableContext} new context with the given key added | ||
*/ | ||
set(key, value) { | ||
return this.constructor.of({ | ||
const constructor = /** @type { typeof VariableContext } */ (this.constructor); | ||
return constructor.of({ | ||
...this.value, | ||
@@ -584,5 +595,5 @@ [key]: value | ||
parent = null, | ||
context, | ||
value, | ||
raw | ||
context = null, | ||
value = null, | ||
raw = null | ||
} = {}) { | ||
@@ -733,2 +744,5 @@ this.name = name; | ||
/** | ||
* @type {Variables} | ||
*/ | ||
let parent = this; | ||
@@ -853,3 +867,3 @@ | ||
* @param { Variables } variables | ||
* @param { string } name | ||
* @param { string } scopeName | ||
* @param { string } code | ||
@@ -976,2 +990,3 @@ * @return { Variables } | ||
// @ts-expect-error internal method | ||
const code = input.read(input.pos, stack.pos); | ||
@@ -1184,3 +1199,3 @@ | ||
'Type/...': tags.typeName, | ||
Wildcard: tags.special, | ||
Wildcard: tags.special(tags.variableName), | ||
null: tags.null, | ||
@@ -1187,0 +1202,0 @@ LineComment: tags.lineComment, |
{ | ||
"name": "lezer-feel", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"description": "Lezer-based FEEL grammar", | ||
"type": "module", | ||
"exports": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
".": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"source": "src/index.js", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"author": "Nico Rehwaldt <https://github.com/nikku>", | ||
@@ -22,2 +22,3 @@ "license": "MIT", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^20.11.24", | ||
"chai": "^4.4.1", | ||
@@ -51,5 +52,5 @@ "chokidar-cli": "^3.0.0", | ||
"dev:test": "chokidar '{dist,test}/**/*.{js,cjs,txt}' -c 'npm test'", | ||
"all": "run-s lint build test:types test", | ||
"all": "run-s lint build check-types test", | ||
"lint": "eslint .", | ||
"test:types": "tsc --lib es6 --noEmit test/test-types.ts", | ||
"check-types": "tsc --noEmit", | ||
"prepare": "run-s build" | ||
@@ -56,0 +57,0 @@ }, |
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
227865
2093
14