blob: dccab6311b2e4acad1c57ad9c6dce755206e3fa1 [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 ::= const-declaration | enum-declaration | interface-declaration |
struct-declaration | union-declaration | table-declaration
const-declaration ::= attribute-list? CONST type identifier-token EQUALS constant
enum-declaration ::= attribute-list? ENUM identifier-token ( COLON integer-type )?
OBRACE ( enum-member SEMICOLON )+ CBRACE
enum-member ::= identifier-token ( EQUALS enum-member-value )?
enum-member-value ::= identifier-token | NUMERIC_LITERAL
interface-declaration ::= attribute-list? INTERFACE identifier-token
( COLON super-interface-list )? OBRACE ( interface-method SEMICOLON )* CBRACE
super-interface-list ::= compound-identifier COMMA super-interface-list | compound-identifier
interface-method ::= ordinal COLON interface-parameters
interface-parameters ::= identifier-token parameter-list ( ARROW parameter-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 ::= type identifier-token ( EQUALS constant )?
table-declaration ::= attribute-list? TABLE identifier-token OBRACE ( 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 ::= 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 constant
vector-type ::= VECTOR LANGLE type RANGLE ( COLON constant )? ( QUESTION )?
string-type ::= STRING ( COLON 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 |
UINT8 | UINT16 | UINT32 | UINT64
constant ::= compound-identifier | literal
ordinal ::= NUMERIC_LITERAL
literal ::= STRING_LITERAL | NUMERIC_LITERAL | TRUE | FALSE
identifier-token ::= IDENTIFIER | TRUE | FALSE | PROCESS | THREAD | VMO | CHANNEL | EVENT | PORT |
INTERRUPT | LOG | SOCKET | RESOURCE | EVENTPAIR | JOB | VMAR | FIFO | GUEST |
TIMER | RESERVED | LIBRARY | CONST | ENUM | INTERFACE | STRUCT | TABLE |
UNION | USING_T | AS | ARRAY | VECTOR | STRING | HANDLE