|
|
@ -130,8 +130,7 @@ void Lexer::analyze() |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_index++; |
|
|
|
increment(); |
|
|
|
m_column++; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -147,11 +146,22 @@ char Lexer::peekNext() |
|
|
|
return m_job->input()[m_index + 1]; |
|
|
|
return m_job->input()[m_index + 1]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
char Lexer::consume() |
|
|
|
void Lexer::increment() |
|
|
|
{ |
|
|
|
{ |
|
|
|
char character = peek(); |
|
|
|
|
|
|
|
m_index++; |
|
|
|
m_index++; |
|
|
|
m_column++; |
|
|
|
m_column++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Lexer::decrement() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_index--; |
|
|
|
|
|
|
|
m_column--; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char Lexer::consume() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
char character = peek(); |
|
|
|
|
|
|
|
increment(); |
|
|
|
return character; |
|
|
|
return character; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -161,8 +171,7 @@ bool Lexer::consumeSpecific(char character) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_index++; |
|
|
|
increment(); |
|
|
|
m_column++; |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -196,9 +205,8 @@ bool Lexer::getString() |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_index++; |
|
|
|
|
|
|
|
m_column++; |
|
|
|
|
|
|
|
symbol += character; |
|
|
|
symbol += character; |
|
|
|
|
|
|
|
increment(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
printf("Pushing -> String: \"%s\"\t%zu[%zu]\n", symbol.c_str(), m_line, column); |
|
|
|
printf("Pushing -> String: \"%s\"\t%zu[%zu]\n", symbol.c_str(), m_line, column); |
|
|
@ -221,12 +229,10 @@ bool Lexer::getNumberOrLiteral(Token::Type type) |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_index++; |
|
|
|
|
|
|
|
m_column++; |
|
|
|
|
|
|
|
symbol += character; |
|
|
|
symbol += character; |
|
|
|
|
|
|
|
increment(); |
|
|
|
} |
|
|
|
} |
|
|
|
m_index--; |
|
|
|
decrement(); |
|
|
|
m_column--; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_tokens->push_back({ type, m_line, column, symbol }); |
|
|
|
m_tokens->push_back({ type, m_line, column, symbol }); |
|
|
|
|
|
|
|
|
|
|
|