Skip to content

Commit

Permalink
Tests: Added strict checks for Prism.languages.extend (#2572)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Dec 22, 2020
1 parent 7266e32 commit 8828500
Show file tree
Hide file tree
Showing 34 changed files with 224 additions and 71 deletions.
4 changes: 2 additions & 2 deletions components/prism-arduino.js

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

2 changes: 1 addition & 1 deletion components/prism-arduino.min.js

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

14 changes: 7 additions & 7 deletions components/prism-birb.js
@@ -1,23 +1,23 @@
Prism.languages.birb = Prism.languages.extend('clike', {
'string': {
pattern: /r?("|')(?:\\.|(?!\1)[^\\])*\1/,
greedy: true
},
'class-name': [
/\b[A-Z](?:[\d_]*[a-zA-Z]\w*)?\b/,

// matches variable and function return types (parameters as well).
/\b[A-Z]\w*(?=\s+\w+\s*[;,=()])/
],
'string': {
pattern: /r?("|')(?:\\.|(?!\1)[^\\])*\1/,
greedy: true
},
'keyword': /\b(?:assert|break|case|class|const|default|else|enum|final|follows|for|grab|if|nest|next|new|noSeeb|return|static|switch|throw|var|void|while)\b/,
'variable': /\b[a-z_]\w*\b/,
'operator': /\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?|:/,
'variable': /\b[a-z_]\w*\b/,
});

Prism.languages.insertBefore('birb','function',{
Prism.languages.insertBefore('birb', 'function', {
'metadata': {
pattern: /<\w+>/,
greedy: true,
alias: 'symbol'
}
});
});
2 changes: 1 addition & 1 deletion components/prism-birb.min.js

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

4 changes: 2 additions & 2 deletions components/prism-c.js
Expand Up @@ -9,8 +9,8 @@ Prism.languages.c = Prism.languages.extend('clike', {
},
'keyword': /\b(?:__attribute__|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
'function': /[a-z_]\w*(?=\s*\()/i,
'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/,
'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i
'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i,
'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
});

Prism.languages.insertBefore('c', 'string', {
Expand Down

0 comments on commit 8828500

Please sign in to comment.