mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
MyParser: hook for external parser
This commit is contained in:
13
src/GF/API/MyParser.hs
Normal file
13
src/GF/API/MyParser.hs
Normal file
@@ -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?")
|
||||||
@@ -44,6 +44,8 @@ import NewerChartParser
|
|||||||
-- see also customGrammarPrinter
|
-- see also customGrammarPrinter
|
||||||
import qualified ConvertGrammar as Cnv
|
import qualified ConvertGrammar as Cnv
|
||||||
|
|
||||||
|
import MyParser
|
||||||
|
|
||||||
import MoreCustom -- either small/ or big/. The one in Small is empty.
|
import MoreCustom -- either small/ or big/. The one in Small is empty.
|
||||||
|
|
||||||
import UseIO
|
import UseIO
|
||||||
@@ -257,6 +259,7 @@ customParser =
|
|||||||
customData "Parsers, selected by option -parser=x" $
|
customData "Parsers, selected by option -parser=x" $
|
||||||
[
|
[
|
||||||
(strCI "chart", chartParser . stateCF)
|
(strCI "chart", chartParser . stateCF)
|
||||||
|
,(strCI "myparser", myParser)
|
||||||
-- add your own parsers here
|
-- add your own parsers here
|
||||||
]
|
]
|
||||||
-- 21/5-04, peb:
|
-- 21/5-04, peb:
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user