diff --git a/grammar/asdl_cpp.py b/grammar/asdl_cpp.py index 7f4ae62ab5..e77109ce41 100644 --- a/grammar/asdl_cpp.py +++ b/grammar/asdl_cpp.py @@ -1881,6 +1881,11 @@ def visitConstructor(self, cons, _): self.emit( 'Location loc;', 2) self.emit( 'loc.first = self().read_int64();', 2) self.emit( 'loc.last = self().read_int64();', 2) + if subs["lcompiler"] == "lfortran": + # Set the location to 0 for now, since we do not yet + # support multiple files + self.emit( 'loc.first = 0;', 2) + self.emit( 'loc.last = 0;', 2) for line in lines: self.emit(line, 2) self.emit( 'return %s::make_%s_t(%s);' % (subs["MOD"], name, ", ".join(args)), 2) @@ -2143,11 +2148,6 @@ def add_masks(fields, node): def main(argv): if len(argv) == 3: def_file, out_file = argv[1:] - elif len(argv) == 1: - print("Assuming default values of AST.asdl and ast.h") - here = os.path.dirname(__file__) - def_file = os.path.join(here, "AST.asdl") - out_file = os.path.join(here, "..", "src", "lpython", "ast.h") else: print("invalid arguments") return 2 @@ -2165,6 +2165,9 @@ def main(argv): if subs["MOD"] == "LPYTHON": subs["MOD"] = "LPython::AST" subs["mod"] = "ast" + subs["lcompiler"] = "lpython" + else: + subs["lcompiler"] = "lfortran" is_asr = (mod.name.upper() == "ASR") fp = open(out_file, "w", encoding="utf-8") try: