From e29eaa71d58101d04b6215bb686b0d503a70c398 Mon Sep 17 00:00:00 2001 From: Anders Nilsson <anders.nilsson@cs.lth.se> Date: Wed, 28 Feb 2007 15:00:34 +0100 Subject: [PATCH] Fixed generation of ValueElement, without annoying whitespace. --- .bzrignore | 1 + owl.jjt | 2 +- siaras/OntologyGeneration.jrag | 18 ++++++++++++++++++ siaras/Siaras.jjt | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.bzrignore b/.bzrignore index 4b8534a..f7bd05c 100644 --- a/.bzrignore +++ b/.bzrignore @@ -16,3 +16,4 @@ siaras/ontology.owl siaras/javadoc siaras/OntologyCompiler.jar *.repository +siaras/ontology.pprj diff --git a/owl.jjt b/owl.jjt index d5549c2..d458ffa 100644 --- a/owl.jjt +++ b/owl.jjt @@ -393,7 +393,7 @@ String getData() { } s.append(t.image); } - return s.toString(); + return s.toString().trim(); } // void StringElement() #StringElement : { Token t; } diff --git a/siaras/OntologyGeneration.jrag b/siaras/OntologyGeneration.jrag index d6b8375..3874e1c 100644 --- a/siaras/OntologyGeneration.jrag +++ b/siaras/OntologyGeneration.jrag @@ -44,6 +44,24 @@ aspect OntologyGeneration { } } + public void ValueElement.genOntology(String ind, PrintStream pStream) { + pStream.print(ind+"<"+name()); + for (int i=0; i<getNumAttribute(); i++) { + pStream.print(" "); + getAttribute(i).genOntology(pStream); + } + if (getNumElement() > 0) { + pStream.println(); + pStream.print(ind+">"); + for (int i=0; i<getNumElement(); i++) { + getElement(i).genOntology(ind+" ", pStream); + } + pStream.println("</"+name()+">"); + } else { + pStream.println("/>"); + } + } + // public void Thing.genOntology(String ind, PrintStream pStream) { // } diff --git a/siaras/Siaras.jjt b/siaras/Siaras.jjt index 589d487..91ee21f 100644 --- a/siaras/Siaras.jjt +++ b/siaras/Siaras.jjt @@ -378,7 +378,7 @@ String getData() { } s.append(t.image); } - return s.toString(); + return s.toString().trim(); } -- GitLab