forked from jacobbrown72/jShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.l
More file actions
37 lines (32 loc) · 612 Bytes
/
Copy pathshell.l
File metadata and controls
37 lines (32 loc) · 612 Bytes
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
%{
#include <stdlib.h>
#include "y.tab.h"
#include "shell.h"
char* str;
int str_length;
void yyerror(char*);
%}
%%
"setenv" return SETENV;
"printenv" return PRINTENV;
"unsetenv" return UNSETENV;
"cd" return CD;
"alias" return ALIAS;
"unalias" return UNALIAS;
"bye" return BYE;
"\"" return QUOTE;
"<" return LT;
">" return GT;
"|" return VERT;
"\\" return WACK;
"&" return AMP;
"2" return STDERR;
"1" return STDOUT;
"0" return STDIN;
[ \t]+ ;
\n return END;
[a-zA-Z0-9_:./~-]+ {str = yytext; str_length = yyleng; return WORD;}
%%
int yywrap(void) {
return 1;
}