Add new token: TokenType.BOOL
This commit is contained in:
11
smnp/token/tokenizers/bool.py
Normal file
11
smnp/token/tokenizers/bool.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from smnp.token.tools import keywordsTokenizer, separated
|
||||
from smnp.token.type import TokenType
|
||||
|
||||
|
||||
def boolTokenizer(input, current, line):
|
||||
consumedChars, token = separated(keywordsTokenizer(TokenType.BOOL, "true", "false"))(input, current, line)
|
||||
if consumedChars > 0:
|
||||
token.value = token.value == "true"
|
||||
return (consumedChars, token)
|
||||
|
||||
return (0, None)
|
||||
Reference in New Issue
Block a user