Commit 9a2c814a0ca1733865c73ab7e3000751eccbe7b3

Simon Reynolds 2015-02-08T17:05:29

Correcting numbers regexes as per suggestions

diff --git a/components/prism-fsharp.js b/components/prism-fsharp.js
index e8ed152..eaa3db4 100644
--- a/components/prism-fsharp.js
+++ b/components/prism-fsharp.js
@@ -14,16 +14,16 @@ Prism.languages.fsharp = Prism.languages.extend('clike', {
 	'preprocessor': /^\s*#.*/gm,
 	'number': [
 		{
-			pattern: /\b-?(0x[\da-fA-F]*.(un|LF)?)\b/g
+			pattern: /\b-?0x[\da-fA-F]+(un|lf|LF)?\b/g
 		},
 		{
-			pattern: /\b-?(0b[01]*(y|uy)?)\b/g
+			pattern: /\b-?0b[01]+(y|uy)?\b/g
 		},
 		{
-			pattern: /\b-?(\d*\.(\d*)?([fFmM]|[Ee](\+|-)?\d*)?)\b/g
+			pattern: /\b-?(\d+\.|\d*\.?\d+)([fFmM]|[eE][+-]?\d+)?\b/g
 		},
 		{
-			pattern: /\b-?(\d+.([uy]|[us]|[ul]|[UL]|I)?)\b/g
+			pattern: /\b-?\d+(y|uy|s|us|l|u|ul|L|UL|I)?\b/g
 		}
 	]
 });
\ No newline at end of file
diff --git a/components/prism-fsharp.min.js b/components/prism-fsharp.min.js
index b70ceb6..937a84f 100644
--- a/components/prism-fsharp.min.js
+++ b/components/prism-fsharp.min.js
@@ -1 +1 @@
-Prism.languages.fsharp=Prism.languages.extend("clike",{comment:[{pattern:/(^|[^\\])\(\*[\w\W]*?\*\)/g,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/g,lookbehind:!0}],keyword:/\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|let|let!|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|return|return!|select|static|struct|then|to|true|try|type|upcast|use|use!|val|void|when|while|with|yield|yield!|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/g,string:/@?("""|"|')((\\|\n)?.)*?\1B?/g,preprocessor:/^\s*#.*/gm,number:[{pattern:/\b-?(0x[\da-fA-F]*.(un|LF)?)\b/g},{pattern:/\b-?(0b[01]*(y|uy)?)\b/g},{pattern:/\b-?(\d*\.(\d*)?([fFmM]|[Ee](\+|-)?\d*)?)\b/g},{pattern:/\b-?(\d+.([uy]|[us]|[ul]|[UL]|I)?)\b/g}]});
\ No newline at end of file
+Prism.languages.fsharp=Prism.languages.extend("clike",{comment:[{pattern:/(^|[^\\])\(\*[\w\W]*?\*\)/g,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/g,lookbehind:!0}],keyword:/\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|let|let!|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|return|return!|select|static|struct|then|to|true|try|type|upcast|use|use!|val|void|when|while|with|yield|yield!|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/g,string:/@?("""|"|')((\\|\n)?.)*?\1B?/g,preprocessor:/^\s*#.*/gm,number:[{pattern:/\b-?0x[\da-fA-F]+(un|lf|LF)?\b/g},{pattern:/\b-?0b[01]+(y|uy)?\b/g},{pattern:/\b-?(\d+\.|\d*\.?\d+)([fFmM]|[eE][+-]?\d+)?\b/g},{pattern:/\b-?\d+(y|uy|s|us|l|u|ul|L|UL|I)?\b/g}]});
\ No newline at end of file
diff --git a/examples/prism-fsharp.html b/examples/prism-fsharp.html
index 9276a4c..cf76552 100644
--- a/examples/prism-fsharp.html
+++ b/examples/prism-fsharp.html
@@ -28,6 +28,8 @@ comment *)</code></pre>
 //Int
 86
 86l
+0b10000
+0x2A6
 //Unsigned Int
 86u
 86ul
@@ -42,6 +44,7 @@ comment *)</code></pre>
 4.14f
 4.f
 4.F
+0x0000000000000000lf
 //Double
 4.14
 2.3E+32