diff options
| author | aarne <unknown> | 2003-11-07 14:54:44 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2003-11-07 14:54:44 +0000 |
| commit | 4c99687f217ce258f821d55e68f5403233f6dea7 (patch) | |
| tree | 04e2d94654dd4ceb4c5e988f18f979594876c730 /src/GF/UseGrammar/GetTree.hs | |
| parent | 6ae3322b373c52e59fb34360345d1c1e35049c5f (diff) | |
Fixed treatment of predefined types (Int, String).
Fixed treatment of predefined types (Int, String).
Added treatment of new reserved words to reading old grammars.
Diffstat (limited to 'src/GF/UseGrammar/GetTree.hs')
| -rw-r--r-- | src/GF/UseGrammar/GetTree.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/GF/UseGrammar/GetTree.hs b/src/GF/UseGrammar/GetTree.hs index 9ad91c21f..0db35baf2 100644 --- a/src/GF/UseGrammar/GetTree.hs +++ b/src/GF/UseGrammar/GetTree.hs @@ -13,6 +13,8 @@ import ShellState import Operations +import Char + -- how to form linearizable trees from strings and from terms of different levels -- -- String --> raw Term --> annot, qualif Term --> Tree @@ -39,11 +41,12 @@ strings2Cat s = (identC m, identC (drop 1 c)) where (m,c) = span (/= '.') s strings2Fun = strings2Cat string2ref :: StateGrammar -> String -> Err G.Term -string2ref _ ('x':'_':ds) = return $ freshAsTerm ds --- hack for generated vars -string2ref gr s = - if elem '.' s - then return $ uncurry G.Q $ strings2Fun s - else return $ G.Vr $ identC s +string2ref gr s = case s of + 'x':'_':ds -> return $ freshAsTerm ds --- hack for generated vars + '"':_:_ -> return $ G.K $ init $ tail s + _:_ | all isDigit s -> return $ G.EInt $ read s + _ | elem '.' s -> return $ uncurry G.Q $ strings2Fun s + _ -> return $ G.Vr $ identC s string2cat :: StateGrammar -> String -> Err G.Cat string2cat gr s = |
