Code tweaks

darcs-hash:20051214010712-ac50b-4053d2c3b97a1ea6168f113e91d3e4915915ea9a.gz
This commit is contained in:
axel 2005-12-14 11:07:12 +10:00
parent 5d069de71d
commit 9dd842ea96
2 changed files with 60 additions and 57 deletions

View file

@ -128,6 +128,11 @@ The fish parser. Contains functions for parsing code.
*/
#define COMMAND_ASSIGN_ERR_MSG L"Unknown command %ls. Did you mean 'set VARIABLE VALUE'? For information on setting variable values, see the manual section on the set command by typing 'help set'."
/**
Error for invalid redirection token
*/
#define REDIRECT_TOKEN_ERR_MSG L"Expected redirection, got token of type %ls"
/** Last error code */
int error_code;
@ -927,7 +932,7 @@ wchar_t *parser_current_line()
line = wcsndup( line, line_end-line );
// debug( 2, L"Current pos %d, line pos %d, file_length %d\n", current_tokenizer_pos, current_line_pos, wcslen(whole_str));
debug( 4, L"Current pos %d, line pos %d, file_length %d\n", current_tokenizer_pos, current_line_pos, wcslen(whole_str));
if( !is_interactive )
{
@ -943,7 +948,10 @@ wchar_t *parser_current_line()
offset=0;
}
/* Skip printing if we are in interactive mode and the error was on the first character of the line */
/*
Skip printing character position if we are in interactive mode
and the error was on the first character of the line
*/
if( offset+current_line_pos )
swprintf( lineinfo+offset,
LINEINFO_SIZE-offset,
@ -1162,16 +1170,23 @@ static void parse_job_main_loop( process_t *p,
io_data_t *new_io;
wchar_t *target = 0;
/*
Don't check redirections in skipped part
Otherwise, bogus errors may be the result
Otherwise, bogus errors may be the result. (Do check
that token is string, though)
*/
if( current_block->skip )
{
tok_next( tok );
if( tok_last_type( tok ) != TOK_STRING )
{
error( SYNTAX_ERROR,
tok_get_pos( tok ),
REDIRECT_TOKEN_ERR_MSG,
tok_get_desc( tok_last_type(tok)) );
}
break;
}
@ -1193,7 +1208,7 @@ static void parse_job_main_loop( process_t *p,
{
error( SYNTAX_ERROR,
tok_get_pos( tok ),
L"Could not expand string %ls",
REDIRECT_TOKEN_ERR_MSG,
tok_last( tok ) );
}

View file

@ -161,22 +161,10 @@ enum parser_error
Error occured while evaluating commands
*/
EVAL_ERROR,
/**
Out of memory error
*/
OOM,
/**
Stack inconsistency error
*/
STACK_ERROR,
/**
Error while evaluating subshell
*/
SUBSHELL_ERROR,
/**
No files matching wildcards where found
*/
WILDCARD_ERROR
}
;