Commit e690866e authored by Anders Nilsson's avatar Anders Nilsson

Added value() method to Attributes, which returns a beautified attribute value.

parent 3b2e13a8
......@@ -421,6 +421,16 @@ aspect GenMisc {
pStream.println(ind(1)+"public String Attribute.name() {");
pStream.println(ind(2)+"return getValue().getSTRING_LITERAL();");
pStream.println(ind(1)+"}");
pStream.println(ind(1)+"public String Attribute.value() {");
pStream.println(ind(2)+"String s = getValue().getSTRING_LITERAL();");
pStream.println(ind(2)+"int hash = s.indexOf('#');");
pStream.println(ind(2)+"int firstCit = s.indexOf('\"');");
pStream.println(ind(2)+"int lastCit = s.lastIndexOf('\"');");
pStream.println(ind(2)+"hash = hash < 0 ? 0 : hash;");
pStream.println(ind(2)+"firstCit = firstCit < 0 ? 0 : firstCit;");
pStream.println(ind(2)+"lastCit = lastCit > firstCit ? lastCit : s.length()-1;");
pStream.println(ind(2)+"return s.substring(Math.max(hash,firstCit)+1,lastCit);");
pStream.println(ind(1)+"}");
// ClassUse.decl()
// pStream.println(ind(1)+"syn lazy Thing ClassUse.decl() {");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment