diff options
| author | Matthew Hall <hallmatthew314@gmail.com> | 2023-02-22 21:42:36 +1300 |
|---|---|---|
| committer | Matthew Hall <hallmatthew314@gmail.com> | 2023-02-22 21:42:36 +1300 |
| commit | 0bde837174fcb9c17cb3adbf6bc3c7407cab10df (patch) | |
| tree | ed5c1d5f6c0a7526e6c0808ebc02f19366ce4a03 /DSL/Parsing.hs | |
| parent | 076364eb60b008e3ea9503049b5f0199273811cb (diff) | |
Proctables are now maps
Diffstat (limited to 'DSL/Parsing.hs')
| -rw-r--r-- | DSL/Parsing.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/DSL/Parsing.hs b/DSL/Parsing.hs index e0017bb..72d6b23 100644 --- a/DSL/Parsing.hs +++ b/DSL/Parsing.hs @@ -1,9 +1,9 @@ module DSL.Parsing where import Data.Char (isDigit, isSpace) -import Data.Maybe (fromMaybe) import DSL.Types +import DSL.Util import DSL.BaseParsers buildDSLLexer :: Parser Char [Char] -> TokenTag -> DSLLexer @@ -197,6 +197,10 @@ programP = phrase $ procs `plus` code procs = mult procP code = mult1 blockP -stringToProgram :: String -> Maybe ([ProcSpec], Program) -stringToProgram = fmap snd . parse (tokenizer `chain` programP) +stringToProgram :: String -> Maybe (ProcTable, Program) +stringToProgram = (>>=(f . snd)) . parse (tokenizer `chain` programP) + where + f (ps, b) = case buildProcTable ps of + Nothing -> Nothing + Just t -> Just (t, b) |
