changed: in SpaceParser: now we do not parse special characters when reading commentaries

so we can parse:
         # such a \n string
         beforehand this \n was treated as a new line character
         and the parser was returning syntax error when reading above 'string'



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@432 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-09-25 16:50:01 +00:00
parent c6c079f8aa
commit 02abfe62fa
2 changed files with 43 additions and 15 deletions

View File

@@ -140,15 +140,25 @@ public:
/*
'\' character is used to escape other characters in a quoted string
'\' character is used to escape other characters
so "some \t t\"ext" will produce "some t t"ext"
default: true
special characters:
\0 - 0 (zero code point)
\t - tabulator (9 code point)
\r - carriage return (13 code point)
\n - a new line character (10 code point)
in other cases we return the last character so \Z gives Z and \\ gives one \
escape character are not used in commentaries
so you can write:
# this is my comment \n but this was not a new line
*/
void UseEscapeChar(bool escape);
/*
if true then the input file or string (char* or std::string) is treated as UTF-8
default: true
*/
void UTF8(bool utf);
@@ -287,6 +297,12 @@ private:
bool use_escape_char;
/*
true if we are reading the commentary (#)
this is to avoid parsing escape characters in the commentary
*/
bool reading_commentary;
std::string afile_name;
void Parse();
@@ -314,9 +330,10 @@ private:
int ReadCharNoEscape();
int ReadChar();
bool IsWhite(int c);
void SkipWhite();
void SkipWhite(bool skip_lines = false);
void SkipWhiteLines();
void SkipLine();
void SkipComment();
void Trim(std::wstring & s);
};