Commit c20c3ec454c9831c4625f90f2be73b192b2feaa1

Golmote 2015-08-30T13:38:32

R: Fixed and simplified patterns

diff --git a/components/prism-r.js b/components/prism-r.js
index f6d9e20..ea92558 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 6784b40..53fe1cc 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