From f298fcb268dbd4fe74d752077f8f012532d095c1 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Mon, 14 Apr 2014 00:07:24 +1000 Subject: Interpreter can now handle literal strings to avoid code injection --- src/Thue/Parser.hs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/Thue/Parser.hs') 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 + -- cgit