]> git.ipfire.org Git - thirdparty/bash.git/blame - parser.h
Imported from ../bash-4.0.tar.gz.
[thirdparty/bash.git] / parser.h
CommitLineData
726f6388
JA
1/* parser.h -- Everything you wanted to know about the parser, but were
2 afraid to ask. */
bb70624e 3
3185942a 4/* Copyright (C) 1995, 2008,2009 Free Software Foundation, Inc.
bb70624e
JA
5
6 This file is part of GNU Bash, the Bourne Again SHell.
7
3185942a
JA
8 Bash is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
bb70624e 12
3185942a
JA
13 Bash is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
bb70624e 17
3185942a
JA
18 You should have received a copy of the GNU General Public License
19 along with Bash. If not, see <http://www.gnu.org/licenses/>.
20*/
bb70624e 21
ccc6cda3
JA
22#if !defined (_PARSER_H_)
23# define _PARSER_H_
726f6388 24
726f6388
JA
25# include "command.h"
26# include "input.h"
ccc6cda3 27
3185942a
JA
28/* Possible states for the parser that require it to do special things. */
29#define PST_CASEPAT 0x00001 /* in a case pattern list */
30#define PST_ALEXPNEXT 0x00002 /* expand next word for aliases */
31#define PST_ALLOWOPNBRC 0x00004 /* allow open brace for function def */
32#define PST_NEEDCLOSBRC 0x00008 /* need close brace */
33#define PST_DBLPAREN 0x00010 /* double-paren parsing */
34#define PST_SUBSHELL 0x00020 /* ( ... ) subshell */
35#define PST_CMDSUBST 0x00040 /* $( ... ) command substitution */
36#define PST_CASESTMT 0x00080 /* parsing a case statement */
37#define PST_CONDCMD 0x00100 /* parsing a [[...]] command */
38#define PST_CONDEXPR 0x00200 /* parsing the guts of [[...]] */
39#define PST_ARITHFOR 0x00400 /* parsing an arithmetic for command */
40#define PST_ALEXPAND 0x00800 /* OK to expand aliases - unused */
41#define PST_CMDTOKEN 0x01000 /* command token OK - unused */
42#define PST_COMPASSIGN 0x02000 /* parsing x=(...) compound assignment */
43#define PST_ASSIGNOK 0x04000 /* assignment statement ok in this context */
44#define PST_EOFTOKEN 0x08000 /* yylex checks against shell_eof_token */
45#define PST_REGEXP 0x10000 /* parsing an ERE/BRE as a single word */
46#define PST_HEREDOC 0x20000 /* reading body of here-document */
47#define PST_REPARSE 0x40000 /* re-parsing in parse_string_to_word_list */
48
ccc6cda3
JA
49/* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */
50struct dstack {
51/* DELIMITERS is a stack of the nested delimiters that we have
52 encountered so far. */
53 char *delimiters;
54
55/* Offset into the stack of delimiters. */
56 int delimiter_depth;
57
58/* How many slots are allocated to DELIMITERS. */
59 int delimiter_space;
60};
61
62#endif /* _PARSER_H_ */