Changeset 6 for trunk/YamlReference/yaml2yeast
- Timestamp:
- 04/06/08 04:24:28 (9 months ago)
- Files:
-
- 1 modified
-
trunk/YamlReference/yaml2yeast/Main.hs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/YamlReference/yaml2yeast/Main.hs
r3 r6 164 164 | ParamN (Maybe Int) -- ^ Specify $n$ parameter. 165 165 | ParamT (Maybe Chomp) -- ^ Specify $t$ parameter. 166 | ParamS (Maybe Style) -- ^ Specify $s$ parameter.167 166 | ParamC (Maybe Context) -- ^ Specify $c$ parameter. 168 167 | Input String -- ^ Specify input file name. … … 193 192 (ReqArg (ParamC . readParameter) "context") 194 193 "c parameter value (context)", 195 Option ['s'] ["style"]196 (ReqArg (ParamS . readParameter) "style")197 "s parameter value (style)",198 194 Option ['t'] ["chomp"] 199 195 (ReqArg (ParamT . readParameter) "chomp") … … 230 226 oN :: Maybe Int, -- ^ N parameter, if any. 231 227 oC :: Maybe Context, -- ^ C parameter, if any. 232 oS :: Maybe Style, -- ^ S parameter, if any.233 228 oT :: Maybe Chomp -- ^ T parameter, if any. 234 229 } … … 244 239 oN = Nothing, 245 240 oC = Nothing, 246 oS = Nothing,247 241 oT = Nothing 248 242 } … … 260 254 ParamN value -> applyFlags flags options { oN = value } 261 255 ParamC value -> applyFlags flags options { oC = value } 262 ParamS value -> applyFlags flags options { oS = value }263 256 ParamT value -> applyFlags flags options { oT = value } 264 257 Production name -> applyFlags flags options { oProduction = name } … … 283 276 runWith :: Options -> IO () 284 277 runWith options = 285 do let resolved = case ((oN options), (oC options), (oS options), (oT options)) of 286 (Nothing, Nothing, Nothing, Nothing) -> tokenizer (oProduction options) 287 (Just n, Nothing, Nothing, Nothing) -> tokenizerWithN (oProduction options) n 288 (Nothing, Just c, Nothing, Nothing) -> tokenizerWithC (oProduction options) c 289 (Nothing, Nothing, Just s, Nothing) -> tokenizerWithS (oProduction options) s 290 (Nothing, Nothing, Nothing, Just t) -> tokenizerWithT (oProduction options) t 291 (Just n, Just c, Nothing, Nothing) -> tokenizerWithNC (oProduction options) n c 292 (Just n, Nothing, Just s, Nothing) -> tokenizerWithNS (oProduction options) n s 293 (Just n, Nothing, Nothing, Just t) -> tokenizerWithNT (oProduction options) n t 294 _ -> error "No production with this combination of parameters" 278 do let resolved = case ((oN options), (oC options), (oT options)) of 279 (Nothing, Nothing, Nothing) -> tokenizer (oProduction options) 280 (Just n, Nothing, Nothing) -> tokenizerWithN (oProduction options) n 281 (Nothing, Just c, Nothing) -> tokenizerWithC (oProduction options) c 282 (Nothing, Nothing, Just t) -> tokenizerWithT (oProduction options) t 283 (Just n, Just c, Nothing) -> tokenizerWithNC (oProduction options) n c 284 (Just n, Nothing, Just t) -> tokenizerWithNT (oProduction options) n t 285 _ -> error "No production with this combination of parameters" 295 286 case resolved of 296 287 Nothing -> error $ "No production " ++ (oProduction options) ++ " or it doesn't take this combination of parameters"
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)