From 51657e10769faa2617d546a06c42e4c62a19bb50 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 30 Jan 2022 17:41:24 +0100 Subject: Removed trailing whitespace all over the place --- Stars45/Token.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'Stars45/Token.cpp') diff --git a/Stars45/Token.cpp b/Stars45/Token.cpp index 857791b..2111616 100644 --- a/Stars45/Token.cpp +++ b/Stars45/Token.cpp @@ -137,12 +137,12 @@ Token::operator = (const Token& rhs) mFullSymbol = new(__FILE__, __LINE__) char[mLength + 1]; strcpy(mFullSymbol, rhs.mFullSymbol); } - + mType = rhs.mType; mKey = rhs.mKey; mLine = rhs.mLine; mColumn = rhs.mColumn; - + return *this; } @@ -151,7 +151,7 @@ Token::operator = (const Token& rhs) bool Token::match(const Token& ref) const { - if (mType == ref.mType) { // if types match + if (mType == ref.mType) { // if types match if (ref.mLength == 0) // if no symbol to match return true; // match! @@ -166,7 +166,7 @@ Token::match(const Token& ref) const } } } - + return false; } @@ -219,12 +219,12 @@ Token::comments(const Text& begin, const Text& end) { combeg[0] = begin(0); if (begin.length() > 1) combeg[1] = begin(1); - else combeg[1] = '\0'; - + else combeg[1] = '\0'; + comend[0] = end(0); if (end.length() > 1) comend[1] = end(1); - else comend[1] = '\0'; -} + else comend[1] = '\0'; +} // +-------------------------------------------------------------------+ @@ -233,12 +233,12 @@ Token::altComments(const Text& begin, const Text& end) { altbeg[0] = begin(0); if (begin.length() > 1) altbeg[1] = begin(1); - else altbeg[1] = '\0'; - + else altbeg[1] = '\0'; + altend[0] = end(0); if (end.length() > 1) altend[1] = end(1); - else altend[1] = '\0'; -} + else altend[1] = '\0'; +} // +-------------------------------------------------------------------+ @@ -269,7 +269,7 @@ Token::typestr() const case EOT: t = "EOT"; break; case LastTokenType: t = "LastTokenType"; break; } - + return t; } @@ -292,7 +292,7 @@ Token::describe(const Text& tok) case '}' : d = "Token::RBrace"; break; default : break; } - + if (d.length() == 0) { if (isalpha(tok(0))) d = "\"" + tok + "\", Token::AlphaIdent"; @@ -305,7 +305,7 @@ Token::describe(const Text& tok) else d = "\"" + tok + "\", Token::SymbolicIdent"; } - + return d; } @@ -346,14 +346,14 @@ Scanner::operator = (const Scanner& rhs) delete [] str; str = new(__FILE__, __LINE__) char [strlen(rhs.str) + 1]; strcpy(str, rhs.str); - + index = rhs.index; old_index = rhs.old_index; length = rhs.length; line = rhs.line; old_line = rhs.old_line; lineStart = rhs.lineStart; - + return *this; } @@ -365,7 +365,7 @@ Scanner::Load(const Text& s) delete [] str; str = new(__FILE__, __LINE__) char [s.length() + 1]; strcpy(str, s.data()); - + index = 0; old_index = 0; best = Token(); @@ -403,7 +403,7 @@ Scanner::Get(Need need) } p++; } - + if (p >= eos) { if (need == Demand && reader) { Load(reader->more()); @@ -431,7 +431,7 @@ Scanner::Get(Need need) } } } - + // generic delimited comments else if (*p == Token::comBeg(0) && (!Token::comBeg(1) || *(p+1) == Token::comBeg(1))) { @@ -471,12 +471,12 @@ Scanner::Get(Need need) // use lexical sub-parser for ints and floats else if (isdigit(*p)) type = GetNumeric(); - + else if (IsSymbolic(*p)) { type = Token::SymbolicIdent; while (IsSymbolic(*p)) p++; } - + else { type = Token::AlphaIdent; while (IsAlpha(*p)) p++; @@ -489,7 +489,7 @@ Scanner::Get(Need need) index = start + extent; // advance the cursor int col = start - lineStart; if (line == 0) col++; - + char* buf = new(__FILE__, __LINE__) char [extent + 1]; strncpy(buf, str + start, extent); buf[extent] = '\0'; @@ -512,7 +512,7 @@ Scanner::Get(Need need) if (result.mType != Token::Keyword) result = Token(buf, type, 0, line+1, col); - + if (line+1 > (size_t) best.mLine || (line+1 == (size_t) best.mLine && col > best.mColumn)) best = result; @@ -535,7 +535,7 @@ Scanner::GetNumeric() } while (isdigit(*p) || *p == '_') p++; // whole number part - + if (*p == '.') { p++; // optional fract part type = Token::FloatLiteral; // implies float -- cgit v1.1