Get some basic function signatures right for new instanced parser

This commit is contained in:
ridiculousfish 2012-01-16 12:10:08 -08:00
parent e4ee4ec3d1
commit fa796d668f
14 changed files with 280 additions and 262 deletions

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,8 @@
#include "util.h" #include "util.h"
#include "io.h" #include "io.h"
class parser_t;
enum enum
{ {
COMMAND_NOT_BUILTIN, COMMAND_NOT_BUILTIN,
@ -125,6 +127,7 @@ int builtin_exists( wchar_t *cmd );
/** /**
Execute a builtin command Execute a builtin command
\param parser The parser being used
\param argv Array containing the command and parameters \param argv Array containing the command and parameters
of the builtin. The list is terminated by a of the builtin. The list is terminated by a
null pointer. This syntax resembles the syntax null pointer. This syntax resembles the syntax
@ -133,7 +136,7 @@ int builtin_exists( wchar_t *cmd );
\return the exit status of the builtin command \return the exit status of the builtin command
*/ */
int builtin_run( wchar_t **argv, io_data_t *io ); int builtin_run( parser_t &parser, wchar_t **argv, io_data_t *io );
/** /**
Insert all builtin names into l. These are not copies of the strings and should not be freed after use. Insert all builtin names into l. These are not copies of the strings and should not be freed after use.
@ -143,18 +146,18 @@ void builtin_get_names( array_list_t *list );
/** /**
Pushes a new set of input/output to the stack. The new stdin is supplied, a new set of output string_buffer_ts is created. Pushes a new set of input/output to the stack. The new stdin is supplied, a new set of output string_buffer_ts is created.
*/ */
void builtin_push_io( int stdin_fd ); void builtin_push_io( parser_t &parser, int stdin_fd );
/** /**
Pops a set of input/output from the stack. The output string_buffer_ts are destroued, but the input file is not closed. Pops a set of input/output from the stack. The output string_buffer_ts are destroued, but the input file is not closed.
*/ */
void builtin_pop_io(); void builtin_pop_io(parser_t &parser);
/** /**
Return a one-line description of the specified builtin Return a one-line description of the specified builtin
*/ */
const wchar_t *builtin_get_desc( const wchar_t *b ); const wchar_t *builtin_get_desc( parser_t &parser, const wchar_t *b );
/** /**
@ -162,7 +165,7 @@ const wchar_t *builtin_get_desc( const wchar_t *b );
the commandline builtin operate on the string to complete instead the commandline builtin operate on the string to complete instead
of operating on whatever is to be completed. of operating on whatever is to be completed.
*/ */
const wchar_t *builtin_complete_get_temporary_buffer(); const wchar_t *builtin_complete_get_temporary_buffer(parser_t &parser);
/** /**
@ -171,6 +174,6 @@ const wchar_t *builtin_complete_get_temporary_buffer();
the next time this function is called, and must never be free'd manually. the next time this function is called, and must never be free'd manually.
*/ */
wchar_t *builtin_help_get( const wchar_t *cmd ); wchar_t *builtin_help_get( parser_t &parser, const wchar_t *cmd );
#endif #endif

View file

@ -214,7 +214,7 @@ static void write_part( const wchar_t *begin,
The commandline builtin. It is used for specifying a new value for The commandline builtin. It is used for specifying a new value for
the commandline. the commandline.
*/ */
static int builtin_commandline( wchar_t **argv ) static int builtin_commandline( parser_t &parser, wchar_t **argv )
{ {
int buffer_part=0; int buffer_part=0;
@ -259,7 +259,7 @@ static int builtin_commandline( wchar_t **argv )
argv[0], argv[0],
L": Can not set commandline in non-interactive mode\n", L": Can not set commandline in non-interactive mode\n",
NULL ); NULL );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -355,7 +355,7 @@ static int builtin_commandline( wchar_t **argv )
BUILTIN_ERR_UNKNOWN, BUILTIN_ERR_UNKNOWN,
argv[0], argv[0],
long_options[opt_index].name ); long_options[opt_index].name );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
@ -418,11 +418,11 @@ static int builtin_commandline( wchar_t **argv )
break; break;
case 'h': case 'h':
builtin_print_help( argv[0], sb_out ); builtin_print_help( parser, argv[0], sb_out );
return 0; return 0;
case L'?': case L'?':
builtin_unknown_option( argv[0], argv[woptind-1] ); builtin_unknown_option( parser, argv[0], argv[woptind-1] );
return 1; return 1;
} }
} }
@ -440,7 +440,7 @@ static int builtin_commandline( wchar_t **argv )
BUILTIN_ERR_COMBO, BUILTIN_ERR_COMBO,
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -451,7 +451,7 @@ static int builtin_commandline( wchar_t **argv )
BUILTIN_ERR_MISSING, BUILTIN_ERR_MISSING,
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
for( i=woptind; i<argc; i++ ) for( i=woptind; i<argc; i++ )
@ -472,7 +472,7 @@ static int builtin_commandline( wchar_t **argv )
_(L"%ls: Unknown input function '%ls'\n"), _(L"%ls: Unknown input function '%ls'\n"),
argv[0], argv[0],
argv[i] ); argv[i] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
} }
@ -490,7 +490,7 @@ static int builtin_commandline( wchar_t **argv )
argv[0], argv[0],
L": Too many arguments\n", L": Too many arguments\n",
NULL ); NULL );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -500,7 +500,7 @@ static int builtin_commandline( wchar_t **argv )
BUILTIN_ERR_COMBO, BUILTIN_ERR_COMBO,
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -513,7 +513,7 @@ static int builtin_commandline( wchar_t **argv )
L"--cut-at-cursor and --tokenize can not be used when setting the commandline" ); L"--cut-at-cursor and --tokenize can not be used when setting the commandline" );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -524,7 +524,7 @@ static int builtin_commandline( wchar_t **argv )
argv[0], argv[0],
L"insertion mode switches can not be used when not in insertion mode" ); L"insertion mode switches can not be used when not in insertion mode" );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -556,7 +556,7 @@ static int builtin_commandline( wchar_t **argv )
BUILTIN_ERR_NOT_NUMBER, BUILTIN_ERR_NOT_NUMBER,
argv[0], argv[0],
argv[woptind] ); argv[woptind] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
} }
current_buffer = reader_get_buffer(); current_buffer = reader_get_buffer();

