on master help sign in
Make sure that variables generated during parsing are less likely to overlap. This is not a pretty fix, but it is better than the previous system.
50ddf4cevancz
elm/src/Guid.hs+3−2
@@ -1,5 +1,5 @@
1{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2−module Guid (guid, run, GuidCounter) where
2+module Guid (guid, run, runAt, GuidCounter) where
3
3
4import Control.Monad.State (evalState, State, get, put)
4import Control.Monad.State (evalState, State, get, put)
5
5
@@ -13,4 +13,5 @@ guid = GC $ do n <- get
13 put (n + 1)
13 put (n + 1)
14 return n
14 return n
15
15
16+run = runAt 0
16−run x = evalState (runGC x) 0
17+runAt n x = evalState (runGC x) n
elm/src/Parse/Expr.hs+4−2
@@ -98,7 +98,8 @@ recordTerm = brackets $ choice [ misc, addContext record ]
98 fDefs <- (:) <$> (PVar <$> rLabel) <*> spacePrefix patternTerm
98 fDefs <- (:) <$> (PVar <$> rLabel) <*> spacePrefix patternTerm
99 whitespace
99 whitespace
100 e <- string "=" >> whitespace >> expr
100 e <- string "=" >> whitespace >> expr
101+ n <- sourceLine <$> getPosition
101− run $ flattenPatterns fDefs e
102+ runAt (1000 * n) $ flattenPatterns fDefs e
102 extract [ FnDef f args exp ] = return (f,args,exp)
103 extract [ FnDef f args exp ] = return (f,args,exp)
103 extract _ = fail "Improperly formed record field."
104 extract _ = fail "Improperly formed record field."
104 record = Record <$> (mapM extract =<< commaSep field)
105 record = Record <$> (mapM extract =<< commaSep field)
@@ -203,7 +204,8 @@ assignExpr = withPos $ do
203 fDefs <- funcDef
204 fDefs <- funcDef
204 whitespace
205 whitespace
205 e <- string "=" >> whitespace >> expr
206 e <- string "=" >> whitespace >> expr
207+ n <- sourceLine <$> getPosition
206− run $ flattenPatterns fDefs e
208+ runAt (1000 * n) $ flattenPatterns fDefs e
207
209
208def = map Definition <$> assignExpr
210def = map Definition <$> assignExpr
209
211