Changeset 8722
- Timestamp:
- 01/17/06 11:56:03 (3 years ago)
- Files:
-
- 4 modified
-
ChangeLog (modified) (1 diff)
-
src/Pugs/Lexer.hs (modified) (1 diff)
-
src/Pugs/Parser/Number.hs (modified) (1 diff)
-
t/syntax/parsing/numbers.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r8666 r8722 9 9 10 10 == Feature Changes 11 12 * 1__0 is now a parsefail. 11 13 12 14 === Shared components -
src/Pugs/Lexer.hs
r8153 r8722 151 151 aheadSym x '=' = not (x `elem` "!~+-*&/|.%^") 152 152 aheadSym '?' y = not (y `elem` "&|^?") 153 aheadSym '+' y = not (y `elem` "&|^ <>+")154 aheadSym '~' y = not (y `elem` "&|^ <>~")153 aheadSym '+' y = not (y `elem` "&|^+") 154 aheadSym '~' y = not (y `elem` "&|^~") 155 155 aheadSym '^' y = not (y `elem` "^.") 156 156 aheadSym x y = y `elem` ";!" || x /= y -
src/Pugs/Parser/Number.hs
r7906 r8722 91 91 number base baseDigit = do 92 92 d <- baseDigit 93 ds <- many (baseDigit <|> char '_')93 ds <- many (baseDigit <|> do { char '_'; lookAhead baseDigit; return '_' }) 94 94 let n = foldl (\x d -> base*x + toInteger (digitToInt d)) 0 digits 95 95 digits = (d : filter (/= '_') ds) -
t/syntax/parsing/numbers.t
r7990 r8722 24 24 is 3.1_41, 3.141, "Underscores work with floating point after decimal"; 25 25 26 is nt10_0.8, 100.8, "Underscores work with floating point before decimal";26 is 10_0.8, 100.8, "Underscores work with floating point before decimal"; 27 27 28 28 is 0xdead_beef, 0xdeadbeef, "Underscores work with hex"; 29 29 30 is 0b1101_1110_1010_1101_1011_111 1_0110_1000, 0xdeadbeef, "Underscores work with binary";30 is 0b1101_1110_1010_1101_1011_1110_1110_1111, 0xdeadbeef, "Underscores work with binary"; 31 31 32 32 is 2e0_1, 20, "Underscores work in the argument for e";
