Sat, 14 Jul 2012 15:58:50 +0300
Removed extdelimeters member, said delimeters are always enabled now.
commands.cxx | file | annotate | diff | comparison | revisions | |
main.cxx | file | annotate | diff | comparison | revisions | |
scriptreader.cxx | file | annotate | diff | comparison | revisions | |
scriptreader.h | file | annotate | diff | comparison | revisions |
--- a/commands.cxx Sat Jul 14 15:44:38 2012 +0300 +++ b/commands.cxx Sat Jul 14 15:58:50 2012 +0300 @@ -51,7 +51,6 @@ void ReadCommands () { ScriptReader* r = new ScriptReader ((char*)"commands.def"); - r->extdelimeters = true; g_CommDef = NULL; CommandDef* curdef = g_CommDef; unsigned int numCommDefs = 0;
--- a/main.cxx Sat Jul 14 15:44:38 2012 +0300 +++ b/main.cxx Sat Jul 14 15:58:50 2012 +0300 @@ -74,7 +74,6 @@ ObjWriter *w = new ObjWriter (argv[2]); // We're set, begin parsing :) - r->extdelimeters = true; r->BeginParse (w); // Clear out the junk afterwards
--- a/scriptreader.cxx Sat Jul 14 15:44:38 2012 +0300 +++ b/scriptreader.cxx Sat Jul 14 15:58:50 2012 +0300 @@ -54,7 +54,6 @@ } ScriptReader::ScriptReader (str path) { - extdelimeters = false; atnewline = false; filepath = path; if (!(fp = fopen (path, "r"))) { @@ -94,32 +93,23 @@ // true if was found, false if not. bool ScriptReader::Next () { str tmp = ""; - bool dontreadnext = false; while (!feof (fp)) { c = ReadChar (); - // Extended delimeters: basically any non-alnum characters. - // These delimeters break the word too. If there was prior data, - // the delimeter pushes the cursor back so that the next character - // will be the same delimeter. If there isn't, the delimeter itself - // is included (and thus becomes a token itself.) - bool shouldBreak = false; - if (extdelimeters) { - if ((c >= 33 && c <= 47) || - (c >= 58 && c <= 64) || - // underscore isn't a delimeter - (c >= 91 && c <= 96 && c != 95) || - (c >= 123 && c <= 126)) { - if (tmp.len()) - fseek (fp, ftell (fp) - 1, SEEK_SET); - else - tmp += c; - shouldBreak = true; - break; - } + // Non-alphanumber characters (sans underscore) break the word too. + // If there was prior data, the delimeter pushes the cursor back so + // that the next character will be the same delimeter. If there isn't, + // the delimeter itself is included (and thus becomes a token itself.) + if ((c >= 33 && c <= 47) || + (c >= 58 && c <= 64) || + (c >= 91 && c <= 96 && c != '_') || + (c >= 123 && c <= 126)) { + if (tmp.len()) + fseek (fp, ftell (fp) - 1, SEEK_SET); + else + tmp += c; + break; } - if (shouldBreak) - break; if (IsDelimeter (c)) { // Don't break if we haven't gathered anything yet. @@ -207,9 +197,6 @@ // I guess this should be a void function putting the return value into token? str ScriptReader::MustGetString () { - if (!extdelimeters) - ParserError ("MustGetString doesn't work with parsers not using extended delimeters!"); - MustNext ("\""); str string;
--- a/scriptreader.h Sat Jul 14 15:44:38 2012 +0300 +++ b/scriptreader.h Sat Jul 14 15:58:50 2012 +0300 @@ -61,8 +61,6 @@ unsigned int curline; unsigned int curchar; str token; - bool atnewline; - bool extdelimeters; // ==================================================================== // METHODS @@ -85,7 +83,7 @@ void BeginParse (ObjWriter* w); private: - bool nextreintepret; + bool atnewline; char c; void ParserMessage (const char* header, char* message); };