Closed am-cid closed 11 months ago
Concerns:
Response:
Would it make sense if this is implemented under the token module? I'm thinking of something like this.
Yeah, looks good and promising. I'm down. So if kunwari nagcall ako print(TokenTypes.BWEAK.lexeme) output niya is yung "bweak" right?
Would it make sense if this is implemented under the token module? I'm thinking of something like this.
Yep yep. Though, I'm making it so that the lexeme is independent from the token type class. Pacheck nalang sa branch ko if it makes sense HAHAHAHAH
Response:
- Yup. I don't think there's any problem with that, though. We can still assign a TokenType for ids and literals even if we won't use the peek method for them.
The problem with that is that this class takes in a lexeme argument and identifiers don't have a fixed lexeme
Would it make sense if this is implemented under the token module? I'm thinking of something like this.
use __init__
instead of a subclass if you're going to stick to using Enum
from enum import Enum
class AClass(Enum):
SAMPLE_CONSTANT = ("Sample arg 1", "Sample arg 2")
def __init__(self, arg1, arg2):
self.arg1 = arg1
self.arg2 = arg2
print(AClass.SAMPLE_CONSTANT.arg1) # prints "Sample arg 1"
PR for this issue!!! #14
Token types contain:
Example: TokenType.BWEAK
passing it to self._peek() would be like
also, complete the token types once implemented