Skip to content

Commit

Permalink
Improve patterns for Nevod language.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-surkov committed Mar 12, 2021
1 parent 483d8df commit 7058f1a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions components/prism-nevod.js
Expand Up @@ -4,19 +4,21 @@ Prism.languages.nevod = {
pattern: /(?:"(?:""|[^"])*"(?!")|'(?:''|[^'])*'(?!'))!?\*?/,
greedy: true,
inside: {
'modifiers': /!$|!\*$|\*$/,
'string-attrs': /!$|!\*$|\*$/,
},
},
'namespace': {
pattern: /(@namespace\s+)[a-zA-Z0-9\-.]+(?=\s*{)/,
lookbehind: true,
},
'pattern': {
pattern: /(@pattern\s+)?#?[a-zA-Z0-9\-.]+\s*(?:(?:[(]\s*(?:(?:~\s*)?[a-zA-Z0-9\-.]+\s*(?:,\s*(?:(?:~\s*)?[a-zA-Z0-9\-.]*))*)[)])\s*)?(?:=)/,
alias: 'class-name',
pattern: /(@pattern\s+)?#?[a-zA-Z0-9\-.]+(?:\s*(?:[(]\s*(?:(?:~\s*)?[a-zA-Z0-9\-.]+\s*(?:,\s*(?:(?:~\s*)?[a-zA-Z0-9\-.]*))*)[)]))?(?=\s*=)/,
lookbehind: true,
inside: {
'name': /#?[a-zA-Z0-9\-.]+/,
'pattern-name': {
pattern: /#?[a-zA-Z0-9\-.]+/,
alias: 'class-name',
},
'attributes': {
pattern: /\(.*\)/,
inside: {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-nevod.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/languages/nevod/string_feature.test
Expand Up @@ -14,11 +14,11 @@
["string", ["\"text in double quotes\""]],
["string", ["\"\""]],
["string", ["'text in single quotes'"]],
["string", ["'case-sensitive text'", ["modifiers", "!"]]],
["string", ["'case-sensitive text'", ["string-attrs", "!"]]],
["string", ["'text ''Nevod'' in quotes'"]],
["string", ["\"text \"\"Nevod\"\" in double quotes\""]],
["string", ["'text prefix'", ["modifiers", "*"]]],
["string", ["'case-sensitive text prefix'", ["modifiers", "!*"]]],
["string", ["'text prefix'", ["string-attrs", "*"]]],
["string", ["'case-sensitive text prefix'", ["string-attrs", "!*"]]],
["string", ["''"]]
]

Expand Down

0 comments on commit 7058f1a

Please sign in to comment.