![]() |
Spicy
|
#include <attribute.h>
Public Member Functions | |
Attribute (std::string tag, Meta m=Meta()) | |
Attribute (std::string tag, Node v, Meta m=Meta()) | |
const auto & | tag () const |
bool | hasValue () const |
const Node & | value () const |
Result< std::reference_wrapper< const Expression > > | valueAsExpression () const |
Result< std::string > | valueAsString () const |
Result< int64_t > | valueAsInteger () const |
auto | properties () const |
bool | operator== (const Attribute &other) const |
![]() | |
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 > | |
auto | childs (int begin, int end) const |
auto | childRefs (int begin, int end) |
template<typename T > | |
hilti::node::Set< T > | childsOfType () const |
template<typename T > | |
std::vector< NodeRef > | childRefsOfType () const |
void | addChild (Node n) |
const auto & | childs () const |
auto & | childs () |
auto & | meta () const |
void | setMeta (Meta m) |
bool | pruneWalk () const |
AST node captures an &<tag>
attribute along with an optional argument.
Constructor for an attribute with no argument.
tag | name of the attribute, including the leading & |
m | meta data to associate with the node |
Constructor for an attribute coming with an argument. The argument must be either an AST node representing an expression.
tag | name of the attribute, including the leading & |
v | node representing the argument to associate with the attribute; must be an expression |
m | meta data to associate with the node |
|
inline |
Returns true if an argument is associated with the attribute.
|
inline |
Implements the Node
interface.
|
inline |
Returns the name of the attribute, including the leading &
.
|
inline |
Returns the attribute associated with the node.
<tt>std::out_of_range</tt> | if the attribute does not have an argument |
|
inline |
Returns the attributes argument as type T
. T
must be either an Expression
, or std::string
. In the former case, the value must be an AST expression node. In the latter case, the argument must be a string constructor expression, and the returned value will be the string it represents.
T | either Expression or std::string |
T
<tt>std::out_of_range</tt> | if the attribute does not have an argument |