From 244307ca3765c784cf3cb7d572eb08751a2ba74c Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 27 May 2004 08:28:43 +0000 Subject: [PATCH] MyParser: hook for external parser --- src/GF/API/MyParser.hs | 13 +++++++++++++ src/GF/UseGrammar/Custom.hs | 3 +++ src/Today.hs | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/GF/API/MyParser.hs diff --git a/src/GF/API/MyParser.hs b/src/GF/API/MyParser.hs new file mode 100644 index 000000000..3bb749a20 --- /dev/null +++ b/src/GF/API/MyParser.hs @@ -0,0 +1,13 @@ +module MyParser where + +import ShellState +import CFIdent +import CF +import Operations + +-- template to define your own parser + +-- type CFParser = [CFTok] -> ([(CFTree,[CFTok])],String) + +myParser :: StateGrammar -> CFCat -> CFParser +myParser gr cat toks = ([],"Would you like to add your own parser?") diff --git a/src/GF/UseGrammar/Custom.hs b/src/GF/UseGrammar/Custom.hs index e5e59fc05..952f6dc07 100644 --- a/src/GF/UseGrammar/Custom.hs +++ b/src/GF/UseGrammar/Custom.hs @@ -44,6 +44,8 @@ import NewerChartParser -- see also customGrammarPrinter import qualified ConvertGrammar as Cnv +import MyParser + import MoreCustom -- either small/ or big/. The one in Small is empty. import UseIO @@ -257,6 +259,7 @@ customParser = customData "Parsers, selected by option -parser=x" $ [ (strCI "chart", chartParser . stateCF) + ,(strCI "myparser", myParser) -- add your own parsers here ] -- 21/5-04, peb: diff --git a/src/Today.hs b/src/Today.hs index da911717b..f3613eba0 100644 --- a/src/Today.hs +++ b/src/Today.hs @@ -1 +1 @@ -module Today where today = "Wed May 26 22:36:42 CEST 2004" +module Today where today = "Thu May 27 11:01:26 CEST 2004"