aboutsummaryrefslogtreecommitdiff
path: root/Sil/Util/Parser.dcl
diff options
context:
space:
mode:
authorCamil Staps2017-07-30 11:35:16 +0200
committerCamil Staps2017-07-30 11:35:16 +0200
commitc5c4788b282a371fdc989e2d13430701f3457441 (patch)
tree156653073824d4e6a770d33072b0af558723f51e /Sil/Util/Parser.dcl
parentAdd positions to Statements (diff)
Better errors
Diffstat (limited to 'Sil/Util/Parser.dcl')
-rw-r--r--Sil/Util/Parser.dcl16
1 files changed, 10 insertions, 6 deletions
diff --git a/Sil/Util/Parser.dcl b/Sil/Util/Parser.dcl
index e5d1cce..14dc022 100644
--- a/Sil/Util/Parser.dcl
+++ b/Sil/Util/Parser.dcl
@@ -1,6 +1,6 @@
definition module Sil.Util.Parser
-from StdOverloaded import class ==
+from StdOverloaded import class ==, class toString
from Control.Applicative import class Applicative, class Alternative
from Control.Monad import class Monad
@@ -13,10 +13,12 @@ from Sil.Error import :: Error
:: *ParseState a
:: ParsePosition =
- { pp_line :: Int
+ { pp_line :: Int
+ , pp_token :: Int
}
class getPos a :: a -> ParsePosition
+instance getPos ParsePosition
:: ParseInput a
= PI_NewLine
@@ -37,13 +39,15 @@ instance name String
runParser :: (Parser a b) *(ParseState a) -> *(MaybeError Error b, *ParseState a)
getPosition :: Parser a ParsePosition
(<?>) :: (Parser a b) Error -> Parser a b
+(<#>) :: (Parser a b) String -> Parser a b | toString a
fail :: Parser a b
top :: Parser a a
peek :: Parser a a
satisfy :: (a -> Bool) -> Parser a a
check :: (a -> Bool) -> Parser a a
(until) infix 2 :: (Parser a b) (Parser a c) -> Parser a [b]
-item :: a -> Parser a a | ==, name a
-list :: [a] -> Parser a [a] | ==, name a
-seplist :: a (Parser a b) -> Parser a [b] | ==, name a
-eof :: Parser a ()
+item :: a -> Parser a a | ==, name, toString a
+list :: [a] -> Parser a [a] | ==, name, toString a
+seplist :: a (Parser a b) -> Parser a [b] | ==, name, toString a
+seplistUntil :: a a (Parser a b) -> Parser a [b] | ==, name, toString a
+eof :: Parser a () | toString a