aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-22 21:40:08 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-22 21:40:08 -0800
commitb43c8da66b3b215690bef5d9814e92bf23b4ba7b (patch)
treeec4ddacaa9ca5105f053cac5907aa669fc3ab24b /parser.h
parentda85bdc4012fb5a5e7ffffe61381fb9ba742958b (diff)
More work towards instanced parser. First successful compilation
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/parser.h b/parser.h
index 1f57829d..6ffd89e2 100644
--- a/parser.h
+++ b/parser.h
@@ -214,6 +214,7 @@ struct tokenizer;
class parser_t {
private:
+ enum parser_type_t parser_type;
std::vector<block_t> blocks;
/* No copying allowed */
@@ -225,13 +226,14 @@ class parser_t {
void skipped_exec( job_t * j );
void eval_job( tokenizer *tok );
int parser_test_argument( const wchar_t *arg, string_buffer_t *out, const wchar_t *prefix, int offset );
- int parser_test( const wchar_t * buff, int *block_level, string_buffer_t *out, const wchar_t *prefix );
- int parser_test_args(const wchar_t * buff, string_buffer_t *out, const wchar_t *prefix );
void print_errors( string_buffer_t *target, const wchar_t *prefix );
public:
std::vector<profile_item_t> profile_items;
+ /** Get the "principal" parser, whatever that is */
+ static parser_t &principal_parser();
+
/** Create a parser of the given type */
parser_t(enum parser_type_t type);
@@ -299,7 +301,7 @@ class parser_t {
/**
Set the current position in the latest string of the tokenizer.
*/
- void set_pos( int p) const;
+ void set_pos( int p);
/**
Get the string currently parsed
@@ -334,7 +336,7 @@ class parser_t {
\param out if non-null, any errors in the command will be filled out into this buffer
\param prefix the prefix string to prepend to each error message written to the \c out buffer
*/
- int test( const wchar_t * buff, int *block_level, string_buffer_t *out, const wchar_t *prefix ) const;
+ int test( const wchar_t * buff, int *block_level, string_buffer_t *out, const wchar_t *prefix );
/**
Test if the specified string can be parsed as an argument list,
@@ -342,7 +344,7 @@ class parser_t {
string contains errors, and the second bit is set if the string
contains an unclosed block.
*/
- int test_args( const wchar_t * buff, string_buffer_t *out, const wchar_t *prefix ) const;
+ int test_args( const wchar_t * buff, string_buffer_t *out, const wchar_t *prefix );
/**
Tell the parser that the specified function may not be run if not