From b5c00d58d146626c02013723b9abe47af14904e1 Mon Sep 17 00:00:00 2001 From: Johannes Mey <johannes.mey@tu-dresden.de> Date: Wed, 8 Feb 2017 12:45:58 +0100 Subject: [PATCH] add option to print the first line of an AST (for test output) --- Parser/spec/ASTPrinting.jadd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Parser/spec/ASTPrinting.jadd b/Parser/spec/ASTPrinting.jadd index ba50aaf..9151a91 100644 --- a/Parser/spec/ASTPrinting.jadd +++ b/Parser/spec/ASTPrinting.jadd @@ -91,4 +91,14 @@ aspect Debug { } return b; } -} \ No newline at end of file + + protected String ASTNode.getPrettyPrintLine() { + PrettyPrinter sw = new PrettyPrinter(" ", false); + try { + this.prettyPrint(sw); + return sw.toString().trim().split("\n")[0]; + } catch (RuntimeException e) { + return e.getMessage(); + } + } +} -- GitLab