From c20c3ec454c9831c4625f90f2be73b192b2feaa1 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 30 Aug 2015 13:38:32 +0200 Subject: [PATCH] R: Fixed and simplified patterns --- components/prism-r.js | 8 ++++---- components/prism-r.min.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/prism-r.js b/components/prism-r.js index f6d9e20e66..ea925583c4 100644 --- a/components/prism-r.js +++ b/components/prism-r.js @@ -1,19 +1,19 @@ Prism.languages.r = { - 'comment': /#.+/, + 'comment': /#.*/, 'string': /(['"])(?:\\?.)*?\1/, 'percent-operator': { // Includes user-defined operators // and %%, %*%, %/%, %in%, %o%, %x% - pattern: /%[^%]*?%/, + pattern: /%[^%\s]*%/, alias: 'operator' }, 'boolean': /\b(?:TRUE|FALSE)\b/, 'ellipsis': /\.\.(?:\.|\d+)/, 'number': [ /\b(?:NaN|Inf)\b/, - /\b(?:0x[\dA-Fa-f]+(?:\.\d*)?|\d*\.?\d+)(?:[EePp][+-]??\d+)?[iL]?\b/ + /\b(?:0x[\dA-Fa-f]+(?:\.\d*)?|\d*\.?\d+)(?:[EePp][+-]?\d+)?[iL]?\b/ ], 'keyword': /\b(?:if|else|repeat|while|function|for|in|next|break|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/, - 'operator': /->>?|!=]=?|::?|&&?|\|\|?|[+\-*\/^$@~]/, + 'operator': /->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/, 'punctuation': /[(){}\[\],;]/ }; \ No newline at end of file diff --git a/components/prism-r.min.js b/components/prism-r.min.js index 6784b40983..53fe1cc6af 100644 --- a/components/prism-r.min.js +++ b/components/prism-r.min.js @@ -1 +1 @@ -Prism.languages.r={comment:/#.+/,string:/(['"])(?:\\?.)*?\1/,"percent-operator":{pattern:/%[^%]*?%/,alias:"operator"},"boolean":/\b(?:TRUE|FALSE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:NaN|Inf)\b/,/\b(?:0x[\dA-Fa-f]+(?:\.\d*)?|\d*\.?\d+)(?:[EePp][+-]??\d+)?[iL]?\b/],keyword:/\b(?:if|else|repeat|while|function|for|in|next|break|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/,operator:/->>?|!=]=?|::?|&&?|\|\|?|[+\-*\/^$@~]/,punctuation:/[(){}\[\],;]/}; \ No newline at end of file +Prism.languages.r={comment:/#.*/,string:/(['"])(?:\\?.)*?\1/,"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},"boolean":/\b(?:TRUE|FALSE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:NaN|Inf)\b/,/\b(?:0x[\dA-Fa-f]+(?:\.\d*)?|\d*\.?\d+)(?:[EePp][+-]?\d+)?[iL]?\b/],keyword:/\b(?:if|else|repeat|while|function|for|in|next|break|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/,operator:/->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/}; \ No newline at end of file