Currently, the 'parser' module cuts some corners with its parsing. This behaviour is because of ease of implementation, but I would like not to continue this if I am to consider this project "completed". Because of this, I would like to upgrade the parser to not erase any data.
To do this, I have identified three situations where data is not preserved:
Whenever a comment exists, it should not be disputed by the program. To accomplish this, it is simply erased.
When an end-line character is found, anything afterwards is erased. (refer to #12)
When there is nothing but whitespace, it is '.strip'd away.
There are a number of means to fix this issue. One of the solutions that I think would work best is to instead yield a wrapper class that contains all relevant data about the respective line.
class <SomeWrapper>:
def __init__(self, data):
# stores the data
...
This way, I could in future configure the parser to return additional data (i.e. the line number), while not having to constantly rewrite tests to some new-length tuple, or configure the 'compile_time' module to work nice with it. All I would need is to add the logic for the new data when I need it.
Currently, the 'parser' module cuts some corners with its parsing. This behaviour is because of ease of implementation, but I would like not to continue this if I am to consider this project "completed". Because of this, I would like to upgrade the parser to not erase any data.
To do this, I have identified three situations where data is not preserved:
There are a number of means to fix this issue. One of the solutions that I think would work best is to instead yield a wrapper class that contains all relevant data about the respective line.
This way, I could in future configure the parser to return additional data (i.e. the line number), while not having to constantly rewrite tests to some new-length tuple, or configure the 'compile_time' module to work nice with it. All I would need is to add the logic for the new data when I need it.