Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ignoring new line characters in string interpolation #2754

Merged
merged 7 commits into from
Sep 2, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ TEMPLATE : '$' '{' (STRING | OBJECT_DEFINITION | ~[\r\n{}'"`])+ '}';

ESCAPE_CHARACTER : '\\' ~[\r\n]?;

TEXT_CONTENT : ~[\r\n];
TEXT_CONTENT : . ;
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ export class ExpressionAntlrLexer extends Lexer {
"\x03\x02\x02\x02\xFE\xFF\x03\x02\x02\x02\xFF\u0100\x07\x7F\x02\x02\u0100" +
"O\x03\x02\x02\x02\u0101\u0103\x07^\x02\x02\u0102\u0104\n\v\x02\x02\u0103" +
"\u0102\x03\x02\x02\x02\u0103\u0104\x03\x02\x02\x02\u0104Q\x03\x02\x02" +
"\x02\u0105\u0106\n\v\x02\x02\u0106S\x03\x02\x02\x02\x19\x02\x03\\bdfh" +
"\x87\xB3\xB9\xBB\xC7\xCC\xCE\xD2\xDC\xDE\xE6\xE8\xEC\xFB\xFD\u0103\b\x03" +
"\x05\x02\x07\x03\x02\b\x02\x02\x03&\x03\t\x03\x02\x06\x02\x02";
"\x02\u0105\u0106\v\x02\x02\x02\u0106S\x03\x02\x02\x02\x19\x02\x03\\bd" +
"fh\x87\xB3\xB9\xBB\xC7\xCC\xCE\xD2\xDC\xDE\xE6\xE8\xEC\xFB\xFD\u0103\b" +
"\x03\x05\x02\x07\x03\x02\b\x02\x02\x03&\x03\t\x03\x02\x06\x02\x02";
public static __ATN: ATN;
public static get _ATN(): ATN {
if (!ExpressionAntlrLexer.__ATN) {
Expand Down
6 changes: 6 additions & 0 deletions libraries/adaptive-expressions/tests/expressionParser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ const dataSource = [
['`hello ${string({obj: 1})}`', 'hello {"obj":1}'],
['`hello ${string({obj: "${not expr}"})}`', 'hello {"obj":"${not expr}"}'],
['`hello ${string({obj: {a: 1}})}`', 'hello {"obj":{"a":1}}'],
['`${hello} \n\n ${world}`', 'hello \n\n world'],
['`${hello} \r\n ${world}`', 'hello \r\n world'],
['`\n\n ${world}`', '\n\n world'],
['`\r\n ${world}`', '\r\n world'],
['`${hello} \n\n`', 'hello \n\n'],
['`${hello} \r\n`', 'hello \r\n'],

//Operators tests

Expand Down