Parse modules
This commit is contained in:
20
src/Main.idr
20
src/Main.idr
@@ -7,8 +7,8 @@ import Lib.Parser.Impl
|
||||
import Lib.Parser
|
||||
import Syntax
|
||||
|
||||
check : Show a => Parser a -> String -> IO ()
|
||||
check pa src = do
|
||||
test : Show a => Parser a -> String -> IO ()
|
||||
test pa src = do
|
||||
_ <- putStrLn "--"
|
||||
_ <- putStrLn $ src
|
||||
let toks = tokenise src
|
||||
@@ -25,11 +25,13 @@ main = do
|
||||
-- this stuff is working with layout, should I bother with col.
|
||||
-- downside is that it will be somewhat picky about the indentation of `in`
|
||||
-- The sixty stuff looks promising. I might want my own tokenizer though.
|
||||
check letExpr "let x = 1\n y = 2\n in x + y"
|
||||
check term "let x = 1 in x + 2"
|
||||
test letExpr "let x = 1\n y = 2\n in x + y"
|
||||
test term "let x = 1 in x + 2"
|
||||
printLn "BREAK"
|
||||
check term "case x of\n True => something\n False => let\n x = 1\n y = 2\n in x + y"
|
||||
check term "x + y * z + w"
|
||||
check term "y * z + w"
|
||||
check term "x -> y -> z"
|
||||
check term "x y z"
|
||||
test term "case x of\n True => something\n False => let\n x = 1\n y = 2\n in x + y"
|
||||
test term "x + y * z + w"
|
||||
test term "y * z + w"
|
||||
test term "x -> y -> z"
|
||||
test term "x y z"
|
||||
test parseMod "module Foo\nfoo : Int -> Int\nfoo = \\ x . x"
|
||||
test lamExpr "\\ x . x"
|
||||
|
||||
Reference in New Issue
Block a user