Lexer.x & Parser.y: add a partial parser for terms

Lexer.x: Change the parser monad type P to allow the remaining input to
	 be returned after a partial parse. Add function

           runPartial :: P t -> String -> Either (Posn, String) (String, t)

Parser.y: Add a partial parser pTerm for nonterminal Exp1.
          Re-export runPartial.
This commit is contained in:
hallgren
2016-04-07 13:32:14 +00:00
parent c130d28ae3
commit 65e675d8e2
2 changed files with 35 additions and 20 deletions

View File

@@ -2,9 +2,10 @@
{
{-# OPTIONS -fno-warn-overlapping-patterns #-}
module GF.Grammar.Parser
( P, runP
( P, runP, runPartial
, pModDef
, pModHeader
, pTerm
, pExp
, pTopDef
, pBNFCRules
@@ -30,6 +31,7 @@ import PGF(mkCId)
%name pModDef ModDef
%name pTopDef TopDef
%partial pModHeader ModHeader
%partial pTerm Exp1
%name pExp Exp
%name pBNFCRules ListCFRule
%name pEBNFRules ListEBNFRule