Skip to content
Permalink
Browse files
Squirrel: Use standard char token (#3256)
  • Loading branch information
RunDevelopment committed Dec 10, 2021
1 parent c56e4bf commit 58a65bfd8b28800491b93d70cc3eccd754c45b42
Showing with 27 additions and 23 deletions.
  1. +13 −12 components/prism-squirrel.js
  2. +1 −1 components/prism-squirrel.min.js
  3. +11 −0 tests/languages/squirrel/char_feature.test
  4. +2 −10 tests/languages/squirrel/string_feature.test
@@ -7,18 +7,11 @@ Prism.languages.squirrel = Prism.languages.extend('clike', {
greedy: true
}
],
'string': [
{
pattern: /(^|[^\\"'@])(?:@"(?:[^"]|"")*"(?!")|"(?:[^\\\r\n"]|\\.)*")/,
lookbehind: true,
greedy: true
},
{
pattern: /(^|[^\\"'])'(?:[^\\']|\\(?:[xuU][0-9a-fA-F]{0,8}|[\s\S]))'/,
lookbehind: true,
greedy: true
}
],
'string': {
pattern: /(^|[^\\"'@])(?:@"(?:[^"]|"")*"(?!")|"(?:[^\\\r\n"]|\\.)*")/,
lookbehind: true,
greedy: true
},

'class-name': {
pattern: /(\b(?:class|enum|extends|instanceof)\s+)\w+(?:\.\w+)*/,
@@ -34,6 +27,14 @@ Prism.languages.squirrel = Prism.languages.extend('clike', {
'punctuation': /[(){}\[\],;.]/
});

Prism.languages.insertBefore('squirrel', 'string', {
'char': {
pattern: /(^|[^\\"'])'(?:[^\\']|\\(?:[xuU][0-9a-fA-F]{0,8}|[\s\S]))'/,
lookbehind: true,
greedy: true
}
});

Prism.languages.insertBefore('squirrel', 'operator', {
'attribute-punctuation': {
pattern: /<\/|\/>/,

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,11 @@
'w'
'\''
'\x41' '\u0041' '\U00000041'

----------------------------------------------------

[
["char", "'w'"],
["char", "'\\''"],
["char", "'\\x41'"], ["char", "'\\u0041'"], ["char", "'\\U00000041'"]
]
@@ -14,10 +14,6 @@ multiline verbatim string
characters
"

'w'
'\''
'\x41' '\u0041' '\U00000041'

----------------------------------------------------

[
@@ -29,9 +25,5 @@ multiline verbatim string
["string", "@\"I'm a verbatim string\""],
["string", "@\" I'm a\r\nmultiline verbatim string\r\n\""],

["string", "@\"\r\n this is a multiline string\r\n it will \"\"embed\"\" all the new line\r\n characters\r\n\""],

["string", "'w'"],
["string", "'\\''"],
["string", "'\\x41'"], ["string", "'\\u0041'"], ["string", "'\\U00000041'"]
]
["string", "@\"\r\n this is a multiline string\r\n it will \"\"embed\"\" all the new line\r\n characters\r\n\""]
]

0 comments on commit 58a65bf

Please sign in to comment.