Software / code / prosody
Comparison
tools/erlparse.lua @ 5080:52767b1f057b
tools/erlparse: Handle decimal point in numbers.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sat, 04 Aug 2012 23:55:52 +0500 |
| parent | 5079:2ab99e239d45 |
| child | 5776:bd0ff8ae98a8 |
comparison
equal
deleted
inserted
replaced
| 5079:2ab99e239d45 | 5080:52767b1f057b |
|---|---|
| 93 local function readNumber() | 93 local function readNumber() |
| 94 local num = { read() }; | 94 local num = { read() }; |
| 95 while isNumeric(peek()) do | 95 while isNumeric(peek()) do |
| 96 num[#num+1] = read(); | 96 num[#num+1] = read(); |
| 97 end | 97 end |
| 98 if peek() == "." then | |
| 99 num[#num+1] = read(); | |
| 100 while isNumeric(peek()) do | |
| 101 num[#num+1] = read(); | |
| 102 end | |
| 103 end | |
| 98 return tonumber(t_concat(num)); | 104 return tonumber(t_concat(num)); |
| 99 end | 105 end |
| 100 local readItem = nil; | 106 local readItem = nil; |
| 101 local function readTuple() | 107 local function readTuple() |
| 102 local t = {}; | 108 local t = {}; |