Changeset 17047
- Timestamp:
- 07/14/07 04:45:22 (15 months ago)
- Location:
- src/Pugs
- Files:
-
- 5 modified
-
AST/Pad.hs (modified) (3 diffs)
-
AST/Utils.hs (modified) (1 diff)
-
Internals/ID.hs (modified) (2 diffs)
-
Lexer.hs (modified) (5 diffs)
-
Parser/Charnames.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/AST/Pad.hs
r16414 r17047 1 1 {-# OPTIONS_GHC -fglasgow-exts -fparr #-} 2 2 module Pugs.AST.Pad ( 3 mkPad, diffPads,unionPads, padKeys, filterPad, adjustPad, mergePadEntry,3 mkPad, unionPads, padKeys, filterPad, adjustPad, mergePadEntry, 4 4 mergeLexPads, readMPad, writeMPad, appendMPad, modifyMPad, newMPad 5 5 ) where … … 51 51 return $ MkMPad (addressOf tvar) tvar 52 52 53 {- 53 54 {-| 54 55 Return the difference between two 'Pad's. … … 62 63 diffPadEntry x y | x == y = Nothing 63 64 | otherwise = Just x 65 -} 64 66 65 67 {-| -
src/Pugs/AST/Utils.hs
r15639 r17047 33 33 Nothing -> errIndex def idx 34 34 (a:_) -> return a 35 36 getMapIndex :: Int -> Maybe a -> Eval (IntMap a) -> Maybe (Eval b) -> Eval a37 getMapIndex idx def doList _ | idx < 0 = do38 -- first, check if the list is at least abs(idx) long.39 list <- doList40 if IntMap.member (abs (idx+1)) list41 then return . fromJust42 $ IntMap.lookup (idx `mod` (IntMap.size list)) list43 else errIndex def idx44 -- now we are all positive; either extend or return45 getMapIndex idx def doList ext = do46 list <- doList47 case IntMap.lookup idx list of48 Just a -> return a49 Nothing -> case ext of50 Just doExt -> do { doExt ; getMapIndex idx def doList Nothing }51 Nothing -> errIndex def idx52 35 53 36 {-| -
src/Pugs/Internals/ID.hs
r15419 r17047 2 2 3 3 module Pugs.Internals.ID ( 4 ID(..), bufToID, 5 hashNew, hashList, 4 ID(..), bufToID, hashNew, 6 5 __, (+++), nullID, 7 6 ) where … … 76 75 hashNew = H.new (==) (UTF8.hash) 77 76 78 {-# INLINE hashList #-}79 hashList :: [(ByteString, a)] -> IO (H.HashTable ByteString a)80 hashList = H.fromList (UTF8.hash)81 82 77 {-# NOINLINE _BufToID #-} 83 78 _BufToID :: H.HashTable ByteString ID -
src/Pugs/Lexer.hs
r15594 r17047 13 13 wordAlpha, wordAny, isWordAlpha, isWordAny, 14 14 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, 18 18 19 19 symbol, interpolatingStringLiteral, escapeCode, … … 131 131 #endif 132 132 133 {- 133 134 -- balanced: parses an open/close delimited expression of any non-alphanumeric character 134 135 balanced :: RuleParser String … … 140 141 return contents 141 142 142 {-143 143 -- The \b rule. 144 144 _ruleWordBoundary :: RuleParser () … … 190 190 return (c:cs) 191 191 192 {- 192 193 {-| 193 194 Match any amount of whitespace (not including newlines), followed by a newline … … 205 206 ruleEndOfLine :: RuleParser () 206 207 ruleEndOfLine = choice [ do { char '\n'; return () }, eof ] 208 -} 207 209 208 210 symbol :: String -> RuleParser String -
src/Pugs/Parser/Charnames.hs
r15503 r17047 23 23 24 24 import qualified Data.HashTable as H 25 import UTF8 (unsafePackAddress )25 import UTF8 (unsafePackAddress, hash) 26 26 27 27 -- If we don't have Perl 5, support for names in the 0x00 - 0xFF range only. … … 290 290 , (unsafePackAddress 35 "LATIN SMALL LETTER Y WITH DIAERESIS"#, 0x00FF) 291 291 ] 292 where 293 hashList :: [(ByteString, a)] -> IO (H.HashTable ByteString a) 294 hashList = H.fromList hash 295 292 296 #endif
