diff options
| author | krasimir <krasimir@chalmers.se> | 2010-10-18 16:51:25 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-10-18 16:51:25 +0000 |
| commit | 775e59dabeb6d1e15a3c1c80d7578a865121b9cf (patch) | |
| tree | b46e85b17fa124b9508058f6069bb8c268424174 /src/runtime/haskell/PGF.hs | |
| parent | 205ac48ac3f96c938e6650c2a610e3e637af5570 (diff) | |
added explicit depth parameter to the parsing API and the corresponding command in the shell
Diffstat (limited to 'src/runtime/haskell/PGF.hs')
| -rw-r--r-- | src/runtime/haskell/PGF.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/runtime/haskell/PGF.hs b/src/runtime/haskell/PGF.hs index c750e66fe..9165f01ef 100644 --- a/src/runtime/haskell/PGF.hs +++ b/src/runtime/haskell/PGF.hs @@ -182,10 +182,10 @@ parseAll :: PGF -> Type -> String -> [[Tree]] parseAllLang :: PGF -> Type -> String -> [(Language,[Tree])] -- | The same as 'parse' but returns more detailed information -parse_ :: PGF -> Language -> Type -> String -> (Parse.ParseOutput,BracketedString) +parse_ :: PGF -> Language -> Type -> Maybe Int -> String -> (Parse.ParseOutput,BracketedString) -- | This is an experimental function. Use it on your own risk -parseWithRecovery :: PGF -> Language -> Type -> [Type] -> String -> (Parse.ParseOutput,BracketedString) +parseWithRecovery :: PGF -> Language -> Type -> [Type] -> Maybe Int -> String -> (Parse.ParseOutput,BracketedString) -- | List of all languages available in the given grammar. languages :: PGF -> [Language] @@ -227,21 +227,21 @@ functionType :: PGF -> CId -> Maybe Type readPGF f = decodeFile f parse pgf lang typ s = - case parse_ pgf lang typ s of + case parse_ pgf lang typ (Just 4) s of (Parse.ParseOk ts,_) -> ts _ -> [] parseAll mgr typ = map snd . parseAllLang mgr typ parseAllLang mgr typ s = - [(lang,ts) | lang <- languages mgr, (Parse.ParseOk ts,_) <- [parse_ mgr lang typ s]] + [(lang,ts) | lang <- languages mgr, (Parse.ParseOk ts,_) <- [parse_ mgr lang typ (Just 4) s]] -parse_ pgf lang typ s = +parse_ pgf lang typ dp s = case Map.lookup lang (concretes pgf) of - Just cnc -> Parse.parse pgf lang typ (words s) + Just cnc -> Parse.parse pgf lang typ dp (words s) Nothing -> error ("Unknown language: " ++ showCId lang) -parseWithRecovery pgf lang typ open_typs s = Parse.parseWithRecovery pgf lang typ open_typs (words s) +parseWithRecovery pgf lang typ open_typs dp s = Parse.parseWithRecovery pgf lang typ open_typs dp (words s) groupResults :: [[(Language,String)]] -> [(Language,[String])] groupResults = Map.toList . foldr more Map.empty . start . concat |
