Skip to content

Commit

Permalink
Reason: Use standard tokens correctly (#3251)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Dec 10, 2021
1 parent 4049e5c commit 809af0d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 27 deletions.
11 changes: 4 additions & 7 deletions components/prism-reason.js
Expand Up @@ -9,15 +9,12 @@ Prism.languages.reason = Prism.languages.extend('clike', {
'operator': /\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/
});
Prism.languages.insertBefore('reason', 'class-name', {
'character': {
'char': {
pattern: /'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,
alias: 'string'
},
'constructor': {
// Negative look-ahead prevents from matching things like String.capitalize
pattern: /\b[A-Z]\w*\b(?!\s*\.)/,
alias: 'variable'
greedy: true
},
// Negative look-ahead prevents from matching things like String.capitalize
'constructor': /\b[A-Z]\w*\b(?!\s*\.)/,
'label': {
pattern: /\b[a-z]\w*(?=::)/,
alias: 'symbol'
Expand Down
2 changes: 1 addition & 1 deletion components/prism-reason.min.js

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

19 changes: 19 additions & 0 deletions tests/languages/reason/char_feature.test
@@ -0,0 +1,19 @@
'a'
'\''
'\\'
'\xff'
'\o214'

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

[
["char", "'a'"],
["char", "'\\''"],
["char", "'\\\\'"],
["char", "'\\xff'"],
["char", "'\\o214'"]
]

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

Checks for characters.
19 changes: 0 additions & 19 deletions tests/languages/reason/character_feature.test

This file was deleted.

0 comments on commit 809af0d

Please sign in to comment.