From 0f1055b8d7f97d86c66fa602c17666bc2ff9c437 Mon Sep 17 00:00:00 2001 From: Constantin Jucovschi Date: Tue, 31 Mar 2009 06:18:54 -0400 Subject: Initial commit --- src/syntaxParser/List.java | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/syntaxParser/List.java (limited to 'src/syntaxParser/List.java') diff --git a/src/syntaxParser/List.java b/src/syntaxParser/List.java new file mode 100644 index 0000000..685c504 --- /dev/null +++ b/src/syntaxParser/List.java @@ -0,0 +1,42 @@ +package syntaxParser; +/* Author: Sorin stancu-Mara + * date: 8 feb 2008 + * All the lists have the same caracteristics, therfore all of them derive from this class + * No need to verify that the list contain same type of elements since they are created using the grammar. + */ + +class List implements IParseTreeNode { + IParseTreeNode element; + List next; + String tag; + + public List(IParseTreeNode elem) { + element = elem; + next = null; + } + + public List(IParseTreeNode elem, List next) { + element = elem; + this.next = next; + } + + public void setTag(String tagName) { + tag = tagName; + if (next != null) { + next.setTag(tag); + } + } + + public String toXML() { + String result = ""; + if (tag != null) { + result += "<" + tag + ">"; + result += element.toXML(); + result += ""; + } else + result += element.toXML(); + if (next != null) + result += next.toXML(); + return result; + } +} -- cgit