![]() |
Spicy
|
#include <unit.h>
Public Member Functions | |
Unit (std::vector< type::function::Parameter > p, std::vector< unit::Item > i, const std::optional< AttributeSet > &={}, Meta m=Meta()) | |
Unit (Wildcard, Meta m=Meta()) | |
auto | parameters () const |
auto | items () const |
std::optional< AttributeSet > | attributes () const |
auto | types () const |
std::optional< Type > | contextType () const |
std::optional< unit::Item > | field (const ID &id) const |
template<typename T > | |
auto | items () const |
std::optional< unit::item::Property > | propertyItem (const std::string &name) const |
auto | propertyItems (const std::string &name) const |
auto | isPublic () const |
bool | usesRandomAccess () const |
bool | supportsSinks () const |
bool | supportsFilters () const |
bool | isFilter () const |
const spicy::detail::codegen::Grammar & | grammar () const |
bool | operator== (const Unit &other) const |
auto | isEqual (const Type &other) const |
auto | typeParameters () const |
auto | isWildcard () const |
auto | properties () const |
![]() | |
bool | hasFlag (type::Flag f) const |
type::Flags | flags () const |
bool | _isConstant () const |
std::optional< ID > | typeID () const |
std::optional< ID > | cxxID () const |
const type::detail::State & | _state () const |
type::detail::State & | _state () |
![]() | |
NodeBase (Meta meta) | |
NodeBase (std::vector< Node > childs, Meta meta) | |
template<typename T > | |
const T & | child (int i) const |
template<typename T > | |
void | assertChildIsA (int i) |
template<typename T > | |
std::vector< T > | childs (int begin, int end) const |
template<typename T > | |
std::vector< T > | childsOfType () const |
template<typename T > | |
auto | nodesOfType () const |
template<typename T > | |
auto | nodesOfType () |
void | addChild (Node n) |
auto & | childs () const |
auto & | childs () |
auto & | meta () const |
void | setMeta (Meta m) |
const NodeRef & | originalNode () const |
void | setOriginalNode (const NodeRef &n) |
void | clearCache () |
Static Public Member Functions | |
static Unit | setPublic (const Unit &unit, bool p) |
static Unit | addItems (const Unit &unit, std::vector< unit::Item > items) |
static Unit | addAttributes (const Unit &unit, AttributeSet attrs) |
static Unit | setGrammar (const Unit &unit, std::shared_ptr< spicy::detail::codegen::Grammar > g) |
AST node for a Spicy unit.
|
inlinestatic |
Copies an existing unit type, adding further attributes.
unit | original unit type |
attrs | additional attributes to add |
|
inlinestatic |
Copies an existing unit type, adding further unit items.
unit | original unit type |
items | additional items to add |
|
inline |
Returns the type set through `context
, if available.
std::optional< type::unit::Item > type::Unit::field | ( | const ID & | id | ) | const |
Returns the field of a given name if it exists. This descends recursively into childs as well.
|
inline |
Returns the grammar associated with the type. It must have been set before through setGrammar()
.
|
inline |
Returns true if this unit type can act as a filter.
|
inline |
Returns true if the unit has been declared as publically/externally accessible.
|
inline |
Returns all of the unit's items of a particular subtype T.
|
inline |
Returns the property of a given name if it exists. If it exists more than once, it's undefined which one is returned.
|
inline |
Returns all properties of a given name.
|
inlinestatic |
Copies an existing unit type, setting its accociated grammar.
unit | original unit type |
g | the grammar |
Copies an existing unit type but changes it public
state.
unit | original unit type |
p | true if the copied type is to be public |
public
state set as requested
|
inline |
Returns true if this unit type supports connecting a filter.
|
inline |
Returns true if this unit type supports connecting to a sink.
|
inline |
Returns true if for this unit the parser generator needs to generate code facilitating random access within the data that an instance is being parsed from.
random-access
). Eventually we should enable this automatically as needed, through static analysis.