View file

@ -289,7 +289,7 @@ const wchar_t *builtin_complete_get_temporary_buffer()
tab-completions. Calls the functions in complete.c for any heavy tab-completions. Calls the functions in complete.c for any heavy
lifting. Defined in builtin_complete.c lifting. Defined in builtin_complete.c
*/ */
static int builtin_complete( wchar_t **argv ) static int builtin_complete( parser_t &parser, wchar_t **argv )
{ {
ASSERT_IS_MAIN_THREAD(); ASSERT_IS_MAIN_THREAD();
int res=0; int res=0;
@ -414,7 +414,7 @@ static int builtin_complete( wchar_t **argv )
BUILTIN_ERR_UNKNOWN, BUILTIN_ERR_UNKNOWN,
argv[0], argv[0],
long_options[opt_index].name ); long_options[opt_index].name );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
res = 1; res = 1;
@ -489,11 +489,11 @@ static int builtin_complete( wchar_t **argv )
break; break;
case 'h': case 'h':
builtin_print_help( argv[0], sb_out ); builtin_print_help( parser, argv[0], sb_out );
return 0; return 0;
case '?': case '?':
builtin_unknown_option( argv[0], argv[woptind-1] ); builtin_unknown_option( parser, argv[0], argv[woptind-1] );
res = 1; res = 1;
break; break;
@ -505,14 +505,14 @@ static int builtin_complete( wchar_t **argv )
{ {
if( condition && wcslen( condition ) ) if( condition && wcslen( condition ) )
{ {
if( parser_test( condition, 0, 0, 0 ) ) if( parser.test( condition, 0, 0, 0 ) )
{ {
sb_printf( sb_err, sb_printf( sb_err,
L"%ls: Condition '%ls' contained a syntax error\n", L"%ls: Condition '%ls' contained a syntax error\n",
argv[0], argv[0],
condition ); condition );
parser_test( condition, 0, sb_err, argv[0] ); parser.test( condition, 0, sb_err, argv[0] );
res = 1; res = 1;
} }
@ -523,14 +523,14 @@ static int builtin_complete( wchar_t **argv )
{ {
if( comp && wcslen( comp ) ) if( comp && wcslen( comp ) )
{ {
if( parser_test_args( comp, 0, 0 ) ) if( parser.test_args( comp, 0, 0 ) )
{ {
sb_printf( sb_err, sb_printf( sb_err,
L"%ls: Completion '%ls' contained a syntax error\n", L"%ls: Completion '%ls' contained a syntax error\n",
argv[0], argv[0],
comp ); comp );
parser_test_args( comp, sb_err, argv[0] ); parser.test_args( comp, sb_err, argv[0] );
res = 1; res = 1;
} }
@ -597,7 +597,7 @@ static int builtin_complete( wchar_t **argv )
sb_printf( sb_err, sb_printf( sb_err,
_( L"%ls: Too many arguments\n" ), _( L"%ls: Too many arguments\n" ),
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
res = 1; res = 1;
} }

View file

@ -160,7 +160,7 @@ static void builtin_jobs_print( job_t *j, int mode, int header )
/** /**
The jobs builtin. Used fopr printing running jobs. Defined in builtin_jobs.c. The jobs builtin. Used fopr printing running jobs. Defined in builtin_jobs.c.
*/ */
static int builtin_jobs( wchar_t **argv ) static int builtin_jobs( parser_t &parser, wchar_t **argv )
{ {
int argc=0; int argc=0;
int found=0; int found=0;
@ -222,7 +222,7 @@ static int builtin_jobs( wchar_t **argv )
argv[0], argv[0],
long_options[opt_index].name ); long_options[opt_index].name );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
@ -247,11 +247,11 @@ static int builtin_jobs( wchar_t **argv )
} }
case 'h': case 'h':
builtin_print_help( argv[0], sb_out ); builtin_print_help( parser, argv[0], sb_out );
return 0; return 0;
case '?': case '?':
builtin_unknown_option( argv[0], argv[woptind-1] ); builtin_unknown_option( parser, argv[0], argv[woptind-1] );
return 1; return 1;
} }

View file

@ -495,7 +495,7 @@ static void print_variables(int include_values, int esc, int scope)
The set builtin. Creates, updates and erases environment variables The set builtin. Creates, updates and erases environment variables
and environemnt variable arrays. and environemnt variable arrays.
*/ */
static int builtin_set( wchar_t **argv ) static int builtin_set( parser_t &parser, wchar_t **argv )
{ {
/** /**
@ -619,11 +619,11 @@ static int builtin_set( wchar_t **argv )
break; break;
case 'h': case 'h':
builtin_print_help( argv[0], sb_out ); builtin_print_help( parser, argv[0], sb_out );
return 0; return 0;
case '?': case '?':
builtin_unknown_option( argv[0], argv[woptind-1] ); builtin_unknown_option( parser, argv[0], argv[woptind-1] );
return 1; return 1;
default: default:
@ -646,7 +646,7 @@ static int builtin_set( wchar_t **argv )
BUILTIN_ERR_COMBO, BUILTIN_ERR_COMBO,
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -658,7 +658,7 @@ static int builtin_set( wchar_t **argv )
BUILTIN_ERR_COMBO, BUILTIN_ERR_COMBO,
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -670,7 +670,7 @@ static int builtin_set( wchar_t **argv )
sb_printf( sb_err, sb_printf( sb_err,
BUILTIN_ERR_GLOCAL, BUILTIN_ERR_GLOCAL,
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -682,7 +682,7 @@ static int builtin_set( wchar_t **argv )
sb_printf( sb_err, sb_printf( sb_err,
BUILTIN_ERR_EXPUNEXP, BUILTIN_ERR_EXPUNEXP,
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -728,7 +728,7 @@ static int builtin_set( wchar_t **argv )
if( !parse_index( indexes, arg, dest, result.size() ) ) if( !parse_index( indexes, arg, dest, result.size() ) )
{ {
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
retcode = 1; retcode = 1;
break; break;
} }
@ -774,7 +774,7 @@ static int builtin_set( wchar_t **argv )
_(L"%ls: Erase needs a variable name\n%ls\n"), _(L"%ls: Erase needs a variable name\n%ls\n"),
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
retcode = 1; retcode = 1;
} }
else else
@ -800,14 +800,14 @@ static int builtin_set( wchar_t **argv )
{ {
free( dest ); free( dest );
sb_printf( sb_err, BUILTIN_ERR_VARNAME_ZERO, argv[0] ); sb_printf( sb_err, BUILTIN_ERR_VARNAME_ZERO, argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
if( (bad_char = wcsvarname( dest ) ) ) if( (bad_char = wcsvarname( dest ) ) )
{ {
sb_printf( sb_err, BUILTIN_ERR_VARCHAR, argv[0], *bad_char ); sb_printf( sb_err, BUILTIN_ERR_VARCHAR, argv[0], *bad_char );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
free( dest ); free( dest );
return 1; return 1;
} }
@ -816,7 +816,7 @@ static int builtin_set( wchar_t **argv )
{ {
free( dest ); free( dest );
sb_printf( sb_err, _(L"%ls: Can not specify scope when erasing array slice\n"), argv[0] ); sb_printf( sb_err, _(L"%ls: Can not specify scope when erasing array slice\n"), argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -848,7 +848,7 @@ static int builtin_set( wchar_t **argv )
{ {
if( !parse_index( indexes, argv[woptind], dest, result.size() ) ) if( !parse_index( indexes, argv[woptind], dest, result.size() ) )
{ {
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
retcode = 1; retcode = 1;
break; break;
} }
@ -861,7 +861,7 @@ static int builtin_set( wchar_t **argv )
if( val_count < idx_count ) if( val_count < idx_count )
{ {
sb_printf( sb_err, _(BUILTIN_SET_ARG_COUNT), argv[0] ); sb_printf( sb_err, _(BUILTIN_SET_ARG_COUNT), argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
retcode=1; retcode=1;
break; break;
} }
@ -933,7 +933,7 @@ static int builtin_set( wchar_t **argv )
sb_printf( sb_err, sb_printf( sb_err,
_(L"%ls: Values cannot be specfied with erase\n"), _(L"%ls: Values cannot be specfied with erase\n"),
argv[0] ); argv[0] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
retcode=1; retcode=1;
} }
else else

View file

@ -252,7 +252,7 @@ static int set( int resource, int hard, int soft, rlim_t value )
The ulimit builtin, used for setting resource limits. Defined in The ulimit builtin, used for setting resource limits. Defined in
builtin_ulimit.c. builtin_ulimit.c.
*/ */
static int builtin_ulimit( wchar_t ** argv ) static int builtin_ulimit( parser_t &parser, wchar_t ** argv )
{ {
int hard=0; int hard=0;
int soft=0; int soft=0;
@ -351,7 +351,7 @@ static int builtin_ulimit( wchar_t ** argv )
BUILTIN_ERR_UNKNOWN, BUILTIN_ERR_UNKNOWN,
argv[0], argv[0],
long_options[opt_index].name ); long_options[opt_index].name );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
@ -415,11 +415,11 @@ static int builtin_ulimit( wchar_t ** argv )
#endif #endif
case L'h': case L'h':
builtin_print_help( argv[0], sb_out ); builtin_print_help( parser, argv[0], sb_out );
return 0; return 0;
case L'?': case L'?':
builtin_unknown_option( argv[0], argv[woptind-1] ); builtin_unknown_option( parser, argv[0], argv[woptind-1] );
return 1; return 1;
} }
} }
@ -436,7 +436,7 @@ static int builtin_ulimit( wchar_t ** argv )
argv[0], argv[0],
L": Too many arguments\n", L": Too many arguments\n",
NULL ); NULL );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
@ -492,7 +492,7 @@ static int builtin_ulimit( wchar_t ** argv )
L"%ls: Invalid limit '%ls'\n", L"%ls: Invalid limit '%ls'\n",
argv[0], argv[0],
argv[woptind] ); argv[woptind] );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }
new_limit *= get_multiplier( what ); new_limit *= get_multiplier( what );
@ -507,7 +507,7 @@ static int builtin_ulimit( wchar_t ** argv )
argv[0], argv[0],
L": Too many arguments\n", L": Too many arguments\n",
NULL ); NULL );
builtin_print_help( argv[0], sb_err ); builtin_print_help( parser, argv[0], sb_err );
return 1; return 1;
} }

