Skip to content

Commit

Permalink
spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
madeso committed May 8, 2020
1 parent 5222e14 commit 37abf8a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions fel/lexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ namespace fel
}
}


Lexer::Lexer(const File& a_file, Log* a_log) : file(a_file), log(a_log)
{
}


namespace
{
bool
Expand All @@ -80,6 +82,7 @@ namespace fel
}
}


bool
IsWhitespace(char c)
{
Expand All @@ -97,6 +100,7 @@ namespace fel
}
}


bool
IsAlpha(char c)
{
Expand All @@ -105,13 +109,15 @@ namespace fel
return c == '_';
}


bool
IsNumeric(char c)
{
if(c >='0' && c<='9') return true;
return false;
}


void
EatWhitespace(FilePointer* file)
{
Expand Down Expand Up @@ -144,12 +150,14 @@ namespace fel
}
}


Token SingleChar(FilePointer* file, TokenType tt)
{
const auto c = file->Read();
return {tt, std::string(1, c)};
}


Token CharAndChar(FilePointer* file, TokenType one_char, char second_char, TokenType two_chars)
{
auto first_char = std::string(1, file->Read());
Expand All @@ -161,6 +169,7 @@ namespace fel
return {one_char, first_char};
}


Token ParseString(Log* log, FilePointer* file)
{
std::ostringstream buffer;
Expand All @@ -187,6 +196,7 @@ namespace fel
}
}


Token Lexer::GetNextToken()
{
EatWhitespace(&file);
Expand Down Expand Up @@ -276,11 +286,13 @@ namespace fel
}
}


LexerReader::LexerReader(const File& a_file, Log* a_log)
: lexer(a_file, a_log)
{
}


Token LexerReader::Peek()
{
if(token)
Expand All @@ -294,6 +306,7 @@ namespace fel
}
}


Token LexerReader::Read()
{
if(token)
Expand All @@ -308,6 +321,7 @@ namespace fel
}
}


std::vector<Token> GetAllTokensInFile(LexerReader* reader)
{
std::vector<Token> ret;
Expand All @@ -317,6 +331,5 @@ namespace fel
}
return ret;
}


}

0 comments on commit 37abf8a

Please sign in to comment.