15 parser.
setFileContent(
"Les GPUs\\dots{} pour quoi faire ?}\\label{chapGPU}\n");
24 parser.
setFileContent(
"Les GPUs\\dots{} pour quoi faire ?}\\label{chapGPU}\n");
33 parser.
setFileContent(
"Les GPUs\\dots{} pour quoi faire ?}\\label{chapGPU}\n");
51 parser.
setFileContent(
"Les GPUs\\dots{} pour quoi faire ?}\\label{chapGPU}\n");
60 parser.
setFileContent(
"des trucs \\\"a\\\" dire\" et d'autres chose");
82 cmdBegin.
setStr(
"\\begin");
83 stepBegin.
getVecCmd().push_back(cmdBegin);
90 stepOpenBrace.
getVecCmd().push_back(cmdOpenBrace);
96 cmdEnvName.
setStr(
"envName");
97 stepEnvName.
getVecCmd().push_back(cmdEnvName);
104 stepEndBrace.
getVecCmd().push_back(cmdEndBrace);
116 vecPatern.push_back(
"\\begin");
117 vecPatern.push_back(
"{");
118 vecPatern.push_back(
"envName");
119 vecPatern.push_back(
"}");
134 cmdBegin.
setStr(
"\\begin");
138 cmdEnvName.
setStr(
"envName");
155 parser.
setFileContent(
" Les GPUs\\dots{} pour quoi faire ?}\\label{chapGPU}\n");
175 b &=
phoenix_check(
"testPFileParserGetUntilKey", strFound, result);
196 std::cout <<
"testPFileParserBase : next char '" << parser.
getNextChar() <<
"'" << std::endl;
198 std::cout <<
"testPFileParserBase : next char '" << parser.
getNextChar() <<
"'" << std::endl;
200 std::cout <<
"testPFileParserBase : next char '" << parser.
getNextChar() <<
"'" << std::endl;
217 std::vector<PString> vecToken;
219 vecToken.push_back(
"other");
221 vecToken.push_back(
"one");
230 std::vector<PString> vecToken;
232 vecToken.push_back(
"other");
234 vecToken.push_back(
"one");
243 std::map<PString, int> mapToken;
247 mapToken[
"other"] = 23;
261 std::vector<std::vector<PString> > patern;
264 vecPatern.push_back(
"other");
265 patern.push_back(vecPatern);
267 vecPatern.push_back(
"one");
268 patern.push_back(vecPatern);
276 std::cout << parser << std::endl;
328 int main(
int argc,
char** argv){
std::vector< PString > PVecString
classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres
void setSeparator(const PString &separator)
Initialise la liste des caractères séparateurs.
size_t getLine() const
Fonction qui renvoie le numéro de la ligne courante.
bool isWhiteSpace()
Says if the current char is a white space.
bool isMatchSeq(const PVecString &patern, bool alwaysPopBack=false)
Match a sequence of token in a vector.
bool isChSpace() const
Dis si le caractère courant est un caractère blanc.
PString getUntilKeyWithoutPaternExclude(const PString &patern, const PString &strNotBeforeEndPatern)
Parse a string until the patern is found, only if it has not strNotBeforeEndPatern before it.
PString getCurrentRow() const
Get the current parsed row.
PString getNextToken()
Get the next token.
PString getUntilKeyWithoutPatern(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu.
void clear()
Clear the save position of the parser in ther current file.
PString getSeparator() const
renvoie la liste des caractères séparateurs
PString getUntilKeyWithoutPaternRecurse(const PString &patern, const PString &beginPatern, const PString &allowedCharAfterBegin)
Get the string until end sequence and take account recursive patern (embeded strings)
void setLine(size_t currentLine)
Set the current line of the PFileParser.
void setWhiteSpace(const PString &whiteSpace)
Initialise la liste des caractères blancs.
bool isMatchToken(const PString &patern)
Says if the patern match with the current caracters of the PFileParser but treats the string as a tok...
bool isMatch(const PString &patern)
Says if the patern match with the current caracters of the PFileParser.
char getCurrentCh() const
Renvoie le caractère courant.
void popPosition()
Get to the last saved position of the PFileParser in the current file.
PString getUntilKey(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern comprise.
PPath getFileName() const
Fonction qui renvoie le nom du fichier que l'on a ouvert.
bool isChSeparator() const
Dis si le caractère courant est un séparateur.
void setColumn(size_t currentCol)
Set the current column of the PFileParser.
void setLocation(const PLocation &location)
Set the current location of the PFileParser.
void setFileContent(const PString &fileContent)
Set the file content.
PString getUntilKeyWithoutPaternRecurseExclude(const PString &patern, const PString &beginPatern, const PString &echapExpr)
Get the string until end sequence and take account recursive patern (embeded strings)
char getPrevCh() const
Renvoie le caractère courant.
size_t getCurrentCharIdx() const
Return the index of the current character.
char getEscapeChar() const
Gets the escape character of the PFileParser.
char getNextChar()
Fonction qui renvoie le prochain caractère du fichier courant.
Classe qui permet de décrire une localisation, avec un nom de fichier et une ligne.
void setIsMatch(bool isMatch)
Set the variable p_isMatch, of type 'bool'.
void setStr(const PString &str)
Set the variable p_str, of type 'PString'.
const std ::vector< PParseStep > & getVecStep() const
Get the variable p_vecStep.
Describes a parsing step.
void setIsOptional(bool isOptional)
Set the variable p_isOptional, of type 'bool'.
const std ::vector< PParseCmd > & getVecCmd() const
Get the variable p_vecCmd.
Path of a directory or a file.
#define phoenix_assert(isOk)
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.
int main(int argc, char **argv)
void testPFileParserIsMatch()
Test the PFileParser.
void testPFileParserParternRecurseExcludeEnd()
Test the PFileParser.
void testPFileParserSeq()
Test the PFileParser.
void testPFileParserBase()
Test the PFileParser.
void testPFileParserSeqOneStep()
Test the PFileParser.
void testPFileParserMapIsMatchToken()
Check the PFileParser.
void testPFileParserGetCurrentRow()
Check the PFileParser.
void testPFileParserMatchSeq()
Test the PFileParser.
void testPFileParserVecVecIsMatch()
Check the PFileParser.
void testPFileParserParternRecurse2()
Test the PFileParser.
void testPFileParserParternExclude()
Test the PFileParser.
void testPFileParserGetNextToken2()
Test the getNextToken method of the PFileParser.
void testPFileParserVecIsMatch()
Check the PFileParser.
void testPFileParserGetNextToken()
Test the getNextToken method of the PFileParser.
void testPFileParserParternRecurse()
Test the PFileParser.
void testPFileParserParternRecurseAllowChar()
Test the PFileParser.
bool testPFileParserGetUntilKey(const PString &inputStr, const PString &search, const PString &result)
Test the PFileParser.
void testPFileParserPartern()
Test the PFileParser.
void testPFileParserVecIsMatchToken()
Check the PFileParser.
void testPFileParserParternRecurseExcludeEnd2()
Test the PFileParser.