blob: 13e9854013de4e419bc1f3b8656946e01632e02c [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
{
parserClass = "fuchsia.developer.plugin.fidl.parser.Parser"
extends = "com.intellij.extapi.psi.ASTWrapperPsiElement"
psiClassPrefix = "Fidl"
psiImplClassSuffix = "Impl"
psiPackage = "fuchsia.developer.plugin.fidl.psi"
psiImplPackage = "fuchsia.developer.plugin.fidl.psi.impl"
elementTypeHolderClass = "fuchsia.developer.plugin.fidl.psi.Types"
elementTypeClass = "fuchsia.developer.plugin.fidl.psi.ElementType"
tokenTypeClass = "fuchsia.developer.plugin.fidl.psi.TokenType"
tokens = [
line_comment="regexp://.*"
]
}
file ::= library-header using-list? declaration-list
library-header ::= attribute-list? LIBRARY compound-identifier SEMICOLON
using-list ::= ( using | using-declaration )*
using-declaration ::= USING_T identifier-token EQUALS primitive-type SEMICOLON
declaration-list ::= ( declaration SEMICOLON )*
compound-identifier ::= identifier-token ( DOT identifier-token )*
using ::= USING_T compound-identifier ( AS identifier-token )? SEMICOLON
declaration ::= bits-declaration |
const-declaration |
enum-declaration |
protocol-declaration |
struct-declaration |
table-declaration |
union-declaration |
xunion-declaration
const-declaration ::= attribute-list? CONST type identifier-token EQUALS constant
enum-declaration ::= attribute-list? ENUM identifier-token ( COLON integer-type )?
OBRACE ( bits-or-enum-member SEMICOLON )+ CBRACE
bits-declaration ::= attribute-list? BITS identifier-token ( COLON unsigned-integer-type )
OBRACE ( bits-or-enum-member SEMICOLON )+ CBRACE
bits-or-enum-member ::= attribute-list? identifier-token ( EQUALS bits-or-enum-member-value )?
bits-or-enum-member-value ::= identifier-token | integral-literal
protocol-declaration ::= attribute-list? PROTOCOL identifier-token
OBRACE ( protocol-member SEMICOLON )* CBRACE
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
parameters ::= parameter ( COMMA parameter )*
parameter ::= type identifier-token
struct-declaration ::= attribute-list? STRUCT identifier-token OBRACE ( struct-field SEMICOLON )* CBRACE
struct-field ::= attribute-list? type identifier-token ( EQUALS constant )?
table-declaration ::= attribute-list? TABLE identifier-token OBRACE ( attribute-list? table-field SEMICOLON )* CBRACE
table-field ::= populated-table-field | reserved-table-field
populated-table-field ::= attribute-list? ordinal COLON type identifier-token ( EQUALS constant )?
reserved-table-field ::= ordinal COLON RESERVED
union-declaration ::= attribute-list? UNION identifier-token OBRACE ( union-field SEMICOLON )+ CBRACE
union-field ::= attribute-list? type identifier-token
xunion-declaration ::= attribute-list? XUNION identifier-token OBRACE ( xunion-field SEMICOLON )+ CBRACE
xunion-field ::= attribute-list? type identifier-token
attribute-list ::= doc-attribute-list | bracket-attribute-list
doc-attribute-list ::= ( DOC_COMMENT )+ bracket-attribute-list?
bracket-attribute-list ::= OBRACKET attributes CBRACKET
attributes ::= attribute ( COMMA attribute )*
attribute ::= identifier-token ( EQUALS STRING_LITERAL )?
type ::= array-type | vector-type | string-type | handle-type
| request-type | primitive-type | identifier-type
identifier-type ::= compound-identifier ( QUESTION )?
array-type ::= ARRAY LANGLE type RANGLE COLON boundary-constant
vector-type ::= VECTOR LANGLE type RANGLE ( COLON boundary-constant )? ( QUESTION )?
string-type ::= STRING ( COLON boundary-constant )? ( QUESTION )?
handle-type ::= HANDLE ( LANGLE handle-subtype RANGLE )? ( QUESTION )?
handle-subtype ::= PROCESS | THREAD | VMO | CHANNEL | EVENT | PORT |
INTERRUPT | LOG | SOCKET | RESOURCE | EVENTPAIR |
JOB | VMAR | FIFO | GUEST | TIMER
request-type ::= REQUEST LANGLE compound-identifier RANGLE ( QUESTION )?
primitive-type ::= integer-type | BOOL | FLOAT32 | FLOAT64
integer-type ::= INT8 | INT16 | INT32 | INT64 | unsigned-integer-type
unsigned-integer-type ::= UINT8 | UINT16 | UINT32 | UINT64
constant ::= compound-identifier | literal
boundary-constant ::= compound-identifier | integral-literal
ordinal ::= integral-literal
literal ::= STRING_LITERAL | numeric-literal | TRUE | FALSE
numeric-literal ::= DECIMAL_FLOAT_LITERAL | integral-literal
integral-literal ::= DECIMAL_INTEGRAL_LITERAL | HEX_INTEGRAL_LITERAL | BINARY_INTEGRAL_LITERAL
identifier-token ::= IDENTIFIER | ARRAY | AS | CHANNEL | CONST | ENUM | ERROR | EVENT | EVENTPAIR | FIFO |
GUEST | HANDLE | INTERFACE | INTERRUPT | JOB | LIBRARY | LOG | PORT | PROCESS |
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 | PROTOCOL | COMPOSE | BITS