yapb-0.1.1: 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 -> ProdRules -> [Terminal token] -> ParseError token ast 
NotFoundGoto :: (TokenInterface token, Typeable token, Typeable ast, Show token, Show ast) => Int -> String -> Stack token ast -> ActionTable -> GotoTable -> ProdRules -> [Terminal token] -> 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 #

Instances
TokenInterface token => Eq (StkElem token ast) Source # 
Instance details

Defined in CommonParserUtil

Methods

(==) :: StkElem token ast -> StkElem token ast -> Bool #

(/=) :: StkElem token ast -> StkElem token ast -> Bool #

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 #

type ParseFunList token ast = [ParseFun token ast] Source #

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

data Candidate Source #

Instances
Eq Candidate Source # 
Instance details

Defined in CommonParserUtil

Show Candidate Source # 
Instance details

Defined in CommonParserUtil

data Automaton token ast Source #

compCandidates :: (TokenInterface token, Typeable token, Typeable ast, Show token, Show ast) => Bool -> Int -> [Candidate] -> Int -> Automaton token ast -> Stack token ast -> IO [[Candidate]] Source #

compGammas :: (TokenInterface token, Typeable token, Typeable ast, Show token, Show ast) => Bool -> Int -> [Candidate] -> Int -> Automaton token ast -> Stack token ast -> [(Int, Stack token ast, String)] -> IO [[Candidate]] Source #

checkCycle :: (Eq a1, TokenInterface token, Show a1) => Bool -> Int -> a1 -> [StkElem token ast] -> [Char] -> [(a1, [StkElem token ast], [Char])] -> ([(a1, [StkElem token ast], [Char])] -> IO [a2]) -> IO [a2] Source #

compGammasForReduce :: (TokenInterface token, Typeable token, Typeable ast, Show token, Show ast) => Int -> Bool -> [Candidate] -> p -> Automaton token ast -> [StkElem token ast] -> [(Int, Stack token ast, String)] -> Int -> IO [[Candidate]] Source #

_handleParseError :: (Typeable token1, Typeable ast, Show token1, Show ast, TokenInterface token1, TokenInterface token2) => Bool -> Int -> Stack token1 ast -> ActionTable -> GotoTable -> ProdRules -> [Terminal token2] -> IO [EmacsDataItem] Source #