Search in sources :

Example 1 with TypedefType

use of net.morimekta.providence.model.TypedefType in project providence by morimekta.

the class ThriftProgramParser method parseTypedef.

private void parseTypedef(ThriftTokenizer tokenizer, String comment, List<Declaration> declarations, Set<String> includedPrograms) throws IOException {
    String type = parseType(tokenizer, tokenizer.expect("typename"), includedPrograms);
    Token id = tokenizer.expectIdentifier("typedef identifier");
    String name = id.asString();
    if (!allowedNameIdentifier(name)) {
        throw tokenizer.failure(id, "Typedef with reserved name: " + name);
    }
    TypedefType typedef = TypedefType.builder().setDocumentation(comment).setType(type).setName(name).build();
    declarations.add(Declaration.withDeclTypedef(typedef));
}
Also used : TypedefType(net.morimekta.providence.model.TypedefType) Token(net.morimekta.providence.serializer.pretty.Token)

Aggregations

TypedefType (net.morimekta.providence.model.TypedefType)1 Token (net.morimekta.providence.serializer.pretty.Token)1