Add flexible modifier
Also, update to recent version of Guava and friends.
Change-Id: I5d7db6df5ed70f738b463598551bd02d8495b1f5
diff --git a/FIDL-Plugin.iml b/FIDL-Plugin.iml
index 31ad032..76be584 100644
--- a/FIDL-Plugin.iml
+++ b/FIDL-Plugin.iml
@@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PLUGIN_MODULE" version="4">
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
- <component name="FacetManager">
- <facet type="Python" name="Python">
- <configuration sdkName="" />
- </facet>
- </component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
@@ -15,16 +10,16 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module-library">
+ <orderEntry type="module-library" exported="">
<library>
<CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/26.0-android/guava-26.0-android.jar!/" />
+ <root url="jar://$USER_HOME$/jars/guava-27.1-jre.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
+ <orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar:///opt/intellij-ce-2019.2/lib/platform-api.jar!/" />
@@ -33,7 +28,7 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
+ <orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar:///opt/intellij-ce-2019.2/lib/platform-util-ui.jar!/" />
@@ -42,7 +37,7 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
+ <orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar:///opt/intellij-ce-2019.2/lib/spellchecker.jar!/" />
diff --git a/WORKSPACE b/WORKSPACE
index c740852..acfef70 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -19,9 +19,9 @@
http_archive(
name = "google_bazel_common",
- strip_prefix = "bazel-common-b5f58a7b26f1c5456dc8c819667bcfec49f66cf1",
- sha256 = "761a6fc2378e827bc61c00b6e1c0135e6670771890f21b555b64bfc1303fd7cc",
- urls = ["https://github.com/google/bazel-common/archive/b5f58a7b26f1c5456dc8c819667bcfec49f66cf1.zip"],
+ sha256 = "45532ec9f1bcd0c5eb8039ddc3a0f7b5dd78a26ff5d7aa26f0e2320e9143ee35",
+ strip_prefix = "bazel-common-0427da17b67ae62faea43105db31d790e712245e",
+ urls = ["https://github.com/google/bazel-common/archive/0427da17b67ae62faea43105db31d790e712245e.zip"],
)
load("@google_bazel_common//:workspace_defs.bzl", "google_common_workspace_rules")
diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml
index 0964eb1..e237944 100644
--- a/resources/META-INF/plugin.xml
+++ b/resources/META-INF/plugin.xml
@@ -20,6 +20,7 @@
<ul>
<li><b>0.14</b>
<ul>
+ <li>Add flexible keyword, allow strict on more declarations </li>
<li>Support union ordinals and remove xunion.</li>
<li>Support service declarations.</li>
</ul>
diff --git a/src/fuchsia/developer/plugin/fidl/BUILD b/src/fuchsia/developer/plugin/fidl/BUILD
index 5a26970..8e42f29 100644
--- a/src/fuchsia/developer/plugin/fidl/BUILD
+++ b/src/fuchsia/developer/plugin/fidl/BUILD
@@ -39,6 +39,7 @@
"fuchsia/developer/plugin/fidl/psi/FidlConstDeclaration.java",
"fuchsia/developer/plugin/fidl/psi/FidlDeclaration.java",
"fuchsia/developer/plugin/fidl/psi/FidlDeclarationList.java",
+ "fuchsia/developer/plugin/fidl/psi/FidlDeclarationModifiers.java",
"fuchsia/developer/plugin/fidl/psi/FidlDocAttributeList.java",
"fuchsia/developer/plugin/fidl/psi/FidlEnumDeclaration.java",
"fuchsia/developer/plugin/fidl/psi/FidlHandleSubtype.java",
@@ -83,6 +84,7 @@
"fuchsia/developer/plugin/fidl/psi/impl/FidlConstDeclarationImpl.java",
"fuchsia/developer/plugin/fidl/psi/impl/FidlDeclarationImpl.java",
"fuchsia/developer/plugin/fidl/psi/impl/FidlDeclarationListImpl.java",
+ "fuchsia/developer/plugin/fidl/psi/impl/FidlDeclarationModifiersImpl.java",
"fuchsia/developer/plugin/fidl/psi/impl/FidlDocAttributeListImpl.java",
"fuchsia/developer/plugin/fidl/psi/impl/FidlEnumDeclarationImpl.java",
"fuchsia/developer/plugin/fidl/psi/impl/FidlHandleSubtypeImpl.java",
diff --git a/src/fuchsia/developer/plugin/fidl/Fidl.bnf b/src/fuchsia/developer/plugin/fidl/Fidl.bnf
index 6abd49f..05546b2 100644
--- a/src/fuchsia/developer/plugin/fidl/Fidl.bnf
+++ b/src/fuchsia/developer/plugin/fidl/Fidl.bnf
@@ -49,12 +49,16 @@
union-declaration |
service-declaration
+declaration-modifiers ::= FLEXIBLE | STRICT
+
const-declaration ::= attribute-list? CONST type-constructor identifier-token EQUALS constant
-enum-declaration ::= attribute-list? STRICT? ENUM identifier-token ( COLON type-constructor )?
- OBRACE ( bits-or-enum-member SEMICOLON )+ CBRACE
+enum-declaration ::= attribute-list? ( declaration-modifiers )*
+ ENUM identifier-token ( COLON type-constructor )?
+ OBRACE ( bits-or-enum-member SEMICOLON )+ CBRACE
-bits-declaration ::= attribute-list? STRICT? BITS identifier-token ( COLON type-constructor )
+bits-declaration ::= attribute-list? ( declaration-modifiers )*
+ BITS identifier-token ( COLON type-constructor )
OBRACE ( bits-or-enum-member SEMICOLON )+ CBRACE
bits-or-enum-member ::= attribute-list? identifier-token EQUALS bits-or-enum-member-value
@@ -74,15 +78,15 @@
parameters ::= parameter ( COMMA parameter )*
-parameter ::= type-constructor identifier-token
+parameter ::= attribute-list? type-constructor identifier-token
protocol-compose ::= COMPOSE compound-identifier
struct-declaration ::= attribute-list? STRUCT identifier-token OBRACE ( member-field SEMICOLON )* CBRACE
-union-declaration ::= attribute-list? STRICT? UNION identifier-token OBRACE ( ordinal-member-field SEMICOLON )+ CBRACE
+union-declaration ::= attribute-list? ( declaration-modifiers )* UNION identifier-token OBRACE ( ordinal-member-field SEMICOLON )+ CBRACE
-table-declaration ::= attribute-list? STRICT? TABLE identifier-token OBRACE ( ordinal-member-field SEMICOLON )* CBRACE
+table-declaration ::= attribute-list? ( declaration-modifiers )* TABLE identifier-token OBRACE ( ordinal-member-field SEMICOLON )* CBRACE
member-field ::= attribute-list? type-constructor identifier-token ( EQUALS constant )?
@@ -134,4 +138,4 @@
TIMER | UNION | USING_T | VECTOR | VMAR | VMO | XUNION | BOOL | FLOAT32 |
FLOAT64 | INT8 | INT16 | INT32 | INT64 | UINT8 | UINT16 | UINT32 | UINT64 |
TRUE | FALSE | PROTOCOL | COMPOSE | BITS | BYTES | EXCEPTION | STRICT |
- IOMMU | PAGER | PCIDEVICE | PMT | SUSPENDTOKEN | VCPU | SERVICE
+ IOMMU | PAGER | PCIDEVICE | PMT | SUSPENDTOKEN | VCPU | SERVICE | FLEXIBLE
diff --git a/src/fuchsia/developer/plugin/fidl/FidlLexer.flex b/src/fuchsia/developer/plugin/fidl/FidlLexer.flex
index a53d586..45d0e9e 100644
--- a/src/fuchsia/developer/plugin/fidl/FidlLexer.flex
+++ b/src/fuchsia/developer/plugin/fidl/FidlLexer.flex
@@ -38,6 +38,7 @@
CONST=const
ENUM=enum
ERROR=error
+FLEXIBLE=flexible
HANDLE=handle
INTERFACE=interface
LIBRARY=library
@@ -150,6 +151,7 @@
{HANDLE} { return HANDLE; }
{RESERVED} { return RESERVED; }
{STRICT} { return STRICT; }
+ {FLEXIBLE} { return FLEXIBLE; }
{CHANNEL} { return CHANNEL; }
{EVENT} { return EVENT; }
diff --git a/src/fuchsia/developer/plugin/fidl/SyntaxHighlighter.java b/src/fuchsia/developer/plugin/fidl/SyntaxHighlighter.java
index fe1b920..f0a5ca7 100644
--- a/src/fuchsia/developer/plugin/fidl/SyntaxHighlighter.java
+++ b/src/fuchsia/developer/plugin/fidl/SyntaxHighlighter.java
@@ -93,6 +93,7 @@
Types.ERROR,
Types.RESERVED,
Types.STRICT,
+ Types.FLEXIBLE,
Types.TRUE,
Types.FALSE)) {
builder.put(key, KEYWORD_KEYS);