diff options
| author | pierreweis <Pierre.Weis@inria.fr> | 2017-01-18 12:34:38 +0100 |
|---|---|---|
| committer | pierreweis <Pierre.Weis@inria.fr> | 2017-01-18 12:34:38 +0100 |
| commit | 878318123f7bcf1df9525bc2168724c42191e712 (patch) | |
| tree | 50e97204aa15d7521cddc3d8b4b6a31e012b70b1 /lex | |
| parent | 14c90d7bbcfb88a1df0b6a79fed30e24cf0858df (diff) | |
| download | ocaml-878318123f7bcf1df9525bc2168724c42191e712.tar.gz | |
Cosmetic: removing spurious spaces in resulting lexer
Diffstat (limited to 'lex')
| -rw-r--r-- | lex/output.ml | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/lex/output.ml b/lex/output.ml index 17df3b3ea0..9716a2aae5 100644 --- a/lex/output.ml +++ b/lex/output.ml @@ -50,22 +50,22 @@ let output_byte_array oc v = let output_tables oc tbl = output_string oc "let __ocaml_lex_tables = {\n"; - fprintf oc " Lexing.lex_base = \n%a;\n" output_array tbl.tbl_base; - fprintf oc " Lexing.lex_backtrk = \n%a;\n" output_array tbl.tbl_backtrk; - fprintf oc " Lexing.lex_default = \n%a;\n" output_array tbl.tbl_default; - fprintf oc " Lexing.lex_trans = \n%a;\n" output_array tbl.tbl_trans; - fprintf oc " Lexing.lex_check = \n%a;\n" output_array tbl.tbl_check; - fprintf oc " Lexing.lex_base_code = \n%a;\n" output_array tbl.tbl_base_code; - - fprintf oc " Lexing.lex_backtrk_code = \n%a;\n" + fprintf oc " Lexing.lex_base =\n%a;\n" output_array tbl.tbl_base; + fprintf oc " Lexing.lex_backtrk =\n%a;\n" output_array tbl.tbl_backtrk; + fprintf oc " Lexing.lex_default =\n%a;\n" output_array tbl.tbl_default; + fprintf oc " Lexing.lex_trans =\n%a;\n" output_array tbl.tbl_trans; + fprintf oc " Lexing.lex_check =\n%a;\n" output_array tbl.tbl_check; + fprintf oc " Lexing.lex_base_code =\n%a;\n" output_array tbl.tbl_base_code; + + fprintf oc " Lexing.lex_backtrk_code =\n%a;\n" output_array tbl.tbl_backtrk_code; - fprintf oc " Lexing.lex_default_code = \n%a;\n" + fprintf oc " Lexing.lex_default_code =\n%a;\n" output_array tbl.tbl_default_code; - fprintf oc " Lexing.lex_trans_code = \n%a;\n" + fprintf oc " Lexing.lex_trans_code =\n%a;\n" output_array tbl.tbl_trans_code; - fprintf oc " Lexing.lex_check_code = \n%a;\n" + fprintf oc " Lexing.lex_check_code =\n%a;\n" output_array tbl.tbl_check_code; - fprintf oc " Lexing.lex_code = \n%a;\n" output_byte_array tbl.tbl_code; + fprintf oc " Lexing.lex_code =\n%a;\n" output_byte_array tbl.tbl_code; output_string oc "}\n\n" @@ -74,20 +74,21 @@ let output_tables oc tbl = let output_entry ic oc has_refill oci e = let init_num, init_moves = e.auto_initial_state in - fprintf oc "%s %alexbuf =\ -\n %a%a __ocaml_lex_%s_rec %alexbuf %d\n" + fprintf oc + "%s %alexbuf =\ + \n %a%a __ocaml_lex_%s_rec %alexbuf %d\n" e.auto_name - output_args e.auto_args + output_args e.auto_args (fun oc x -> if x > 0 then - fprintf oc "lexbuf.Lexing.lex_mem <- Array.make %d (-1) ; " x) + fprintf oc "lexbuf.Lexing.lex_mem <- Array.make %d (-1);" x) e.auto_mem_size (output_memory_actions " ") init_moves e.auto_name output_args e.auto_args init_num; fprintf oc "and __ocaml_lex_%s_rec %alexbuf __ocaml_lex_state =\n" - e.auto_name output_args e.auto_args ; + e.auto_name output_args e.auto_args; fprintf oc " match Lexing.%sengine" (if e.auto_mem_size == 0 then "" else "new_"); fprintf oc " __ocaml_lex_tables __ocaml_lex_state lexbuf with\n "; @@ -101,13 +102,13 @@ let output_entry ic oc has_refill oci e = e.auto_actions; if has_refill then fprintf oc - " | __ocaml_lex_state -> __ocaml_lex_refill \ - \n (fun lexbuf -> lexbuf.Lexing.refill_buff lexbuf; \ + " | __ocaml_lex_state -> __ocaml_lex_refill\ + \n (fun lexbuf -> lexbuf.Lexing.refill_buff lexbuf;\ \n __ocaml_lex_%s_rec %alexbuf __ocaml_lex_state) lexbuf\n\n" e.auto_name output_args e.auto_args else fprintf oc - " | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; \ + " | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;\ \n __ocaml_lex_%s_rec %alexbuf __ocaml_lex_state\n\n" e.auto_name output_args e.auto_args @@ -131,7 +132,7 @@ let output_lexdef ic oc oci header rh tables entry_points trailer = Array.length tables.tbl_check_code) + Array.length tables.tbl_code) in if size_groups > 0 && not !Common.quiet_mode then - Printf.printf "%d additional bytes used for bindings\n" size_groups ; + Printf.printf "%d additional bytes used for bindings\n" size_groups; flush stdout; if Array.length tables.tbl_trans > 0x8000 then raise Table_overflow; copy_chunk ic oc oci header false; |
