2006-10-28 19:45:02 +00:00
|
|
|
/*
|
|
|
|
* lineparse.h
|
|
|
|
*
|
|
|
|
* This file is a part of NSIS.
|
|
|
|
*
|
2009-02-01 14:44:30 +00:00
|
|
|
* Copyright (C) 1999-2009 Nullsoft and Contributors
|
2006-10-28 19:45:02 +00:00
|
|
|
*
|
|
|
|
* Licensed under the zlib/libpng license (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
*
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty.
|
2010-03-24 17:22:56 +00:00
|
|
|
*
|
|
|
|
* Unicode support by Jim Park -- 08/09/2007
|
2006-10-28 19:45:02 +00:00
|
|
|
*/
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
#ifndef _LINEPARSE_H_
|
|
|
|
#define _LINEPARSE_H_
|
|
|
|
|
2010-03-24 17:22:56 +00:00
|
|
|
#include "tchar.h"
|
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
class LineParser {
|
|
|
|
public:
|
|
|
|
|
2004-10-11 11:45:15 +00:00
|
|
|
LineParser(bool bCommentBlock);
|
|
|
|
virtual ~LineParser();
|
2002-08-02 10:01:35 +00:00
|
|
|
|
2007-01-24 13:24:28 +00:00
|
|
|
bool inComment();
|
2007-01-24 13:25:44 +00:00
|
|
|
bool inCommentBlock();
|
2010-03-24 17:22:56 +00:00
|
|
|
int parse(TCHAR *line, int ignore_escaping=0); // returns -1 on error
|
2004-10-11 11:45:15 +00:00
|
|
|
int getnumtokens();
|
|
|
|
void eattoken();
|
|
|
|
double gettoken_float(int token, int *success=0);
|
|
|
|
int gettoken_int(int token, int *success=0);
|
2010-03-24 17:22:56 +00:00
|
|
|
TCHAR *gettoken_str(int token);
|
|
|
|
int gettoken_enum(int token, const TCHAR *strlist); // null seperated list
|
2002-08-02 10:01:35 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2004-10-11 11:45:15 +00:00
|
|
|
void freetokens();
|
2010-03-24 17:22:56 +00:00
|
|
|
int doline(TCHAR *line, int ignore_escaping=0);
|
2004-10-11 11:45:15 +00:00
|
|
|
|
2002-08-02 10:01:35 +00:00
|
|
|
int m_eat;
|
|
|
|
int m_nt;
|
2007-01-24 13:25:44 +00:00
|
|
|
bool m_incommentblock;
|
2007-01-24 13:24:28 +00:00
|
|
|
bool m_incomment;
|
2010-03-24 17:22:56 +00:00
|
|
|
TCHAR **m_tokens;
|
2002-08-02 10:01:35 +00:00
|
|
|
};
|
2004-03-12 20:43:54 +00:00
|
|
|
#endif//_LINEPARSE_H_
|