Skip to content

Commit

Permalink
Rip: Use standard char token (#3252)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Dec 10, 2021
1 parent bacf9ae commit 2069ab0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
32 changes: 19 additions & 13 deletions components/prism-rip.js
@@ -1,5 +1,23 @@
Prism.languages.rip = {
'comment': /#.*/,
'comment': {
pattern: /#.*/,
greedy: true
},

'char': {
pattern: /\B`[^\s`'",.:;#\/\\()<>\[\]{}]\b/,
greedy: true
},
'string': {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},

'regex': {
pattern: /(^|[^/])\/(?!\/)(?:\[[^\n\r\]]*\]|\\.|[^/\\\r\n\[])+\/(?=\s*(?:$|[\r\n,.;})]))/,
lookbehind: true,
greedy: true
},

'keyword': /(?:=>|->)|\b(?:case|catch|class|else|exit|finally|if|raise|return|switch|try)\b/,

Expand All @@ -11,19 +29,7 @@ Prism.languages.rip = {
'time': /\b\d{2}:\d{2}:\d{2}\b/,
'datetime': /\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\b/,

'character': /\B`[^\s`'",.:;#\/\\()<>\[\]{}]\b/,

'regex': {
pattern: /(^|[^/])\/(?!\/)(?:\[[^\n\r\]]*\]|\\.|[^/\\\r\n\[])+\/(?=\s*(?:$|[\r\n,.;})]))/,
lookbehind: true,
greedy: true
},

'symbol': /:[^\d\s`'",.:;#\/\\()<>\[\]{}][^\s`'",.:;#\/\\()<>\[\]{}]*/,
'string': {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
'number': /[+-]?\b(?:\d+\.\d+|\d+)\b/,

'punctuation': /(?:\.{2,3})|[`,.:;=\/\\()<>\[\]{}]/,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-rip.min.js

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

@@ -1,14 +1,15 @@
`a
`b
`Z
----------------------------------------------------

[
["character", "`a"],
["character", "`b"],
["character", "`Z"]
]

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

Checks for characters.
`a
`b
`Z

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

[
["char", "`a"],
["char", "`b"],
["char", "`Z"]
]

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

Checks for characters.

0 comments on commit 2069ab0

Please sign in to comment.