|
3 | 3 | " Maintainer: Patrick Walton <[email protected]>
|
4 | 4 | " Maintainer: Ben Blum <[email protected]>
|
5 | 5 | " Maintainer: Chris Morgan <[email protected]>
|
6 |
| -" Last Change: 2013 Dec 04 |
| 6 | +" Last Change: 2013 Dec 10 |
7 | 7 |
|
8 | 8 | if version < 600
|
9 | 9 | syntax clear
|
@@ -160,14 +160,15 @@ syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(8\|16\|32\|64
|
160 | 160 | syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\="
|
161 | 161 | syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\="
|
162 | 162 |
|
163 |
| -" To mark it as a float, it must have at least one of the three things integral values don't have: |
| 163 | +" Special case for numbers of the form "1." which are float literals, unless followed by |
| 164 | +" an identifier, which makes them integer literals with a method call or field access. |
| 165 | +" (This must go first so the others take precedence.) |
| 166 | +syn match rustFloat display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\@!" |
| 167 | +" To mark a number as a normal float, it must have at least one of the three things integral values don't have: |
164 | 168 | " a decimal point and more numbers; an exponent; and a type suffix.
|
165 | 169 | syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)\="
|
166 | 170 | syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\(f32\|f64\)\="
|
167 | 171 | syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)"
|
168 |
| -" Special case for numbers of the form "1." which are float literals, unless followed by |
169 |
| -" an identifier, which makes them integer literals with a method call or field access. |
170 |
| -syn match rustFloat display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\@!" |
171 | 172 |
|
172 | 173 | " For the benefit of delimitMate
|
173 | 174 | syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
|
|
0 commit comments