diff options
author | Jed Barber <jjbarber@y7mail.com> | 2014-04-14 00:07:24 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2014-04-14 00:07:24 +1000 |
commit | f298fcb268dbd4fe74d752077f8f012532d095c1 (patch) | |
tree | 225bfc8b4aed4adefeb510582e28b5921054eb2c /src/Thue/Parser.hs | |
parent | 71a9dca53149ecd7913fd244fe5922d4aa0b0803 (diff) |
Interpreter can now handle literal strings to avoid code injection
Diffstat (limited to 'src/Thue/Parser.hs')
-rw-r--r-- | src/Thue/Parser.hs | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/Thue/Parser.hs b/src/Thue/Parser.hs index 3ca937e..a9c2d96 100644 --- a/src/Thue/Parser.hs +++ b/src/Thue/Parser.hs @@ -4,11 +4,12 @@ module Thue.Parser ( ThueState, ThueChar(..), - tCh, - tStr, - parseThue, - toThueState, + + tCh, + tLit, + tStr, + tLitStr, fromThueState ) where @@ -48,24 +49,21 @@ parseThue = parse thue "error" -toThueState :: String -> ThueState -toThueState = map TChar - - - -fromThueState :: ThueState -> String -fromThueState = map tChar - - - tCh :: Char -> ThueChar tCh = TChar - +tLit :: Char -> ThueChar +tLit = TLit tStr :: String -> ThueState tStr = map TChar +tLitStr :: String -> ThueState +tLitStr = map TLit + +fromThueState :: ThueState -> String +fromThueState = map tChar + |