2007-04-22 09:50:26 +00:00
|
|
|
/** \file parser_keywords.h
|
|
|
|
|
|
|
|
Functions having to do with parser keywords, like testing if a function is a block command.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FISH_PARSER_KEYWORD_H
|
|
|
|
#define FISH_PARSER_KEYWORD_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
Return valuse for parser_keywords_is_switch()
|
|
|
|
*/
|
2011-12-27 03:18:46 +00:00
|
|
|
enum
|
2007-04-22 09:50:26 +00:00
|
|
|
{
|
|
|
|
ARG_NON_SWITCH,
|
|
|
|
ARG_SWITCH,
|
|
|
|
ARG_SKIP
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Check if the specified argument is a switch. Return ARG_SWITCH if yes,
|
|
|
|
ARG_NON_SWITCH if no and ARG_SKIP if the argument is '--'
|
|
|
|
*/
|
2012-01-30 17:46:33 +00:00
|
|
|
bool parser_keywords_is_switch( const wcstring &cmd );
|
2007-04-22 09:50:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-12-27 03:18:46 +00:00
|
|
|
Tests if the specified commands parameters should be interpreted as another command, which will be true if the command is either 'command', 'exec', 'if', 'while' or 'builtin'.
|
2007-04-22 09:50:26 +00:00
|
|
|
|
|
|
|
\param cmd The command name to test
|
|
|
|
\return 1 of the command parameter is a command, 0 otherwise
|
|
|
|
*/
|
|
|
|
|
2012-01-30 17:46:33 +00:00
|
|
|
bool parser_keywords_is_subcommand( const wcstring &cmd );
|
2007-04-22 09:50:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Tests if the specified command is a reserved word, i.e. if it is
|
|
|
|
the name of one of the builtin functions that change the block or
|
|
|
|
command scope, like 'for', 'end' or 'command' or 'exec'. These
|
|
|
|
functions may not be overloaded, so their names are reserved.
|
|
|
|
|
|
|
|
\param word The command name to test
|
|
|
|
\return 1 of the command parameter is a command, 0 otherwise
|
|
|
|
*/
|
2012-01-30 17:46:33 +00:00
|
|
|
bool parser_keywords_is_reserved( const wcstring &word );
|
2007-04-22 09:50:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Test if the specified string is command that opens a new block
|
|
|
|
*/
|
|
|
|
|
2012-01-30 17:46:33 +00:00
|
|
|
bool parser_keywords_is_block( const wcstring &word);
|
2007-04-22 09:50:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Check if the specified command is one of the builtins that cannot
|
|
|
|
have arguments, any followin argument is interpreted as a new
|
|
|
|
command
|
|
|
|
*/
|
2012-01-30 17:46:33 +00:00
|
|
|
bool parser_keywords_skip_arguments( const wcstring &cmd );
|
2007-04-22 09:50:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|