@cnrs/hel 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ast2str.js +1 -0
- package/src/str2ast.js +1 -0
- package/src/str2fun.js +1 -0
package/package.json
CHANGED
package/src/ast2str.js
CHANGED
package/src/str2ast.js
CHANGED
|
@@ -102,6 +102,7 @@ class StringToAstVisitor extends CstVisitor {
|
|
|
102
102
|
const visitor = new StringToAstVisitor(); // this is stateless, so Singleton
|
|
103
103
|
|
|
104
104
|
export function toAst(input) {
|
|
105
|
+
if (!input) return {}; // accepts ""
|
|
105
106
|
const result = tokenize(input);
|
|
106
107
|
parser.input = result.tokens; // resets the parser's internal state
|
|
107
108
|
const cst = parser.statement(); // semantics actions are now defined
|
package/src/str2fun.js
CHANGED
|
@@ -129,6 +129,7 @@ class StringToFunctionVisitor extends CstVisitor {
|
|
|
129
129
|
const visitor = new StringToFunctionVisitor(); // this is stateless, so Singleton
|
|
130
130
|
|
|
131
131
|
export function toFunction(input) {
|
|
132
|
+
if (!input) return (item) => true; // accepts ""
|
|
132
133
|
const result = tokenize(input);
|
|
133
134
|
parser.input = result.tokens; // resets the parser's internal state
|
|
134
135
|
const cst = parser.statement(); // semantics actions are now defined
|