Changeset 7949 for src/Pugs/Lexer.hs

Show
Ignore:
Timestamp:
11/13/05 17:31:09 (3 years ago)
Author:
autrijus
svk:copy_cache_prev:
10363
Message:

* luqui's \d[] patch eats the trailing space after the bracket;

change "brackets" to "verbatimBrackets" to solve this.

* moreover, fix the old bug of "&foo() &bar()" eating the

whitespace inbetween, due to the same cause.

* test for both in t/syntax/interpolation/strings.t

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Lexer.hs

    r7943 r7949  
    6161maybeParens :: CharParser st a -> CharParser st a 
    6262maybeParens p = choice [ parens p, p ] 
    63 maybeBrackets :: CharParser st a -> CharParser st a 
    64 maybeBrackets p = choice [ brackets p, p ] 
     63 
     64maybeVerbatimBrackets :: CharParser st a -> CharParser st a 
     65maybeVerbatimBrackets p = choice [ verbatimBrackets p, p ] 
    6566 
    6667parens     :: CharParser st a -> CharParser st a 
     
    205206 
    206207charNum :: GenParser Char st Char                     
    207 charNum         = do{ code <- decimal  
    208                               <|> do{ char 'o'; maybeBrackets $ number 8 octDigit } 
    209                               <|> do{ char 'x'; maybeBrackets $ number 16 hexDigit } 
    210                               <|> do{ char 'd'; maybeBrackets $ number 10 digit } 
    211                     ; return (toEnum (fromInteger code)) 
    212                     } 
     208charNum = do 
     209    code <- choice 
     210        [ decimal  
     211        , based 'o'  8 octDigit 
     212        , based 'x' 16 hexDigit 
     213        , based 'd' 10 digit 
     214        ] 
     215    return . toEnum $ fromInteger code 
     216    where 
     217    based ch num p = do 
     218        char ch 
     219        let p' = number num p 
     220        choice [ verbatimBrackets p', p' ] 
    213221 
    214222number :: Integer -> GenParser tok st Char -> GenParser tok st Integer