summaryrefslogtreecommitdiff
path: root/src/Thue/Parser.hs
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-04-12 18:21:28 +1000
committerJed Barber <jjbarber@y7mail.com>2014-04-12 18:21:28 +1000
commitc01b04cbeb3be96fd4e65103526872392d79886f (patch)
tree0959c10e403440415eb886ff8bfbc975e3bd148a /src/Thue/Parser.hs
parentb123d2018f88570bdf1c1a93f19ee00cdcdf216d (diff)
Changes to allow for thuestates that aren't mere strings
Diffstat (limited to 'src/Thue/Parser.hs')
-rw-r--r--src/Thue/Parser.hs18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Thue/Parser.hs b/src/Thue/Parser.hs
index 2ee41ae..10e9334 100644
--- a/src/Thue/Parser.hs
+++ b/src/Thue/Parser.hs
@@ -3,7 +3,9 @@ module Thue.Parser (
ThueRule(..),
ThueState,
- parseThue
+ parseThue,
+ toThueState,
+ fromThueState
) where
import Control.Applicative( some )
@@ -31,6 +33,16 @@ parseThue = parse thue "error"
+toThueState :: String -> ThueState
+toThueState = id
+
+
+
+fromThueState :: ThueState -> String
+fromThueState = id
+
+
+
thue = do
rs <- many rule
@@ -58,7 +70,7 @@ initialState = do
return (concat s)
-ruleState = some ruleStateChar
+ruleState = some ruleStateChar >>= return . toThueState
ruleStateChar = noneOf "\n\r:"
@@ -66,7 +78,7 @@ ruleStateChar = noneOf "\n\r:"
<?> "state character"
-state = many stateChar
+state = many stateChar >>= return . toThueState
stateChar = noneOf "\n\r"