Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ rec {
multiline_string = ''
This is a multiline string. \${1 + 3}
\\\${this is not interpolated}
''\${this is not either}
'some string in single quotes' \${nixpkgs}
'';
}
Expand Down
10 changes: 7 additions & 3 deletions src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ export const scanIndString = new ExternalTokenizer((input) => {
if (i > 0) input.acceptToken(indStrContent);
break;
} else if (next === apostrophe && afterApostrophe) {
if (i > 1) input.acceptToken(indStrContent, -1);
else input.acceptToken(indStrEnd, 1);
break;
if (input.peek(1) === dollar) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this package have tests? it would be great to add a test case for this.

Copy link

@milahu milahu Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have tests in my lezer-parser-nix repo, but i changed token names, so the tests are outdated

(also my parser fails on attrpath interpolations like { a.${b}.${c} = 1; } ...)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #3

input.advance();
} else {
if (i > 1) input.acceptToken(indStrContent, -1);
else input.acceptToken(indStrEnd, 1);
break;
}
} else if (next === braceL && afterDollar) {
if (i == 1) input.acceptToken(indStrDollarBrace, 1);
else input.acceptToken(indStrContent, -1);
Expand Down