-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. `)` is part for symbols (strings). 2. Function names which have a keyword/builtin as a prefix are not matched correctly. 3. Zero-length function names. 4. `'` is highlighted as `string` even if it marks a list. Also add support for Scheme characters.
- Loading branch information
1 parent
5db0465
commit 225dd3f
Showing
8 changed files
with
143 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
Prism.languages.scheme = { | ||
'comment' : /;.*/, | ||
'string' : { | ||
pattern: /"(?:[^"\\\r\n]|\\.)*"|'[^('\s]*/, | ||
'comment': /;.*/, | ||
'string': { | ||
pattern: /"(?:[^"\\\r\n]|\\.)*"|'[^()#'\s]+/, | ||
greedy: true | ||
}, | ||
'keyword' : { | ||
pattern : /(\()(?:define(?:-syntax|-library|-values)?|(?:case-)?lambda|let(?:\*|rec)?(?:-values)?|else|if|cond|begin|delay(?:-force)?|parameterize|guard|set!|(?:quasi-)?quote|syntax-rules)/, | ||
lookbehind : true | ||
'character': { | ||
pattern: /#\\(?:u[a-fA-F\d]{4}|[a-zA-Z]+|\S)/, | ||
alias: 'string' | ||
}, | ||
'builtin' : { | ||
pattern : /(\()(?:(?:cons|car|cdr|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?)/, | ||
lookbehind : true | ||
'keyword': { | ||
pattern: /(\()(?:define(?:-syntax|-library|-values)?|(?:case-)?lambda|let(?:\*|rec)?(?:-values)?|else|if|cond|begin|delay(?:-force)?|parameterize|guard|set!|(?:quasi-)?quote|syntax-rules)(?=[()\s])/, | ||
lookbehind: true | ||
}, | ||
'builtin': { | ||
pattern: /(\()(?:(?:cons|car|cdr|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?)(?=[()\s])/, | ||
lookbehind: true | ||
}, | ||
'number' : { | ||
'number': { | ||
pattern: /(\s|[()])[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/, | ||
lookbehind: true | ||
}, | ||
'boolean' : /#[tf]/, | ||
'boolean': /#[tf]/, | ||
'operator': { | ||
pattern: /(\()(?:[-+*%\/]|[<>]=?|=>?)/, | ||
lookbehind: true | ||
}, | ||
'function' : { | ||
pattern : /(\()[^\s()]*(?=[\s)])/, | ||
lookbehind : true | ||
'function': { | ||
pattern: /(\()[^()#'\s]+(?=[()\s)])/, | ||
lookbehind: true | ||
}, | ||
'punctuation' : /[()]/ | ||
}; | ||
'punctuation': /[()']/ | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
(cons | ||
(car | ||
(cdr | ||
(null? | ||
(pair? | ||
(boolean? | ||
(eof-object? | ||
(char? | ||
(procedure? | ||
(number? | ||
(port? | ||
(string? | ||
(vector? | ||
(symbol? | ||
(bytevector? | ||
(list | ||
(call-with-current-continuation | ||
(call/cc | ||
(append | ||
(abs | ||
(apply | ||
(eval | ||
(cons) | ||
(car) | ||
(cdr) | ||
(null?) | ||
(pair?) | ||
(boolean?) | ||
(eof-object?) | ||
(char?) | ||
(procedure?) | ||
(number?) | ||
(port?) | ||
(string?) | ||
(vector?) | ||
(symbol?) | ||
(bytevector?) | ||
(list) | ||
(call-with-current-continuation) | ||
(call/cc) | ||
(append) | ||
(abs) | ||
(apply) | ||
(eval) | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["punctuation", "("], ["builtin", "cons"], | ||
["punctuation", "("], ["builtin", "car"], | ||
["punctuation", "("], ["builtin", "cdr"], | ||
["punctuation", "("], ["builtin", "null?"], | ||
["punctuation", "("], ["builtin", "pair?"], | ||
["punctuation", "("], ["builtin", "boolean?"], | ||
["punctuation", "("], ["builtin", "eof-object?"], | ||
["punctuation", "("], ["builtin", "char?"], | ||
["punctuation", "("], ["builtin", "procedure?"], | ||
["punctuation", "("], ["builtin", "number?"], | ||
["punctuation", "("], ["builtin", "port?"], | ||
["punctuation", "("], ["builtin", "string?"], | ||
["punctuation", "("], ["builtin", "vector?"], | ||
["punctuation", "("], ["builtin", "symbol?"], | ||
["punctuation", "("], ["builtin", "bytevector?"], | ||
["punctuation", "("], ["builtin", "list"], | ||
["punctuation", "("], ["builtin", "call-with-current-continuation"], | ||
["punctuation", "("], ["builtin", "call/cc"], | ||
["punctuation", "("], ["builtin", "append"], | ||
["punctuation", "("], ["builtin", "abs"], | ||
["punctuation", "("], ["builtin", "apply"], | ||
["punctuation", "("], ["builtin", "eval"] | ||
["punctuation", "("], ["builtin", "cons"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "car"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "cdr"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "null?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "pair?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "boolean?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "eof-object?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "char?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "procedure?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "number?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "port?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "string?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "vector?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "symbol?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "bytevector?"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "list"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "call-with-current-continuation"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "call/cc"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "append"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "abs"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "apply"], ["punctuation", ")"], | ||
["punctuation", "("], ["builtin", "eval"], ["punctuation", ")"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for builtins. | ||
Checks for builtins. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#\a | ||
#\space | ||
#\u0041 | ||
#\λ | ||
#\) | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["character", "#\\a"], | ||
["character", "#\\space"], | ||
["character", "#\\u0041"], | ||
["character", "#\\λ"], | ||
["character", "#\\)"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for character literals. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
(define | ||
(define-syntax | ||
(define-library | ||
(define-values | ||
(case-lambda | ||
(lambda | ||
(let | ||
(let* | ||
(letrec | ||
(let-values | ||
(let*-values | ||
(letrec-values | ||
(else | ||
(if | ||
(cond | ||
(begin | ||
(delay | ||
(delay-force | ||
(parameterize | ||
(guard | ||
(set! | ||
(quasi-quote | ||
(quote | ||
(syntax-rules | ||
(define) | ||
(define-syntax) | ||
(define-library) | ||
(define-values) | ||
(case-lambda) | ||
(lambda) | ||
(let) | ||
(let*) | ||
(letrec) | ||
(let-values) | ||
(let*-values) | ||
(letrec-values) | ||
(else) | ||
(if) | ||
(cond) | ||
(begin) | ||
(delay) | ||
(delay-force) | ||
(parameterize) | ||
(guard) | ||
(set!) | ||
(quasi-quote) | ||
(quote) | ||
(syntax-rules) | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["punctuation", "("], ["keyword", "define"], | ||
["punctuation", "("], ["keyword", "define-syntax"], | ||
["punctuation", "("], ["keyword", "define-library"], | ||
["punctuation", "("], ["keyword", "define-values"], | ||
["punctuation", "("], ["keyword", "case-lambda"], | ||
["punctuation", "("], ["keyword", "lambda"], | ||
["punctuation", "("], ["keyword", "let"], | ||
["punctuation", "("], ["keyword", "let*"], | ||
["punctuation", "("], ["keyword", "letrec"], | ||
["punctuation", "("], ["keyword", "let-values"], | ||
["punctuation", "("], ["keyword", "let*-values"], | ||
["punctuation", "("], ["keyword", "letrec-values"], | ||
["punctuation", "("], ["keyword", "else"], | ||
["punctuation", "("], ["keyword", "if"], | ||
["punctuation", "("], ["keyword", "cond"], | ||
["punctuation", "("], ["keyword", "begin"], | ||
["punctuation", "("], ["keyword", "delay"], | ||
["punctuation", "("], ["keyword", "delay-force"], | ||
["punctuation", "("], ["keyword", "parameterize"], | ||
["punctuation", "("], ["keyword", "guard"], | ||
["punctuation", "("], ["keyword", "set!"], | ||
["punctuation", "("], ["keyword", "quasi-quote"], | ||
["punctuation", "("], ["keyword", "quote"], | ||
["punctuation", "("], ["keyword", "syntax-rules"] | ||
["punctuation", "("], ["keyword", "define"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "define-syntax"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "define-library"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "define-values"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "case-lambda"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "lambda"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "let"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "let*"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "letrec"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "let-values"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "let*-values"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "letrec-values"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "else"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "if"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "cond"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "begin"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "delay"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "delay-force"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "parameterize"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "guard"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "set!"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "quasi-quote"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "quote"], ["punctuation", ")"], | ||
["punctuation", "("], ["keyword", "syntax-rules"], ["punctuation", ")"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for keywords. | ||
Checks for keywords. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
"" | ||
"fo\"obar" | ||
'turkey | ||
(define a 'foo) | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["string", "\"\""], | ||
["string", "\"fo\\\"obar\""], | ||
["string", "'turkey"] | ||
["string", "'turkey"], | ||
["punctuation", "("], ["keyword", "define"], " a ", ["string","'foo"], ["punctuation",")"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for strings and symbols. | ||
Checks for strings and symbols. |