package pyre-ast

  1. Overview
  2. Docs
Full-fidelity Python parser in OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

pyre-ast-0.1.11.tbz
sha256=c344def5b0360185b404f99cacdb250b7061e38ed547cb871b7f9398c94c4900
sha512=4579de8085f42757224744f5980034ca589b2bd6eb77f7966a277c63011201fb2a260f730691aecd4e8c21cf2d1ae98b741277649ec965b256c4e333722e055f

doc/pyre-ast/PyreAst/Parser/Concrete/index.html

Module Parser.ConcreteSource

This module provides parsing APIs for downstream clients that are written in the traditional "initial" style which expects a concrete ADT representation for abstract syntax trees.

Logic in this module is implemented entirely on top of the tagless-final APIs provided in the Parser.TaglessFinal module.

Sourceval parse_module : context:Context.t -> ?enable_type_comment:bool -> string -> (Concrete.Module.t, Error.t) result

parse_module ~context input takes the string input and parse into a Python module. See documentation of Context.t for the meaning of the context argument.

Optionally an enable_type_comment argument can be specified. If it is true, the parser will attempt to populate the type_comment section of each AST node that has it. Otherwise, contents in comments will all get ignored and type_comment will always be unset.

Calling this function is equivalent to calling TaglessFinal.parse_module with spec set to the return value of PyreAst.Concrete.make_tagless_final.

Sourceval parse_expression : context:Context.t -> string -> (Concrete.Expression.t, Error.t) result

parse_expression ~context ~spec input takes the string input and parse it into a Python expression . See documentation of Context.t for the meaning of the context argument.

Calling this function is equivalent to calling TaglessFinal.parse_expression with spec set to the return value of PyreAst.Concrete.make_tagless_final.

Sourceval parse_function_type : context:Context.t -> string -> (Concrete.FunctionType.t, Error.t) result

parse_expression ~context ~spec input takes the string input and parse it into a Python function type signature. See documentation of Context.t for the meaning of the context argument, and see documentation of TaglessFinal.parse_function_type for the meaning of "function type signature".

Calling this function is equivalent to calling TaglessFinal.parse_function_type with spec set to the return value of PyreAst.Concrete.make_tagless_final.

OCaml

Innovation. Community. Security.