Changeset 17047

Show
Ignore:
Timestamp:
07/14/07 04:45:22 (15 months ago)
Author:
audreyt
Message:

* Final batch of HPC-inspired toplevel removals:

Pugs.AST.Pads.diffPads
Pugs.AST.Utils.getMapIndex
Pugs.Internals.ID.hashList

(moved to a local definition in Pugs.Parser.Charnames)

Pugs.Lexer.balanced
Pugs.Lexer.ruleWhiteSpaceLine (and ruleEndOfLine)

Location:
src/Pugs
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/AST/Pad.hs

    r16414 r17047  
    11{-# OPTIONS_GHC -fglasgow-exts -fparr #-} 
    22module Pugs.AST.Pad ( 
    3   mkPad, diffPads, unionPads, padKeys, filterPad, adjustPad, mergePadEntry, 
     3  mkPad, unionPads, padKeys, filterPad, adjustPad, mergePadEntry, 
    44  mergeLexPads, readMPad, writeMPad, appendMPad, modifyMPad, newMPad 
    55) where 
     
    5151    return $ MkMPad (addressOf tvar) tvar 
    5252 
     53{- 
    5354{-| 
    5455Return the difference between two 'Pad's. 
     
    6263    diffPadEntry x y | x == y    = Nothing 
    6364                     | otherwise = Just x 
     65-} 
    6466 
    6567{-| 
  • src/Pugs/AST/Utils.hs

    r15639 r17047  
    3333            Nothing    -> errIndex def idx 
    3434        (a:_) -> return a 
    35  
    36 getMapIndex :: Int -> Maybe a -> Eval (IntMap a) -> Maybe (Eval b) -> Eval a 
    37 getMapIndex idx def doList _ | idx < 0 = do 
    38     -- first, check if the list is at least abs(idx) long. 
    39     list <- doList 
    40     if IntMap.member (abs (idx+1)) list 
    41         then return . fromJust 
    42             $ IntMap.lookup (idx `mod` (IntMap.size list)) list 
    43         else errIndex def idx 
    44 -- now we are all positive; either extend or return 
    45 getMapIndex idx def doList ext = do 
    46     list <- doList 
    47     case IntMap.lookup idx list of 
    48         Just a  -> return a 
    49         Nothing -> case ext of 
    50             Just doExt -> do { doExt ; getMapIndex idx def doList Nothing } 
    51             Nothing    -> errIndex def idx 
    5235 
    5336{-| 
  • src/Pugs/Internals/ID.hs

    r15419 r17047  
    22 
    33module Pugs.Internals.ID ( 
    4     ID(..), bufToID, 
    5     hashNew, hashList, 
     4    ID(..), bufToID, hashNew, 
    65    __, (+++), nullID,  
    76) where 
     
    7675hashNew = H.new (==) (UTF8.hash) 
    7776 
    78 {-# INLINE hashList #-} 
    79 hashList :: [(ByteString, a)] -> IO (H.HashTable ByteString a) 
    80 hashList = H.fromList (UTF8.hash) 
    81  
    8277{-# NOINLINE _BufToID #-} 
    8378_BufToID :: H.HashTable ByteString ID 
  • src/Pugs/Lexer.hs

    r15594 r17047  
    1313    wordAlpha, wordAny, isWordAlpha, isWordAny, 
    1414    maybeParens, parens, whiteSpace, mandatoryWhiteSpace, lexeme, identifier, identLetter, 
    15     braces, brackets, angles, balanced, balancedDelim, decimal, 
    16  
    17     ruleVerbatimIdentifier, ruleDelimitedIdentifier, ruleQualifiedIdentifier, ruleWhiteSpaceLine, 
     15    braces, brackets, angles, balancedDelim, decimal, 
     16 
     17    ruleVerbatimIdentifier, ruleDelimitedIdentifier, ruleQualifiedIdentifier, 
    1818 
    1919    symbol, interpolatingStringLiteral, escapeCode, 
     
    131131#endif 
    132132 
     133{- 
    133134-- balanced: parses an open/close delimited expression of any non-alphanumeric character 
    134135balanced :: RuleParser String 
     
    140141    return contents 
    141142 
    142 {- 
    143143-- The \b rule. 
    144144_ruleWordBoundary :: RuleParser () 
     
    190190    return (c:cs) 
    191191 
     192{- 
    192193{-| 
    193194Match any amount of whitespace (not including newlines), followed by a newline 
     
    205206ruleEndOfLine :: RuleParser () 
    206207ruleEndOfLine = choice [ do { char '\n'; return () }, eof ] 
     208-} 
    207209 
    208210symbol :: String -> RuleParser String 
  • src/Pugs/Parser/Charnames.hs

    r15503 r17047  
    2323 
    2424import qualified Data.HashTable as H 
    25 import UTF8 (unsafePackAddress) 
     25import UTF8 (unsafePackAddress, hash) 
    2626 
    2727-- If we don't have Perl 5, support for names in the 0x00 - 0xFF range only. 
     
    290290    , (unsafePackAddress 35 "LATIN SMALL LETTER Y WITH DIAERESIS"#, 0x00FF) 
    291291    ] 
     292    where 
     293    hashList :: [(ByteString, a)] -> IO (H.HashTable ByteString a) 
     294    hashList = H.fromList hash 
     295 
    292296#endif