on master help sign in
Wall police
61e25b6coreyoconnor
src/Data/Terminfo/Parse.hs+22−22
@@ -97,13 +97,13 @@ cap_expression_parser = do
97
97
98param_escape_parser :: CapParser BuildResults
98param_escape_parser :: CapParser BuildResults
99param_escape_parser = do
99param_escape_parser = do
100− char '%'
100+ _ <- char '%'
101 inc_offset 1
101 inc_offset 1
102 literal_percent_parser <|> param_op_parser
102 literal_percent_parser <|> param_op_parser
103
103
104literal_percent_parser :: CapParser BuildResults
104literal_percent_parser :: CapParser BuildResults
105literal_percent_parser = do
105literal_percent_parser = do
106− char '%'
106+ _ <- char '%'
107 start_offset <- getState >>= return . next_offset
107 start_offset <- getState >>= return . next_offset
108 inc_offset 1
108 inc_offset 1
109 return $ BuildResults 0 [Bytes start_offset 1] []
109 return $ BuildResults 0 [Bytes start_offset 1] []
@@ -123,32 +123,32 @@ param_op_parser
123
123
124increment_op_parser :: CapParser BuildResults
124increment_op_parser :: CapParser BuildResults
125increment_op_parser = do
125increment_op_parser = do
126− char 'i'
126+ _ <- char 'i'
127 inc_offset 1
127 inc_offset 1
128 return $ BuildResults 0 [] [ IncFirstTwo ]
128 return $ BuildResults 0 [] [ IncFirstTwo ]
129
129
130push_op_parser :: CapParser BuildResults
130push_op_parser :: CapParser BuildResults
131push_op_parser = do
131push_op_parser = do
132− char 'p'
132+ _ <- char 'p'
133 param_n <- digit >>= return . (\d -> read [d])
133 param_n <- digit >>= return . (\d -> read [d])
134 inc_offset 2
134 inc_offset 2
135 return $ BuildResults param_n [ PushParam $ param_n - 1 ] []
135 return $ BuildResults param_n [ PushParam $ param_n - 1 ] []
136
136
137dec_out_parser :: CapParser BuildResults
137dec_out_parser :: CapParser BuildResults
138dec_out_parser = do
138dec_out_parser = do
139− char 'd'
139+ _ <- char 'd'
140 inc_offset 1
140 inc_offset 1
141 return $ BuildResults 0 [ DecOut ] []
141 return $ BuildResults 0 [ DecOut ] []
142
142
143char_out_parser :: CapParser BuildResults
143char_out_parser :: CapParser BuildResults
144char_out_parser = do
144char_out_parser = do
145− char 'c'
145+ _ <- char 'c'
146 inc_offset 1
146 inc_offset 1
147 return $ BuildResults 0 [ CharOut ] []
147 return $ BuildResults 0 [ CharOut ] []
148
148
149conditional_op_parser :: CapParser BuildResults
149conditional_op_parser :: CapParser BuildResults
150conditional_op_parser = do
150conditional_op_parser = do
151− char '?'
151+ _ <- char '?'
152 inc_offset 1
152 inc_offset 1
153 cond_part <- many_expr conditional_true_parser
153 cond_part <- many_expr conditional_true_parser
154 parts <- many_p
154 parts <- many_p
@@ -191,17 +191,17 @@ conditional_op_parser = do
191
191
192conditional_true_parser :: CapParser ()
192conditional_true_parser :: CapParser ()
193conditional_true_parser = do
193conditional_true_parser = do
194− string "%t"
194+ _ <- string "%t"
195 inc_offset 2
195 inc_offset 2
196
196
197conditional_false_parser :: CapParser ()
197conditional_false_parser :: CapParser ()
198conditional_false_parser = do
198conditional_false_parser = do
199− string "%e"
199+ _ <- string "%e"
200 inc_offset 2
200 inc_offset 2
201
201
202conditional_end_parser :: CapParser ()
202conditional_end_parser :: CapParser ()
203conditional_end_parser = do
203conditional_end_parser = do
204− string "%;"
204+ _ <- string "%;"
205 inc_offset 2
205 inc_offset 2
206
206
207bitwise_op_parser :: CapParser BuildResults
207bitwise_op_parser :: CapParser BuildResults
@@ -212,19 +212,19 @@ bitwise_op_parser
212
212
213bitwise_or_parser :: CapParser BuildResults
213bitwise_or_parser :: CapParser BuildResults
214bitwise_or_parser = do
214bitwise_or_parser = do
215− char '|'
215+ _ <- char '|'
216 inc_offset 1
216 inc_offset 1
217 return $ BuildResults 0 [ BitwiseOr ] [ ]
217 return $ BuildResults 0 [ BitwiseOr ] [ ]
218
218
219bitwise_and_parser :: CapParser BuildResults
219bitwise_and_parser :: CapParser BuildResults
220bitwise_and_parser = do
220bitwise_and_parser = do
221− char '&'
221+ _ <- char '&'
222 inc_offset 1
222 inc_offset 1
223 return $ BuildResults 0 [ BitwiseAnd ] [ ]
223 return $ BuildResults 0 [ BitwiseAnd ] [ ]
224
224
225bitwise_xor_parser :: CapParser BuildResults
225bitwise_xor_parser :: CapParser BuildResults
226bitwise_xor_parser = do
226bitwise_xor_parser = do
227− char '^'
227+ _ <- char '^'
228 inc_offset 1
228 inc_offset 1
229 return $ BuildResults 0 [ BitwiseXOr ] [ ]
229 return $ BuildResults 0 [ BitwiseXOr ] [ ]
230
230
@@ -234,22 +234,22 @@ arith_op_parser
234 <|> minus_op
234 <|> minus_op
235 where
235 where
236 plus_op = do
236 plus_op = do
237− char '+'
237+ _ <- char '+'
238 inc_offset 1
238 inc_offset 1
239 return $ BuildResults 0 [ ArithPlus ] [ ]
239 return $ BuildResults 0 [ ArithPlus ] [ ]
240 minus_op = do
240 minus_op = do
241− char '-'
241+ _ <- char '-'
242 inc_offset 1
242 inc_offset 1
243 return $ BuildResults 0 [ ArithMinus ] [ ]
243 return $ BuildResults 0 [ ArithMinus ] [ ]
244
244
245literal_int_op_parser :: CapParser BuildResults
245literal_int_op_parser :: CapParser BuildResults
246literal_int_op_parser = do
246literal_int_op_parser = do
247− char '{'
247+ _ <- char '{'
248 inc_offset 1
248 inc_offset 1
249 n_str <- many1 digit
249 n_str <- many1 digit
250 inc_offset $ toEnum $ length n_str
250 inc_offset $ toEnum $ length n_str
251 let n :: Word = read n_str
251 let n :: Word = read n_str
252− char '}'
252+ _ <- char '}'
253 inc_offset 1
253 inc_offset 1
254 return $ BuildResults 0 [ PushValue n ] [ ]
254 return $ BuildResults 0 [ PushValue n ] [ ]
255
255
@@ -260,15 +260,15 @@ compare_op_parser
260 <|> compare_gt_op
260 <|> compare_gt_op
261 where
261 where
262 compare_eq_op = do
262 compare_eq_op = do
263− char '='
263+ _ <- char '='
264 inc_offset 1
264 inc_offset 1
265 return $ BuildResults 0 [ CompareEq ] [ ]
265 return $ BuildResults 0 [ CompareEq ] [ ]
266 compare_lt_op = do
266 compare_lt_op = do
267− char '<'
267+ _ <- char '<'
268 inc_offset 1
268 inc_offset 1
269 return $ BuildResults 0 [ CompareLt ] [ ]
269 return $ BuildResults 0 [ CompareLt ] [ ]
270 compare_gt_op = do
270 compare_gt_op = do
271− char '>'
271+ _ <- char '>'
272 inc_offset 1
272 inc_offset 1
273 return $ BuildResults 0 [ CompareGt ] [ ]
273 return $ BuildResults 0 [ CompareGt ] [ ]
274
274
@@ -284,9 +284,9 @@ bytes_op_parser = do
284
284
285char_const_parser :: CapParser BuildResults
285char_const_parser :: CapParser BuildResults
286char_const_parser = do
286char_const_parser = do
287− char '\''
287+ _ <- char '\''
288 char_value <- liftM (toEnum . fromEnum) anyChar
288 char_value <- liftM (toEnum . fromEnum) anyChar
289− char '\''
289+ _ <- char '\''
290 inc_offset 3
290 inc_offset 3
291 return $ BuildResults 0 [ PushValue char_value ] [ ]
291 return $ BuildResults 0 [ PushValue char_value ] [ ]
292
292
test/verify_eval_terminfo_caps.hs+2−2
@@ -98,8 +98,8 @@ main = do
98 liftIO $ putStrLn $ "\tevaluating cap: " ++ cap_name
98 liftIO $ putStrLn $ "\tevaluating cap: " ++ cap_name
99 case Terminfo.getCapability ti (Terminfo.tiGetStr cap_name) of
99 case Terminfo.getCapability ti (Terminfo.tiGetStr cap_name) of
100 Just cap_def -> do
100 Just cap_def -> do
101− verify ( "\teval cap " ++ cap_name ++ " -> " ++ show cap_def )
101+ _ <- verify ( "\teval cap " ++ cap_name ++ " -> " ++ show cap_def )
102− ( verify_eval_cap cap_def )
102+ ( verify_eval_cap cap_def )
103 return ()
103 return ()
104 Nothing -> do
104 Nothing -> do
105 return ()
105 return ()