mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-19 16:12:52 -06:00
Fixed several things, e.g. tokenizer.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user