diff --git a/components/prism-scheme.js b/components/prism-scheme.js index f4024474eb..4a5bc3bd3a 100644 --- a/components/prism-scheme.js +++ b/components/prism-scheme.js @@ -22,12 +22,12 @@ Prism.languages.scheme = { }, 'boolean': /#[tf]/, 'operator': { - pattern: /(\()(?:[-+*%\/]|[<>]=?|=>?)/, + pattern: /(\()(?:[-+*%\/]|[<>]=?|=>?)(?=\s|$)/, lookbehind: true }, - 'function': { - pattern: /(\()[^()#'\s]+(?=[()\s)])/, - lookbehind: true + 'function' : { + pattern : /(\()[^()'\s]+(?=[()\s)]|$)/, + lookbehind : true }, - 'punctuation': /[()']/ + 'punctuation' : /[()']/ }; diff --git a/components/prism-scheme.min.js b/components/prism-scheme.min.js index 9b41709b9e..b509bfc4ac 100644 --- a/components/prism-scheme.min.js +++ b/components/prism-scheme.min.js @@ -1 +1 @@ -Prism.languages.scheme={comment:/;.*/,string:{pattern:/"(?:[^"\\\r\n]|\\.)*"|'[^()#'\s]+/,greedy:!0},character:{pattern:/#\\(?:u[a-fA-F\d]{4}|[a-zA-Z]+|\S)/,alias:"string"},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:!0},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:!0},number:{pattern:/(\s|[()])[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/,lookbehind:!0},"boolean":/#[tf]/,operator:{pattern:/(\()(?:[-+*%\/]|[<>]=?|=>?)/,lookbehind:!0},"function":{pattern:/(\()[^()#'\s]+(?=[()\s)])/,lookbehind:!0},punctuation:/[()']/}; \ No newline at end of file +Prism.languages.scheme={comment:/;.*/,string:{pattern:/"(?:[^"\\\r\n]|\\.)*"|'[^()#'\s]+/,greedy:!0},character:{pattern:/#\\(?:u[a-fA-F\d]{4}|[a-zA-Z]+|\S)/,alias:"string"},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:!0},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:!0},number:{pattern:/(\s|[()])[-+]?\d*\.?\d+(?:\s*[-+]\s*\d*\.?\d+i)?\b/,lookbehind:!0},"boolean":/#[tf]/,operator:{pattern:/(\()(?:[-+*%\/]|[<>]=?|=>?)(?=\s|$)/,lookbehind:!0},"function":{pattern:/(\()[^()'\s]+(?=[()\s)]|$)/,lookbehind:!0},punctuation:/[()']/}; \ No newline at end of file diff --git a/tests/languages/scheme/function_feature.test b/tests/languages/scheme/function_feature.test index f7c6547b58..699ca063f4 100644 --- a/tests/languages/scheme/function_feature.test +++ b/tests/languages/scheme/function_feature.test @@ -3,6 +3,9 @@ (exact? 2) (inexact->exact 3) (!fact) +(** 10) +(exact? +(** (defined foo) ---------------------------------------------------- @@ -13,6 +16,9 @@ ["punctuation", "("], ["function", "exact?"], ["number", "2"], ["punctuation", ")"], ["punctuation", "("], ["function", "inexact->exact"], ["number", "3"], ["punctuation", ")"], ["punctuation", "("], ["function", "!fact"], ["punctuation", ")"], + ["punctuation", "("], ["function", "**"], ["number", "10"], ["punctuation", ")"], + ["punctuation", "("], ["function", "exact?"], + ["punctuation", "("], ["function", "**"], ["punctuation", "("], ["function", "defined"], " foo", ["punctuation", ")"] ]