Merge branch 'rinderknecht@fix_preprocessor' into 'dev'

[Bug] I forgot the check whether to perform #include or not.

See merge request ligolang/ligo!619
This commit is contained in:
Christian Rinderknecht 2020-05-15 18:07:31 +00:00
commit c021254cd4

View File

@ -492,6 +492,7 @@ rule scan state = parse
and file = Lexing.(lexbuf.lex_curr_p.pos_fname) in and file = Lexing.(lexbuf.lex_curr_p.pos_fname) in
let base = Filename.basename file let base = Filename.basename file
and reg, incl_file = scan_inclusion state lexbuf in and reg, incl_file = scan_inclusion state lexbuf in
if state.mode = Copy then
let incl_dir = Filename.dirname incl_file in let incl_dir = Filename.dirname incl_file in
let path = mk_path state in let path = mk_path state in
let incl_path, incl_chan = let incl_path, incl_chan =
@ -510,8 +511,9 @@ rule scan state = parse
let state = {state with env=state'.env; incl=state'.incl} in let state = {state with env=state'.env; incl=state'.incl} in
let path = if path = "" then base let path = if path = "" then base
else path ^ Filename.dir_sep ^ base in else path ^ Filename.dir_sep ^ base in
print state (sprintf "\n# %i \"%s\" 2" (line+1) path); let () = print state (sprintf "\n# %i \"%s\" 2" (line+1) path)
scan state lexbuf in scan state lexbuf
else scan state lexbuf
| "if" -> | "if" ->
let mode = expr state lexbuf in let mode = expr state lexbuf in
let mode = if state.mode = Copy then mode else Skip in let mode = if state.mode = Copy then mode else Skip in