Fixed several things, e.g. tokenizer.

This commit is contained in:
aarne
2003-11-03 16:27:55 +00:00
parent 2728e6e7ce
commit 94326929b1
18 changed files with 133 additions and 69 deletions

View File

@@ -44,3 +44,9 @@ string2ref gr s =
if elem '.' s
then return $ uncurry G.Q $ strings2Fun s
else return $ G.Vr $ identC s
string2cat :: StateGrammar -> String -> Err G.Cat
string2cat gr s =
if elem '.' s
then return $ strings2Fun s
else return $ curry id (absId gr) (identC s)

View File

@@ -12,7 +12,7 @@ import LookAbs
import MMacros
import TypeCheck (annotate) ----
import Str
import Unlex
import Text
----import TypeCheck -- to annotate
import Operations
@@ -105,10 +105,14 @@ linLab0 = L (identC "s")
sTables2strs :: [[([Patt],[Str])]] -> [[Str]]
sTables2strs = map snd . concat
-- from this, to get a list of strings --- customize unlexer
-- from this, to get a list of strings
strs2strings :: [[Str]] -> [String]
strs2strings = map unlex
-- this is just unwords; use an unlexer from Text to postprocess
unlex :: [Str] -> String
unlex = performBinds . concat . map sstr . take 1 ----
-- finally, a top-level function to get a string from an expression
linTree2string :: Marker -> CanonGrammar -> Ident -> A.Tree -> String
linTree2string mk gr m e = err id id $ do

View File

@@ -21,7 +21,11 @@ tokVars :: String -> [CFTok]
tokVars = map mkCFTokVar . words
mkCFTok :: String -> CFTok
mkCFTok s = tS s ---- if (isLiteral s) then (mkLit s) else (tS s)
mkCFTok s = case s of
'"' :cs@(_:_) -> tL $ init cs
'\'':cs@(_:_) -> tL $ init cs --- 's Gravenhage
_:_ | all isDigit s -> tI s
_ -> tS s
mkCFTokVar :: String -> CFTok
mkCFTokVar s = case s of