forked from wryun/es-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.h
More file actions
61 lines (43 loc) · 1.29 KB
/
input.h
File metadata and controls
61 lines (43 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* input.h -- definitions for es lexical analyzer ($Revision: 1.1.1.1 $) */
#define MAXUNGET 2 /* maximum 2 character pushback */
#include "token.h" /* for YYSTYPE */
/* Input contains state that lasts longer than a $&parse. */
struct Input {
const char *name, *str;
int lineno;
int fd;
Boolean eof;
int runflags;
};
typedef enum { NW, RW, KW } WordState; /* nonword, realword, keyword */
/* Parser contains state that lasts for one call to $&parse or less. */
struct Parser {
Input *input;
List *reader;
void *space; /* pspace, for parser-related allocations */
/* these variables are all allocated in pspace */
Tree *tree; /* the final parse tree */
Here *hereq; /* pending here document queue */
const char *error; /* syntax error, if it exists */
/* read buffer */
size_t buflen;
unsigned char *buf, *bufend, *bufbegin;
/* token pushback buffer */
int ungot, unget[MAXUNGET];
/* lexer state */
WordState ws;
Boolean dollar;
size_t bufsize;
char *tokenbuf;
};
/* input.c */
extern int get(Parser *p);
extern void unget(Parser *p, int c);
extern void yyerror(Parser *p, const char *s);
/* token.c */
extern const char dnw[];
extern int yylex(YYSTYPE *y, Parser *p);
extern void inityy(Parser *p);
extern void print_prompt2(Parser *p);
/* parse.y */
extern int yyparse(Parser *p);