Changeset 7952

Show
Ignore:
Timestamp:
11/14/05 03:15:26 (3 years ago)
Author:
luqui
svk:copy_cache_prev:
10363
Message:

Added mandatoryWhiteSpace combinator (needs cleanup).
Changed \X control char to \cX, as per spec. Also fixed math so that
\cA refers to char 1 rather than 0 (where \c@ refers to 0).
Implemented method-call listop form: $obj.method: arg1, arg2.

Location:
src/Pugs
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Lexer.hs

    r7949 r7952  
    1313module Pugs.Lexer ( 
    1414    wordAlpha, wordAny, isWordAlpha, isWordAny, 
    15     maybeParens, parens, whiteSpace, lexeme, identifier, 
     15    maybeParens, parens, whiteSpace, mandatoryWhiteSpace, lexeme, identifier, 
    1616    braces, brackets, angles, balanced, balancedDelim, decimal, 
    1717 
     
    6969whiteSpace :: CharParser st () 
    7070whiteSpace = P.whiteSpace perl6Lexer 
     71mandatoryWhiteSpace :: CharParser st () 
     72mandatoryWhiteSpace = skipMany1 (oneOf " \t\n")  -- XXX unicode and whatnot 
    7173lexeme     :: CharParser st a -> CharParser st a 
    7274lexeme     = P.lexeme     perl6Lexer 
     
    200202 
    201203charControl :: GenParser Char st Char 
    202 charControl     = do{ char '^' 
     204charControl     = do{ char 'c' 
    203205                    ; code <- upper 
    204                     ; return (toEnum (fromEnum code - fromEnum 'A')) 
     206                    ; return (toEnum (fromEnum code - fromEnum '@')) 
    205207                    } 
    206208 
  • src/Pugs/Parser.hs

    r7949 r7952  
    16331633    (invs,args) <- if mustHaveParens 
    16341634        then parseHasParenParamList 
    1635         else option (Nothing,[]) $ parseParenParamList 
     1635        else do  -- $obj.foo: arg1, arg2    # listop method call 
     1636                 -- we require whitespace after the colon (but not before) 
     1637                 -- so that @list.map:{...} doesn't get interpreted the 
     1638                 -- wrong way. 
     1639            listcolon <- option False $ try $ do { char ':'; mandatoryWhiteSpace; return True } 
     1640            if listcolon 
     1641                then parseNoParenParamList 
     1642                else option (Nothing,[]) $ parseParenParamList 
    16361643    when (isJust invs) $ fail "Only one invocant allowed" 
    16371644    return $ \x -> if hasEqual 
  • src/Pugs/Pretty.hs

    r7943 r7952  
    191191quoted '%'  = "\\%" 
    192192quoted '&'  = "\\&" 
     193quoted '^'  = "\\^" 
    193194quoted x | x < ' ' || x > '~' = "\\d[" ++ show (ord x) ++ "]" 
    194195quoted x = [x]