cgv
Loading...
Searching...
No Matches
command_token.h
1#pragma once
2
3#include <vector>
4#include "expression_processor.h"
5
6#include "lib_begin.h"
7
8namespace cgv {
9 namespace ppp {
10
11 enum CommandType {
12 CT_IMPLICIT_TEXT = -1,
13 CT_TEXT = 0,
14 CT_DEFINE,
15 CT_SKIP,
16 CT_READ,
17 CT_WRITE,
18 CT_RAND,
19 CT_NAMESPACE,
20 CT_FOR,
21 CT_IF, CT_ELIF, CT_ELSE,
22 CT_EVAL, CT_STRING, CT_LIST,
23 CT_BEGIN, CT_END,
24 CT_INCLUDE, CT_CINCLUDE, CT_EXCLUDE, CT_INSERT,
25 CT_REFLECT_NEXT_LINE, CT_REFLECT_PREV_LINE,
26 CT_COUT, CT_CIN, CT_ERROR, CT_WARNING,
27 CT_SYSTEM, CT_DIR, CT_FUNC, CT_EXIT,
28 CT_TRANSFORM,
29 CT_SCAN_INCLUDES,
30 CT_UNDEF
31 };
32
33 struct CGV_API command_token : public cgv::utils::token
34 {
35 protected:
36 static std::string last_error;
37 static token last_error_token;
38 public:
39 static const std::string& get_last_error();
40 static const token& get_last_error_token();
42 CommandType ct;
44 unsigned int parenthesis_index;
46 unsigned int block_end;
48 std::vector<expression_processor> expressions;
49
53 command_token(const token& t);
55 bool split_off_from(token& t);
57 unsigned get_skip_length() const;
59 unsigned get_nr_expressions() const;
61 unsigned get_min_nr_expressions() const;
63 bool is_nr_expressions_fix() const;
65 const char* get_keyword() const;
67 bool is_empty() const;
69 bool block_follows() const;
71 bool remove_preceeding_empty_text_token() const;
73 char get_open_parenthesis() const;
75 char get_close_parenthesis() const;
76 };
77
78 }
79}
80#include <cgv/config/lib_end.h>
CommandType
enumerate type for all command types supported in configuration files
Definition register.h:470
the cgv namespace
Definition print.h:11
unsigned int block_end
store the index of the command token that terminates the block following this command
unsigned int parenthesis_index
store index of parenthesis that enclosed the expressions
CommandType ct
store command type
std::vector< expression_processor > expressions
vector of parsed expressions
representation of a token in a text by two pointers begin and end, that point to the first character ...
Definition token.h:18