From 211823650ba298aac899ff944819290f0bd4654a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Thu, 16 May 2024 14:42:47 +0200 Subject: [PATCH] feat(editor): Expand supported Unicode range for expressions (#9420) --- .../codemirror-lang/src/expressions/README.md | 6 +++++ .../src/expressions/expressions.grammar | 2 +- .../src/expressions/grammar.ts | 3 +-- .../test/expressions/cases.txt | 24 +++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/packages/@n8n/codemirror-lang/src/expressions/README.md b/packages/@n8n/codemirror-lang/src/expressions/README.md index a758f62325..53c9e5c100 100644 --- a/packages/@n8n/codemirror-lang/src/expressions/README.md +++ b/packages/@n8n/codemirror-lang/src/expressions/README.md @@ -24,3 +24,9 @@ export function n8nExpressionLanguageSupport() { return new LanguageSupport(n8nLanguage); } ``` + +## Supported Unicode ranges + +- From `Basic Latin` up to and including `Currency Symbols` +- `Miscellaneous Symbols and Pictographs` +- `CJK Unified Ideographs` diff --git a/packages/@n8n/codemirror-lang/src/expressions/expressions.grammar b/packages/@n8n/codemirror-lang/src/expressions/expressions.grammar index f2cf200f35..9217f2c2fb 100644 --- a/packages/@n8n/codemirror-lang/src/expressions/expressions.grammar +++ b/packages/@n8n/codemirror-lang/src/expressions/expressions.grammar @@ -15,7 +15,7 @@ entity { Plaintext | Resolvable } resolvableChar { unicodeChar | "}" ![}] | "\\}}" } - unicodeChar { $[\u0000-\u007C] | $[\u007E-\u1FFF] | $[\u20A0-\u20CF] | $[\u{1F300}-\u{1F64F}] } + unicodeChar { $[\u0000-\u007C] | $[\u007E-\u20CF] | $[\u{1F300}-\u{1F64F}] | $[\u4E00-\u9FFF] } } @detectDelim diff --git a/packages/@n8n/codemirror-lang/src/expressions/grammar.ts b/packages/@n8n/codemirror-lang/src/expressions/grammar.ts index d1233ba922..bd081b4832 100644 --- a/packages/@n8n/codemirror-lang/src/expressions/grammar.ts +++ b/packages/@n8n/codemirror-lang/src/expressions/grammar.ts @@ -1,6 +1,5 @@ // This file was generated by lezer-generator. You probably shouldn't edit it. import { LRParser } from '@lezer/lr'; - export const parser = LRParser.deserialize({ version: 14, states: "nQQOPOOOOOO'#Cb'#CbOOOO'#C`'#C`QQOPOOOOOO-E6^-E6^", @@ -11,7 +10,7 @@ export const parser = LRParser.deserialize({ skippedNodes: [0], repeatNodeCount: 1, tokenData: - "&U~RTO#ob#o#p!h#p;'Sb;'S;=`!]<%lOb~gTQ~O#ob#o#pv#p;'Sb;'S;=`!]<%lOb~yUO#ob#p;'Sb;'S;=`!]<%l~b~Ob~~!c~!`P;=`<%lb~!hOQ~~!kVO#ob#o#p#Q#p;'Sb;'S;=`!]<%l~b~Ob~~!c~#TWO#O#Q#O#P#m#P#q#Q#q#r%Z#r$IS#Q$Lj$Ml#Q;(b;(c%x;(c;(d&O~#pWO#O#Q#O#P#m#P#q#Q#q#r$Y#r$IS#Q$Lj$Ml#Q;(b;(c%x;(c;(d&O~$]TO#q#Q#q#r$l#r;'S#Q;'S;=`%r<%lO#Q~$qWR~O#O#Q#O#P#m#P#q#Q#q#r%Z#r$IS#Q$Lj$Ml#Q;(b;(c%x;(c;(d&O~%^TO#q#Q#q#r%m#r;'S#Q;'S;=`%r<%lO#Q~%rOR~~%uP;=`<%l#Q~%{P;NQ<%l#Q~&RP;=`;JY#Q", + "&U~RTO#ob#o#p!h#p;'Sb;'S;=`!]<%lOb~gTQ~O#ob#o#pv#p;'Sb;'S;=`!]<%lOb~yUO#ob#p;'Sb;'S;=`!]<%l~b~Ob~~!c~!`P;=`<%lb~!hOQ~~!kVO#ob#o#p#Q#p;'Sb;'S;=`!]<%l~b~Ob~~!c~#TWO#O#Q#O#P#m#P#q#Q#q#r%Z#r$Ml#Q*5S41d#Q;(b;(c%x;(c;(d&O~#pWO#O#Q#O#P#m#P#q#Q#q#r$Y#r$Ml#Q*5S41d#Q;(b;(c%x;(c;(d&O~$]TO#q#Q#q#r$l#r;'S#Q;'S;=`%r<%lO#Q~$qWR~O#O#Q#O#P#m#P#q#Q#q#r%Z#r$Ml#Q*5S41d#Q;(b;(c%x;(c;(d&O~%^TO#q#Q#q#r%m#r;'S#Q;'S;=`%r<%lO#Q~%rOR~~%uP;=`<%l#Q~%{P;NQ<%l#Q~&RP;=`;JY#Q", tokenizers: [0], topRules: { Program: [0, 1] }, tokenPrec: 0, diff --git a/packages/@n8n/codemirror-lang/test/expressions/cases.txt b/packages/@n8n/codemirror-lang/test/expressions/cases.txt index eeb42610a2..36f41ddccd 100644 --- a/packages/@n8n/codemirror-lang/test/expressions/cases.txt +++ b/packages/@n8n/codemirror-lang/test/expressions/cases.txt @@ -253,3 +253,27 @@ Program(Resolvable) ==> Program(Resolvable) + +# Resolvable with general punctuation char + +{{ '†' }} + +==> + +Program(Resolvable) + +# Resolvable with superscript char + +{{ '⁷' }} + +==> + +Program(Resolvable) + +# Resolvable with CJK char + +{{ '漢' }} + +==> + +Program(Resolvable)