/** * Handles the incremental parsing of this attribute specification. * * @param reparser the parser doing the incremental parsing. * @param isDamaged true if the location contains the damaged area, false if only its' location * needs to be updated. */ @Override public void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException { // TODO if (isDamaged) { throw new ReParseException(); } templateInst.updateSyntax(reparser, false); reparser.updateLocation(templateInst.getLocation()); }
@Override public void findReferences( final ReferenceFinder referenceFinder, final List<Hit> foundIdentifiers) { if (templateInst != null) { templateInst.findReferences(referenceFinder, foundIdentifiers); } }
public boolean isOmit() { ITTCN3Template templateBody = templateInst.getTemplateBody(); switch (templateBody.getTemplatetype()) { case OMIT_VALUE: return true; case SPECIFIC_VALUE: return (((SpecificValue_Template) templateBody).getSpecificValue().getValuetype() == IValue.Value_type.OMIT_VALUE); default: return false; } }
@Override public boolean accept(ASTVisitor v) { switch (v.visit(this)) { case ASTVisitor.V_ABORT: return false; case ASTVisitor.V_SKIP: return true; } if (templateInst != null) { if (!templateInst.accept(v)) { return false; } } if (v.leave(this) == ASTVisitor.V_ABORT) { return false; } return true; }
public void check(final CompilationTimeStamp timestamp, final Scope scope) { templateInst.setMyScope(scope); if (isOmit()) { // special case, no type needed if (indicator == Indicator_Type.Before_Indicator || indicator == Indicator_Type.After_Indicator) { if (!hasAllKeyword) { final String message = MessageFormat.format( "Keyword `all'' is expected after `omit'' when omitting all fields {0} the specified field", indicator.getDisplayName()); templateInst.getLocation().reportSemanticError(message); } } else { if (hasAllKeyword) { templateInst .getLocation() .reportSemanticError("Unexpected `all' keyword after `omit' when omitting one field"); } } type = null; return; } if (hasAllKeyword) { templateInst .getLocation() .reportSemanticError("Unexpected `all' keyword after the in-line template"); } // determine the type of the tmpl_inst type = templateInst.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_TEMPLATE); if (type == null) { templateInst.getTemplateBody().setLoweridToReference(timestamp); type = templateInst.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_TEMPLATE); } if (type == null) { templateInst .getLocation() .reportSemanticError("Cannot determine the type of the in-line template"); return; } type.check(timestamp); IType typeLast = type.getTypeRefdLast(timestamp); if (typeLast == null || typeLast.getIsErroneous(timestamp)) { type = null; return; } if (isRaw) { switch (typeLast.getTypetypeTtcn3()) { case TYPE_BITSTRING: case TYPE_OCTETSTRING: case TYPE_CHARSTRING: case TYPE_UCHARSTRING: break; default: templateInst .getLocation() .reportSemanticError( MessageFormat.format( "An in-line template of type `{0}'' cannot be used as a `raw'' erroneous value", typeLast.getTypename())); } } if (templateInst.getDerivedReference() != null) { templateInst .getLocation() .reportSemanticError( "Reference to a constant value was expected instead of an in-line modified template"); type = null; return; } ITTCN3Template templ = templateInst.getTemplateBody(); if (templ.isValue(timestamp)) { value = templ.getValue(); value.setMyGovernor(type); type.checkThisValueRef(timestamp, value); type.checkThisValue( timestamp, value, new ValueCheckingOptions( Expected_Value_type.EXPECTED_CONSTANT, false, false, true, false, false)); } else { templateInst .getLocation() .reportSemanticError("A specific value without matching symbols was expected"); type = null; return; } }