Search in sources :

Example 11 with CharstringExtractor

use of org.eclipse.titan.designer.AST.TTCN3.values.CharstringExtractor in project titan.EclipsePlug-ins by eclipse.

the class HostIdExpression method checkExpressionOperand1.

/**
 * Checks the 1st operand
 * in charstring (optional)
 * @param timestamp
 *                the timestamp of the actual semantic check cycle.
 * @param expectedValue
 *                the kind of value expected.
 * @param referenceChain
 *                a reference chain to detect cyclic references.
 */
private void checkExpressionOperand1(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
    if (value == null) {
        return;
    }
    value.setLoweridToReference(timestamp);
    final Type_type tempType = value.getExpressionReturntype(timestamp, expectedValue);
    switch(tempType) {
        case TYPE_CHARSTRING:
            final IValue last = value.getValueRefdLast(timestamp, expectedValue, referenceChain);
            if (!last.isUnfoldable(timestamp)) {
                final String originalString = ((Charstring_Value) last).getValue();
                final CharstringExtractor cs = new CharstringExtractor(originalString);
                if (cs.isErrorneous()) {
                    value.getLocation().reportSemanticError(cs.getErrorMessage());
                    setIsErroneous(true);
                }
            }
            break;
        case TYPE_UNDEFINED:
            setIsErroneous(true);
            break;
        default:
            if (!isErroneous) {
                location.reportSemanticError(OPERAND1_ERROR1);
                setIsErroneous(true);
            }
            break;
    }
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Charstring_Value(org.eclipse.titan.designer.AST.TTCN3.values.Charstring_Value) Type_type(org.eclipse.titan.designer.AST.IType.Type_type) CharstringExtractor(org.eclipse.titan.designer.AST.TTCN3.values.CharstringExtractor)

Aggregations

IValue (org.eclipse.titan.designer.AST.IValue)11 CharstringExtractor (org.eclipse.titan.designer.AST.TTCN3.values.CharstringExtractor)11 Charstring_Value (org.eclipse.titan.designer.AST.TTCN3.values.Charstring_Value)10 Type_type (org.eclipse.titan.designer.AST.IType.Type_type)9 Expected_Value_type (org.eclipse.titan.designer.AST.TTCN3.Expected_Value_type)1 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)1 Octetstring_Value (org.eclipse.titan.designer.AST.TTCN3.values.Octetstring_Value)1 UniversalCharstring (org.eclipse.titan.designer.AST.TTCN3.values.UniversalCharstring)1