View file

@ -174,7 +174,7 @@ static int event_is_blocked( event_t *e )
block_t *block; block_t *block;
event_block_t *eb; event_block_t *eb;
for( block = current_block; block; block = block->outer ) for( block = parser.current_block; block; block = block->outer )
{ {
for( eb = block->first_event_block; eb; eb=eb->next ) for( eb = block->first_event_block; eb; eb=eb->next )
{ {
@ -459,10 +459,10 @@ static void event_fire_internal( event_t *event )
*/ */
proc_push_interactive(0); proc_push_interactive(0);
prev_status = proc_get_last_status(); prev_status = proc_get_last_status();
parser_push_block( EVENT ); parser.push_block( EVENT );
current_block->param1.event = event; parser.current_block->param1.event = event;
eval( buffer.c_str(), 0, TOP ); eval( buffer.c_str(), 0, TOP );
parser_pop_block(); parser.pop_block();
proc_pop_interactive(); proc_pop_interactive();
proc_set_last_status( prev_status ); proc_set_last_status( prev_status );
} }

View file

@ -1208,10 +1208,10 @@ void exec( job_t *j )
break; break;
} }
parser_push_block( shadows?FUNCTION_CALL:FUNCTION_CALL_NO_SHADOW ); parser.push_block( shadows?FUNCTION_CALL:FUNCTION_CALL_NO_SHADOW );
current_block->param2.function_call_process = p; parser.current_block->param2.function_call_process = p;
current_block->param1.function_call_name = (wchar_t *)halloc_register( current_block, wcsdup( p->argv[0] ) ); parser.current_block->param1.function_call_name = (wchar_t *)halloc_register( current_block, wcsdup( p->argv[0] ) );
/* /*
@ -1234,7 +1234,7 @@ void exec( job_t *j )
internal_exec_helper( def, TOP, j->io ); internal_exec_helper( def, TOP, j->io );
parser_allow_function(); parser_allow_function();
parser_pop_block(); parser.pop_block();
break; break;
} }

View file

@ -204,7 +204,7 @@ void function_destroy()
} }
void function_add( function_data_t *data ) void function_add( function_data_t *data, const parser_t &parser )
{ {
int i; int i;
@ -215,7 +215,7 @@ void function_add( function_data_t *data )
function_internal_info_t &info = loaded_functions[data->name]; function_internal_info_t &info = loaded_functions[data->name];
info.definition_offset = parse_util_lineno( parser_get_buffer(), current_block->tok_pos )-1; info.definition_offset = parse_util_lineno( parser.get_buffer(), parser.current_block->tok_pos )-1;
info.definition = data->definition; info.definition = data->definition;
if( data->named_arguments ) if( data->named_arguments )

View file

@ -15,6 +15,8 @@
#include "util.h" #include "util.h"
#include "common.h" #include "common.h"
class parser_t;
/** /**
Structure describing a function. This is used by the parser to Structure describing a function. This is used by the parser to
store data on a function while parsing it. It is not used store data on a function while parsing it. It is not used

View file

@ -1863,7 +1863,7 @@ static int parse_job( process_t *p,
if( new_block ) if( new_block )
{ {
parser_push_block( WHILE ); parser.push_block( WHILE );
current_block->param1.while_state=WHILE_TEST_FIRST; current_block->param1.while_state=WHILE_TEST_FIRST;
current_block->tok_pos = mark; current_block->tok_pos = mark;
} }
@ -1876,7 +1876,7 @@ static int parse_job( process_t *p,
{ {
tok_next( tok ); tok_next( tok );
parser_push_block( IF ); parser.push_block( IF );
current_block->param1.if_state=0; current_block->param1.if_state=0;
current_block->tok_pos = mark; current_block->tok_pos = mark;
@ -2251,7 +2251,7 @@ static void skipped_exec( job_t * j )
( wcscmp( p->argv[0], L"begin" )==0) || ( wcscmp( p->argv[0], L"begin" )==0) ||
( wcscmp( p->argv[0], L"function" )==0)) ( wcscmp( p->argv[0], L"function" )==0))
{ {
parser_push_block( FAKE ); parser.push_block( FAKE );
} }
else if( wcscmp( p->argv[0], L"end" )==0) else if( wcscmp( p->argv[0], L"end" )==0)
{ {
@ -2537,7 +2537,7 @@ int eval( const wchar_t *cmd, io_data_t *io, enum block_type_t block_type )
eval_level++; eval_level++;
parser_push_block( block_type ); parser.push_block( block_type );
current_tokenizer = (tokenizer *)malloc( sizeof(tokenizer)); current_tokenizer = (tokenizer *)malloc( sizeof(tokenizer));
tok_init( current_tokenizer, cmd, 0 ); tok_init( current_tokenizer, cmd, 0 );

View file

@ -180,17 +180,31 @@ enum parser_error
CMDSUBST_ERROR, CMDSUBST_ERROR,
}; };
enum parser_type_t {
PARSER_TYPE_NONE,
PARSER_TYPE_GENERAL,
PARSER_TYPE_FUNCTIONS_ONLY,
PARSER_TYPE_COMPLETIONS_ONLY
};
class parser_t { class parser_t {
private: private:
std::vector<block_t> blocks; std::vector<block_t> blocks;
/* No copying allowed */
parser_t(const parser_t&);
parser_t& operator=(const parser_t&);
public: public:
/** Create a parser of the given type */
parser_t(enum parser_type_t type);
/** The current innermost block */ /** The current innermost block */
const block_t &current_block(void) const; block_t *current_block;
/** Global event blocks */ /** Global event blocks */
const block_t &global_event_block(void) const; event_block_t *global_event_block;
/** Current block level io redirections */ /** Current block level io redirections */
io_data_t &block_io(void) const; io_data_t &block_io(void) const;

View file

@ -452,7 +452,7 @@ static void handle_child_status( pid_t pid, int status )
} }
else else
{ {
block_t *c = current_block; block_t *c = parser.current_block;
if( p && found_proc ) if( p && found_proc )
{ {
while( c ) while( c )