2006-05-04 07:55:42 +00:00
|
|
|
/*
|
2008-04-26 09:24:14 +00:00
|
|
|
* Copyright (C) 2001-2008 Andreas Steffen
|
|
|
|
*
|
2018-05-23 14:04:50 +00:00
|
|
|
* HSR Hochschule fuer Technik Rapperswil
|
2006-05-04 07:55:42 +00:00
|
|
|
*
|
|
|
|
* 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 2 of the License, or (at your
|
|
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-03-13 14:14:44 +00:00
|
|
|
/**
|
|
|
|
* @defgroup lexparser lexparser
|
|
|
|
* @{ @ingroup utils
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LEXPARSER_H_
|
|
|
|
#define LEXPARSER_H_
|
2006-05-04 07:55:42 +00:00
|
|
|
|
2006-10-31 12:27:59 +00:00
|
|
|
#include <library.h>
|
2006-05-04 07:55:42 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Eats whitespace
|
2006-05-04 07:55:42 +00:00
|
|
|
*/
|
|
|
|
bool eat_whitespace(chunk_t *src);
|
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Compare null-terminated pattern with chunk
|
2006-05-04 07:55:42 +00:00
|
|
|
*/
|
|
|
|
bool match(const char *pattern, const chunk_t *ch);
|
|
|
|
|
|
|
|
/**
|
2008-12-03 09:45:58 +00:00
|
|
|
* Extracts a token ending with the first occurrence of a given termination symbol
|
2006-05-04 07:55:42 +00:00
|
|
|
*/
|
|
|
|
bool extract_token(chunk_t *token, const char termination, chunk_t *src);
|
|
|
|
|
2007-11-16 20:23:29 +00:00
|
|
|
/**
|
2008-12-03 09:45:58 +00:00
|
|
|
* Extracts a token ending with the first occurrence of a given null-terminated string
|
|
|
|
*/
|
|
|
|
bool extract_token_str(chunk_t *token, const char *termination, chunk_t *src);
|
|
|
|
|
2006-05-04 07:55:42 +00:00
|
|
|
/**
|
2009-03-24 17:43:01 +00:00
|
|
|
* Fetches a new text line terminated by \\n or \\r\\n
|
2006-05-04 07:55:42 +00:00
|
|
|
*/
|
|
|
|
bool fetchline(chunk_t *src, chunk_t *line);
|
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Extracts a value that might be single or double quoted
|
2006-05-04 07:55:42 +00:00
|
|
|
*/
|
|
|
|
err_t extract_value(chunk_t *value, chunk_t *line);
|
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* extracts a name: value pair from a text line
|
2006-05-04 07:55:42 +00:00
|
|
|
*/
|
|
|
|
err_t extract_name_value(chunk_t *name, chunk_t *value, chunk_t *line);
|
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* extracts a parameter: value from a text line
|
2006-05-04 07:55:42 +00:00
|
|
|
*/
|
|
|
|
err_t extract_parameter_value(chunk_t *name, chunk_t *value, chunk_t *line);
|
2008-03-13 14:14:44 +00:00
|
|
|
|
2009-03-24 17:43:01 +00:00
|
|
|
#endif /** LEXPARSER_H_ @}*/
|