Skip to content

Commit cb25098

Browse files
committed
allow #if 0|1
1 parent fbcfbcd commit cb25098

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

parsing/lexer.mll

+7-5
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,13 @@ let directive_parse token_with_comments lexbuf =
396396
curr_loc)))
397397
value_v
398398
| INT (v,None) ->
399-
token_op calc
400-
~no:(fun _e ->
401-
raise(Error(Conditional_expr_expected_type(Dir_type_bool,Dir_type_int),
402-
curr_loc)))
403-
(Dir_int (cvt_int_literal v))
399+
let num_v = cvt_int_literal v in
400+
token_op calc
401+
~no:(fun e ->
402+
push e;
403+
num_v <> 0
404+
)
405+
(Dir_int num_v)
404406
| FLOAT (v,None) ->
405407
token_op calc
406408
~no:(fun _e ->

0 commit comments

Comments
 (0)