never executed always true always false
1 module HelVM.HelMA.Automata.SubLeq.Lexer where
2
3 import HelVM.HelMA.Automata.SubLeq.Symbol
4
5 import HelVM.HelIO.Extra
6 import HelVM.HelIO.ReadText
7 import HelVM.HelMA.Automaton.API.IOTypes
8
9 import qualified Text.Read as Read
10 import qualified Text.Show as Show
11
12 tokenize :: Source -> SymbolList
13 tokenize source = (maybeToList . readTextMaybe) =<< splitOneOf " \t\n" source
14
15 readSymbols :: Source -> Symbols
16 readSymbols source = readTextUnsafe source :: Symbols
17
18 ----
19
20 newtype Symbols = Symbols SymbolList
21
22 instance Show Symbols where
23 show (Symbols symbols) = toString $ unwords $ shows symbols
24
25 instance Read Symbols where
26 readsPrec _ source = [( Symbols $ tokenize $ toText source , "")]
27
28 ----
29
30 shows :: SymbolList -> [Text]
31 shows symbols = show <$> symbols