RustPython / RustPython/Parser
Question: How to walk/visit the AST?
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Rust
- Estrellas
- 117
- Forks
- 38
- Merge medio
- 4 d 7 h
- PR fusionados (30 d)
- 1
Descripción
I'm trying to extract all the imports from a python file. To do this I'm using the rustpython_parser::parse function to get an AST and then iterating over all the statements in the body to find Stmt::Import and Stmt::ImportFrom. This works for imports defined at the root of the file, however misses any imports defined inside e.g. function/class definitions etc. So I think what I really want to do is walk the AST and visit all the nodes. Is there some way to achieve this with one of the rustpython packages?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el punto de entrada rustpython_parser::parse y las instrucciones AST en body. Revisa los paquetes de RustPython en busca de una API existente de visitor o traversal de AST y confirma si puede alcanzar importaciones anidadas en definiciones de funciones y clases.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python, rust
- Área
- compilers, tooling
- Tipo de issue
- Documentación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100