/* Copyright (C) 2008 Emmanuel Varoquaux This file is part of XOS. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LEX_H #define LEX_H typedef int (*lexer_getc_func_t)(); /* types de tokens */ enum { TT_AND_AND, /* '&&' */ TT_OR_OR, /* '||' */ TT_GREATER_GREATER, /* '>>' */ TT_LESS_AND, /* '<&' */ TT_GREATER_AND, /* '>&' */ TT_LESS_GREATER, /* '<>' */ TT_GREATER_BAR, /* '>|' */ TT_GREATER, /* '>' */ TT_LESS, /* '<' */ TT_SEMICOLON, /* ';' */ TT_LEFT_PARENTHESIS, /* '(' */ TT_RIGHT_PARENTHESIS, /* ')' */ TT_BAR, /* '|' */ TT_AMPERSAND, /* '&' */ TT_NEWLINE, /* '\n' */ TT_NUMBER, TT_WORD, TT_END_OF_INPUT }; /* token */ struct token_struct { int type; union { int number; /* TT_NUMBER */ char *word; /* TT_WORD */ int error; /* TT_END_OF_INPUT */ }; }; extern lexer_getc_func_t lexer_getc_func; extern struct token_struct current_token; void lex(); void skip_line(); char *remove_quotes(const char *string); #endif