@@ -164,7 +164,8 @@ int emit_asr(const std::string &infile,
164
164
diagnostics.diagnostics .clear ();
165
165
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
166
166
r = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
167
- compiler_options.disable_main , compiler_options.symtab_only , infile);
167
+ compiler_options.disable_main , compiler_options.symtab_only , infile,
168
+ compiler_options.import_path );
168
169
std::cerr << diagnostics.render (input, lm, compiler_options);
169
170
if (!r.ok ) {
170
171
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -207,7 +208,8 @@ int emit_cpp(const std::string &infile,
207
208
diagnostics.diagnostics .clear ();
208
209
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
209
210
r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
210
- compiler_options.disable_main , compiler_options.symtab_only , infile);
211
+ compiler_options.disable_main , compiler_options.symtab_only , infile,
212
+ compiler_options.import_path );
211
213
std::cerr << diagnostics.render (input, lm, compiler_options);
212
214
if (!r1.ok ) {
213
215
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -248,7 +250,8 @@ int emit_c(const std::string &infile,
248
250
diagnostics.diagnostics .clear ();
249
251
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
250
252
r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
251
- compiler_options.disable_main , compiler_options.symtab_only , infile);
253
+ compiler_options.disable_main , compiler_options.symtab_only , infile,
254
+ compiler_options.import_path );
252
255
std::cerr << diagnostics.render (input, lm, compiler_options);
253
256
if (!r1.ok ) {
254
257
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -289,7 +292,8 @@ int emit_wat(const std::string &infile,
289
292
diagnostics.diagnostics .clear ();
290
293
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
291
294
r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
292
- compiler_options.disable_main , compiler_options.symtab_only , infile);
295
+ compiler_options.disable_main , compiler_options.symtab_only , infile,
296
+ compiler_options.import_path );
293
297
std::cerr << diagnostics.render (input, lm, compiler_options);
294
298
if (!r1.ok ) {
295
299
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -333,7 +337,8 @@ int get_symbols (const std::string &infile,
333
337
LFortran::LPython::AST::ast_t * ast = r1.result ;
334
338
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
335
339
x = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
336
- compiler_options.disable_main , compiler_options.symtab_only , infile);
340
+ compiler_options.disable_main , compiler_options.symtab_only ,
341
+ infile, compiler_options.import_path );
337
342
if (!x.ok ) {
338
343
std::cout << " {}\n " ;
339
344
return 0 ;
@@ -426,7 +431,8 @@ int get_errors (const std::string &infile,
426
431
LFortran::LPython::AST::ast_t * ast = r1.result ;
427
432
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
428
433
r = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
429
- compiler_options.disable_main , compiler_options.symtab_only , infile);
434
+ compiler_options.disable_main , compiler_options.symtab_only ,
435
+ infile, compiler_options.import_path );
430
436
}
431
437
std::vector<LFortran::LPython::error_highlight> diag_lists;
432
438
LFortran::LPython::error_highlight h;
@@ -538,7 +544,8 @@ int emit_llvm(const std::string &infile,
538
544
diagnostics.diagnostics .clear ();
539
545
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
540
546
r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
541
- compiler_options.disable_main , compiler_options.symtab_only , infile);
547
+ compiler_options.disable_main , compiler_options.symtab_only , infile,
548
+ compiler_options.import_path );
542
549
std::cerr << diagnostics.render (input, lm, compiler_options);
543
550
if (!r1.ok ) {
544
551
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -596,7 +603,8 @@ int compile_python_to_object_file(
596
603
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
597
604
r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics,
598
605
!(arg_c && compiler_options.disable_main ),
599
- compiler_options.disable_main , compiler_options.symtab_only , infile);
606
+ compiler_options.disable_main , compiler_options.symtab_only , infile,
607
+ compiler_options.import_path );
600
608
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
601
609
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
602
610
std::cerr << diagnostics.render (input, lm, compiler_options);
@@ -679,7 +687,8 @@ int compile_to_binary_wasm(
679
687
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
680
688
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
681
689
r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
682
- compiler_options.disable_main , compiler_options.symtab_only , infile);
690
+ compiler_options.disable_main , compiler_options.symtab_only , infile,
691
+ compiler_options.import_path );
683
692
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
684
693
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
685
694
std::cerr << diagnostics.render (input, lm, compiler_options);
@@ -927,7 +936,8 @@ EMSCRIPTEN_KEEPALIVE char* emit_asr_from_source(char *input) {
927
936
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
928
937
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
929
938
asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, true ,
930
- compiler_options.disable_main , compiler_options.symtab_only , " input" );
939
+ compiler_options.disable_main , compiler_options.symtab_only , " input" ,
940
+ compiler_options.import_path );
931
941
out = diagnostics.render (input, lm, compiler_options);
932
942
if (asr.ok ) {
933
943
out += LFortran::pickle (*asr.result , compiler_options.use_colors , compiler_options.indent ,
@@ -946,7 +956,8 @@ EMSCRIPTEN_KEEPALIVE char* emit_wat_from_source(char *input) {
946
956
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
947
957
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
948
958
asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, true ,
949
- compiler_options.disable_main , compiler_options.symtab_only , " input" );
959
+ compiler_options.disable_main , compiler_options.symtab_only , " input" ,
960
+ compiler_options.import_path );
950
961
out = diagnostics.render (input, lm, compiler_options);
951
962
if (asr.ok ) {
952
963
LFortran::Result<LFortran::Vec<uint8_t >>
@@ -974,7 +985,8 @@ EMSCRIPTEN_KEEPALIVE char* emit_cpp_from_source(char *input) {
974
985
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
975
986
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
976
987
asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, true ,
977
- compiler_options.disable_main , compiler_options.symtab_only , " input" );
988
+ compiler_options.disable_main , compiler_options.symtab_only , " input" ,
989
+ compiler_options.import_path );
978
990
out = diagnostics.render (input, lm, compiler_options);
979
991
if (asr.ok ) {
980
992
auto res = LFortran::asr_to_cpp (al, *asr.result , diagnostics,
@@ -1013,7 +1025,8 @@ EMSCRIPTEN_KEEPALIVE char* emit_wasm_from_source(char *input) {
1013
1025
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
1014
1026
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
1015
1027
asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, true ,
1016
- compiler_options.disable_main , compiler_options.symtab_only , " input" );
1028
+ compiler_options.disable_main , compiler_options.symtab_only , " input" ,
1029
+ compiler_options.import_path );
1017
1030
out = diagnostics.render (input, lm, compiler_options);
1018
1031
if (asr.ok ) {
1019
1032
LFortran::Result<LFortran::Vec<uint8_t >>
@@ -1114,7 +1127,8 @@ int main(int argc, char *argv[])
1114
1127
// app.add_flag("-E", arg_E, "Preprocess only; do not compile, assemble or link");
1115
1128
// app.add_option("-l", arg_l, "Link library option");
1116
1129
// app.add_option("-L", arg_L, "Library path option");
1117
- // app.add_option("-I", arg_I, "Include path")->allow_extra_args(false);
1130
+ app.add_option (" -I" , compiler_options.import_path , " Specify the path"
1131
+ " to look for the module" )->allow_extra_args (false );
1118
1132
// app.add_option("-J", arg_J, "Where to save mod files");
1119
1133
// app.add_flag("-g", arg_g, "Compile with debugging information");
1120
1134
// app.add_option("-D", compiler_options.c_preprocessor_defines, "Define <macro>=<value> (or 1 if <value> omitted)")->allow_extra_args(false);
0 commit comments