This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 regels
415 B

  1. "Transformer for evaluating json.lark"
  2. from lark import Transformer, v_args
  3. class JsonTreeToJson(Transformer):
  4. @v_args(inline=True)
  5. def string(self, s):
  6. return s[1:-1].replace('\\"', '"')
  7. array = list
  8. pair = tuple
  9. object = dict
  10. number = v_args(inline=True)(float)
  11. null = lambda self, _: None
  12. true = lambda self, _: True
  13. false = lambda self, _: False