mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
added exponential and hex numbers
This commit is contained in:
6
TODO
6
TODO
@@ -1,5 +1,11 @@
|
|||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
|
* Add TextMate syntax highlighter to the download.
|
||||||
|
|
||||||
|
* Code Cleanup.
|
||||||
|
|
||||||
|
* Add JS-style exponential number literals.
|
||||||
|
|
||||||
* Is it possible to close blocks (functions, ifs, trys) without an explicit
|
* Is it possible to close blocks (functions, ifs, trys) without an explicit
|
||||||
block delimiter or significant whitespace?
|
block delimiter or significant whitespace?
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ spaced_out_multiline_object: {
|
|||||||
|
|
||||||
pi: 3.14159
|
pi: 3.14159
|
||||||
|
|
||||||
list: [1, 2, 3, 4]
|
a_googol: 1e100
|
||||||
|
|
||||||
|
list: [-1, 0, 1, 2, 3, 4]
|
||||||
|
|
||||||
regex: /match[ing](every|thing|\/)/gi
|
regex: /match[ing](every|thing|\/)/gi
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Lexer
|
|||||||
"super"]
|
"super"]
|
||||||
|
|
||||||
IDENTIFIER = /\A([a-zA-Z$_]\w*)/
|
IDENTIFIER = /\A([a-zA-Z$_]\w*)/
|
||||||
NUMBER = /\A([0-9]+(\.[0-9]+)?)/
|
NUMBER = /\A\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?(e[+\-]?[0-9]+)?))\b/i
|
||||||
STRING = /\A("(.*?)[^\\]"|'(.*?)[^\\]')/m
|
STRING = /\A("(.*?)[^\\]"|'(.*?)[^\\]')/m
|
||||||
JS = /\A(`(.*?)`)/
|
JS = /\A(`(.*?)`)/
|
||||||
OPERATOR = /\A([+\*&|\/\-%=<>]+)/
|
OPERATOR = /\A([+\*&|\/\-%=<>]+)/
|
||||||
@@ -65,8 +65,7 @@ class Lexer
|
|||||||
|
|
||||||
def number_token
|
def number_token
|
||||||
return false unless number = @chunk[NUMBER, 1]
|
return false unless number = @chunk[NUMBER, 1]
|
||||||
float = number.include?('.')
|
token(:NUMBER, number)
|
||||||
token(:NUMBER, float ? number.to_f : number.to_i)
|
|
||||||
@i += number.length
|
@i += number.length
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user