Skip to content

Commit d98c51e

Browse files
committed
Fix a bug with unparsing keywords
They do not need quotes.
1 parent 830263a commit d98c51e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/language/compiling/unparsing.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ testCases(
2424
[{}, either.makeRight('{}')],
2525
['a', either.makeRight('a')],
2626
['Hello, world!', either.makeRight('"Hello, world!"')],
27+
['@test', either.makeRight('@test')],
2728
[{ 0: 'a' }, either.makeRight('{ a }')],
2829
[{ 1: 'a' }, either.makeRight('{ 1: a }')],
2930
[
@@ -67,6 +68,7 @@ testCases(
6768
[{}, either.makeRight('{}')],
6869
['a', either.makeRight('a')],
6970
['Hello, world!', either.makeRight('"Hello, world!"')],
71+
['@test', either.makeRight('@test')],
7072
[{ 0: 'a' }, either.makeRight('{\n a\n}')],
7173
[{ 1: 'a' }, either.makeRight('{\n 1: a\n}')],
7274
[
@@ -115,6 +117,7 @@ testCases(
115117
[{}, either.makeRight('{}')],
116118
['a', either.makeRight('"a"')],
117119
['Hello, world!', either.makeRight('"Hello, world!"')],
120+
['@test', either.makeRight('"@test"')],
118121
[{ 0: 'a' }, either.makeRight('{\n "0": "a"\n}')],
119122
[{ 1: 'a' }, either.makeRight('{\n "1": "a"\n}')],
120123
[

src/language/unparsing/plz-utilities.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ export const sugarFreeMoleculeAsKeyValuePairStrings = (
113113

114114
export const unparseAtom = (atom: string): Right<string> =>
115115
either.makeRight(
116-
quoteIfNecessary(
117-
/^@[^@]/.test(atom) ? kleur.bold(kleur.underline(atom)) : atom,
118-
),
116+
/^@[^@]/.test(atom)
117+
? kleur.bold(kleur.underline(quoteIfNecessary(atom)))
118+
: quoteIfNecessary(atom),
119119
)
120120

121121
type UnparseAtomOrMolecule = (

0 commit comments

Comments
 (0)