From b5a2d64a7b84d80ad373f6d5ebb7ffeb77f13dfb Mon Sep 17 00:00:00 2001 From: Jakob Herrmann Date: Wed, 15 Feb 2017 12:22:06 +0100 Subject: [PATCH] * Some getters in syntaxtree * Extend RunParser (makes problems). --- src/de/dhbwstuttgart/parser/RunParser.java | 5 +++++ src/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java | 4 ++++ src/de/dhbwstuttgart/syntaxtree/Field.java | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/de/dhbwstuttgart/parser/RunParser.java b/src/de/dhbwstuttgart/parser/RunParser.java index 8912d494..08228eb0 100644 --- a/src/de/dhbwstuttgart/parser/RunParser.java +++ b/src/de/dhbwstuttgart/parser/RunParser.java @@ -35,6 +35,11 @@ public class RunParser{ System.out.println(mod.getClass().getName()); } System.out.println(c.getClassName().toString()); + System.out.println("{"); + for(Field field : c.getFieldDecl()){ + System.out.println(field.getName()); + } + System.out.println("}"); } } catch(java.util.NoSuchElementException e){ diff --git a/src/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java b/src/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java index 9d280aff..f82ae057 100755 --- a/src/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java +++ b/src/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java @@ -55,5 +55,9 @@ public class ClassOrInterface extends GTVDeclarationContext implements IItemWith public Modifiers getModifiers(){ return this.modifiers; } + + public List getFieldDecl(){ + return this.fielddecl; + } } diff --git a/src/de/dhbwstuttgart/syntaxtree/Field.java b/src/de/dhbwstuttgart/syntaxtree/Field.java index 9eaf7942..5482a4c5 100644 --- a/src/de/dhbwstuttgart/syntaxtree/Field.java +++ b/src/de/dhbwstuttgart/syntaxtree/Field.java @@ -19,6 +19,8 @@ public class Field extends GTVDeclarationContext implements Generic { this.type = type; } - + public String getName(){ + return this.name; + } }