Files
flatbuffers-bigfoot/docs/source/Grammar.md
Wouter van Oortmerssen 0952143971 Added user defined attribute declarations.
This is such that if you mis-spell an attribute, it doesn't get
silently ignored.

Bug: 18294628
Change-Id: I10013f5b2a21048b7daba2e9410678f528e09761
Tested: on Linux.
2014-11-19 11:06:17 -08:00

1.0 KiB
Executable File

Formal Grammar of the schema language

schema = include* ( namespace_decl | type_decl | enum_decl | root_decl | attribute_decl | object )*

include = include string_constant ;

namespace_decl = namespace ident ( . ident )* ;

attribute_decl = attribute string_constant ;

type_decl = ( table | struct ) ident metadata { field_decl+ }

enum_decl = ( enum | union ) ident [ : type ] metadata { commasep( enumval_decl ) }

root_decl = root_type ident ;

field_decl = type : ident [ = scalar ] metadata ;

type = bool | byte | ubyte | short | ushort | int | uint | float | long | ulong | double | string | [ type ] | ident

enumval_decl = ident [ = integer_constant ]

metadata = [ ( commasep( ident [ : scalar ] ) ) ]

scalar = integer_constant | float_constant | true | false

object = { commasep( ident : value ) }

value = scalar | object | string_constant | [ commasep( value ) ]

commasep(x) = [ x ( , x )* ]