Commit 36466589 authored by Nicolas Lenz's avatar Nicolas Lenz

Trying around with separators

parent d170b02b
......@@ -13,10 +13,16 @@ type Parser = Parsec Void Text
-- Lexer
lineComment, blockComment :: Parser ()
lineComment = L.skipLineComment "//"
blockComment = L.skipBlockCommentNested "/*" "*/"
sc :: Parser ()
sc = L.space space1 lineComment blockComment where
lineComment = L.skipLineComment "//"
blockComment = L.skipBlockCommentNested "/*" "*/"
sc = L.space blanks lineComment blockComment where
blanks = skipSome $ char ' '
scFull :: Parser ()
scFull = L.space space1 lineComment blockComment
lexeme :: Parser a -> Parser a
lexeme = L.lexeme sc
......@@ -35,10 +41,8 @@ identifier = (lexeme . try) (T.pack <$> ((:) <$> letterChar <*> many alphaNumCha
-- Parser
-- TODO: Newlines/multiple definitions don't work, they are taken as parts of the previous definition
katrin :: Parser Katrin
katrin = between sc eof (Katrin <$> many definition)
katrin = between sc (skipMany spaceChar >> eof) (Katrin <$> definition `sepBy1` (char '\n') <?> "definition")
definition :: Parser Definition
definition = Definition <$> identifier <* symbol "=" <*> expression
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment