Removed some of the bad uses of findMeta (where no meta tag would be found) from the Rain parser

This commit is contained in:
Neil Brown 2008-05-30 16:39:58 +00:00
parent 05c16b77d3
commit d623c82b3b

View File

@ -174,7 +174,7 @@ dataType
<?> "data type" <?> "data type"
variable :: RainParser A.Variable variable :: RainParser A.Variable
variable = do {v <- name ; return $ A.Variable (findMeta v) v} variable = do {v <- name ; return $ A.Variable (A.nameMeta v) v}
<|> try (do {m <- sIn ; v <- variable ; return $ A.DirectedVariable m A.DirInput v}) <|> try (do {m <- sIn ; v <- variable ; return $ A.DirectedVariable m A.DirInput v})
<|> try (do {m <- sOut ; v <- variable ; return $ A.DirectedVariable m A.DirOutput v}) <|> try (do {m <- sOut ; v <- variable ; return $ A.DirectedVariable m A.DirOutput v})
<?> "variable" <?> "variable"
@ -479,11 +479,11 @@ tupleDef = do {sLeftR ; tm <- sepBy tupleDefMember sComma ; sRightR ; return tm}
tupleDefMember = do {t <- dataType ; sColon ; n <- name ; return (n,t)} tupleDefMember = do {t <- dataType ; sColon ; n <- name ; return (n,t)}
declaration :: Data a => RainParser (Meta, A.Structured a -> A.Structured a) declaration :: Data a => RainParser (Meta, A.Structured a -> A.Structured a)
declaration = try $ do {t <- dataType; sColon ; ns <- name `sepBy1` sComma ; sSemiColon ; declaration = try $ do {t <- dataType; m <- sColon ; ns <- name `sepBy1` sComma ; sSemiColon ;
return (findMeta t, \x -> foldr (foldSpec t) x ns) } return (m, \x -> foldr (foldSpec t) x ns) }
where where
foldSpec :: Data a => A.Type -> A.Name -> (A.Structured a -> A.Structured a) foldSpec :: Data a => A.Type -> A.Name -> (A.Structured a -> A.Structured a)
foldSpec t n = A.Spec (findMeta t) $ A.Specification (findMeta t) n $ A.Declaration (findMeta t) t foldSpec t n = A.Spec (A.nameMeta n) $ A.Specification (A.nameMeta n) n $ A.Declaration (A.nameMeta n) t
terminator :: Data a => A.Structured a terminator :: Data a => A.Structured a
terminator = A.Several emptyMeta [] terminator = A.Several emptyMeta []