Search in sources :

Example 1 with AConcatExpression

use of de.be4.classicalb.core.parser.node.AConcatExpression in project probparsers by bendisposto.

the class RulesMachineChecker method countPlaceHoldersInExpression.

private Integer countPlaceHoldersInExpression(PExpression param) {
    if (param instanceof AConcatExpression) {
        AConcatExpression con = (AConcatExpression) param;
        Integer left = countPlaceHoldersInExpression(con.getLeft());
        Integer right = countPlaceHoldersInExpression(con.getRight());
        if (left == null || right == null) {
            return null;
        } else {
            return left + right;
        }
    } else if (param instanceof AStringExpression) {
        AStringExpression string = (AStringExpression) param;
        String content = string.getContent().getText();
        String subString = "~w";
        return countOccurrences(content, subString);
    } else {
        return null;
    }
}
Also used : AConcatExpression(de.be4.classicalb.core.parser.node.AConcatExpression) AStringExpression(de.be4.classicalb.core.parser.node.AStringExpression)

Aggregations

AConcatExpression (de.be4.classicalb.core.parser.node.AConcatExpression)1 AStringExpression (de.be4.classicalb.core.parser.node.AStringExpression)1