summaryrefslogtreecommitdiff
path: root/src/GF/Source/ParGF.y
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2007-11-01 10:08:32 +0000
committerbringert <bringert@cs.chalmers.se>2007-11-01 10:08:32 +0000
commitdafbcb7f9b21b0e723a6b712c684d3f1b05057aa (patch)
treefce8c43765b8453281f589c9975ba89d4ebc597d /src/GF/Source/ParGF.y
parent59e432812829a106d6719f2490e3f64ef77abbff (diff)
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.
Diffstat (limited to 'src/GF/Source/ParGF.y')
-rw-r--r--src/GF/Source/ParGF.y25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/GF/Source/ParGF.y b/src/GF/Source/ParGF.y
index 944fe7562..c15c57c08 100644
--- a/src/GF/Source/ParGF.y
+++ b/src/GF/Source/ParGF.y
@@ -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
}