yapb-0.1.0: Yet Another Parser Builder (YAPB)

Safe HaskellNone
LanguageHaskell2010

CommonParserUtil

Documentation

type LexFun token = String -> Maybe token Source #

type LexerSpecList token = [(RegExpStr, LexFun token)] Source #

data LexerSpec token Source #

Constructors

LexerSpec 

Fields

type ParseFun token ast = Stack token ast -> ast Source #

type ParserSpecList token ast = [(ProdRuleStr, ParseFun token ast)] Source #

data Spec token ast Source #

Constructors

Spec (LexerSpec token) (ParserSpec token ast) 

type Line = Int Source #

lexing :: TokenInterface token => LexerSpec token -> String -> IO [Terminal token] Source #

lexing_ :: TokenInterface token => LexerSpec token -> Line -> Column -> String -> IO [Terminal token] Source #

data ParseError token ast where Source #

Constructors

NotFoundAction :: (TokenInterface token, Typeable token, Typeable ast, Show token, Show ast) => Terminal token -> Int -> Stack token ast -> ActionTable -> GotoTable -> ParseError token ast 
NotFoundGoto :: (TokenInterface token, Typeable token, Typeable ast, Show token, Show ast) => Int -> String -> Stack token ast -> ActionTable -> GotoTable -> ParseError token ast 
Instances
(Show token, Show ast) => Show (ParseError token ast) Source # 
Instance details

Defined in CommonParserUtil

Methods

showsPrec :: Int -> ParseError token ast -> ShowS #

show :: ParseError token ast -> String #

showList :: [ParseError token ast] -> ShowS #

(TokenInterface token, Typeable token, Show token, Typeable ast, Show ast) => Exception (ParseError token ast) Source # 
Instance details

Defined in CommonParserUtil

prParseError :: ParseError token ast -> IO () Source #

parsing :: (TokenInterface token, Typeable token, Typeable ast, Show token, Show ast) => ParserSpec token ast -> [Terminal token] -> IO ast Source #

data StkElem token ast Source #

type Stack token ast = [StkElem token ast] Source #

get :: Stack token ast -> Int -> ast Source #

getText :: Stack token ast -> Int -> String Source #

push :: a -> [a] -> [a] Source #

pop :: [a] -> (a, [a]) Source #

prStack :: TokenInterface token => Stack token ast -> String Source #

currentState :: Stack token ast -> Int Source #

lookupTable :: (Eq a, Show a) => [(a, b)] -> a -> String -> Maybe b Source #

revTakeRhs :: Int -> [a] -> [a] Source #

runAutomaton :: (TokenInterface token, Typeable token, Typeable ast, Show token, Show ast) => ActionTable -> GotoTable -> ProdRules -> [ParseFun token ast] -> [Terminal token] -> IO ast Source #