Changeset 8722

Show
Ignore:
Timestamp:
01/17/06 11:56:03 (3 years ago)
Author:
audreyt
Message:

* numbers.t: all underscore-related subtests now pass.

Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r8666 r8722  
    99 
    1010== Feature Changes 
     11 
     12* 1__0 is now a parsefail. 
    1113 
    1214=== Shared components 
  • src/Pugs/Lexer.hs

    r8153 r8722  
    151151    aheadSym x   '=' = not (x `elem` "!~+-*&/|.%^") 
    152152    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` "&|^~") 
    155155    aheadSym '^' y   = not (y `elem` "^.") 
    156156    aheadSym x   y   = y `elem` ";!" || x /= y 
  • src/Pugs/Parser/Number.hs

    r7906 r8722  
    9191    number base baseDigit = do 
    9292        d   <- baseDigit 
    93         ds  <- many (baseDigit <|> char '_') 
     93        ds  <- many (baseDigit <|> do { char '_'; lookAhead baseDigit; return '_' }) 
    9494        let n = foldl (\x d -> base*x + toInteger (digitToInt d)) 0 digits 
    9595            digits = (d : filter (/= '_') ds) 
  • t/syntax/parsing/numbers.t

    r7990 r8722  
    2424is 3.1_41, 3.141, "Underscores work with floating point after decimal"; 
    2525 
    26 isnt 10_0.8, 100.8, "Underscores work with floating point before decimal"; 
     26is 10_0.8, 100.8, "Underscores work with floating point before decimal"; 
    2727 
    2828is 0xdead_beef, 0xdeadbeef, "Underscores work with hex"; 
    2929 
    30 is 0b1101_1110_1010_1101_1011_1111_0110_1000, 0xdeadbeef, "Underscores work with binary"; 
     30is 0b1101_1110_1010_1101_1011_1110_1110_1111, 0xdeadbeef, "Underscores work with binary"; 
    3131 
    3232is 2e0_1, 20, "Underscores work in the argument for e";