Parse Boolean literals.
This commit is contained in:
@@ -41,6 +41,7 @@ from .utils.stack import list_to_stack
|
|||||||
|
|
||||||
|
|
||||||
#TODO: explain the details of float lits and strings.
|
#TODO: explain the details of float lits and strings.
|
||||||
|
BOOL = 'true|false'
|
||||||
FLOAT = r'-?\d+\.\d*(e(-|\+)\d+)?'
|
FLOAT = r'-?\d+\.\d*(e(-|\+)\d+)?'
|
||||||
INT = r'-?\d+'
|
INT = r'-?\d+'
|
||||||
SYMBOL = r'[•\w!@$%^&*()_+<>?|\/;:`~,.=-]+'
|
SYMBOL = r'[•\w!@$%^&*()_+<>?|\/;:`~,.=-]+'
|
||||||
@@ -114,6 +115,7 @@ def _parse(tokens):
|
|||||||
|
|
||||||
|
|
||||||
_scanner = Scanner([
|
_scanner = Scanner([
|
||||||
|
( BOOL, lambda _, token: token == 'true'),
|
||||||
( FLOAT, lambda _, token: float(token)),
|
( FLOAT, lambda _, token: float(token)),
|
||||||
( INT, lambda _, token: int(token)),
|
( INT, lambda _, token: int(token)),
|
||||||
( SYMBOL, lambda _, token: Symbol(token)),
|
( SYMBOL, lambda _, token: Symbol(token)),
|
||||||
|
|||||||
Reference in New Issue
Block a user