Skip to content

Commit

Permalink
better parser method that accept input string
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Dec 6, 2024
1 parent 8a95909 commit 4e0e77c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![npm](https://img.shields.io/badge/npm-1.0.0%E2%80%93beta.19-blue.svg)](https://www.npmjs.com/package/@jcubic/lips)
![1.0.0 Complete](https://img.shields.io/github/milestones/progress-percent/jcubic/lips/1?label=1.0.0%20Complete)
[![Build and test](https://github.com/jcubic/lips/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/lips/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&395903f2a79f3fd8d9ca3c439886a723)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&7915d6a91c5e42fb85121e1908012292)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Join Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jcubic/lips)
![NPM Download Count](https://img.shields.io/npm/dm/@jcubic/lips)
![JSDelivr Download count](https://img.shields.io/jsdelivr/npm/hm/@jcubic/lips)
Expand Down
20 changes: 10 additions & 10 deletions dist/lips.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions dist/lips.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.esm.min.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/lips.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.min.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ class Parser {
return result;
}, cleanup);
}
parse(arg) {
prepare(arg) {
if (arg instanceof LString) {
arg = arg.toString();
}
Expand Down Expand Up @@ -1867,7 +1867,7 @@ async function* _parse(arg, env) {
parser = arg;
} else {
parser = new Parser({ env });
parser.parse(arg);
parser.prepare(arg);
}
let prev;
while (true) {
Expand Down Expand Up @@ -7037,7 +7037,7 @@ function InputPort(read, env = global_env) {
if (!this.char_ready()) {
const line = await this._read();
parser = new Parser({ env });
parser.parse(line);
parser.prepare(line);
}
return this.__parser__;
});
Expand Down Expand Up @@ -7238,7 +7238,7 @@ function InputStringPort(string, env = global_env) {
this._with_parser = this._with_init_parser.bind(this, () => {
if (!this.__parser__) {
this.__parser__ = new Parser({ env });
this.__parser__.parse(string);
this.__parser__.prepare(string);
}
return this.__parser__;
});
Expand Down Expand Up @@ -7533,7 +7533,7 @@ Interpreter.prototype.exec = async function(arg, options = {}) {
if (Array.isArray(arg)) {
return exec(arg, { env, dynamic_env, use_dynamic });
} else {
this.__parser__.parse(arg);
this.__parser__.prepare(arg);
return exec(this.__parser__, { env, dynamic_env, use_dynamic });
}
};
Expand Down Expand Up @@ -7983,7 +7983,7 @@ const constants = {
...parsable_contants
};
// -------------------------------------------------------------------------
const global_env = new Environment({
var global_env = new Environment({
eof,
undefined, // undefined as parser constant breaks most of the unit tests
// ---------------------------------------------------------------------
Expand Down

0 comments on commit 4e0e77c

Please sign in to comment.