Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Parser = Parsec Void String
- schema :: Parser Schema
- decl :: Parser (Maybe Decl)
- sc :: Parser ()
- lexeme :: Parser a -> Parser a
- symbol :: String -> Parser String
- rword :: String -> Parser ()
- curly :: Parser a -> Parser a
- square :: Parser a -> Parser a
- parens :: Parser a -> Parser a
- commaSep :: Parser a -> Parser [a]
- commaSep1 :: Parser a -> Parser (NonEmpty a)
- commaSepEndBy1 :: Parser a -> Parser (NonEmpty a)
- semi :: Parser ()
- colon :: Parser ()
- ident :: Parser Ident
- typ :: Parser Type
- typeRef :: Parser TypeRef
- tableField :: Parser TableField
- structField :: Parser StructField
- tableDecl :: Parser TableDecl
- structDecl :: Parser StructDecl
- enumDecl :: Parser EnumDecl
- enumVal :: Parser EnumVal
- unionDecl :: Parser UnionDecl
- unionVal :: Parser UnionVal
- namespaceDecl :: Parser NamespaceDecl
- stringLiteral :: Parser StringLiteral
- intLiteral :: Parser IntLiteral
- attributeVal :: Parser AttributeVal
- defaultVal :: Parser DefaultVal
- metadata :: Parser Metadata
- include :: Parser Include
- nativeInclude :: Parser ()
- rootDecl :: Parser RootDecl
- fileExtensionDecl :: Parser ()
- fileIdentifierDecl :: Parser FileIdentifierDecl
- attributeDecl :: Parser AttributeDecl
- attributeName :: Parser Text
- jsonObj :: Parser ()
- rpcDecl :: Parser ()
- rpcMethod :: Parser ()
Documentation
schema :: Parser Schema Source #
Roughly based on: https://google.github.io/flatbuffers/flatbuffers_grammar.html. Differences between this parser and the above grammar:
- Unions members now support aliases.
- An enum's underlying type used to be optional (defaulting to
short
), but now it's mandatory. - Attributes can be reffered to either as an identifier or as a string literal (e.g.
attr
or"attr"
). - Struct fields can't have default values.
- The grammar states that tablestruct field defaults can only be scalars (integerfloating point constants), when in reality, it could be also be a boolean or an enum identifier.
- The grammar says attribute values can be integers, floats or string literals. Flatc only allows integers and string literals. To make things simpler, we decided to go with flatc's approach and disallow floats.
- The grammar says namespaces must include at least one fragment, but an empty namespace
(i.e.
namespace ;
) is perfectly valid. - This supports
native_include
statements (see: https://google.github.io/flatbuffers/flatbuffers_guide_use_cpp.html#flatbuffers_cpp_object_based_api)
nativeInclude :: Parser () Source #
fileExtensionDecl :: Parser () Source #