------------------------------------------------------------------------------
-- The ADP Compiler 
-- Copyright (C) 2001-2007 Peter Steffen, Marco Ruether, Christian Lang,
-- Georg Sauthoff
--
-- Send comments/bug reports to: P.Steffen <psteffen@techfak.uni-bielefeld.de>.
-- Updates: http://www.techfak.uni-bielefeld.de/~psteffen/
------------------------------------------------------------------------------

> module Parse2 (
>   parse2
> ) where

> import Parse
> import NewParser
> import Convert

> parse2 inp filename = NewParser.parse inp (filename, 1)

-- > convert :: String -> String
-- > convert []                                                        = []
-- > convert ('\n':'u':'s':'e':'r':'d':'e':'f':'s':'{':xs)             = "\n#userdefs{" ++ convert xs
-- > convert ('\n':'a':'l':'g':'e':'b':'r':'a':'t':'y':'p':'e':'{':xs) = "\n#algebratype{" ++ convert xs
-- > convert ('\n':'g':'r':'a':'m':'m':'a':'r':'[':xs)                 = "\n#grammar[" ++ convert xs
-- > convert ('\n':'a':'l':'g':'e':'b':'r':'a':'[':xs)                 = "\n#algebra" ++ convert (tail $ snd $ span (/= ']') xs)
-- > convert ('\n':'m':'a':'i':'n':'{':xs)                             = "\n#main{"  ++ convert xs
-- > convert ('\n':'t':'a':'r':'g':'e':'t':'{':xs)                     = "\n#target{" ++ convert xs
-- > convert ('u':'s':'e':'r':'d':'e':'f':'s':'{':xs)                  = "#userdefs{" ++ convert xs
-- > convert ('a':'l':'g':'e':'b':'r':'a':'t':'y':'p':'e':'{':xs)      = "#algebratype{" ++ convert xs
-- > convert ('g':'r':'a':'m':'m':'a':'r':'[':xs)                      = "#grammar[" ++ convert xs
-- > convert ('a':'l':'g':'e':'b':'r':'a':'[':xs)                      = "#algebra" ++ convert (tail $ snd $ span (/= ']') xs)
-- > convert ('m':'a':'i':'n':'{':xs)                                  = "#main{"  ++ convert xs
-- > convert ('t':'a':'r':'g':'e':'t':'{':xs)                          = "#target{" ++ convert xs
-- > convert ('$':xs)                                                  = convert xs
-- > convert (x:xs)                                                    = x:convert xs
