Content-Length: 255697 | pFad | http://github.com/lark-parser/lark/issues/1526

87 Parsing bytestrings and token values · Issue #1526 · lark-parser/lark · GitHub
Skip to content

Parsing bytestrings and token values #1526

@createyourpersonalaccount

Description

I tried using the calculator example with use_bytes=True but it wouldn't parse a NUMBER:

ValueError: could not convert string to float: Token('NUMBER', b'1')

I had to modify

number = float
to:

    number = lambda _, token = float(token.value)

even though Token.value specifies that it is redundant to write token.value because it's always equal to token.

Using Lark 1.2.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/lark-parser/lark/issues/1526

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy