frostc-1.0.0.0: The Frost Programming Language Compiler
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ast.Parser.TypeDefinition

Synopsis

Documentation

parseTypeDefinition :: Parser Type Source #

Parse a type definition. This function combines multiple specific type definition. It tries to match typedefs, structs, and unions.

structType :: Parser Type Source #

Parses a struct type definition. A struct is defined with the "struct" keyword followed by an optional name and a list of fields enclosed in braces. Example: "struct { x -> int, y -> float }".

unionType :: Parser Type Source #

Parses a union type definition. A union is defined with the "union" keyword followed by an optional name and a list of variants enclosed in braces. Example: "union { data -> *char, error -> int }".

typedefType :: Parser Type Source #

Parses a typedef. A typedef associates a new name with an existing type using the "::" syntax. Example: "Vector2i :: Vector".

parseField :: Parser (String, Type) Source #

Parses a single field within a struct or union. Each field consists of a name followed by "->" and its type. Example: "x -> int".