32 #ifndef _QORE_QOREPARSELISTNODE_H
34 #define _QORE_QOREPARSELISTNODE_H
43 class QoreParseListNode :
public ParseNode {
45 typedef std::vector<QoreValue> nvec_t;
47 DLLLOCAL QoreParseListNode(
const QoreProgramLocation* loc) : ParseNode(loc,
NT_PARSE_LIST, true) {
50 DLLLOCAL QoreParseListNode(
const QoreParseListNode& old,
ExceptionSink* xsink) : ParseNode(old),
51 vtype(old.vtype), typeInfo(old.typeInfo), finalized(old.finalized), vlist(old.vlist) {
52 values.reserve(old.values.size());
53 lvec.reserve(old.lvec.size());
55 for (
unsigned i = 0; i < old.values.size(); ++i) {
56 add(copy_value_and_resolve_lvar_refs(old.values[i], xsink), old.lvec[i]);
62 DLLLOCAL ~QoreParseListNode() {
63 for (
auto& i : values)
67 DLLLOCAL
void add(
QoreValue v,
const QoreProgramLocation* loc) {
72 if (v.
hasNode() && v.hasEffect())
74 }
else if (has_effect() && !v.hasEffect()) {
82 assert(vtypes.empty());
84 values.erase(values.begin());
85 lvec.erase(lvec.begin());
90 assert(i < values.size());
94 DLLLOCAL
const QoreValue get(
size_t i)
const {
95 assert(i < values.size());
99 DLLLOCAL
QoreValue& getReference(
size_t i) {
100 assert(i < values.size());
104 DLLLOCAL
const QoreProgramLocation* getLocation(
size_t i)
const {
105 assert(i < lvec.size());
115 DLLLOCAL
size_t size()
const {
116 return values.size();
119 DLLLOCAL
bool empty()
const {
120 return values.empty();
123 DLLLOCAL
void setFinalized() {
128 DLLLOCAL
bool isFinalized()
const {
132 DLLLOCAL
bool isVariableList()
const {
136 DLLLOCAL
void setVariableList() {
141 DLLLOCAL
void finalizeBlock(
int start_line,
int end_line);
143 DLLLOCAL nvec_t& getValues() {
147 DLLLOCAL
const nvec_t& getValues()
const {
151 DLLLOCAL
const type_vec_t& getValueTypes()
const {
155 DLLLOCAL QoreParseListNode* listRefSelf()
const {
157 return const_cast<QoreParseListNode*
>(
this);
166 DLLLOCAL
virtual const char* getTypeName()
const {
170 DLLLOCAL QoreParseListNode* copyBlank()
const {
171 QoreParseListNode* n =
new QoreParseListNode(loc);
174 n->finalized = finalized;
179 DLLLOCAL
int parseInitIntern(
bool& needs_eval, QoreParseContext& parse_context);
182 typedef std::vector<const QoreProgramLocation*> lvec_t;
187 const QoreTypeInfo* vtype =
nullptr;
189 const QoreTypeInfo* typeInfo;
191 bool finalized =
false;
195 DLLLOCAL
virtual const QoreTypeInfo* getTypeInfo()
const {
199 DLLLOCAL
virtual int parseInitImpl(
QoreValue& val, QoreParseContext& parse_context);
DLLEXPORT void ref() const
increments the reference count
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
std::vector< const QoreTypeInfo * > type_vec_t
vector of type information for parameter lists
Definition: common.h:251
const qore_type_t NT_PARSE_LIST
type value for QoreParseListNode
Definition: node_types.h:84
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275
DLLEXPORT bool hasNode() const
returns true if the object contains a non-null AbstractQoreNode pointer (ie type == QV_Node && v....