endPosition,
RegexpExpression_MissingStringExpression
);
}
else {
Expression stringExpression = expression.getStringExpression();
// Invalid string expression
if (!isValid(stringExpression, StringExpressionBNF.ID)) {
int startPosition = position(stringExpression);
int endPosition = startPosition + length(stringExpression);
addProblem(
expression,
startPosition,
endPosition,
RegexpExpression_InvalidStringExpression
);
}
// Validate string expression
else {
stringExpression.accept(this);
}
}
// Missing pattern value
if (!expression.hasPatternValue()) {
int startPosition = position(expression) +
length(expression.getStringExpression()) +
(expression.hasSpaceAfterStringExpression() ? 1 : 0) +
6 /* REGEXP */ +
(expression.hasSpaceAfterIdentifier() ? 1 : 0);
int endPosition = startPosition;
addProblem(expression, startPosition, endPosition, RegexpExpression_MissingPatternValue);
}
else {
Expression patternValue = expression.getStringExpression();
// Invalid string expression
if (!isValid(patternValue, PatternValueBNF.ID)) {
int startPosition = position(expression) +
length(expression.getStringExpression()) +
(expression.hasSpaceAfterStringExpression() ? 1 : 0) +
6 /* REGEXP */ +
(expression.hasSpaceAfterIdentifier() ? 1 : 0);
int endPosition = startPosition + length(patternValue);
addProblem(
expression,
startPosition,
endPosition,
RegexpExpression_InvalidPatternValue
);
}
// Validate pattern value
else {
patternValue.accept(this);
}
}
}
}