use of org.eclipse.titan.designer.AST.TTCN3.values.CharstringExtractor in project titan.EclipsePlug-ins by eclipse.
the class IsTemplateKindExpression method checkExpressionOperand2.
/**
* Checks the 2nd 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 checkExpressionOperand2(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
if (value == null) {
setIsErroneous(true);
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(OPERAND2_ERROR1);
setIsErroneous(true);
}
break;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.values.CharstringExtractor in project titan.EclipsePlug-ins by eclipse.
the class DecvalueUnicharExpression method checkExpressionOperand3.
/**
* Checks the 3rd 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 checkExpressionOperand3(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
if (value3 == null) {
return;
}
value3.setLoweridToReference(timestamp);
final Type_type tempType = value3.getExpressionReturntype(timestamp, expectedValue);
switch(tempType) {
case TYPE_CHARSTRING:
final IValue last = value3.getValueRefdLast(timestamp, expectedValue, referenceChain);
if (!last.isUnfoldable(timestamp)) {
final String originalString = ((Charstring_Value) last).getValue();
final CharstringExtractor cs = new CharstringExtractor(originalString);
if (cs.isErrorneous()) {
value3.getLocation().reportSemanticError(cs.getErrorMessage());
setIsErroneous(true);
}
}
break;
case TYPE_UNDEFINED:
setIsErroneous(true);
break;
default:
if (!isErroneous) {
location.reportSemanticError(OPERAND3_ERROR1);
setIsErroneous(true);
}
break;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.values.CharstringExtractor in project titan.EclipsePlug-ins by eclipse.
the class Char2IntExpression method evaluateValue.
@Override
public /**
* {@inheritDoc}
*/
IValue evaluateValue(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return lastValue;
}
isErroneous = false;
lastTimeChecked = timestamp;
lastValue = this;
if (value == null) {
return lastValue;
}
checkExpressionOperands(timestamp, expectedValue, referenceChain);
if (getIsErroneous(timestamp)) {
return lastValue;
}
if (isUnfoldable(timestamp, referenceChain)) {
return lastValue;
}
final IValue last = value.getValueRefdLast(timestamp, referenceChain);
if (last.getIsErroneous(timestamp)) {
setIsErroneous(true);
return lastValue;
}
switch(last.getValuetype()) {
case CHARSTRING_VALUE:
final String string = ((Charstring_Value) last).getValue();
final CharstringExtractor cs = new CharstringExtractor(string);
lastValue = new Integer_Value(cs.getExtractedString().charAt(0));
lastValue.copyGeneralProperties(this);
break;
default:
setIsErroneous(true);
break;
}
return lastValue;
}
use of org.eclipse.titan.designer.AST.TTCN3.values.CharstringExtractor in project titan.EclipsePlug-ins by eclipse.
the class CheckStateExpression method checkExpressionOperand1.
/**
* Checks the operand
* in charstring (mandatory)
* @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) {
setIsErroneous(true);
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;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.values.CharstringExtractor in project titan.EclipsePlug-ins by eclipse.
the class AnyPortCheckStateExpression method checkExpressionOperand1.
/**
* Checks the operand
* in charstring (mandatory)
* @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) {
setIsErroneous(true);
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;
}
}
Aggregations