Commit 87c9b1b9 authored by László Domoszlai's avatar László Domoszlai

fix parsing of real numbers with exponent tag

git-svn-id: https://svn.cs.ru.nl/repos/clean-sapl/branches/hierarchical@618 cb785ff4-4565-4a15-8565-04c4fcf96d79
parent 4324c5f8
......@@ -152,11 +152,26 @@ where
numberToken p1
# fpart = skipChars line (start+p1) isDigit
# (real, stop) = if ((size line) > fpart && line.[fpart] == '.')
# (dot, stop) = if ((size line) > fpart && line.[fpart] == '.')
(True, skipChars line (fpart+1) isDigit) (False, fpart)
= return (TLit (if real
(LReal (toReal (tstr stop)))
(LInt (toInt (tstr stop)))), stop)
# (exp, stopexp) = readExp stop
= return (TLit (if (dot || exp <> 0)
(LReal (toReal (tstr stop) * (10.0 ^ toReal (exp))))
(LInt (toInt (tstr stop)))), stopexp)
readExp start
| size line < start + 2
= (0, start)
| line.[start] <> 'e' && line.[start] <> 'E'
= (0, start)
# stop = skipChars line (start + 1 + signskip) isDigit
= (sign * (toInt (line % (start + 1 + signskip, stop - 1))), stop)
where
sign = case line.[start+1] of
'+' = 1
'-' = -1
= 1
signskip = if (isDigit line.[start+1]) 0 1
tokensWithPositions :: !String -> [PosToken]
tokensWithPositions inp = tokens_ 1 1 0 []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment