/* A Bison parser, made from /usr/homes/chet/src/bash/src/parse.y
by GNU bison 1.34. */
#define YYBISON 1 /* Identify Bison output. */
# define IF 257
# define THEN 258
# define ELSE 259
# define ELIF 260
# define FI 261
# define CASE 262
# define ESAC 263
# define FOR 264
# define SELECT 265
# define WHILE 266
# define UNTIL 267
# define DO 268
# define DONE 269
# define FUNCTION 270
# define COND_START 271
# define COND_END 272
# define COND_ERROR 273
# define IN 274
# define BANG 275
# define TIME 276
# define TIMEOPT 277
# define WORD 278
# define ASSIGNMENT_WORD 279
# define NUMBER 280
# define ARITH_CMD 281
# define ARITH_FOR_EXPRS 282
# define COND_CMD 283
# define AND_AND 284
# define OR_OR 285
# define GREATER_GREATER 286
# define LESS_LESS 287
# define LESS_AND 288
# define LESS_LESS_LESS 289
# define GREATER_AND 290
# define SEMI_SEMI 291
# define LESS_LESS_MINUS 292
# define AND_GREATER 293
# define LESS_GREATER 294
# define GREATER_BAR 295
# define yacc_EOF 296
#line 21 "/usr/homes/chet/src/bash/src/parse.y"
#include "config.h"
#include "bashtypes.h"
#include "bashansi.h"
#include "filecntl.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
#if defined (HAVE_LOCALE_H)
# include <locale.h>
#endif
#include <stdio.h>
#include "chartypes.h"
#include <signal.h>
#include "memalloc.h"
#define NEED_STRFTIME_DECL /* used in externs.h */
#include "shell.h"
#include "trap.h"
#include "flags.h"
#include "parser.h"
#include "mailcheck.h"
#include "test.h"
#include "builtins/common.h"
#include "builtins/builtext.h"
#include "shmbutil.h"
#if defined (READLINE)
# include "bashline.h"
# include <readline/readline.h>
#endif /* READLINE */
#if defined (HISTORY)
# include "bashhist.h"
# include <readline/history.h>
#endif /* HISTORY */
#if defined (JOB_CONTROL)
# include "jobs.h"
#endif /* JOB_CONTROL */
#if defined (ALIAS)
# include "alias.h"
#endif /* ALIAS */
#if defined (PROMPT_STRING_DECODE)
# ifndef _MINIX
# include <sys/param.h>
# endif
# include <time.h>
# if defined (TM_IN_SYS_TIME)
# include <sys/types.h>
# include <sys/time.h>
# endif /* TM_IN_SYS_TIME */
# include "maxpath.h"
#endif /* PROMPT_STRING_DECODE */
#define RE_READ_TOKEN -99
#define NO_EXPANSION -100
#ifdef DEBUG
# define YYDEBUG 1
#else
# define YYDEBUG 0
#endif
#if defined (HANDLE_MULTIBYTE)
# define last_shell_getc_is_singlebyte \
((shell_input_line_index > 1) \
? shell_input_line_property[shell_input_line_index - 1] \
: 1)
# define MBTEST(x) ((x) && last_shell_getc_is_singlebyte)
#else
# define last_shell_getc_is_singlebyte 1
# define MBTEST(x) ((x))
#endif
#if defined (EXTENDED_GLOB)
extern int extended_glob;
#endif
extern int eof_encountered;
extern int no_line_editing, running_under_emacs;
extern int current_command_number;
extern int sourcelevel;
extern int posixly_correct;
extern int last_command_exit_value;
extern int interrupt_immediately;
extern char *shell_name, *current_host_name;
extern char *dist_version;
extern int patch_level;
extern int dump_translatable_strings, dump_po_strings;
extern sh_builtin_func_t *last_shell_builtin, *this_shell_builtin;
#if defined (BUFFERED_INPUT)
extern int bash_input_fd_changed;
#endif
extern int errno;
/* **************************************************************** */
/* */
/* "Forward" declarations */
/* */
/* **************************************************************** */
#ifdef DEBUG
static void debug_parser __P((int));
#endif
static int yy_getc __P((void));
static int yy_ungetc __P((int));
#if defined (READLINE)
static int yy_readline_get __P((void));
static int yy_readline_unget __P((int));
#endif
static int yy_string_get __P((void));
static int yy_string_unget __P((int));
static int yy_stream_get __P((void));
static int yy_stream_unget __P((int));
static int shell_getc __P((int));
static void shell_ungetc __P((int));
static void discard_until __P((int));
#if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
static void push_string __P((char *, int, alias_t *));
static void pop_string __P((void));
static void free_string_list __P((void));
#endif
static char *read_a_line __P((int));
static int reserved_word_acceptable __P((int));
static int yylex __P((void));
static int alias_expand_token __P((char *));
static int time_command_acceptable __P((void));
static int special_case_tokens __P((char *));
static int read_token __P((int));
static char *parse_matched_pair __P((int, int, int, int *, int));
#if defined (ARRAY_VARS)
static char *parse_compound_assignment __P((int *));
#endif
#if defined (DPAREN_ARITHMETIC) || defined (ARITH_FOR_COMMAND)
static int parse_dparen __P((int));
static int parse_arith_cmd __P((char **));
#endif
#if defined (COND_COMMAND)
static void cond_error __P((void));
static COND_COM *cond_expr __P((void));
static COND_COM *cond_or __P((void));
static COND_COM *cond_and __P((void));
static COND_COM *cond_term __P((void));
static int cond_skip_newlines __P((void));
static COMMAND *parse_cond_command __P((void));
#endif
#if defined (ARRAY_VARS)
static int token_is_assignment __P((char *, int));
static int token_is_ident __P((char *, int));
#endif
static int read_token_word __P((int));
static void discard_parser_constructs __P((int));
static char *error_token_from_token __P((int));
static char *error_token_from_text __P((void));
static void print_offending_line __P((void));
static void report_syntax_error __P((char *));
static void handle_eof_input_unit __P((void));
static void prompt_again __P((void));
#if 0
static void reset_readline_prompt __P((void));
#endif
static void print_prompt __P((void));
#if defined (HISTORY)
char *history_delimiting_chars __P((void));
#endif
#if defined (HANDLE_MULTIBYTE)
static void set_line_mbstate __P((void));
static char *shell_input_line_property = NULL;
#else
# define set_line_mbstate()
#endif
extern int yyerror __P((const char *));
#ifdef DEBUG
extern int yydebug;
#endif
/* Default prompt strings */
char *primary_prompt = PPROMPT;
char *secondary_prompt = SPROMPT;
/* PROMPT_STRING_POINTER points to one of these, never to an actual string. */
char *ps1_prompt, *ps2_prompt;
/* Handle on the current prompt string. Indirectly points through
ps1_ or ps2_prompt. */
char **prompt_string_pointer = (char **)NULL;
char *current_prompt_string;
/* Non-zero means we expand aliases in commands. */
int expand_aliases = 0;
/* If non-zero, the decoded prompt string undergoes parameter and
variable substitution, command substitution, arithmetic substitution,
string expansion, process substitution, and quote removal in
decode_prompt_string. */
int promptvars = 1;
/* The decoded prompt string. Used if READLINE is not defined or if
editing is turned off. Analogous to current_readline_prompt. */
static char *current_decoded_prompt;
/* The number of lines read from input while creating the current command. */
int current_command_line_count;
/* Variables to manage the task of reading here documents, because we need to
defer the reading until after a complete command has been collected. */
static REDIRECT *redir_stack[10];
int need_here_doc;
/* Where shell input comes from. History expansion is performed on each
line when the shell is interactive. */
static char *shell_input_line = (char *)NULL;
static int shell_input_line_index;
static int shell_input_line_size; /* Amount allocated for shell_input_line. */
static int shell_input_line_len; /* strlen (shell_input_line) */
/* Either zero or EOF. */
static int shell_input_line_terminator;
/* The line number in a script on which a function definition starts. */
static int function_dstart;
/* The line number in a script on which a function body starts. */
static int function_bstart;
/* The line number in a script at which an arithmetic for command starts. */
static int arith_for_lineno;
static REDIRECTEE redir;
#line 276 "/usr/homes/chet/src/bash/src/parse.y"
#ifndef YYSTYPE
typedef union {
WORD_DE
没有合适的资源?快使用搜索试试~ 我知道了~
bash-2.05b.tar.gz
需积分: 1 0 下载量 138 浏览量
2024-01-30
00:30:32
上传
评论
收藏 1.87MB GZ 举报
温馨提示
共820个文件
c:197个
h:103个
right:50个
Bash 是一种广泛使用的 Unix shell,它是一个命令语言解释器,允许用户通过命令行界面与操作系统交互。Bash 同时是许多类 Unix 系统(如 Linux 和 macOS)的默认 shell,并且支持多种脚本编程功能。 Bash 作为一个强大的命令行工具,不仅用于日常的文件管理和系统操作任务,而且在自动化脚本、任务调度和高级编程方面也非常有用。它的灵活性和易用性使其成为开发者和系统管理员的首选 shell。
资源推荐
资源详情
资源评论
收起资源包目录
bash-2.05b.tar.gz (820个子文件)
bash.1 223KB
bashbug.1 1KB
builtins.1 700B
test-minus-e.1 149B
rbash.1 145B
test-minus-e.2 186B
aliases 647B
arc2tarz 2KB
array-at-star 2KB
array-stuff 2KB
array-to-string 340B
AUTHORS 16KB
autoload 3KB
basename 645B
basename2 762B
getoptx.bash 9KB
require.bash 5KB
number.bash 5KB
string.bash 5KB
line-input.bash 5KB
send_mail.bash 4KB
cdhist.bash 3KB
fixfiles.bash 3KB
coshell.bash 2KB
jdate.bash 2KB
krand.bash 2KB
remap_keys.bash 2KB
y_or_n_p.bash 2KB
mktmp.bash 2KB
stty.bash 2KB
coproc.bash 2KB
source.bash 2KB
cal2day.bash 1KB
isnum.bash 1KB
showperm.bash 1KB
bash_version.bash 1KB
prompt.bash 1KB
aliasconv.bash 1000B
xfind.bash 972B
shcat.bash 933B
meta.bash 884B
nohup.bash 862B
aref.bash 758B
bash.sub.bash 748B
notify.bash 732B
xalias.bash 471B
randomcard.bash 409B
hanoi.bash 400B
spin.bash 285B
jj.bash 111B
bash-profile 887B
Bash_aliases 1KB
Bash_profile 339B
bashdb 12KB
bashdb 772B
bashrand 2KB
bashrc 2KB
Bashrc.bfox 2KB
bison 846B
braces-tests 386B
y.tab.c 175KB
subst.c 174KB
execute_cmd.c 101KB
variables.c 92KB
jobs.c 88KB
man2html.c 82KB
bashline.c 74KB
display.c 62KB
complete.c 59KB
bind.c 51KB
snprintf.c 46KB
shell.c 46KB
emacs_keymap.c 37KB
mkbuiltins.c 36KB
vi_keymap.c 36KB
histexpand.c 36KB
pcomplete.c 34KB
getconf.c 33KB
text.c 33KB
malloc.c 33KB
vi_mode.c 32KB
redir.c 28KB
print_cmd.c 27KB
readline.c 26KB
expr.c 24KB
trap.c 23KB
general.c 22KB
test.c 21KB
strftime.c 21KB
glob.c 21KB
rltty.c 21KB
nojobs.c 20KB
make_cmd.c 20KB
sm_loop.c 20KB
bashhist.c 19KB
array.c 18KB
common.c 17KB
arrayfunc.c 17KB
termcap.c 17KB
terminal.c 17KB
共 820 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
程序员Chino的日记
- 粉丝: 2691
- 资源: 3万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功