Skip to content

Commit

Permalink
lexical scope for linter
Browse files Browse the repository at this point in the history
  • Loading branch information
robsimmons committed Mar 12, 2024
1 parent e536cbe commit b0e5a48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/datastructures/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ export function dataToString(d: Data, needsParens = true): string {
return `#${view.value ? 'tt' : 'ff'}`;
case 'ref':
return `#${view.value}`;
case 'string':
case 'string': {
const escaped = [];
let i = 0;
while (i < view.value.length) {
if (view.value.codePointAt(i)! > 0xffff) {
escaped.push(`\\u{${view.value.codePointAt(i)!.toString(16)}}`);
i += 2;
} else {
let ch = view.value.charAt(i);
const ch = view.value.charAt(i);
if (ch.charCodeAt(0) > 0xff) {
escaped.push(`\\u{${view.value.charCodeAt(i).toString(16)}}`);
} else if (ch.match(/[ !#-[\]-~]/)) {
Expand All @@ -187,6 +187,7 @@ export function dataToString(d: Data, needsParens = true): string {
}
}
return `"${escaped.join('')}"`;
}
case 'const':
return view.args.length === 0
? view.name
Expand Down

0 comments on commit b0e5a48

Please sign in to comment.