7#ifndef __PMULTIFILEPARSER_H__
8#define __PMULTIFILEPARSER_H__
13#define MULTI_PARSER_SEPARATORS_STRING "()[]{}+=*.;,/%#':<>\""
30 PMultiFileParser(
const PPath & inputDirectory = PPath(),
const PPath & outputDirectory = PPath());
33 bool load(
const PPath & configFile);
37 void addCommentConfig(
const PString & beginStringComment,
const PString & endStringComment =
"\n");
46 bool checkExpectedToken(
const PString & tokenExpected,
const PString & tokenBefore =
"");
47 bool checkExpectedMatch(
const PString & tokenExpected,
const PString & tokenBefore =
"");
52 bool isMatch(
const PString & token);
54 bool isMatchSeq(
const PVecString & patern,
bool alwaysPopBack =
false);
55 bool isMatch(
const PString & patern,
const PString & forbiddenCharBefore);
56 PString
isMatch(
const PVecString & vecToken);
std::pair< PString, PString > PMultiCommentConfig
Describes a comment config.
std::list< PMultiCommentConfig > PListMultiCommentConfig
Describes a list of comment config.
classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres
void setFileContent(const PString &fileContent)
Set the file content to be parsed.
bool isMatchSeq(const PVecString &patern, bool alwaysPopBack=false)
Match a sequence of token in a vector.
virtual ~PMultiFileParser()
Destructeur of PMultiFileParser.
void getCurrentTokenWithoutComment()
Get the current token and skip the comment.
const PString & getLastComment() const
Get the last comment.
virtual void postLoadFile()
Post load file.
PMultiFileParser(const PPath &inputDirectory=PPath(), const PPath &outputDirectory=PPath())
Default constructeur of PMultiFileParser.
PString isMatchToken(const PVecString &vecToken)
Check the matching between the current caracters and all the string in the vector but treats the stri...
PPath p_inputDirectory
Input directory of the parser.
bool load(const PPath &configFile)
Load the PMultiFileParser with the configFile.
virtual bool parseFile()=0
void clearComment()
Clear comment.
PString getStrComposedOf(const PString &charset)
Get the string composed of charset charcters.
virtual void preLoadFile()
Pre load file.
std::list< PFileParser > p_listFileParser
List of all the parsers for all the loaded files.
bool isMatch(const PString &token)
Check if the given token matches the current read file.
void errorAt()
Write a parsing error.
void initialisationPMultiFileParser(const PPath &inputDirectory, const PPath &outputDirectory)
Initialisation function of the class PMultiFileParser.
void unexpectedToken()
Print unexpected token error.
PString p_lastComment
last comment
void pointAtRow()
Point the problem.
bool checkExpectedToken(const PString &tokenExpected, const PString &tokenBefore="")
Check if the p_currentToken == tokenExpected.
PFileParser * p_parser
Parser helper for the config file.
bool fullParsing()
Perform the full parsing pf data.
bool p_run
Run the parsing if true.
void addCommentConfig(const PMultiCommentConfig &commentConfig)
Adds a comment config for the parser.
bool isMatchRewind(const PString &token)
Check if the given token matches the current read file and goes back even if the token matches.
PListMultiCommentConfig p_listCommentConfig
Defines the differents comments we allow in the parsing.
void stopParsing()
Stop the parsing of all the files.
bool checkExpectedMatch(const PString &tokenExpected, const PString &tokenBefore="")
Check if the tokenExpected match.
PFileParser * getCurrentParser()
Gets the current parser.
PString p_currentToken
CurrentToken parsed.
PPath p_outputDirectory
Output directory of the parser.
void skipComment()
Skip comment.