From 1b7f8f4374662100d085b9d6860d49f01f1a3405 Mon Sep 17 00:00:00 2001 From: Anders Nilsson <andersn@control.lth.se> Date: Wed, 18 Jun 2014 16:59:40 +0200 Subject: [PATCH] Trying to fix bitrot --- CompilerGeneration.jrag | 2 ++ Names.jrag | 2 +- Rewrites.jrag | 38 +++++++++++++++++++++++--------------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/CompilerGeneration.jrag b/CompilerGeneration.jrag index 2a9c803..a155ba6 100644 --- a/CompilerGeneration.jrag +++ b/CompilerGeneration.jrag @@ -102,6 +102,8 @@ aspect AbsGrammarGeneration { // Thing is handled explicitly return; } + System.out.println(name()); + dumpTree(" ",System.out); pStream.print(name()); pStream.print(" : "+getSuperClass().name()); pStream.print(" ::="); diff --git a/Names.jrag b/Names.jrag index c698d4d..c5b6a40 100644 --- a/Names.jrag +++ b/Names.jrag @@ -1,7 +1,7 @@ /* -*-Java-*- */ /* - * Copyright (C) 2006,2010 Anders Nilsson <anders.nilsson@control.lth.se> + * Copyright (C) 2006,2010,2014 Anders Nilsson <anders.nilsson@control.lth.se> * * This file is part of OntologyCompiler. * diff --git a/Rewrites.jrag b/Rewrites.jrag index ceb5cbe..24d5f9c 100644 --- a/Rewrites.jrag +++ b/Rewrites.jrag @@ -30,6 +30,7 @@ aspect MiscUtilities { syn lazy String Attribute.trim() { String s = getValue().getSTRING_LITERAL(); + s.replaceAll("&iml;",""); if (s.indexOf('"') == 0) { s = s.substring(1,s.length()-1).trim(); } @@ -226,7 +227,12 @@ aspect MiscUtilities { return (ComplexElement) e; } - syn boolean Declaration.isClassDecl() = getElement(0).isClass(); + syn boolean Declaration.isClassDecl() { + dumpTree(" ",System.out); + return getElement(0).isClass(); + } + eq OwlClassDecl.isClassDecl() = true; + eq OwlClassUse.isClassDecl() = false; eq ClassDeclaration.isClassDecl() = false; eq IndividualDeclaration.isClassDecl() = false; syn boolean Declaration.isIndividualDecl() = getElement(0).isIndividual(); @@ -243,20 +249,22 @@ aspect MiscUtilities { aspect RewriteClasses { - rewrite Declaration { - when (isClassDecl()) - to ClassDeclaration { - ClassDeclaration c = new ClassDeclaration(); - c.setElementList(getElementList()); - return c; - } - // when (isIndividualDecl()) - // to IndividualDeclaration { - // IndividualDeclaration c = new IndividualDeclaration(); - // c.setElementList(getElementList()); - // return c; - // } - } + // rewrite OClass { + // when (isClassDecl()) + // to ClassDeclaration { + // System.out.println(getId()); + // ClassDeclaration c = new ClassDeclaration(); + // c.setElementList(getElementList()); + // c.setAttributeList(getAttributeList()); + // return c; + // } + // // when (isIndividualDecl()) + // // to IndividualDeclaration { + // // IndividualDeclaration c = new IndividualDeclaration(); + // // c.setElementList(getElementList()); + // // return c; + // // } + // } rewrite OwlClass { when (isTopLevel()) -- GitLab