daeisbae / AParser

Yet another programming language for educational purpose and simplicity
https://daeisbae.github.io/AParser/
MIT License
1 stars 0 forks source link

Debug mode for setting limit of printing token from one lexer. #19

Closed daeisbae closed 6 months ago

daeisbae commented 6 months ago

This will prevent infinite loop printing. During lexing, if the lex counting goes wrong it will give result like this.

>>> ! 
...
Token( TokenType: Operator Value: '!' )
Token( TokenType: Operator Value: '!' )
Token( TokenType: Operator Value: '!' )
Token( TokenType: Operator Value: '!' )
Token( TokenType: Operator Value: '!' )
Token( TokenType: Operator Value: '!' )
Token( TokenType: Operator Value: '!' )
Token( TokenType: Operator Value: '!^C

To prevent the infinite loop of token printing from happening, this implementation is requested