From f7111ca1f7d0f4809cdc684fd3d555c517e4adfc Mon Sep 17 00:00:00 2001 From: Ivan Sagalaev Date: Tue, 4 Nov 2014 10:01:34 -0800 Subject: [PATCH] Extract Rust numbers into a separate markup test. (And fix them.) --- src/languages/rust.js | 2 +- src/test.html | 16 ++-------------- test/detect/rust/default.txt | 12 ------------ test/markup/rust/numbers.expect.txt | 11 +++++++++++ test/markup/rust/numbers.txt | 11 +++++++++++ 5 files changed, 25 insertions(+), 27 deletions(-) create mode 100644 test/markup/rust/numbers.expect.txt create mode 100644 test/markup/rust/numbers.txt diff --git a/src/languages/rust.js b/src/languages/rust.js index 3e9c45710a..7367151293 100644 --- a/src/languages/rust.js +++ b/src/languages/rust.js @@ -43,7 +43,7 @@ function(hljs) { }, { className: 'number', - begin: '\\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\\.[0-9_]+)?([uif](8|16|32|64)?)?)', + begin: /\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\.[0-9_]+)?([eE][+-]?[0-9_]+)?)([uif](8|16|32|64)?)?/, relevance: 0 }, { diff --git a/src/test.html b/src/test.html index 243d663c74..abe197800b 100644 --- a/src/test.html +++ b/src/test.html @@ -3223,18 +3223,6 @@

Automatically detected languages

 use std;
 
-123;                               // type int
-123u;                              // type uint
-123_u;                             // type uint
-0xff00;                            // type int
-0xff_u8;                           // type u8
-0b1111_1111_1001_0000_i32;         // type i32
-123.0;                             // type float
-0.1;                               // type float
-3f;                                // type float
-0.1f32;                            // type f32
-12E+99_f64;                        // type f64
-
 'a';
 '\n';
 '\x1A';
@@ -4013,7 +4001,7 @@ 

Automatically detected languages

name: VM_; count: 3; my-instance-property: whatever; - + instance of cluster-node { name: cluster node; # An in-line comment } @@ -4021,7 +4009,7 @@

Automatically detected languages

instance of VM_openstack { name: VM_database; - + instance of mysql { name: mysql; } diff --git a/test/detect/rust/default.txt b/test/detect/rust/default.txt index 24a1f81ff9..a753cb8ec3 100644 --- a/test/detect/rust/default.txt +++ b/test/detect/rust/default.txt @@ -1,17 +1,5 @@ use std; -123; // type int -123u; // type uint -123_u; // type uint -0xff00; // type int -0xff_u8; // type u8 -0b1111_1111_1001_0000_i32; // type i32 -123.0; // type float -0.1; // type float -3f; // type float -0.1f32; // type f32 -12E+99_f64; // type f64 - 'a'; '\n'; '\x1A'; diff --git a/test/markup/rust/numbers.expect.txt b/test/markup/rust/numbers.expect.txt new file mode 100644 index 0000000000..396c108e89 --- /dev/null +++ b/test/markup/rust/numbers.expect.txt @@ -0,0 +1,11 @@ +123; +123u; +123_u; +0xff00; +0xff_u8; +0b1111_1111_1001_0000_i32; +123.0; +0.1; +3f; +0.1f32; +12E+99_f64; diff --git a/test/markup/rust/numbers.txt b/test/markup/rust/numbers.txt new file mode 100644 index 0000000000..a5652c7cc3 --- /dev/null +++ b/test/markup/rust/numbers.txt @@ -0,0 +1,11 @@ +123; +123u; +123_u; +0xff00; +0xff_u8; +0b1111_1111_1001_0000_i32; +123.0; +0.1; +3f; +0.1f32; +12E+99_f64;