GithubHelp home page GithubHelp logo

progval / rust-python-parser Goto Github PK

View Code? Open in Web Editor NEW
73.0 5.0 13.0 198 KB

A Python parser written in Rust using nom

Home Page: https://docs.rs/python-parser

License: GNU General Public License v3.0

Rust 98.74% Python 1.26%
rust python parser python-parser rust-python nom

rust-python-parser's Introduction

rust-python-parser

A Python parser for Rust libraries and programs.

Currently supports Python 3.8's syntax (except type comments, which are ignored like regular comments)

rust-python-parser's People

Contributors

progval avatar ralexstokes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rust-python-parser's Issues

Support for newer versions of Python3?

Are there any plans to support newer features in Python?

In particular, I see that the parser will panic when it tries to read a type annotation like:

foo: int

foo = 22

Parse f-strings

Currently they are just parsed as regular strings with a prefix

Multiple `if` statements causes a panic

Trying to parse some code and found a problem that seems to be caused with two consecutive if statements.

Input:

if True:
    pass
if True:
    pass

Causes a panic when parsing the second statement.

Parse type comments?

Starting with python 3.8, type comments are parsed by cpython's parser. We might want to support them.

But that's a lot of work, so I'm not sure it's worth it

Fix the pretty-printer for f-string

Currently, the pretty-printer handles f-string like regular strings, which means it may output this: f"foo {d[\"bar\"]} baz", which is invalid syntax, as backslashes are not allowed between curly brackets

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.