...

Text file src/github.com/google/flatbuffers/docs/source/Grammar.md

Documentation: github.com/google/flatbuffers/docs/source

     1Grammar of the schema language    {#flatbuffers_grammar}
     2==============================
     3
     4schema = include*
     5         ( namespace\_decl | type\_decl | enum\_decl | root\_decl |
     6           file_extension_decl | file_identifier_decl |
     7           attribute\_decl | rpc\_decl | object )*
     8
     9include = `include` string\_constant `;`
    10
    11namespace\_decl = `namespace` ident ( `.` ident )* `;`
    12
    13attribute\_decl = `attribute` ident | `"` ident `"` `;`
    14
    15type\_decl = ( `table` | `struct` ) ident metadata `{` field\_decl+ `}`
    16
    17enum\_decl = ( `enum` ident `:` type | `union` ident )  metadata `{`
    18commasep( enumval\_decl ) `}`
    19
    20root\_decl = `root_type` ident `;`
    21
    22field\_decl = ident `:` type [ `=` scalar ] metadata `;`
    23
    24rpc\_decl = `rpc_service` ident `{` rpc\_method+ `}`
    25
    26rpc\_method = ident `(` ident `)` `:` ident metadata `;`
    27
    28type = `bool` | `byte` | `ubyte` | `short` | `ushort` | `int` | `uint` |
    29`float` | `long` | `ulong` | `double` |
    30`int8` | `uint8` | `int16` | `uint16` | `int32` | `uint32`| `int64` | `uint64` |
    31`float32` | `float64` |
    32`string` | `[` type `]` | ident
    33
    34enumval\_decl = ident [ `=` integer\_constant ] metadata
    35
    36metadata = [ `(` commasep( ident [ `:` single\_value ] ) `)` ]
    37
    38scalar = boolean\_constant | integer\_constant | float\_constant
    39
    40object = `{` commasep( ident `:` value ) `}`
    41
    42single\_value = scalar | string\_constant
    43
    44value = single\_value | object | `[` commasep( value ) `]`
    45
    46commasep(x) = [ x ( `,` x )\* ]
    47
    48file_extension_decl = `file_extension` string\_constant `;`
    49
    50file_identifier_decl = `file_identifier` string\_constant `;`
    51
    52string\_constant = `\".*?\"`
    53
    54ident = `[a-zA-Z_][a-zA-Z0-9_]*`
    55
    56`[:digit:]` = `[0-9]`
    57
    58`[:xdigit:]` = `[0-9a-fA-F]`
    59
    60dec\_integer\_constant = `[-+]?[:digit:]+`
    61
    62hex\_integer\_constant = `[-+]?0[xX][:xdigit:]+`
    63
    64integer\_constant = dec\_integer\_constant | hex\_integer\_constant
    65
    66dec\_float\_constant = `[-+]?(([.][:digit:]+)|([:digit:]+[.][:digit:]*)|([:digit:]+))([eE][-+]?[:digit:]+)?`
    67
    68hex\_float\_constant = `[-+]?0[xX](([.][:xdigit:]+)|([:xdigit:]+[.][:xdigit:]*)|([:xdigit:]+))([pP][-+]?[:digit:]+)`
    69
    70special\_float\_constant = `[-+]?(nan|inf|infinity)`
    71
    72float\_constant = dec\_float\_constant | hex\_float\_constant | special\_float\_constant
    73
    74boolean\_constant = `true` | `false`

View as plain text