Skip to content

Commit

Permalink
fix quote cycle in REPL #313
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Feb 13, 2024
1 parent 9978f33 commit 5c464bc
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* fix formatting `syntax-rules`
* improve floating point representation and parsing
* fix bookmark when hovering over boolean values
* fix quoted cycle in REPL [#313](https://github.com/jcubic/lips/issues/313)

## 1.0.0-beta.18
### Breaking
Expand Down
10 changes: 5 additions & 5 deletions bin/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ function print_error(e, stack) {
log_error(e.message);
if (e.__code__) {
strace = e.__code__.map((line, i) => {
var prefix = `[${i+1}]: `;
var formatter = new Formatter(line);
var output = formatter.break().format({
const prefix = `[${i+1}]: `;
const formatter = new Formatter(line);
const output = formatter.break().format({
offset: prefix.length
});
return prefix + output;
Expand All @@ -108,10 +108,10 @@ function print_error(e, stack) {
// -----------------------------------------------------------------------------
function print(result) {
if (result && result.length) {
var last = result.pop();
const last = result.pop();
if (last !== undefined) {
try {
var ret = env.get('repr')(last, true);
const ret = env.get('repr')(last, true);
console.log('\x1b[K' + ret.toString());
} catch(e) {
print_error(e, options.t || options.trace);
Expand Down
12 changes: 8 additions & 4 deletions dist/lips.cjs

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

12 changes: 8 additions & 4 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.

12 changes: 8 additions & 4 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.

4 changes: 4 additions & 0 deletions src/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -7235,6 +7235,10 @@ function quote(value) {
if (is_pair(value) || value instanceof LSymbol) {
value[__data__] = true;
}
if (is_pair(value) && value[__data__]) {
// cycle in REPL #313
value.markCycles();
}
return value;
}
// -------------------------------------------------------------------------
Expand Down

0 comments on commit 5c464bc

Please sign in to comment.