Add protocol support / deprecate interface support. Update relnotes for 0.7, update URL to adjust for new doc location. Change-Id: I8a67a1b43002ae55f2bf98897230e36e94cb79fb
diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index eb701fe..0e4b880 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml
@@ -8,7 +8,7 @@ <category>Languages</category> <description><![CDATA[ - <a href="https://fuchsia.googlesource.com/docs/+/master/development/languages/fidl/intro/README.md">FIDL</a> Plugin for IntelliJ.<br> + <a href="https://fuchsia.googlesource.com/fuchsia/+/master/docs/development/languages/fidl/intro/README.md">FIDL</a> Plugin for IntelliJ.<br> <h2> Features </h2> <ul> <li> Syntax and Semantic Highlighting </li> @@ -20,6 +20,7 @@ <ul> <li><b>0.7</b> <ul> + <li>Add protocol support, deprecate interface support</li> <li>Remove explicit ordinal support</li> <li>Add doc comment support to interfaces</li> </ul>
diff --git a/src/fuchsia/developer/plugin/fidl/BUILD b/src/fuchsia/developer/plugin/fidl/BUILD index d324d46..e2e275b 100644 --- a/src/fuchsia/developer/plugin/fidl/BUILD +++ b/src/fuchsia/developer/plugin/fidl/BUILD
@@ -45,8 +45,7 @@ "fuchsia/developer/plugin/fidl/psi/FidlIdentifierType.java", "fuchsia/developer/plugin/fidl/psi/FidlIntegerType.java", "fuchsia/developer/plugin/fidl/psi/FidlInterfaceDeclaration.java", - "fuchsia/developer/plugin/fidl/psi/FidlInterfaceMethod.java", - "fuchsia/developer/plugin/fidl/psi/FidlInterfaceParameters.java", + "fuchsia/developer/plugin/fidl/psi/FidlInterfaceMember.java", "fuchsia/developer/plugin/fidl/psi/FidlLibraryHeader.java", "fuchsia/developer/plugin/fidl/psi/FidlLiteral.java", "fuchsia/developer/plugin/fidl/psi/FidlOrdinal.java", @@ -55,6 +54,11 @@ "fuchsia/developer/plugin/fidl/psi/FidlParameters.java", "fuchsia/developer/plugin/fidl/psi/FidlPopulatedTableField.java", "fuchsia/developer/plugin/fidl/psi/FidlPrimitiveType.java", + "fuchsia/developer/plugin/fidl/psi/FidlProtocolCompose.java", + "fuchsia/developer/plugin/fidl/psi/FidlProtocolDeclaration.java", + "fuchsia/developer/plugin/fidl/psi/FidlProtocolEvent.java", + "fuchsia/developer/plugin/fidl/psi/FidlProtocolMember.java", + "fuchsia/developer/plugin/fidl/psi/FidlProtocolMethod.java", "fuchsia/developer/plugin/fidl/psi/FidlRequestType.java", "fuchsia/developer/plugin/fidl/psi/FidlReservedTableField.java", "fuchsia/developer/plugin/fidl/psi/FidlStringType.java", @@ -93,8 +97,7 @@ "fuchsia/developer/plugin/fidl/psi/impl/FidlIdentifierTypeImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlIntegerTypeImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlInterfaceDeclarationImpl.java", - "fuchsia/developer/plugin/fidl/psi/impl/FidlInterfaceMethodImpl.java", - "fuchsia/developer/plugin/fidl/psi/impl/FidlInterfaceParametersImpl.java", + "fuchsia/developer/plugin/fidl/psi/impl/FidlInterfaceMemberImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlLibraryHeaderImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlLiteralImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlOrdinalImpl.java", @@ -103,6 +106,11 @@ "fuchsia/developer/plugin/fidl/psi/impl/FidlParametersImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlPopulatedTableFieldImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlPrimitiveTypeImpl.java", + "fuchsia/developer/plugin/fidl/psi/impl/FidlProtocolComposeImpl.java", + "fuchsia/developer/plugin/fidl/psi/impl/FidlProtocolDeclarationImpl.java", + "fuchsia/developer/plugin/fidl/psi/impl/FidlProtocolEventImpl.java", + "fuchsia/developer/plugin/fidl/psi/impl/FidlProtocolMemberImpl.java", + "fuchsia/developer/plugin/fidl/psi/impl/FidlProtocolMethodImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlRequestTypeImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlReservedTableFieldImpl.java", "fuchsia/developer/plugin/fidl/psi/impl/FidlStringTypeImpl.java",
diff --git a/src/fuchsia/developer/plugin/fidl/ContextAwareHighlighter.java b/src/fuchsia/developer/plugin/fidl/ContextAwareHighlighter.java index 92a0353..dfdb83e 100644 --- a/src/fuchsia/developer/plugin/fidl/ContextAwareHighlighter.java +++ b/src/fuchsia/developer/plugin/fidl/ContextAwareHighlighter.java
@@ -30,6 +30,10 @@ Annotation annotation = holder.createInfoAnnotation(element, null); annotation.setTextAttributes(IDENTIFIER_ATTRIBUTE); } + if (element.getNode().getElementType() == Types.INTERFACE) { + holder.createWarningAnnotation(element, + "Interfaces are deprecated, and will be replaced with protocols in a future language revision"); + } if (element.getNode().getElementType() == Types.XUNION) { holder.createWarningAnnotation(element, "Xunions are transitional, and will be removed in a future language revision");
diff --git a/src/fuchsia/developer/plugin/fidl/Fidl.bnf b/src/fuchsia/developer/plugin/fidl/Fidl.bnf index daf5496..9275d51 100644 --- a/src/fuchsia/developer/plugin/fidl/Fidl.bnf +++ b/src/fuchsia/developer/plugin/fidl/Fidl.bnf
@@ -35,8 +35,14 @@ using ::= USING_T compound-identifier ( AS identifier-token )? SEMICOLON -declaration ::= const-declaration | enum-declaration | interface-declaration | - struct-declaration | union-declaration | xunion-declaration | table-declaration +declaration ::= const-declaration | + enum-declaration | + interface-declaration | + protocol-declaration | + struct-declaration | + table-declaration | + union-declaration | + xunion-declaration const-declaration ::= attribute-list? CONST type identifier-token EQUALS constant @@ -47,15 +53,24 @@ enum-member-value ::= identifier-token | NUMERIC_LITERAL +// TODO: Delete this once interfaces are disallowed interface-declaration ::= attribute-list? INTERFACE identifier-token - ( COLON super-interface-list )? OBRACE ( interface-method SEMICOLON )* CBRACE + ( COLON super-interface-list )? OBRACE ( interface-member SEMICOLON )* CBRACE + +interface-member ::= protocol-method | protocol-event super-interface-list ::= compound-identifier COMMA super-interface-list | compound-identifier -interface-method ::= attribute-list? interface-parameters ( ERROR type )? +protocol-declaration ::= attribute-list? PROTOCOL identifier-token + OBRACE ( protocol-member SEMICOLON )* CBRACE -interface-parameters ::= identifier-token parameter-list ( ARROW parameter-list )? - | ARROW identifier-token parameter-list +protocol-member ::= protocol-compose | protocol-method | protocol-event + +protocol-compose ::= COMPOSE compound-identifier + +protocol-method ::= attribute-list? identifier-token parameter-list ( ARROW parameter-list )? ( ERROR type )? + +protocol-event ::= attribute-list? ARROW identifier-token parameter-list parameter-list ::= OPAREN parameters? CPAREN @@ -128,4 +143,4 @@ REQUEST | RESERVED | RESOURCE | SOCKET | STRING | STRUCT | TABLE | THREAD | TIMER | UNION | USING_T | VECTOR | VMAR | VMO | XUNION | BOOL | FLOAT32 | FLOAT64 | INT8 | INT16 | INT32 | INT64 | UINT8 | UINT16 | UINT32 | UINT64 | - TRUE | FALSE \ No newline at end of file + TRUE | FALSE | PROTOCOL | COMPOSE \ No newline at end of file
diff --git a/src/fuchsia/developer/plugin/fidl/FidlLexer.flex b/src/fuchsia/developer/plugin/fidl/FidlLexer.flex index b5d4195..d73a3cb 100644 --- a/src/fuchsia/developer/plugin/fidl/FidlLexer.flex +++ b/src/fuchsia/developer/plugin/fidl/FidlLexer.flex
@@ -34,6 +34,7 @@ ARRAY=array AS=as CHANNEL=channel +COMPOSE=compose CONST=const ENUM=enum ERROR=error @@ -49,6 +50,7 @@ LOG=log PORT=port PROCESS=process +PROTOCOL=protocol REQUEST=request RESERVED=reserved RESOURCE=resource @@ -117,6 +119,8 @@ {CONST} { return CONST; } {ENUM} { return ENUM; } {INTERFACE} { return INTERFACE; } + {PROTOCOL} { return PROTOCOL; } + {COMPOSE} { return COMPOSE; } {STRUCT} { return STRUCT; } {TABLE} { return TABLE; } {UNION} { return UNION; }
diff --git a/src/fuchsia/developer/plugin/fidl/SyntaxHighlighter.java b/src/fuchsia/developer/plugin/fidl/SyntaxHighlighter.java index 6688aa2..807bc12 100644 --- a/src/fuchsia/developer/plugin/fidl/SyntaxHighlighter.java +++ b/src/fuchsia/developer/plugin/fidl/SyntaxHighlighter.java
@@ -81,6 +81,8 @@ Types.CONST, Types.ENUM, Types.INTERFACE, + Types.PROTOCOL, + Types.COMPOSE, Types.STRUCT, Types.TABLE, Types.UNION,