assignment 1
This commit is contained in:
37
scanner.h
Normal file
37
scanner.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef SCANNER_H
|
||||
#define SCANNER_H
|
||||
|
||||
#define INITIAL_STRING_SIZE 10
|
||||
|
||||
// This enum denotes what type of variable a token is.
|
||||
enum Type {
|
||||
EXECUTABLE, // a command in either $CWD or $PATH
|
||||
OPTION, // any options to pass to an executable or builtin
|
||||
COMPOSITION, // '&&', '||', ';', '\n'
|
||||
BUILTIN, // one of a few pre-defined builtin executables
|
||||
PIPELINE, // '|'
|
||||
REDIRECT, // '<' or '>'
|
||||
BACKGROUND, // '&'
|
||||
FILENAME // a file (for redirection)
|
||||
};
|
||||
|
||||
typedef struct ListNode *List;
|
||||
|
||||
typedef struct ListNode {
|
||||
char *t;
|
||||
enum Type type;
|
||||
List next;
|
||||
} ListNode;
|
||||
|
||||
|
||||
char *readInputLine();
|
||||
|
||||
List getTokenList(char *s);
|
||||
|
||||
bool isEmpty(List l);
|
||||
|
||||
void printList(List l);
|
||||
|
||||
void freeTokenList(List l);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user