public static TypeDefinition<?> parseTypeWithBody(final String moduleName, final String typeName,
final Type_body_stmtsContext typeBody, final List<String> actualPath, final URI namespace,
final Date revision, final String prefix, final Builder parent) {
+ final int line = typeBody.getStart().getLine();
TypeDefinition<?> baseType = null;
Integer fractionDigits = getFractionDigits(typeBody);
List<PatternConstraint> patternStatements = getPatternConstraint(typeBody);
List<RangeConstraint> rangeStatements = getRangeConstraints(typeBody);
- TypeConstraints constraints = new TypeConstraints(moduleName, typeBody.getStart().getLine());
+ TypeConstraints constraints = new TypeConstraints(moduleName, line);
constraints.addFractionDigits(fractionDigits);
constraints.addLengths(lengthStatements);
constraints.addPatterns(patternStatements);
} else if ("int64".equals(typeName)) {
intType = new Int64(baseTypePath);
}
+ if(intType == null) {
+ throw new YangParseException(moduleName, line, "Unknown yang type "+ typeName);
+ }
constraints.addRanges(intType.getRangeStatements());
baseType = intType;
} else if (typeName.startsWith("uint")) {
} else if ("uint64".equals(typeName)) {
uintType = new Uint64(baseTypePath);
}
+ if(uintType == null) {
+ throw new YangParseException(moduleName, line, "Unknown yang type "+ typeName);
+ }
constraints.addRanges(uintType.getRangeStatements());
baseType = uintType;
} else if ("enumeration".equals(typeName)) {