diff --git a/DataWeave.YAML-tmLanguage b/DataWeave.YAML-tmLanguage index 0633b9e..3c4ecbf 100644 --- a/DataWeave.YAML-tmLanguage +++ b/DataWeave.YAML-tmLanguage @@ -403,6 +403,7 @@ repository: '0': { name: string.quoted.double.dw punctuation.definition.string.end.dw } patterns: - include: '#template-substitution-element' + - include: '#template-dollar' - include: '#string-character-escape' - match: ([^`]) name: string.template.dw @@ -417,6 +418,7 @@ repository: '0': { name: string.template.dw punctuation.definition.string.template.end.dw} patterns: - include: '#template-substitution-element' + - include: '#template-dollar' - include: '#string-character-escape' - match: ([^`]) name: string.template.dw @@ -434,6 +436,7 @@ repository: '0': { name: string.quoted.double.dw punctuation.definition.string.end.dw } patterns: - include: '#template-substitution-element' + - include: '#template-dollar' - include: '#string-character-escape' - match: ([^"]) name: string.quoted.double.dw @@ -448,10 +451,23 @@ repository: '2': { name: invalid.illegal.newline.dw } patterns: - include: '#template-substitution-element' + - include: '#template-dollar' - include: '#string-character-escape' - match: ([^']) name: string.quoted.single.dw + template-dollar: + patterns: + - match: (\$(\$)+) + name: variable.parameter.dw + - match: (\$)(?![a-zA-Z(]) + name: variable.parameter.dw + - match: (\$)([a-zA-Z][a-zA-Z0-9_]*) + captures: + '1': {name: keyword.other.dw} + '2': {name: variable.other.dw} + name: variable.parameter.dw + template-substitution-element: name: meta.template.expression.dw begin: \$\( diff --git a/DataWeave.tmLanguage b/DataWeave.tmLanguage index 21be042..7121802 100644 --- a/DataWeave.tmLanguage +++ b/DataWeave.tmLanguage @@ -1192,6 +1192,10 @@ include #template-substitution-element + + include + #template-dollar + include #string-character-escape @@ -1237,6 +1241,10 @@ include #template-substitution-element + + include + #template-dollar + include #string-character-escape @@ -1284,6 +1292,10 @@ include #template-substitution-element + + include + #template-dollar + include #string-character-escape @@ -1329,6 +1341,10 @@ include #template-substitution-element + + include + #template-dollar + include #string-character-escape @@ -1341,6 +1357,43 @@ + template-dollar + + patterns + + + match + (\$(\$)+) + name + variable.parameter.dw + + + match + (\$)(?![a-zA-Z(]) + name + variable.parameter.dw + + + match + (\$)([a-zA-Z][a-zA-Z0-9_]*) + captures + + 1 + + name + keyword.other.dw + + 2 + + name + variable.other.dw + + + name + variable.parameter.dw + + + template-substitution-element name diff --git a/tests/baselines/interpolations.baseline.txt b/tests/baselines/interpolations.baseline.txt new file mode 100644 index 0000000..c9a473a --- /dev/null +++ b/tests/baselines/interpolations.baseline.txt @@ -0,0 +1,1132 @@ +original file +----------------------------------- +fun SQL(literals, parts) = '' +--- +[ + SQL `SELECT * FROM table WHERE id = $(1) AND name = $('a')`, + SQL `$('p')`, + SQL `$('a')$('b')`, + SQL `$('a')---$('b')`, + SQL `---$('a')---$('b')---`, + SQL `$('p')bbb`, + SQL `aaa$('p')`, + SQL `aaa$('p')bbb`, + SQL`SELECT * FROM table WHERE id = $(1) AND name = $('a')`, + SQL`$('p')`, + SQL`$('a')$('b')`, + SQL`$('a')---$('b')`, + SQL`---$('a')---$('b')---`, + SQL`$('p')bbb$tato`, + SQL`aaa$('p')`, + SQL`aaa$('p')bbb`, + `SELECT * FROM table WHERE id = $(1) AND name = $('a')`, + `$('p')`, + `$('a')$('b')`, + `$('a')---$('b')`, + `---$('a')---$('b')---`, + `$('p')bbb`, + `aaa$('p')`, + `aaa$('p')bbb`, + `$tato`, + '$+$', + '$$$$$asd' +] +----------------------------------- + +Grammar: DataWeave.tmLanguage +----------------------------------- +>fun SQL(literals, parts) = '' + ^^^ + meta.directive.fun.dw storage.type.dw + ^ + meta.directive.fun.dw + ^^^ + meta.directive.fun.dw entity.name.function.dw + ^ + meta.directive.fun.dw + ^^^^^^^^ + meta.directive.fun.dw variable.parameter.dw + ^^ + meta.directive.fun.dw + ^^^^^ + meta.directive.fun.dw variable.parameter.dw + ^ + meta.directive.fun.dw + ^ + meta.directive.fun.dw + ^ + meta.directive.fun.dw keyword.operator.assignment.dw + ^ + string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + string.quoted.single.dw punctuation.definition.string.end.dw +>--- + ^^^ + keyword.operator.body-marker.dw +>[ + ^ + meta.array.literal.dw meta.brace.square.dw +> SQL `SELECT * FROM table WHERE id = $(1) AND name = $('a')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw constant.numeric.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL `$('p')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL `$('a')$('b')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL `$('a')---$('b')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL `---$('a')---$('b')---`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL `$('p')bbb`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL `aaa$('p')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL `aaa$('p')bbb`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL`SELECT * FROM table WHERE id = $(1) AND name = $('a')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw constant.numeric.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL`$('p')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL`$('a')$('b')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL`$('a')---$('b')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL`---$('a')---$('b')---`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL`$('p')bbb$tato`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw variable.parameter.dw keyword.other.dw + ^^^^ + meta.array.literal.dw variable.parameter.dw variable.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL`aaa$('p')`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> SQL`aaa$('p')bbb`, + ^^ + meta.array.literal.dw + ^^^ + meta.array.literal.dw support.function.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw punctuation.definition.string.template.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> `SELECT * FROM table WHERE id = $(1) AND name = $('a')`, + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw constant.numeric.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> `$('p')`, + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> `$('a')$('b')`, + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> `$('a')---$('b')`, + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> `---$('a')---$('b')---`, + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> `$('p')bbb`, + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.begin.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> `aaa$('p')`, + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> `aaa$('p')bbb`, + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw + ^ + meta.array.literal.dw meta.template.expression.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw meta.template.expression.dw keyword.other.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.template.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> `$tato`, + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw variable.parameter.dw keyword.other.dw + ^^^^ + meta.array.literal.dw variable.parameter.dw variable.other.dw + ^ + meta.array.literal.dw string.quoted.double.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> '$+$', + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^ + meta.array.literal.dw variable.parameter.dw + ^ + meta.array.literal.dw string.quoted.single.dw + ^ + meta.array.literal.dw variable.parameter.dw + ^ + meta.array.literal.dw string.quoted.single.dw punctuation.definition.string.end.dw + ^ + meta.array.literal.dw punctuation.separator.comma.dw +> '$$$$$asd' + ^^ + meta.array.literal.dw + ^ + meta.array.literal.dw string.quoted.single.dw punctuation.definition.string.begin.dw + ^^^^^ + meta.array.literal.dw variable.parameter.dw + ^ + meta.array.literal.dw string.quoted.single.dw + ^ + meta.array.literal.dw string.quoted.single.dw + ^ + meta.array.literal.dw string.quoted.single.dw + ^ + meta.array.literal.dw string.quoted.single.dw punctuation.definition.string.end.dw +>] + ^ + meta.array.literal.dw meta.brace.square.dw \ No newline at end of file diff --git a/tests/cases/interpolations.dwl b/tests/cases/interpolations.dwl new file mode 100644 index 0000000..383b6ed --- /dev/null +++ b/tests/cases/interpolations.dwl @@ -0,0 +1,31 @@ +fun SQL(literals, parts) = '' +--- +[ + SQL `SELECT * FROM table WHERE id = $(1) AND name = $('a')`, + SQL `$('p')`, + SQL `$('a')$('b')`, + SQL `$('a')---$('b')`, + SQL `---$('a')---$('b')---`, + SQL `$('p')bbb`, + SQL `aaa$('p')`, + SQL `aaa$('p')bbb`, + SQL`SELECT * FROM table WHERE id = $(1) AND name = $('a')`, + SQL`$('p')`, + SQL`$('a')$('b')`, + SQL`$('a')---$('b')`, + SQL`---$('a')---$('b')---`, + SQL`$('p')bbb$tato`, + SQL`aaa$('p')`, + SQL`aaa$('p')bbb`, + `SELECT * FROM table WHERE id = $(1) AND name = $('a')`, + `$('p')`, + `$('a')$('b')`, + `$('a')---$('b')`, + `---$('a')---$('b')---`, + `$('p')bbb`, + `aaa$('p')`, + `aaa$('p')bbb`, + `$tato`, + '$+$', + '$$$$$asd' +] \ No newline at end of file