Skip to content

Commit

Permalink
Merge pull request #169 from stdweird/anno_values
Browse files Browse the repository at this point in the history
annotations: add default to annotation for attribute type with a default
  • Loading branch information
ned21 authored Oct 26, 2017
2 parents 1a02b66 + 1bb8244 commit 4cb3a59
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import org.quattor.pan.exceptions.EvaluationException;
import org.quattor.pan.exceptions.SyntaxException;
import org.quattor.pan.exceptions.SystemException;
import org.quattor.pan.dml.Operation;
import org.quattor.pan.parser.ASTStatement.StatementType;
import org.quattor.pan.parser.ASTOperation.OperationType;
import org.quattor.pan.template.SourceRange;
import org.quattor.pan.utils.MessageUtils;
import org.quattor.pan.utils.XmlUtils;
Expand Down Expand Up @@ -189,6 +191,22 @@ private static String getElementInfo(Node ast, AttributesImpl atts) {
addAttribute(atts, "extensible", node.isExtensible());
addAttribute(atts, "range", node.getRange());

} else if (ast instanceof ASTOperation) {
ASTOperation node = (ASTOperation) ast;
if (ast.jjtGetParent() instanceof ASTOperation) {
ASTOperation parent = (ASTOperation) ast.jjtGetParent();
if (parent.getOperationType() == OperationType.DML &&
parent.jjtGetParent() instanceof ASTOperation) {
ASTOperation grandparent = (ASTOperation) parent.jjtGetParent();
if (grandparent.getOperationType() == OperationType.DEFAULT) {
if (node.getOperation() != null) {
elementName = "default";
addSourceRangeAttribute(atts, node);
addAttribute(atts, "text", node.getOperation().toString());
}
}
}
}
}

return elementName;
Expand Down

0 comments on commit 4cb3a59

Please sign in to comment.