mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-06-09 18:16:32 -06:00
move the FCFG lexer to FCFG.Active where it should have been. It was a hack anyway
This commit is contained in:
@@ -148,7 +148,15 @@ xchart2syntaxchart (XChart actives finals) pinfo =
|
||||
|
||||
literals :: FCFPInfo -> Input FToken -> [(FCat,Item)]
|
||||
literals pinfo toks =
|
||||
[let (c,node) = grammarLexer pinfo t in (c,Final [makeRange i j] node) | Edge i j t <- inputEdges toks, not (t `elem` grammarToks pinfo)]
|
||||
[let (c,node) = lexer t in (c,Final [makeRange i j] node) | Edge i j t <- inputEdges toks, not (t `elem` grammarToks pinfo)]
|
||||
where
|
||||
lexer t =
|
||||
case reads t of
|
||||
[(n,"")] -> (fcatInt, SInt (n::Integer))
|
||||
_ -> case reads t of
|
||||
[(f,"")] -> (fcatFloat, SFloat (f::Double))
|
||||
_ -> (fcatString,SString t)
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- Earley --
|
||||
|
||||
@@ -48,7 +48,6 @@ data FCFPInfo
|
||||
-- ^ used in 'GF.Parsing.MCFG.Active' (Kilbury):
|
||||
, grammarCats :: SList FCat
|
||||
, grammarToks :: SList FToken
|
||||
, grammarLexer :: FToken -> (FCat,SyntaxNode RuleId RangeRec)
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +67,8 @@ getLeftCornerCat lins
|
||||
where
|
||||
syms = lins ! 0
|
||||
|
||||
buildFCFPInfo :: (FToken -> (FCat,SyntaxNode RuleId RangeRec)) -> FGrammar -> FCFPInfo
|
||||
buildFCFPInfo lexer grammar =
|
||||
buildFCFPInfo :: FGrammar -> FCFPInfo
|
||||
buildFCFPInfo grammar =
|
||||
FCFPInfo { allRules = allrules
|
||||
, topdownRules = topdownrules
|
||||
-- , emptyRules = emptyrules
|
||||
@@ -78,7 +77,6 @@ buildFCFPInfo lexer grammar =
|
||||
, leftcornerTokens = leftcorntoks
|
||||
, grammarCats = grammarcats
|
||||
, grammarToks = grammartoks
|
||||
, grammarLexer = lexer
|
||||
}
|
||||
|
||||
where allrules = listArray (0,length grammar-1) grammar
|
||||
|
||||
Reference in New Issue
Block a user