Comparing version 0.24.0 to 0.25.0
@@ -9,2 +9,8 @@ # Changelog | ||
## 0.25.0 | ||
* `CHORE`: add typings | ||
* `DEPS`: bump to `lezer-feel@0.5` | ||
* `DEPS`: bump to `lezer@1` | ||
## 0.24.0 | ||
@@ -11,0 +17,0 @@ |
@@ -59,3 +59,3 @@ import { parser as parser$1 } from 'lezer-feel'; | ||
}, | ||
'string': fn(function (obj, b) { | ||
'string': fn(function (obj) { | ||
if (arguments.length !== 1) { | ||
@@ -209,9 +209,9 @@ return null; | ||
'union': fn(function () { | ||
var lists = []; | ||
var _lists = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
lists[_i] = arguments[_i]; | ||
_lists[_i] = arguments[_i]; | ||
} | ||
throw notImplemented('union'); | ||
}, ['list']), | ||
'distinct values': fn(function (list) { | ||
'distinct values': fn(function (_list) { | ||
throw notImplemented('distinct values'); | ||
@@ -227,9 +227,9 @@ }, ['list']), | ||
}, 'number'), | ||
'median': listFn(function (numbers) { | ||
'median': listFn(function (_numbers) { | ||
throw notImplemented('median'); | ||
}, 'number'), | ||
'stddev': listFn(function (numbers) { | ||
'stddev': listFn(function (_numbers) { | ||
throw notImplemented('stddev'); | ||
}, 'number'), | ||
'mode': listFn(function (numbers) { | ||
'mode': listFn(function (_numbers) { | ||
throw notImplemented('mode'); | ||
@@ -490,3 +490,3 @@ }, 'number'), | ||
} | ||
return '{' + Object.entries(obj).map(function (entry, idx) { | ||
return '{' + Object.entries(obj).map(function (entry) { | ||
return toKeyString(entry[0]) + ': ' + toDeepString(entry[1]); | ||
@@ -616,10 +616,12 @@ }).join(', ') + '}'; | ||
tree.iterate({ | ||
enter: function (node, start, end) { | ||
if (node.isError) { | ||
throw new Error("Statement unparseable at [" + start + ", " + end + "]"); | ||
enter: function (nodeRef) { | ||
var _c = nodeRef.type, isError = _c.isError, isSkipped = _c.isSkipped; | ||
var from = nodeRef.from, to = nodeRef.to; | ||
if (isError) { | ||
throw new Error("Statement unparseable at [" + from + ", " + to + "]"); | ||
} | ||
if (node.isSkipped) { | ||
if (isSkipped) { | ||
return false; | ||
} | ||
var nodeInput = input.slice(start, end); | ||
var nodeInput = input.slice(from, to); | ||
stack.push({ | ||
@@ -630,4 +632,4 @@ nodeInput: nodeInput, | ||
}, | ||
leave: function (node, start, end) { | ||
if (node.isSkipped) { | ||
leave: function (nodeRef) { | ||
if (nodeRef.type.isSkipped) { | ||
return; | ||
@@ -637,3 +639,3 @@ } | ||
var parent = stack[stack.length - 1]; | ||
var expr = evalNode(node, nodeInput, args); | ||
var expr = evalNode(nodeRef, nodeInput, args); | ||
parent.args.push(expr); | ||
@@ -723,4 +725,4 @@ } | ||
}, Test('boolean')); | ||
case 'Wildcard': return function (context) { return true; }; | ||
case 'null': return function (context) { | ||
case 'Wildcard': return function (_context) { return true; }; | ||
case 'null': return function (_context) { | ||
return null; | ||
@@ -802,6 +804,6 @@ }; | ||
}, Test('boolean')); | ||
case 'NumericLiteral': return tag(function (context) { return input.includes('.') ? parseFloat(input) : parseInt(input); }, 'number'); | ||
case 'BooleanLiteral': return tag(function (context) { return input === 'true' ? true : false; }, 'boolean'); | ||
case 'StringLiteral': return tag(function (context) { return input.slice(1, -1); }, 'string'); | ||
case 'PositionalParameters': return function (context) { return args; }; | ||
case 'NumericLiteral': return tag(function (_context) { return input.includes('.') ? parseFloat(input) : parseInt(input); }, 'number'); | ||
case 'BooleanLiteral': return tag(function (_context) { return input === 'true' ? true : false; }, 'boolean'); | ||
case 'StringLiteral': return tag(function (_context) { return input.slice(1, -1); }, 'string'); | ||
case 'PositionalParameters': return function (_context) { return args; }; | ||
case 'DateTimeConstructor': return function (context) { | ||
@@ -833,3 +835,3 @@ return getBuiltin(input); | ||
})(); | ||
case 'Parameters': return args.length === 3 ? args[1] : function (context) { return []; }; | ||
case 'Parameters': return args.length === 3 ? args[1] : function (_context) { return []; }; | ||
case 'Comparison': return function (context) { | ||
@@ -1014,3 +1016,3 @@ var operator = args[1]; | ||
} | ||
function getBuiltin(name, context) { | ||
function getBuiltin(name, _context) { | ||
return builtins[name]; | ||
@@ -1086,7 +1088,8 @@ } | ||
function tag(fn, type) { | ||
fn.type = type; | ||
fn.toString = function () { | ||
return "TaggedFunction[" + type + "] " + Function.prototype.toString.call(fn); | ||
}; | ||
return fn; | ||
return Object.assign(fn, { | ||
type: type, | ||
toString: function () { | ||
return "TaggedFunction[" + type + "] " + Function.prototype.toString.call(fn); | ||
} | ||
}); | ||
} | ||
@@ -1093,0 +1096,0 @@ function combineResult(result, match) { |
@@ -63,3 +63,3 @@ 'use strict'; | ||
}, | ||
'string': fn(function (obj, b) { | ||
'string': fn(function (obj) { | ||
if (arguments.length !== 1) { | ||
@@ -213,9 +213,9 @@ return null; | ||
'union': fn(function () { | ||
var lists = []; | ||
var _lists = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
lists[_i] = arguments[_i]; | ||
_lists[_i] = arguments[_i]; | ||
} | ||
throw notImplemented('union'); | ||
}, ['list']), | ||
'distinct values': fn(function (list) { | ||
'distinct values': fn(function (_list) { | ||
throw notImplemented('distinct values'); | ||
@@ -231,9 +231,9 @@ }, ['list']), | ||
}, 'number'), | ||
'median': listFn(function (numbers) { | ||
'median': listFn(function (_numbers) { | ||
throw notImplemented('median'); | ||
}, 'number'), | ||
'stddev': listFn(function (numbers) { | ||
'stddev': listFn(function (_numbers) { | ||
throw notImplemented('stddev'); | ||
}, 'number'), | ||
'mode': listFn(function (numbers) { | ||
'mode': listFn(function (_numbers) { | ||
throw notImplemented('mode'); | ||
@@ -494,3 +494,3 @@ }, 'number'), | ||
} | ||
return '{' + Object.entries(obj).map(function (entry, idx) { | ||
return '{' + Object.entries(obj).map(function (entry) { | ||
return toKeyString(entry[0]) + ': ' + toDeepString(entry[1]); | ||
@@ -620,10 +620,12 @@ }).join(', ') + '}'; | ||
tree.iterate({ | ||
enter: function (node, start, end) { | ||
if (node.isError) { | ||
throw new Error("Statement unparseable at [" + start + ", " + end + "]"); | ||
enter: function (nodeRef) { | ||
var _c = nodeRef.type, isError = _c.isError, isSkipped = _c.isSkipped; | ||
var from = nodeRef.from, to = nodeRef.to; | ||
if (isError) { | ||
throw new Error("Statement unparseable at [" + from + ", " + to + "]"); | ||
} | ||
if (node.isSkipped) { | ||
if (isSkipped) { | ||
return false; | ||
} | ||
var nodeInput = input.slice(start, end); | ||
var nodeInput = input.slice(from, to); | ||
stack.push({ | ||
@@ -634,4 +636,4 @@ nodeInput: nodeInput, | ||
}, | ||
leave: function (node, start, end) { | ||
if (node.isSkipped) { | ||
leave: function (nodeRef) { | ||
if (nodeRef.type.isSkipped) { | ||
return; | ||
@@ -641,3 +643,3 @@ } | ||
var parent = stack[stack.length - 1]; | ||
var expr = evalNode(node, nodeInput, args); | ||
var expr = evalNode(nodeRef, nodeInput, args); | ||
parent.args.push(expr); | ||
@@ -727,4 +729,4 @@ } | ||
}, Test('boolean')); | ||
case 'Wildcard': return function (context) { return true; }; | ||
case 'null': return function (context) { | ||
case 'Wildcard': return function (_context) { return true; }; | ||
case 'null': return function (_context) { | ||
return null; | ||
@@ -806,6 +808,6 @@ }; | ||
}, Test('boolean')); | ||
case 'NumericLiteral': return tag(function (context) { return input.includes('.') ? parseFloat(input) : parseInt(input); }, 'number'); | ||
case 'BooleanLiteral': return tag(function (context) { return input === 'true' ? true : false; }, 'boolean'); | ||
case 'StringLiteral': return tag(function (context) { return input.slice(1, -1); }, 'string'); | ||
case 'PositionalParameters': return function (context) { return args; }; | ||
case 'NumericLiteral': return tag(function (_context) { return input.includes('.') ? parseFloat(input) : parseInt(input); }, 'number'); | ||
case 'BooleanLiteral': return tag(function (_context) { return input === 'true' ? true : false; }, 'boolean'); | ||
case 'StringLiteral': return tag(function (_context) { return input.slice(1, -1); }, 'string'); | ||
case 'PositionalParameters': return function (_context) { return args; }; | ||
case 'DateTimeConstructor': return function (context) { | ||
@@ -837,3 +839,3 @@ return getBuiltin(input); | ||
})(); | ||
case 'Parameters': return args.length === 3 ? args[1] : function (context) { return []; }; | ||
case 'Parameters': return args.length === 3 ? args[1] : function (_context) { return []; }; | ||
case 'Comparison': return function (context) { | ||
@@ -1018,3 +1020,3 @@ var operator = args[1]; | ||
} | ||
function getBuiltin(name, context) { | ||
function getBuiltin(name, _context) { | ||
return builtins[name]; | ||
@@ -1090,7 +1092,8 @@ } | ||
function tag(fn, type) { | ||
fn.type = type; | ||
fn.toString = function () { | ||
return "TaggedFunction[" + type + "] " + Function.prototype.toString.call(fn); | ||
}; | ||
return fn; | ||
return Object.assign(fn, { | ||
type: type, | ||
toString: function () { | ||
return "TaggedFunction[" + type + "] " + Function.prototype.toString.call(fn); | ||
} | ||
}); | ||
} | ||
@@ -1097,0 +1100,0 @@ function combineResult(result, match) { |
@@ -1,2 +0,2 @@ | ||
import { Tree } from 'lezer'; | ||
import { Tree } from '@lezer/common'; | ||
declare type ParseContext = Record<string, any>; | ||
@@ -3,0 +3,0 @@ declare type ParseResult = { |
@@ -1,1 +0,1 @@ | ||
export declare function is(el: any, type: string): boolean; | ||
export declare function is(el: string, type: string): boolean; |
{ | ||
"name": "feelin", | ||
"version": "0.24.0", | ||
"version": "0.25.0", | ||
"description": "A FEEL parser and interpreter", | ||
@@ -12,2 +12,3 @@ "main": "dist/index.js", | ||
"source": "src/index.ts", | ||
"types": "dist/index.d.ts", | ||
"devDependencies": { | ||
@@ -17,6 +18,10 @@ "@rollup/plugin-commonjs": "^17.0.0", | ||
"@rollup/plugin-typescript": "^8.1.0", | ||
"@types/chai": "^4.3.1", | ||
"@types/mocha": "^9.1.1", | ||
"@typescript-eslint/eslint-plugin": "^5.30.6", | ||
"@typescript-eslint/parser": "^5.30.6", | ||
"chai": "^4.2.0", | ||
"chokidar-cli": "^2.1.0", | ||
"eslint": "^7.16.0", | ||
"eslint-plugin-bpmn-io": "^0.11.0", | ||
"eslint": "^8.19.0", | ||
"eslint-plugin-bpmn-io": "^0.14.0", | ||
"fast-glob": "^3.2.4", | ||
@@ -34,4 +39,4 @@ "mkdirp": "^1.0.4", | ||
"dependencies": { | ||
"lezer": "^0.13.1", | ||
"lezer-feel": "^0.3.0" | ||
"@lezer/lr": "^1.2.0", | ||
"lezer-feel": "^0.5.1" | ||
}, | ||
@@ -44,4 +49,5 @@ "repository": { | ||
"scripts": { | ||
"all": "run-s lint build generate-typings test", | ||
"lint": "eslint .", | ||
"all": "run-s lint build generate-typings test lint:types", | ||
"lint": "eslint . --ext js,ts", | ||
"lint:types": "tsc --noEmit test/types.ts", | ||
"build": "rollup -c", | ||
@@ -48,0 +54,0 @@ "generate-typings": "tsc src/index.ts --emitDeclarationOnly --declaration --outDir dist", |
Sorry, the diff of this file is too big to display
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
367016
6658
21
+ Added@lezer/lr@^1.2.0
+ Added@lezer/common@1.2.3(transitive)
+ Added@lezer/lr@1.4.2(transitive)
+ Addedlezer-feel@0.5.1(transitive)
- Removedlezer@^0.13.1
- Removedlezer@0.13.5(transitive)
- Removedlezer-feel@0.3.0(transitive)
- Removedlezer-tree@0.13.2(transitive)
Updatedlezer-feel@^0.5.1