Regenerated ParGF.y with current BNFC, and regenerated ParGF.hs with Happy 1.17. This seems to fix some of the less informative parsing error messages.

This commit is contained in:
bringert
2007-11-01 10:08:32 +00:00
parent 59e4328128
commit dafbcb7f9b
2 changed files with 80 additions and 64 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,11 @@
-- This Happy file was machine-generated by the BNF converter
{
module ParGF where
import AbsGF
import LexGF
import ErrM
{-# OPTIONS -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}
module GF.Source.ParGF where --H
import GF.Source.AbsGF --H
import GF.Source.LexGF --H
import GF.Infra.Ident --H
import GF.Data.ErrM --H
}
%name pGrammar Grammar
@@ -102,7 +104,7 @@ L_err { _ }
%%
Ident :: { Ident } : L_ident { Ident $1 }
Ident :: { Ident } : L_ident { identC $1 } --H
Integer :: { Integer } : L_integ { (read $1) :: Integer }
String :: { String } : L_quoted { $1 }
Double :: { Double } : L_doubl { (read $1) :: Double }
@@ -158,8 +160,11 @@ ModType : 'abstract' Ident { MTAbstract $2 }
ModBody :: { ModBody }
ModBody : Extend Opens '{' ListTopDef '}' { MBody $1 $2 (reverse $4) }
| Ident 'with' ListOpen { MWith $1 $3 }
| ListIncluded '**' Ident 'with' ListOpen { MWithE $1 $3 $5 }
| ListIncluded { MNoBody $1 }
| Included 'with' ListOpen { MWith $1 $3 }
| Included 'with' ListOpen '**' Opens '{' ListTopDef '}' { MWithBody $1 $3 $5 (reverse $7) }
| ListIncluded '**' Included 'with' ListOpen { MWithE $1 $3 $5 }
| ListIncluded '**' Included 'with' ListOpen '**' Opens '{' ListTopDef '}' { MWithEBody $1 $3 $5 $7 (reverse $9) }
| 'reuse' Ident { MReuse $2 }
| 'union' ListIncluded { MUnion $2 }
@@ -603,7 +608,11 @@ thenM = (>>=)
happyError :: [Token] -> Err a
happyError ts =
Bad $ "syntax error at " ++ tokenPos ts ++ if null ts then [] else (" before " ++ unwords (map prToken (take 4 ts)))
Bad $ "syntax error at " ++ tokenPos ts ++
case ts of
[] -> []
[Err _] -> " due to lexer error"
_ -> " before " ++ unwords (map prToken (take 4 ts))
myLexer = tokens
}