Newer
Older
/*
** parser.h for 42sh
**
** Made by Seblu
** Login <seblu@epita.fr>
**
** Started on Wed Aug 2 00:49:50 2006 Seblu
// Define is parser or lexer is running for DEBBUGING
# define DEBUG_PARSER 1
# define DEBUG_LEXER 0
enum {
TOKEN_COUNT = 22,
KEYWORD_COUNT = 15,
};
TOK_NEWLINE, // \n
TOK_EOF, // EOF
TOK_AND, // &&
TOK_SEPAND, // &
TOK_OR, // ||
TOK_PIPE, // |
TOK_DSEMI, // ;;
TOK_SEP, // ;
TOK_DLESSDASH, // <<-
TOK_DLESS, // <<
TOK_LESSGREAT, // <>
TOK_LESSAND, // <&
TOK_LESS, // <
TOK_DGREAT, // >>
TOK_GREATAND, // >&
TOK_CLOBBER, // >|
TOK_GREAT, // >
TOK_IONUMBER, // number juste before '>' or '<'
/*!
** Parser initialization
**
** @param fs file stream to read
**
** @return the new struct
*/
/*!
** Do a parse pass
**
** @param parser the parser where we do this parse
**
** @return ast_to_execute
*/
** Lexer initialization
**
** @param fs file stream to read
**
** @return the new struct
*/
** Flush current information of position in the line,
** size of the line, and free line buffer. This is call
** by the parser after an error.
** Return the next token and destroy it
** @warning The token MUST be freed !
**
** @return the next token
** Return the next token without destruction of it.
** @warning The token string MUST NOT be freed !
** @return the look ahead token
/*!
** Parse input as a here-document (describe is XSI)
**
** @param lexer current lexer
*/
s_token lexer_getheredoc(s_lexer *lexer, const char *delim);