Hello, everybody!
I am confused about implementing 
hasMoreLines() and 
advance() methods of the Parser class.
I found this thread that considers the matter: 
http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/How-to-handle-comments-using-API-td4032033.html.
However, the conclusion from that discussion is that the 
Parser class can be improved by combining 
hasMoreLines() with the 
advance() method (making them one). Therefore, the first one is useless in some sense.
Is this true? If not, 
how should the hasMoreLines() method check if there are more lines for the advance() method?
I am implementing the Assembler using C++. The current solution I have in mind requires the 
hasMoreLines() method to read the file until it finds a valid instruction, then return to its original position and return true. When it is true, the 
advance() method will do the same steps to find the next valid instruction. The only difference from the 
hasMoreLines() subroutine is that it will update the current instruction and keep the current reading position. As you may have observed, this is redundant.
If this were the case, then it is better to combine these two methods. It will be more efficient. Therefore, is this true? Or am I misunderstanding how they should behave and what they should do?
Thank you for your time and feedback.
Best,
Rodolfo