Spicy
Public Member Functions | Public Attributes | List of all members
spicy::rt::Parser Struct Reference

#include <parser.h>

Public Member Functions

 Parser (std::string name, bool is_public, Parse1Function parse1, hilti::rt::any parse2, Parse3Function parse3, ContextNewFunction context_new, const hilti::rt::TypeInfo *type, std::string description, hilti::rt::Vector< MIMEType > mime_types, hilti::rt::Vector< ParserPort > ports)
 
 Parser (std::string name, bool is_public, Parse1Function parse1, hilti::rt::any parse2, Parse3Function parse3, hilti::rt::Null, const hilti::rt::TypeInfo *type, std::string description, hilti::rt::Vector< MIMEType > mime_types, hilti::rt::Vector< ParserPort > ports)
 
 Parser (std::string name, bool is_public, hilti::rt::Null, hilti::rt::any parse2, hilti::rt::Null, hilti::rt::Null, const hilti::rt::TypeInfo *type, std::string description, hilti::rt::Vector< MIMEType > mime_types, hilti::rt::Vector< ParserPort > ports)
 
 Parser (std::string name, bool is_public, hilti::rt::Null, hilti::rt::any parse2, hilti::rt::Null, ContextNewFunction context_new, const hilti::rt::TypeInfo *type, std::string description, hilti::rt::Vector< MIMEType > mime_types, hilti::rt::Vector< ParserPort > ports)
 
 Parser (const Parser &)=default
 
 Parser (Parser &&) noexcept=default
 
Parseroperator= (const Parser &)=default
 
Parseroperator= (Parser &&) noexcept=default
 
std::optional< UnitContextcreateContext () const
 

Public Attributes

std::string name
 
bool is_public
 
std::string linker_scope
 
Parse1Function parse1 {}
 
hilti::rt::any parse2
 
Parse3Function parse3 {}
 
ContextNewFunction context_new = nullptr
 
const hilti::rt::TypeInfotype_info
 
std::string description
 
hilti::rt::Vector< MIMETypemime_types
 
hilti::rt::Vector< ParserPortports
 
std::optional< detail::ParseSinkFunction > __parse_sink
 
std::optional< std::function< void(hilti::rt::StrongReferenceGeneric, uint64_t, uint64_t)> > __hook_gap
 
std::optional< std::function< void(hilti::rt::StrongReferenceGeneric, uint64_t, const hilti::rt::Bytes &, const hilti::rt::Bytes &)> > __hook_overlap
 
std::optional< std::function< void(hilti::rt::StrongReferenceGeneric, uint64_t)> > __hook_skipped
 
std::optional< std::function< void(hilti::rt::StrongReferenceGeneric, uint64_t, const hilti::rt::Bytes &)> > __hook_undelivered
 

Detailed Description

Runtime information about an available parser.

Note: When changing this struct, adapt the Spicy-side spicy_rt::Parser as well.

Member Function Documentation

◆ createContext()

std::optional<UnitContext> spicy::rt::Parser::createContext ( ) const
inline

Create a new instance of the context type defined for the parser. If there's no context defined, returns an unset optional.

Member Data Documentation

◆ __hook_gap

std::optional<std::function<void(hilti::rt::StrongReferenceGeneric, uint64_t, uint64_t)> > spicy::rt::Parser::__hook_gap

For internal use only. Dispatcher for the corresponding unit hook.

◆ __hook_overlap

std::optional<std::function<void(hilti::rt::StrongReferenceGeneric, uint64_t, const hilti::rt::Bytes&, const hilti::rt::Bytes&)> > spicy::rt::Parser::__hook_overlap

For internal use only. Dispatcher for the corresponding unit hook.

◆ __hook_skipped

std::optional<std::function<void(hilti::rt::StrongReferenceGeneric, uint64_t)> > spicy::rt::Parser::__hook_skipped

For internal use only. Dispatcher for the corresponding unit hook.

◆ __hook_undelivered

std::optional<std::function<void(hilti::rt::StrongReferenceGeneric, uint64_t, const hilti::rt::Bytes&)> > spicy::rt::Parser::__hook_undelivered

For internal use only. Dispatcher for the corresponding unit hook.

◆ __parse_sink

std::optional<detail::ParseSinkFunction> spicy::rt::Parser::__parse_sink

For internal use only. Set by registerParser() for units that's don't receive arguments.

◆ context_new

ContextNewFunction spicy::rt::Parser::context_new = nullptr

Function instantantiating a new instance of the context defined for the parse. Unset if no context is defined.

◆ description

std::string spicy::rt::Parser::description

Human-readable description associated with this parser.

◆ is_public

bool spicy::rt::Parser::is_public

Whether this parser is public.

◆ linker_scope

std::string spicy::rt::Parser::linker_scope

Linker scope of the unit registering the parser. This can be used for disambiguation between linked units. Will be set/overidden by registerParser().

◆ mime_types

hilti::rt::Vector<MIMEType> spicy::rt::Parser::mime_types

MIME types this parer can handle.

◆ name

std::string spicy::rt::Parser::name

Short descriptive name.

◆ parse1

Parse1Function spicy::rt::Parser::parse1 {}

Function performing parsing of given input into a temporary instance. This will remain unset if the unit type cannot be used through a parse1-style function because it receives parameters.

◆ parse2

hilti::rt::any spicy::rt::Parser::parse2

Function performing parsing of given input into a provided instance. The actual type of this member is Parse2Function<T>.

◆ parse3

Parse3Function spicy::rt::Parser::parse3 {}

Function performing parsing of given input into a ParsedUnited that will be returned. This will remain unset if the unit type cannot be used through a parse3-style function because it receives parameters.

◆ ports

hilti::rt::Vector<ParserPort> spicy::rt::Parser::ports

Well-known ports associated with this parser.


The documentation for this struct was generated from the following file: