From 6050c36f1593bb870eb69fea5ea57b56a7e53a17 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Wed, 13 Nov 2024 10:53:59 +0100 Subject: [PATCH] removed experiment of building error trees on the fly if they are not there --- .../values/parsetrees/TreeAdapter.java | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/org/rascalmpl/values/parsetrees/TreeAdapter.java b/src/org/rascalmpl/values/parsetrees/TreeAdapter.java index 5ebdba4f390..2bf2c468590 100644 --- a/src/org/rascalmpl/values/parsetrees/TreeAdapter.java +++ b/src/org/rascalmpl/values/parsetrees/TreeAdapter.java @@ -210,8 +210,10 @@ else if (index == dot) { eprod = prod.set("prod", IRascalValueFactory.getInstance().integer(dot + 1)); return setProduction(setArgs(tree, args.append(repl)), eprod); } - - // otherwise we return null which indicates the field does not exist. + else { + // otherwise we return null which indicates the field does not exist. + return null; + } } } } @@ -306,22 +308,8 @@ else if (ProductionAdapter.isError(prod)) { return new FieldResult(sym, (ITree) tree.getArgs().get(index)); } else { - // We have the right prodction and the field would be there, if we didn't recover from a parse error - // and are missing some of the children (including the indicated field). - // So we return a quasi tree that is of the right type, but it otherwise just an error tree - // like its parent. This tree does not have content, because we wouldn't know which of the skipped - // parts are meant. - var vf = IRascalValueFactory.getInstance(); - // @PieterOlivier is this the right way to do this? I just need an empty tree of the right symbol. - var skipped = vf.constructor(RascalValueFactory.Production_Skipped); - var skippedProd = vf.constructor(RascalValueFactory.Production_Error, sym, skipped, vf.integer(0)); - var skippedTree = vf.appl(skippedProd); - var parentLoc = getLocation(tree); - if (parentLoc != null) { - // TODO @PieterOlivier I guess we need the location of the last parsed element, and use an - // empty range that is just beyond that. But for now I'd like to test with this. - } - return new FieldResult(sym, skippedTree); + // we simply don't have that field yet. too bad. + return null; } } }