private ParseTree parseRecordTypeExpression() { SourcePosition start = getTreeStartLocation(); ParseTree typeExpression; if (peek(TokenType.OPEN_CURLY)) { eat(TokenType.OPEN_CURLY); typeExpression = new RecordTypeTree(getTreeLocation(start), parseInterfaceElements()); eat(TokenType.CLOSE_CURLY); } else { typeExpression = parseTypeQuery(); } return typeExpression; }
private ParseTree parseRecordTypeExpression() { SourcePosition start = getTreeStartLocation(); ParseTree typeExpression; if (peek(TokenType.OPEN_CURLY)) { eat(TokenType.OPEN_CURLY); typeExpression = new RecordTypeTree(getTreeLocation(start), parseInterfaceElements()); eat(TokenType.CLOSE_CURLY); } else { typeExpression = parseTypeQuery(); } return typeExpression; }
private ParseTree parseInterfaceDeclaration() { SourcePosition start = getTreeStartLocation(); eat(TokenType.INTERFACE); IdentifierToken name = eatId(); GenericTypeListTree generics = maybeParseGenericTypes(); ImmutableList.Builder<ParseTree> superTypes = ImmutableList.builder(); if (peek(TokenType.EXTENDS)) { eat(TokenType.EXTENDS); ParseTree type = parseType(); superTypes.add(type); while (peek(TokenType.COMMA)) { eat(TokenType.COMMA); type = parseType(); if (type != null) { superTypes.add(type); } } } eat(TokenType.OPEN_CURLY); ImmutableList<ParseTree> elements = parseInterfaceElements(); eat(TokenType.CLOSE_CURLY); return new InterfaceDeclarationTree(getTreeLocation(start), name, generics, superTypes.build(), elements); }
private ParseTree parseInterfaceDeclaration() { SourcePosition start = getTreeStartLocation(); eat(TokenType.INTERFACE); IdentifierToken name = eatId(); GenericTypeListTree generics = maybeParseGenericTypes(); ImmutableList.Builder<ParseTree> superTypes = ImmutableList.builder(); if (peek(TokenType.EXTENDS)) { eat(TokenType.EXTENDS); ParseTree type = parseType(); superTypes.add(type); while (peek(TokenType.COMMA)) { eat(TokenType.COMMA); type = parseType(); if (type != null) { superTypes.add(type); } } } eat(TokenType.OPEN_CURLY); ImmutableList<ParseTree> elements = parseInterfaceElements(); eat(TokenType.CLOSE_CURLY); return new InterfaceDeclarationTree(getTreeLocation(start), name, generics, superTypes.build(), elements); }