from collections.abc import Callable
from typing import cast
+from sys import stdin
class NullType:
- pass
+ def __repr__(self) -> str:
+ return "null"
Null: NullType = NullType()
def tag(tag: str) -> Parser[str]:
- return parser_flatten(
- parser_map(lambda s: s if s.startswith(tag) else None, char)
+ return lambda s: (
+ (s[: len(tag)], s[len(tag) :]) if s.startswith(tag) else None
)
)(s)
-print(json_value("-12331.111e231"))
-print(json_value('"hello world\\\\ \\" "'))
-print(json_value('[123, -123e3, {"hello": "axy", "num": 421}]'))
+print(json_value(stdin.read()))