Skip to content

Commit

Permalink
Scheme: Minor improvements (#1814)
Browse files Browse the repository at this point in the history
Minor improvements for the Scheme language.
  • Loading branch information
RunDevelopment authored Mar 24, 2019
1 parent 5c1a6fb commit 191830f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
14 changes: 7 additions & 7 deletions components/prism-scheme.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Prism.languages.scheme = {
'comment': /;.*/,
'string': {
pattern: /"(?:[^"\\\r\n]|\\.)*"|'[^()#'\s]+/,
pattern: /"(?:[^"\\]|\\.)*"|'[^()#'\s]+/,
greedy: true
},
'character': {
pattern: /#\\(?:u[a-fA-F\d]{4}|[a-zA-Z]+|\S)/,
pattern: /#\\(?:[ux][a-fA-F\d]+|[a-zA-Z]+|\S)/,
alias: 'string'
},
'keyword': {
Expand All @@ -17,17 +17,17 @@ Prism.languages.scheme = {
lookbehind: true
},
'number': {
pattern: /(\s|[()])[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/,
pattern: /([\s()])[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/,
lookbehind: true
},
'boolean': /#[tf]/,
'operator': {
pattern: /(\()(?:[-+*%\/]|[<>]=?|=>?)(?=\s|$)/,
lookbehind: true
},
'function' : {
pattern : /(\()[^()'\s]+(?=[()\s)]|$)/,
lookbehind : true
'function': {
pattern: /(\()[^()'\s]+(?=[()\s)]|$)/,
lookbehind: true
},
'punctuation' : /[()']/
'punctuation': /[()']/
};
2 changes: 1 addition & 1 deletion components/prism-scheme.min.js

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

2 changes: 2 additions & 0 deletions tests/languages/scheme/character_feature.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#\a
#\space
#\u0041
#\x10FFFF
#\λ
#\)

Expand All @@ -10,6 +11,7 @@
["character", "#\\a"],
["character", "#\\space"],
["character", "#\\u0041"],
["character", "#\\x10FFFF"],
["character", "#\\λ"],
["character", "#\\)"]
]
Expand Down
5 changes: 5 additions & 0 deletions tests/languages/scheme/string_feature.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
""
"fo\"obar"
"
multi
line
"
'turkey
(define a 'foo)

Expand All @@ -8,6 +12,7 @@
[
["string", "\"\""],
["string", "\"fo\\\"obar\""],
["string", "\"\r\nmulti\r\nline\r\n\""],
["string", "'turkey"],
["punctuation", "("], ["keyword", "define"], " a ", ["string","'foo"], ["punctuation",")"]
]
Expand Down

0 comments on commit 191830f

Please sign in to comment.