Lab11 solutions (UCB CS61A@2021 Fall)
Context
Problem 1
Important: Your code for this part should go in
buffer.py.Your job in this part is to implement the
currentandpop_firstmethods of theBufferclass.
currentshould return the current token of the current line we’re on in theBufferinstance without removing it. If there are no more tokens in the current line, thencurrentshould move onto the next valid line, and return the first token of this line. If there are no more tokens left to return from the entire source (we’ve reached the end of all input lines), thencurrentshould returnNone(this logic is already provided for you in theexcept StopIterationblock).