@@ -34,6 +34,7 @@ Date: June 2006
34
34
#include < goto-programs/read_goto_binary.h>
35
35
#include < goto-programs/write_goto_binary.h>
36
36
37
+ #include < langapi/language_file.h>
37
38
#include < langapi/mode.h>
38
39
39
40
#include < linking/static_lifetime_init.h>
@@ -80,8 +81,8 @@ bool compilet::doit()
80
81
add_compiler_specific_defines (config);
81
82
82
83
// Parse command line for source and object file names
83
- for (std::size_t i= 0 ; i<_cmdline .args .size (); i++)
84
- if (add_input_file (_cmdline .args [i]))
84
+ for (std::size_t i = 0 ; i < cmdline .args .size (); i++)
85
+ if (add_input_file (cmdline .args [i]))
85
86
return true ;
86
87
87
88
for (std::list<std::string>::const_iterator it = libraries.begin ();
@@ -456,7 +457,9 @@ bool compilet::compile()
456
457
457
458
// / parses a source file (low-level parsing)
458
459
// / \return true on error, false otherwise
459
- bool compilet::parse (const std::string &file_name)
460
+ bool compilet::parse (
461
+ const std::string &file_name,
462
+ language_filest &language_files)
460
463
{
461
464
if (file_name==" -" )
462
465
return parse_stdin ();
@@ -527,8 +530,7 @@ bool compilet::parse(const std::string &file_name)
527
530
528
531
if (lf.language ->parse (infile, file_name))
529
532
{
530
- if (get_ui ()==ui_message_handlert::uit::PLAIN)
531
- error () << " PARSING ERROR" << eom;
533
+ error () << " PARSING ERROR" << eom;
532
534
return true ;
533
535
}
534
536
}
@@ -571,8 +573,7 @@ bool compilet::parse_stdin()
571
573
{
572
574
if (language.parse (std::cin, " " ))
573
575
{
574
- if (get_ui ()==ui_message_handlert::uit::PLAIN)
575
- error () << " PARSING ERROR" << eom;
576
+ error () << " PARSING ERROR" << eom;
576
577
return true ;
577
578
}
578
579
}
@@ -634,29 +635,32 @@ bool compilet::write_bin_object_file(
634
635
// / \return true on error, false otherwise
635
636
bool compilet::parse_source (const std::string &file_name)
636
637
{
637
- if (parse (file_name))
638
+ language_filest language_files;
639
+ language_files.set_message_handler (get_message_handler ());
640
+
641
+ if (parse (file_name, language_files))
638
642
return true ;
639
643
640
- if (typecheck ()) // we just want to typecheck this one file here
644
+ // we just typecheck one file here
645
+ if (language_files.typecheck (symbol_table))
646
+ {
647
+ error () << " CONVERSION ERROR" << eom;
641
648
return true ;
649
+ }
642
650
643
- if (( has_suffix (file_name, " .class " ) ||
644
- has_suffix (file_name, " .jar " )) &&
645
- final ())
651
+ if (language_files. final (symbol_table))
652
+ {
653
+ error () << " CONVERSION ERROR " << eom;
646
654
return true ;
655
+ }
647
656
648
- // so we remove it from the list afterwards
649
- language_files.remove_file (file_name);
650
657
return false ;
651
658
}
652
659
653
660
// / constructor
654
661
// / \return nothing
655
- compilet::compilet (cmdlinet &_cmdline, ui_message_handlert &mh, bool Werror):
656
- language_uit(_cmdline, mh),
657
- ns(symbol_table),
658
- cmdline(_cmdline),
659
- warning_is_fatal(Werror)
662
+ compilet::compilet (cmdlinet &_cmdline, message_handlert &mh, bool Werror)
663
+ : messaget(mh), ns(symbol_table), cmdline(_cmdline), warning_is_fatal(Werror)
660
664
{
661
665
mode=COMPILE_LINK_EXECUTABLE;
662
666
echo_file_name=false ;
0 commit comments